diff --git a/Frameworks/TagLib/English.lproj/InfoPlist.strings b/Frameworks/TagLib/English.lproj/InfoPlist.strings
new file mode 100644
index 000000000..7080cf949
Binary files /dev/null and b/Frameworks/TagLib/English.lproj/InfoPlist.strings differ
diff --git a/Frameworks/TagLib/Info.plist b/Frameworks/TagLib/Info.plist
new file mode 100644
index 000000000..8ebb0ad93
--- /dev/null
+++ b/Frameworks/TagLib/Info.plist
@@ -0,0 +1,26 @@
+
+
+
+
+ CFBundleDevelopmentRegion
+ English
+ CFBundleExecutable
+ ${EXECUTABLE_NAME}
+ CFBundleName
+ ${PRODUCT_NAME}
+ CFBundleIconFile
+
+ CFBundleIdentifier
+ com.yourcompany.yourcocoaframework
+ CFBundleInfoDictionaryVersion
+ 6.0
+ CFBundlePackageType
+ FMWK
+ CFBundleSignature
+ ????
+ CFBundleVersion
+ 1.0
+ NSPrincipalClass
+
+
+
diff --git a/Frameworks/TagLib/taglib/AUTHORS b/Frameworks/TagLib/taglib/AUTHORS
new file mode 100644
index 000000000..8872bd80e
--- /dev/null
+++ b/Frameworks/TagLib/taglib/AUTHORS
@@ -0,0 +1,11 @@
+Scott Wheeler
+ Author, maintainer
+Ismael Orenstein
+ Xing header implementation
+Allan Sandfeld Jensen
+ FLAC metadata implementation
+Teemu Tervo
+ Numerous bug reports and fixes
+
+Please send all patches and questions to taglib-devel@kde.org rather than to
+individual developers!
diff --git a/Frameworks/TagLib/taglib/COPYING.LGPL b/Frameworks/TagLib/taglib/COPYING.LGPL
new file mode 100644
index 000000000..4362b4915
--- /dev/null
+++ b/Frameworks/TagLib/taglib/COPYING.LGPL
@@ -0,0 +1,502 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ , 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
diff --git a/Frameworks/TagLib/taglib/config.h b/Frameworks/TagLib/taglib/config.h
new file mode 100644
index 000000000..b0fb3e5a0
--- /dev/null
+++ b/Frameworks/TagLib/taglib/config.h
@@ -0,0 +1,11 @@
+/* config-taglib.h. Generated by cmake from config-taglib.h.cmake */
+
+/* NOTE: only add something here if it is really needed by all of kdelibs.
+ Otherwise please prefer adding to the relevant config-foo.h.cmake file,
+ to minimize recompilations and increase modularity. */
+/* Define if you have libz */
+#define HAVE_ZLIB 1
+
+/* #undef NO_ITUNES_HACKS */
+#define WITH_ASF 1
+#define WITH_MP4 1
diff --git a/Frameworks/TagLib/taglib/taglib/ape/ape-tag-format.txt b/Frameworks/TagLib/taglib/taglib/ape/ape-tag-format.txt
new file mode 100644
index 000000000..21ff1c861
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/ape/ape-tag-format.txt
@@ -0,0 +1,170 @@
+================================================================================
+= APE Tag Specification, Version 2.000
+================================================================================
+
+Original Content (C) 2004, Frank Klemm
+Formatting / Editing (C) 2004, Scott Wheeler
+
+================================================================================
+= Contents
+================================================================================
+
+1 - APE Tag General Structure
+2 - APE Tag Header / Footer Format
+3 - APE Tag Flags
+4 - APE Tag Item Format
+5 - APE Tag Item Supported Keys
+6 - APE Tag Item Content
+7 - Data Types
+7.1 - Data Types / UTF-8
+7.2 - Data Types / Dates
+7.3 - Data Types / Timestamps
+
+================================================================================
+= 1 - APE Tag General Structure
+================================================================================
+
+Member of Basic Components of SV8 Stream Note:
+
+It is strongly recommended that the data size be stored in the tags. The size
+should normally be in the roughly one kilobyte, never more than 8 kilobytes.
+
+Larger data should be stored externally using link entries. Linked data is much
+easier to process by normal programs, so for instance JPEG data should not be
+included inside the audio file.
+
+APE Tag Version 2.000 (with header, recommended):
+
+/================================\
+| APE Tag Header | 32 bytes |
+|-------------------|------------|
+| APE Tag Item 1 | > 10 bytes |
+| APE Tag Item 2 | > 10 bytes |
+| APE Tag Item n-1 | > 10 bytes |
+| APE Tag Item n | > 10 bytes |
+|-------------------|------------|
+| APE Tag Footer | 32 bytes |
+\================================/
+
+
+APE tag items should be sorted ascending by size. When streaming, parts of the
+APE tag may be dropped to reduce the danger of drop outs between tracks. This
+is not required, but is strongly recommended. It would be desirable for the i
+tems to be sorted by importance / size, but this is not feasible. This
+convention should only be broken when adding less important small items and it
+is not desirable to rewrite the entire tag. An APE tag at the end of a file
+(the recommended location) must have at least a footer; an APE tag at the
+beginning of a file (strongly discouraged) must have at least a header.
+
+APE Tag Version 1.000 (without header, deprecated)
+
+/================================\
+| APE Tag Item 1 | > 10 bytes |
+| APE Tag Item 2 | > 10 bytes |
+| APE Tag Item n-1 | > 10 bytes |
+| APE Tag Item n | > 10 bytes |
+|-------------------|------------|
+| APE Tag Footer | 32 bytes |
+\================================/
+
+================================================================================
+= 2 - APE Tag Header / Footer Format
+================================================================================
+
+Contains number, length and attributes of all tag items
+
+Header and Footer are different in 1 bit in the Tags Flags to distinguish
+between them.
+
+Member of APE Tag 2.0
+
+/===========================================================================\
+| Preamble | 8 bytes | { 'A', 'P', 'E', 'T', 'A', 'G', 'E', 'X' } |
+|----------------|---------|------------------------------------------------|
+| Version Number | 4 bytes | 1000 = Version 1.000, 2000 = Version 2.000 |
+|----------------|---------|------------------------------------------------|
+| Tag Size | 4 bytes | Tag size in bytes including footer and all tag |
+| | | items excluding the header (for 1.000 |
+| | | compatibility) |
+|----------------|---------|------------------------------------------------|
+| Item Count | 4 bytes | Number of items in the tag |
+|----------------|---------|------------------------------------------------|
+| Tag Flags | 4 bytes | Global flags |
+|----------------|---------|------------------------------------------------|
+| Reserved | 8 bytes | Must be zeroed |
+\===========================================================================/
+
+================================================================================
+= 3 - APE Tag Flags
+================================================================================
+
+The general flag structure for either items or headers / footers is the same.
+Bits 31, 30 and 29 are specific to headers / footers, whereas 2 through 0 are
+item specific.
+
+Note: APE Tags from Version 1.0 do not use any of the following. All flags in
+that version are zeroed and ignored when reading.
+
+/=================================================================\
+| Contains Header | Bit 31 | 1 - has header | 0 - no header |
+|-----------------|-------------|---------------------------------|
+| Contains Footer | Bit 30 | 1 - has footer | 0 - no footer |
+|-----------------|-------------|---------------------------------|
+| Is Header | Bit 29 | 1 - is header | 0 - is footer |
+|-----------------|-------------|---------------------------------|
+| Undefined | Bits 28 - 3 | Undefined, must be zeroed |
+|-----------------|-------------|---------------------------------|
+| Encoding | Bits 2 - 1 | 00 - UTF-8 |
+| | | 01 - Binary Data * |
+| | | 10 - External Reference ** |
+| | | 11 - Reserved |
+|-----------------|-------------|---------------------------------|
+| Read Only | Bit 0 | 1 - read only | 0 - read/write |
+\=================================================================/
+
+ (*) Should be ignored by tools for editing text values
+(**) Allowed external reference formats:
+ - http://host/directory/filename.ext
+ - ftp://host/directory/filename.ext
+ - filename.ext
+ - /directory/filename.ext
+ - DRIVE:/directory/filename.ext
+
+ Note: External references are also UTF-8 encoded.
+
+================================================================================
+= 4 - APE Tag Item Format
+================================================================================
+
+APE Tag Items are stored as key-value pairs. APE Tags Item Key are case
+sensitive, however it is illegal to use keys which only differ in case and
+it is recommended that tag reading not be case sensitive.
+
+Every key can only occur (at most) once. It is not possible to repeat a key
+to signify updated contents.
+
+Tags can be partially or completely repeated in the streaming format. This
+makes it possible to display an artist and / or title if it was missed at the
+beginning of the stream. It is recommended that the important information like
+artist, album and title should occur approximately every 2 minutes in the
+stream and again 5 to 10 seconds before the end. However, care should be tak
+en not to replicate this information too often or during passages with high
+bitrate demands to avoid unnecessary drop-outs.
+
+/==============================================================================\
+| Content Size | 4 bytes | Length of the value in bytes |
+|----------------|---------------|---------------------------------------------|
+| Flags | 4 bytes | Item flags |
+|----------------|---------------|---------------------------------------------|
+| Key | 2 - 255 bytes | Item key |
+|----------------|---------------|---------------------------------------------|
+| Key Terminator | 1 byte | Null byte that indicates the end of the key |
+|----------------|---------------|---------------------------------------------|
+| Value | variable | Content (formatted according to the flags) |
+\==============================================================================/
+
+================================================================================
+
+Sections 5 - 7 haven't yet been converted from:
+
+http://www.personal.uni-jena.de/~pfk/mpp/sv8/apetag.html
diff --git a/Frameworks/TagLib/taglib/taglib/ape/apefile.cpp b/Frameworks/TagLib/taglib/taglib/ape/apefile.cpp
new file mode 100644
index 000000000..5d914756e
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/ape/apefile.cpp
@@ -0,0 +1,270 @@
+/***************************************************************************
+ copyright : (C) 2010 by Alex Novichkov
+ email : novichko@atnet.ru
+
+ copyright : (C) 2006 by Lukáš Lalinský
+ email : lalinsky@gmail.com
+ (original WavPack implementation)
+
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ (original MPC implementation)
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+
+#include "apefile.h"
+
+#include "apetag.h"
+#include "apefooter.h"
+
+using namespace TagLib;
+
+namespace
+{
+ enum { APEIndex, ID3v1Index };
+}
+
+class APE::File::FilePrivate
+{
+public:
+ FilePrivate() :
+ APELocation(-1),
+ APESize(0),
+ ID3v1Location(-1),
+ properties(0),
+ hasAPE(false),
+ hasID3v1(false) {}
+
+ ~FilePrivate()
+ {
+ delete properties;
+ }
+
+ long APELocation;
+ uint APESize;
+
+ long ID3v1Location;
+
+ TagUnion tag;
+
+ Properties *properties;
+
+ // These indicate whether the file *on disk* has these tags, not if
+ // this data structure does. This is used in computing offsets.
+
+ bool hasAPE;
+ bool hasID3v1;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+APE::File::File(FileName file, bool readProperties,
+ Properties::ReadStyle propertiesStyle) : TagLib::File(file)
+{
+ d = new FilePrivate;
+ read(readProperties, propertiesStyle);
+}
+
+APE::File::~File()
+{
+ delete d;
+}
+
+TagLib::Tag *APE::File::tag() const
+{
+ return &d->tag;
+}
+
+APE::Properties *APE::File::audioProperties() const
+{
+ return d->properties;
+}
+
+bool APE::File::save()
+{
+ if(readOnly()) {
+ debug("APE::File::save() -- File is read only.");
+ return false;
+ }
+
+ // Update ID3v1 tag
+
+ if(ID3v1Tag()) {
+ if(d->hasID3v1) {
+ seek(d->ID3v1Location);
+ writeBlock(ID3v1Tag()->render());
+ }
+ else {
+ seek(0, End);
+ d->ID3v1Location = tell();
+ writeBlock(ID3v1Tag()->render());
+ d->hasID3v1 = true;
+ }
+ }
+ else {
+ if(d->hasID3v1) {
+ removeBlock(d->ID3v1Location, 128);
+ d->hasID3v1 = false;
+ if(d->hasAPE) {
+ if(d->APELocation > d->ID3v1Location)
+ d->APELocation -= 128;
+ }
+ }
+ }
+
+ // Update APE tag
+
+ if(APETag()) {
+ if(d->hasAPE)
+ insert(APETag()->render(), d->APELocation, d->APESize);
+ else {
+ if(d->hasID3v1) {
+ insert(APETag()->render(), d->ID3v1Location, 0);
+ d->APESize = APETag()->footer()->completeTagSize();
+ d->hasAPE = true;
+ d->APELocation = d->ID3v1Location;
+ d->ID3v1Location += d->APESize;
+ }
+ else {
+ seek(0, End);
+ d->APELocation = tell();
+ writeBlock(APETag()->render());
+ d->APESize = APETag()->footer()->completeTagSize();
+ d->hasAPE = true;
+ }
+ }
+ }
+ else {
+ if(d->hasAPE) {
+ removeBlock(d->APELocation, d->APESize);
+ d->hasAPE = false;
+ if(d->hasID3v1) {
+ if(d->ID3v1Location > d->APELocation) {
+ d->ID3v1Location -= d->APESize;
+ }
+ }
+ }
+ }
+
+ return true;
+}
+
+ID3v1::Tag *APE::File::ID3v1Tag(bool create)
+{
+ return d->tag.access(ID3v1Index, create);
+}
+
+APE::Tag *APE::File::APETag(bool create)
+{
+ return d->tag.access(APEIndex, create);
+}
+
+void APE::File::strip(int tags)
+{
+ if(tags & ID3v1) {
+ d->tag.set(ID3v1Index, 0);
+ APETag(true);
+ }
+
+ if(tags & APE) {
+ d->tag.set(APEIndex, 0);
+
+ if(!ID3v1Tag())
+ APETag(true);
+ }
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+void APE::File::read(bool readProperties, Properties::ReadStyle /* propertiesStyle */)
+{
+ // Look for an ID3v1 tag
+
+ d->ID3v1Location = findID3v1();
+
+ if(d->ID3v1Location >= 0) {
+ d->tag.set(ID3v1Index, new ID3v1::Tag(this, d->ID3v1Location));
+ d->hasID3v1 = true;
+ }
+
+ // Look for an APE tag
+
+ d->APELocation = findAPE();
+
+ if(d->APELocation >= 0) {
+ d->tag.set(APEIndex, new APE::Tag(this, d->APELocation));
+ d->APESize = APETag()->footer()->completeTagSize();
+ d->APELocation = d->APELocation + APETag()->footer()->size() - d->APESize;
+ d->hasAPE = true;
+ }
+
+ if(!d->hasID3v1)
+ APETag(true);
+
+ // Look for APE audio properties
+
+ if(readProperties) {
+ d->properties = new Properties(this);
+ }
+}
+
+long APE::File::findAPE()
+{
+ if(!isValid())
+ return -1;
+
+ if(d->hasID3v1)
+ seek(-160, End);
+ else
+ seek(-32, End);
+
+ long p = tell();
+
+ if(readBlock(8) == APE::Tag::fileIdentifier())
+ return p;
+
+ return -1;
+}
+
+long APE::File::findID3v1()
+{
+ if(!isValid())
+ return -1;
+
+ seek(-128, End);
+ long p = tell();
+
+ if(readBlock(3) == ID3v1::Tag::fileIdentifier())
+ return p;
+
+ return -1;
+}
diff --git a/Frameworks/TagLib/taglib/taglib/ape/apefile.h b/Frameworks/TagLib/taglib/taglib/ape/apefile.h
new file mode 100644
index 000000000..a4bc80d90
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/ape/apefile.h
@@ -0,0 +1,171 @@
+/***************************************************************************
+ copyright : (C) 2010 by Alex Novichkov
+ email : novichko@atnet.ru
+
+ copyright : (C) 2006 by Lukáš Lalinský
+ email : lalinsky@gmail.com
+ (original WavPack implementation)
+
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ (original MPC implementation)
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_APEFILE_H
+#define TAGLIB_APEFILE_H
+
+#include "tfile.h"
+#include "taglib_export.h"
+#include "apeproperties.h"
+
+namespace TagLib {
+
+ class Tag;
+
+ namespace ID3v1 { class Tag; }
+ namespace APE { class Tag; }
+
+ //! An implementation of APE metadata
+
+ /*!
+ * This is implementation of APE metadata.
+ *
+ * This supports ID3v1 and APE (v1 and v2) style comments as well as reading stream
+ * properties from the file.
+ */
+
+ namespace APE {
+
+ //! An implementation of TagLib::File with APE specific methods
+
+ /*!
+ * This implements and provides an interface APE WavPack files to the
+ * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
+ * the abstract TagLib::File API as well as providing some additional
+ * information specific to APE files.
+ */
+
+ class TAGLIB_EXPORT File : public TagLib::File
+ {
+ public:
+ /*!
+ * This set of flags is used for various operations and is suitable for
+ * being OR-ed together.
+ */
+ enum TagTypes {
+ //! Empty set. Matches no tag types.
+ NoTags = 0x0000,
+ //! Matches ID3v1 tags.
+ ID3v1 = 0x0001,
+ //! Matches APE tags.
+ APE = 0x0002,
+ //! Matches all tag types.
+ AllTags = 0xffff
+ };
+
+ /*!
+ * Contructs an WavPack file from \a file. If \a readProperties is true the
+ * file's audio properties will also be read using \a propertiesStyle. If
+ * false, \a propertiesStyle is ignored.
+ */
+ File(FileName file, bool readProperties = true,
+ Properties::ReadStyle propertiesStyle = Properties::Average);
+
+ /*!
+ * Destroys this instance of the File.
+ */
+ virtual ~File();
+
+ /*!
+ * Returns the Tag for this file. This will be an APE tag, an ID3v1 tag
+ * or a combination of the two.
+ */
+ virtual TagLib::Tag *tag() const;
+
+ /*!
+ * Returns the APE::Properties for this file. If no audio properties
+ * were read then this will return a null pointer.
+ */
+ virtual Properties *audioProperties() const;
+
+ /*!
+ * Saves the file.
+ *
+ * \note According to the official Monkey's Audio SDK, an APE file
+ * can only have either ID3V1 or APE tags, so a parameter is used here.
+ */
+ virtual bool save();
+
+ /*!
+ * Returns a pointer to the ID3v1 tag of the file.
+ *
+ * If \a create is false (the default) this will return a null pointer
+ * if there is no valid ID3v1 tag. If \a create is true it will create
+ * an ID3v1 tag if one does not exist. If there is already an APE tag, the
+ * new ID3v1 tag will be placed after it.
+ *
+ * \note The Tag is still owned by the APE::File and should not be
+ * deleted by the user. It will be deleted when the file (object) is
+ * destroyed.
+ */
+ ID3v1::Tag *ID3v1Tag(bool create = false);
+
+ /*!
+ * Returns a pointer to the APE tag of the file.
+ *
+ * If \a create is false (the default) this will return a null pointer
+ * if there is no valid APE tag. If \a create is true it will create
+ * a APE tag if one does not exist.
+ *
+ * \note The Tag is still owned by the APE::File and should not be
+ * deleted by the user. It will be deleted when the file (object) is
+ * destroyed.
+ */
+ APE::Tag *APETag(bool create = false);
+
+ /*!
+ * This will remove the tags that match the OR-ed together TagTypes from the
+ * file. By default it removes all tags.
+ *
+ * \note This will also invalidate pointers to the tags
+ * as their memory will be freed.
+ * \note In order to make the removal permanent save() still needs to be called
+ */
+ void strip(int tags = AllTags);
+
+ private:
+ File(const File &);
+ File &operator=(const File &);
+
+ void read(bool readProperties, Properties::ReadStyle propertiesStyle);
+ void scan();
+ long findID3v1();
+ long findAPE();
+
+ class FilePrivate;
+ FilePrivate *d;
+ };
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/ape/apefooter.cpp b/Frameworks/TagLib/taglib/taglib/ape/apefooter.cpp
new file mode 100644
index 000000000..0805e9e00
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/ape/apefooter.cpp
@@ -0,0 +1,236 @@
+/***************************************************************************
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ (C) 2002 - 2008 by Scott Wheeler (id3v2header.cpp)
+ email : kde@carewolf.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+
+#include
+#include
+
+#include "apefooter.h"
+
+using namespace TagLib;
+using namespace APE;
+
+class Footer::FooterPrivate
+{
+public:
+ FooterPrivate() : version(0),
+ footerPresent(true),
+ headerPresent(false),
+ isHeader(false),
+ itemCount(0),
+ tagSize(0) {}
+
+ ~FooterPrivate() {}
+
+ uint version;
+
+ bool footerPresent;
+ bool headerPresent;
+
+ bool isHeader;
+
+ uint itemCount;
+ uint tagSize;
+
+ static const uint size = 32;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// static members
+////////////////////////////////////////////////////////////////////////////////
+
+TagLib::uint Footer::size()
+{
+ return FooterPrivate::size;
+}
+
+ByteVector Footer::fileIdentifier()
+{
+ return ByteVector::fromCString("APETAGEX");
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+Footer::Footer()
+{
+ d = new FooterPrivate;
+}
+
+Footer::Footer(const ByteVector &data)
+{
+ d = new FooterPrivate;
+ parse(data);
+}
+
+Footer::~Footer()
+{
+ delete d;
+}
+
+TagLib::uint Footer::version() const
+{
+ return d->version;
+}
+
+bool Footer::headerPresent() const
+{
+ return d->headerPresent;
+}
+
+bool Footer::footerPresent() const
+{
+ return d->footerPresent;
+}
+
+bool Footer::isHeader() const
+{
+ return d->isHeader;
+}
+
+void Footer::setHeaderPresent(bool b) const
+{
+ d->headerPresent = b;
+}
+
+TagLib::uint Footer::itemCount() const
+{
+ return d->itemCount;
+}
+
+void Footer::setItemCount(uint s)
+{
+ d->itemCount = s;
+}
+
+TagLib::uint Footer::tagSize() const
+{
+ return d->tagSize;
+}
+
+TagLib::uint Footer::completeTagSize() const
+{
+ if(d->headerPresent)
+ return d->tagSize + d->size;
+ else
+ return d->tagSize;
+}
+
+void Footer::setTagSize(uint s)
+{
+ d->tagSize = s;
+}
+
+void Footer::setData(const ByteVector &data)
+{
+ parse(data);
+}
+
+ByteVector Footer::renderFooter() const
+{
+ return render(false);
+}
+
+ByteVector Footer::renderHeader() const
+{
+ if (!d->headerPresent) return ByteVector();
+
+ return render(true);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// protected members
+////////////////////////////////////////////////////////////////////////////////
+
+void Footer::parse(const ByteVector &data)
+{
+ if(data.size() < size())
+ return;
+
+ // The first eight bytes, data[0..7], are the File Identifier, "APETAGEX".
+
+ // Read the version number
+
+ d->version = data.mid(8, 4).toUInt(false);
+
+ // Read the tag size
+
+ d->tagSize = data.mid(12, 4).toUInt(false);
+
+ // Read the item count
+
+ d->itemCount = data.mid(16, 4).toUInt(false);
+
+ // Read the flags
+
+ std::bitset<32> flags(TAGLIB_CONSTRUCT_BITSET(data.mid(20, 4).toUInt(false)));
+
+ d->headerPresent = flags[31];
+ d->footerPresent = !flags[30];
+ d->isHeader = flags[29];
+
+}
+
+ByteVector Footer::render(bool isHeader) const
+{
+ ByteVector v;
+
+ // add the file identifier -- "APETAGEX"
+
+ v.append(fileIdentifier());
+
+ // add the version number -- we always render a 2.000 tag regardless of what
+ // the tag originally was.
+
+ v.append(ByteVector::fromUInt(2000, false));
+
+ // add the tag size
+
+ v.append(ByteVector::fromUInt(d->tagSize, false));
+
+ // add the item count
+
+ v.append(ByteVector::fromUInt(d->itemCount, false));
+
+ // render and add the flags
+
+ std::bitset<32> flags;
+
+ flags[31] = d->headerPresent;
+ flags[30] = false; // footer is always present
+ flags[29] = isHeader;
+
+ v.append(ByteVector::fromUInt(flags.to_ulong(), false));
+
+ // add the reserved 64bit
+
+ v.append(ByteVector::fromLongLong(0));
+
+ return v;
+}
diff --git a/Frameworks/TagLib/taglib/taglib/ape/apefooter.h b/Frameworks/TagLib/taglib/taglib/ape/apefooter.h
new file mode 100644
index 000000000..080f93006
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/ape/apefooter.h
@@ -0,0 +1,173 @@
+/***************************************************************************
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_APEFOOTER_H
+#define TAGLIB_APEFOOTER_H
+
+#include "tbytevector.h"
+#include "taglib_export.h"
+
+namespace TagLib {
+
+ namespace APE {
+
+ //! An implementation of APE footers
+
+ /*!
+ * This class implements APE footers (and headers). It attempts to follow, both
+ * semantically and programatically, the structure specified in
+ * the APE v2.0 standard. The API is based on the properties of APE footer and
+ * headers specified there.
+ */
+
+ class TAGLIB_EXPORT Footer
+ {
+ public:
+ /*!
+ * Constructs an empty APE footer.
+ */
+ Footer();
+
+ /*!
+ * Constructs an APE footer based on \a data. parse() is called
+ * immediately.
+ */
+ Footer(const ByteVector &data);
+
+ /*!
+ * Destroys the footer.
+ */
+ virtual ~Footer();
+
+ /*!
+ * Returns the version number. (Note: This is the 1000 or 2000.)
+ */
+ uint version() const;
+
+ /*!
+ * Returns true if a header is present in the tag.
+ */
+ bool headerPresent() const;
+
+ /*!
+ * Returns true if a footer is present in the tag.
+ */
+ bool footerPresent() const;
+
+ /*!
+ * Returns true this is actually the header.
+ */
+ bool isHeader() const;
+
+ /*!
+ * Sets whether the header should be rendered or not
+ */
+ void setHeaderPresent(bool b) const;
+
+ /*!
+ * Returns the number of items in the tag.
+ */
+ uint itemCount() const;
+
+ /*!
+ * Set the item count to \a s.
+ * \see itemCount()
+ */
+ void setItemCount(uint s);
+
+ /*!
+ * Returns the tag size in bytes. This is the size of the frame content and footer.
+ * The size of the \e entire tag will be this plus the header size, if present.
+ *
+ * \see completeTagSize()
+ */
+ uint tagSize() const;
+
+ /*!
+ * Returns the tag size, including if present, the header
+ * size.
+ *
+ * \see tagSize()
+ */
+ uint completeTagSize() const;
+
+ /*!
+ * Set the tag size to \a s.
+ * \see tagSize()
+ */
+ void setTagSize(uint s);
+
+ /*!
+ * Returns the size of the footer. Presently this is always 32 bytes.
+ */
+ static uint size();
+
+ /*!
+ * Returns the string used to identify an APE tag inside of a file.
+ * Presently this is always "APETAGEX".
+ */
+ static ByteVector fileIdentifier();
+
+ /*!
+ * Sets the data that will be used as the footer. 32 bytes,
+ * starting from \a data will be used.
+ */
+ void setData(const ByteVector &data);
+
+ /*!
+ * Renders the footer back to binary format.
+ */
+ ByteVector renderFooter() const;
+
+ /*!
+ * Renders the header corresponding to the footer. If headerPresent is
+ * set to false, it returns an empty ByteVector.
+ */
+ ByteVector renderHeader() const;
+
+ protected:
+ /*!
+ * Called by setData() to parse the footer data. It makes this information
+ * available through the public API.
+ */
+ void parse(const ByteVector &data);
+
+ /*!
+ * Called by renderFooter and renderHeader
+ */
+ ByteVector render(bool isHeader) const;
+
+ private:
+ Footer(const Footer &);
+ Footer &operator=(const Footer &);
+
+ class FooterPrivate;
+ FooterPrivate *d;
+ };
+
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/ape/apeitem.cpp b/Frameworks/TagLib/taglib/taglib/ape/apeitem.cpp
new file mode 100644
index 000000000..350eac0b5
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/ape/apeitem.cpp
@@ -0,0 +1,230 @@
+/***************************************************************************
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+
+#include "apeitem.h"
+
+using namespace TagLib;
+using namespace APE;
+
+class APE::Item::ItemPrivate
+{
+public:
+ ItemPrivate() : type(Text), readOnly(false) {}
+
+ Item::ItemTypes type;
+ String key;
+ ByteVector value;
+ StringList text;
+ bool readOnly;
+};
+
+APE::Item::Item()
+{
+ d = new ItemPrivate;
+}
+
+APE::Item::Item(const String &key, const String &value)
+{
+ d = new ItemPrivate;
+ d->key = key;
+ d->text.append(value);
+}
+
+APE::Item::Item(const String &key, const StringList &values)
+{
+ d = new ItemPrivate;
+ d->key = key;
+ d->text = values;
+}
+
+APE::Item::Item(const Item &item)
+{
+ d = new ItemPrivate(*item.d);
+}
+
+APE::Item::~Item()
+{
+ delete d;
+}
+
+Item &APE::Item::operator=(const Item &item)
+{
+ delete d;
+ d = new ItemPrivate(*item.d);
+ return *this;
+}
+
+void APE::Item::setReadOnly(bool readOnly)
+{
+ d->readOnly = readOnly;
+}
+
+bool APE::Item::isReadOnly() const
+{
+ return d->readOnly;
+}
+
+void APE::Item::setType(APE::Item::ItemTypes val)
+{
+ d->type = val;
+}
+
+APE::Item::ItemTypes APE::Item::type() const
+{
+ return d->type;
+}
+
+String APE::Item::key() const
+{
+ return d->key;
+}
+
+ByteVector APE::Item::value() const
+{
+ // This seems incorrect as it won't be actually rendering the value to keep it
+ // up to date.
+
+ return d->value;
+}
+
+void APE::Item::setKey(const String &key)
+{
+ d->key = key;
+}
+
+void APE::Item::setValue(const String &value)
+{
+ d->text = value;
+}
+
+void APE::Item::setValues(const StringList &value)
+{
+ d->text = value;
+}
+
+void APE::Item::appendValue(const String &value)
+{
+ d->text.append(value);
+}
+
+void APE::Item::appendValues(const StringList &values)
+{
+ d->text.append(values);
+}
+
+int APE::Item::size() const
+{
+ return 8 + d->key.size() + 1 + d->value.size();
+}
+
+StringList APE::Item::toStringList() const
+{
+ return d->text;
+}
+
+StringList APE::Item::values() const
+{
+ return d->text;
+}
+
+String APE::Item::toString() const
+{
+ return isEmpty() ? String::null : d->text.front();
+}
+
+bool APE::Item::isEmpty() const
+{
+ switch(d->type) {
+ case Text:
+ case Binary:
+ if(d->text.isEmpty())
+ return true;
+ if(d->text.size() == 1 && d->text.front().isEmpty())
+ return true;
+ return false;
+ case Locator:
+ return d->value.isEmpty();
+ default:
+ return false;
+ }
+}
+
+void APE::Item::parse(const ByteVector &data)
+{
+ // 11 bytes is the minimum size for an APE item
+
+ if(data.size() < 11) {
+ debug("APE::Item::parse() -- no data in item");
+ return;
+ }
+
+ uint valueLength = data.mid(0, 4).toUInt(false);
+ uint flags = data.mid(4, 4).toUInt(false);
+
+ d->key = String(data.mid(8), String::UTF8);
+
+ d->value = data.mid(8 + d->key.size() + 1, valueLength);
+
+ setReadOnly(flags & 1);
+ setType(ItemTypes((flags >> 1) & 3));
+
+ if(int(d->type) < 2)
+ d->text = StringList(ByteVectorList::split(d->value, '\0'), String::UTF8);
+}
+
+ByteVector APE::Item::render() const
+{
+ ByteVector data;
+ TagLib::uint flags = ((d->readOnly) ? 1 : 0) | (d->type << 1);
+ ByteVector value;
+
+ if(isEmpty())
+ return data;
+
+ if(d->type == Text) {
+ StringList::ConstIterator it = d->text.begin();
+
+ value.append(it->data(String::UTF8));
+ it++;
+ for(; it != d->text.end(); ++it) {
+ value.append('\0');
+ value.append(it->data(String::UTF8));
+ }
+ d->value = value;
+ }
+ else
+ value.append(d->value);
+
+ data.append(ByteVector::fromUInt(value.size(), false));
+ data.append(ByteVector::fromUInt(flags, false));
+ data.append(d->key.data(String::UTF8));
+ data.append(ByteVector('\0'));
+ data.append(value);
+
+ return data;
+}
diff --git a/Frameworks/TagLib/taglib/taglib/ape/apeitem.h b/Frameworks/TagLib/taglib/taglib/ape/apeitem.h
new file mode 100644
index 000000000..01fcc764f
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/ape/apeitem.h
@@ -0,0 +1,204 @@
+/***************************************************************************
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_APEITEM_H
+#define TAGLIB_APEITEM_H
+
+#include "tbytevector.h"
+#include "tstring.h"
+#include "tstringlist.h"
+
+namespace TagLib {
+
+ namespace APE {
+
+ //! An implementation of APE-items
+
+ /*!
+ * This class provides the features of items in the APEv2 standard.
+ */
+ class TAGLIB_EXPORT Item
+ {
+ public:
+ /*!
+ * Enum of types an Item can have. The value of 3 is reserved.
+ */
+ enum ItemTypes {
+ //! Item contains text information coded in UTF-8
+ Text = 0,
+ //! Item contains binary information
+ Binary = 1,
+ //! Item is a locator of external stored information
+ Locator = 2
+ };
+ /*!
+ * Constructs an empty item.
+ */
+ Item();
+
+ /*!
+ * Constructs an item with \a key and \a value.
+ */
+ // BIC: Remove this, StringList has a constructor from a single string
+ Item(const String &key, const String &value);
+
+ /*!
+ * Constructs an item with \a key and \a values.
+ */
+ Item(const String &key, const StringList &values);
+
+ /*!
+ * Construct an item as a copy of \a item.
+ */
+ Item(const Item &item);
+
+ /*!
+ * Destroys the item.
+ */
+ virtual ~Item();
+
+ /*!
+ * Copies the contents of \a item into this item.
+ */
+ Item &operator=(const Item &item);
+
+ /*!
+ * Returns the key.
+ */
+ String key() const;
+
+ /*!
+ * Returns the binary value.
+ *
+ * \deprecated This will be removed in the next binary incompatible version
+ * as it is not kept in sync with the things that are set using setValue()
+ * and friends.
+ */
+ ByteVector value() const;
+
+ /*!
+ * Sets the key for the item to \a key.
+ */
+ void setKey(const String &key);
+
+ /*!
+ * Sets the value of the item to \a value and clears any previous contents.
+ *
+ * \see toString()
+ */
+ void setValue(const String &value);
+
+ /*!
+ * Sets the value of the item to the list of values in \a value and clears
+ * any previous contents.
+ *
+ * \see toStringList()
+ */
+ void setValues(const StringList &values);
+
+ /*!
+ * Appends \a value to create (or extend) the current list of values.
+ *
+ * \see toString()
+ */
+ void appendValue(const String &value);
+
+ /*!
+ * Appends \a values to extend the current list of values.
+ *
+ * \see toStringList()
+ */
+ void appendValues(const StringList &values);
+
+ /*!
+ * Returns the size of the full item.
+ */
+ int size() const;
+
+ /*!
+ * Returns the value as a single string. In case of multiple strings,
+ * the first is returned.
+ */
+ String toString() const;
+
+ /*!
+ * \deprecated
+ * \see values
+ */
+ StringList toStringList() const;
+
+ /*!
+ * Returns the list of values.
+ */
+ StringList values() const;
+
+ /*!
+ * Render the item to a ByteVector.
+ */
+ ByteVector render() const;
+
+ /*!
+ * Parse the item from the ByteVector \a data.
+ */
+ void parse(const ByteVector& data);
+
+ /*!
+ * Set the item to read-only.
+ */
+ void setReadOnly(bool readOnly);
+
+ /*!
+ * Return true if the item is read-only.
+ */
+ bool isReadOnly() const;
+
+ /*!
+ * Sets the type of the item to \a type.
+ *
+ * \see ItemTypes
+ */
+ void setType(ItemTypes type);
+
+ /*!
+ * Returns the type of the item.
+ */
+ ItemTypes type() const;
+
+ /*!
+ * Returns if the item has any real content.
+ */
+ bool isEmpty() const;
+
+ private:
+ class ItemPrivate;
+ ItemPrivate *d;
+ };
+ }
+
+}
+
+#endif
+
+
diff --git a/Frameworks/TagLib/taglib/taglib/ape/apeproperties.cpp b/Frameworks/TagLib/taglib/taglib/ape/apeproperties.cpp
new file mode 100644
index 000000000..3154d1045
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/ape/apeproperties.cpp
@@ -0,0 +1,224 @@
+/***************************************************************************
+ copyright : (C) 2010 by Alex Novichkov
+ email : novichko@atnet.ru
+
+ copyright : (C) 2006 by Lukáš Lalinský
+ email : lalinsky@gmail.com
+ (original WavPack implementation)
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+#include
+#include "id3v2tag.h"
+#include "apeproperties.h"
+#include "apefile.h"
+
+using namespace TagLib;
+
+class APE::Properties::PropertiesPrivate
+{
+public:
+ PropertiesPrivate(File *file, long streamLength) :
+ length(0),
+ bitrate(0),
+ sampleRate(0),
+ channels(0),
+ version(0),
+ bitsPerSample(0),
+ file(file),
+ streamLength(streamLength) {}
+
+ int length;
+ int bitrate;
+ int sampleRate;
+ int channels;
+ int version;
+ int bitsPerSample;
+ File *file;
+ long streamLength;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+APE::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style)
+{
+ d = new PropertiesPrivate(file, file->length());
+ read();
+}
+
+APE::Properties::~Properties()
+{
+ delete d;
+}
+
+int APE::Properties::length() const
+{
+ return d->length;
+}
+
+int APE::Properties::bitrate() const
+{
+ return d->bitrate;
+}
+
+int APE::Properties::sampleRate() const
+{
+ return d->sampleRate;
+}
+
+int APE::Properties::channels() const
+{
+ return d->channels;
+}
+
+int APE::Properties::version() const
+{
+ return d->version;
+}
+
+int APE::Properties::bitsPerSample() const
+{
+ return d->bitsPerSample;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+
+void APE::Properties::read()
+{
+ // First we are searching the descriptor
+ long offset = findDescriptor();
+ if(offset < 0)
+ return;
+
+ // Then we read the header common for all versions of APE
+ d->file->seek(offset);
+ ByteVector commonHeader=d->file->readBlock(6);
+ if(!commonHeader.startsWith("MAC "))
+ return;
+ d->version = commonHeader.mid(4).toUInt(false);
+
+ if(d->version >= 3980) {
+ analyzeCurrent();
+ }
+ else {
+ analyzeOld();
+ }
+}
+
+long APE::Properties::findDescriptor()
+{
+ long ID3v2Location = findID3v2();
+ long ID3v2OriginalSize = 0;
+ bool hasID3v2 = false;
+ if(ID3v2Location >= 0) {
+ ID3v2::Tag tag(d->file, ID3v2Location, 0);
+ ID3v2OriginalSize = tag.header()->completeTagSize();
+ if(tag.header()->tagSize() > 0)
+ hasID3v2 = true;
+ }
+
+ long offset = 0;
+ if(hasID3v2)
+ offset = d->file->find("MAC ", ID3v2Location + ID3v2OriginalSize);
+ else
+ offset = d->file->find("MAC ");
+
+ if(offset < 0) {
+ debug("APE::Properties::findDescriptor() -- APE descriptor not found");
+ return -1;
+ }
+
+ return offset;
+}
+
+long APE::Properties::findID3v2()
+{
+ if(!d->file->isValid())
+ return -1;
+
+ d->file->seek(0);
+
+ if(d->file->readBlock(3) == ID3v2::Header::fileIdentifier())
+ return 0;
+
+ return -1;
+}
+
+void APE::Properties::analyzeCurrent()
+{
+ // Read the descriptor
+ d->file->seek(2, File::Current);
+ ByteVector descriptor = d->file->readBlock(44);
+ uint descriptorBytes = descriptor.mid(0,4).toUInt(false);
+
+ if ((descriptorBytes - 52) > 0)
+ d->file->seek(descriptorBytes - 52, File::Current);
+
+ // Read the header
+ ByteVector header = d->file->readBlock(24);
+
+ // Get the APE info
+ d->channels = header.mid(18, 2).toShort(false);
+ d->sampleRate = header.mid(20, 4).toUInt(false);
+ d->bitsPerSample = header.mid(16, 2).toShort(false);
+ //d->compressionLevel =
+
+ uint totalFrames = header.mid(12, 4).toUInt(false);
+ uint blocksPerFrame = header.mid(4, 4).toUInt(false);
+ uint finalFrameBlocks = header.mid(8, 4).toUInt(false);
+ uint totalBlocks = totalFrames > 0 ? (totalFrames - 1) * blocksPerFrame + finalFrameBlocks : 0;
+ d->length = totalBlocks / d->sampleRate;
+ d->bitrate = d->length > 0 ? ((d->streamLength * 8L) / d->length) / 1000 : 0;
+}
+
+void APE::Properties::analyzeOld()
+{
+ ByteVector header = d->file->readBlock(26);
+ uint totalFrames = header.mid(18, 4).toUInt(false);
+
+ // Fail on 0 length APE files (catches non-finalized APE files)
+ if(totalFrames == 0)
+ return;
+
+ short compressionLevel = header.mid(0, 2).toShort(false);
+ uint blocksPerFrame;
+ if(d->version >= 3950)
+ blocksPerFrame = 73728 * 4;
+ else if(d->version >= 3900 || (d->version >= 3800 && compressionLevel == 4000))
+ blocksPerFrame = 73728;
+ else
+ blocksPerFrame = 9216;
+ d->channels = header.mid(4, 2).toShort(false);
+ d->sampleRate = header.mid(6, 4).toUInt(false);
+ uint finalFrameBlocks = header.mid(22, 4).toUInt(false);
+ uint totalBlocks = totalFrames > 0 ? (totalFrames - 1) * blocksPerFrame + finalFrameBlocks : 0;
+ d->length = totalBlocks / d->sampleRate;
+ d->bitrate = d->length > 0 ? ((d->streamLength * 8L) / d->length) / 1000 : 0;
+}
+
diff --git a/Frameworks/TagLib/taglib/taglib/ape/apeproperties.h b/Frameworks/TagLib/taglib/taglib/ape/apeproperties.h
new file mode 100644
index 000000000..8b543a572
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/ape/apeproperties.h
@@ -0,0 +1,98 @@
+/***************************************************************************
+ copyright : (C) 2010 by Alex Novichkov
+ email : novichko@atnet.ru
+
+ copyright : (C) 2006 by Lukáš Lalinský
+ email : lalinsky@gmail.com
+ (original WavPack implementation)
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_APEPROPERTIES_H
+#define TAGLIB_APEPROPERTIES_H
+
+#include "taglib_export.h"
+#include "audioproperties.h"
+
+namespace TagLib {
+
+ namespace APE {
+
+ class File;
+
+ //! An implementation of audio property reading for APE
+
+ /*!
+ * This reads the data from an APE stream found in the AudioProperties
+ * API.
+ */
+
+ class TAGLIB_EXPORT Properties : public AudioProperties
+ {
+ public:
+ /*!
+ * Create an instance of APE::Properties with the data read from the
+ * ByteVector \a data.
+ */
+ Properties(File *f, ReadStyle style = Average);
+
+ /*!
+ * Destroys this APE::Properties instance.
+ */
+ virtual ~Properties();
+
+ // Reimplementations.
+
+ virtual int length() const;
+ virtual int bitrate() const;
+ virtual int sampleRate() const;
+ virtual int channels() const;
+
+ /*!
+ * Returns number of bits per sample.
+ */
+ int bitsPerSample() const;
+
+ /*!
+ * Returns APE version.
+ */
+ int version() const;
+
+ private:
+ Properties(const Properties &);
+ Properties &operator=(const Properties &);
+
+ void read();
+
+ long findDescriptor();
+ long findID3v2();
+
+ void analyzeCurrent();
+ void analyzeOld();
+
+ class PropertiesPrivate;
+ PropertiesPrivate *d;
+ };
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/ape/apetag.cpp b/Frameworks/TagLib/taglib/taglib/ape/apetag.cpp
new file mode 100644
index 000000000..3bfde906d
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/ape/apetag.cpp
@@ -0,0 +1,331 @@
+/***************************************************************************
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.com
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifdef __SUNPRO_CC
+// Sun Studio finds multiple specializations of Map because
+// it considers specializations with and without class types
+// to be different; this define forces Map to use only the
+// specialization with the class keyword.
+#define WANT_CLASS_INSTANTIATION_OF_MAP (1)
+#endif
+
+#include
+#include
+#include
+
+#include "apetag.h"
+#include "apefooter.h"
+#include "apeitem.h"
+
+using namespace TagLib;
+using namespace APE;
+
+class APE::Tag::TagPrivate
+{
+public:
+ TagPrivate() : file(0), footerLocation(-1), tagLength(0) {}
+
+ File *file;
+ long footerLocation;
+ long tagLength;
+
+ Footer footer;
+
+ ItemListMap itemListMap;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public methods
+////////////////////////////////////////////////////////////////////////////////
+
+APE::Tag::Tag() : TagLib::Tag()
+{
+ d = new TagPrivate;
+}
+
+APE::Tag::Tag(File *file, long footerLocation) : TagLib::Tag()
+{
+ d = new TagPrivate;
+ d->file = file;
+ d->footerLocation = footerLocation;
+
+ read();
+}
+
+APE::Tag::~Tag()
+{
+ delete d;
+}
+
+ByteVector APE::Tag::fileIdentifier()
+{
+ return ByteVector::fromCString("APETAGEX");
+}
+
+String APE::Tag::title() const
+{
+ if(d->itemListMap["TITLE"].isEmpty())
+ return String::null;
+ return d->itemListMap["TITLE"].toString();
+}
+
+String APE::Tag::artist() const
+{
+ if(d->itemListMap["ARTIST"].isEmpty())
+ return String::null;
+ return d->itemListMap["ARTIST"].toString();
+}
+
+String APE::Tag::album() const
+{
+ if(d->itemListMap["ALBUM"].isEmpty())
+ return String::null;
+ return d->itemListMap["ALBUM"].toString();
+}
+
+String APE::Tag::comment() const
+{
+ if(d->itemListMap["COMMENT"].isEmpty())
+ return String::null;
+ return d->itemListMap["COMMENT"].toString();
+}
+
+String APE::Tag::genre() const
+{
+ if(d->itemListMap["GENRE"].isEmpty())
+ return String::null;
+ return d->itemListMap["GENRE"].toString();
+}
+
+TagLib::uint APE::Tag::year() const
+{
+ if(d->itemListMap["YEAR"].isEmpty())
+ return 0;
+ return d->itemListMap["YEAR"].toString().toInt();
+}
+
+TagLib::uint APE::Tag::track() const
+{
+ if(d->itemListMap["TRACK"].isEmpty())
+ return 0;
+ return d->itemListMap["TRACK"].toString().toInt();
+}
+
+float APE::Tag::rgAlbumGain() const
+{
+ if (d->itemListMap["REPLAYGAIN_ALBUM_GAIN"].isEmpty())
+ return 0;
+ return d->itemListMap["REPLAYGAIN_ALBUM_GAIN"].toString().toFloat();
+}
+
+float APE::Tag::rgAlbumPeak() const
+{
+ if (d->itemListMap["REPLAYGAIN_ALBUM_PEAK"].isEmpty())
+ return 0;
+ return d->itemListMap["REPLAYGAIN_ALBUM_PEAK"].toString().toFloat();
+}
+
+float APE::Tag::rgTrackGain() const
+{
+ if (d->itemListMap["REPLAYGAIN_TRACK_GAIN"].isEmpty())
+ return 0;
+ return d->itemListMap["REPLAYGAIN_TRACK_GAIN"].toString().toFloat();
+}
+
+float APE::Tag::rgTrackPeak() const
+{
+ if (d->itemListMap["REPLAYGAIN_TRACK_PEAK"].isEmpty())
+ return 0;
+ return d->itemListMap["REPLAYGAIN_TRACK_PEAK"].toString().toFloat();
+}
+
+void APE::Tag::setTitle(const String &s)
+{
+ addValue("TITLE", s, true);
+}
+
+void APE::Tag::setArtist(const String &s)
+{
+ addValue("ARTIST", s, true);
+}
+
+void APE::Tag::setAlbum(const String &s)
+{
+ addValue("ALBUM", s, true);
+}
+
+void APE::Tag::setComment(const String &s)
+{
+ addValue("COMMENT", s, true);
+}
+
+void APE::Tag::setGenre(const String &s)
+{
+ addValue("GENRE", s, true);
+}
+
+void APE::Tag::setYear(uint i)
+{
+ if(i <= 0)
+ removeItem("YEAR");
+ else
+ addValue("YEAR", String::number(i), true);
+}
+
+void APE::Tag::setTrack(uint i)
+{
+ if(i <= 0)
+ removeItem("TRACK");
+ else
+ addValue("TRACK", String::number(i), true);
+}
+
+void APE::Tag::setRGAlbumGain(float f)
+{
+ if (f == 0)
+ removeItem("REPLAYGAIN_ALBUM_GAIN");
+ else
+ addValue("REPLAYGAIN_ALBUM_GAIN", String::number(f) + " dB", true);
+}
+
+void APE::Tag::setRGAlbumPeak(float f)
+{
+ if (f == 0)
+ removeItem("REPLAYGAIN_ALBUM_PEAK");
+ else
+ addValue("REPLAYGAIN_ALBUM_PEAK", String::number(f), true);
+}
+
+void APE::Tag::setRGTrackGain(float f)
+{
+ if (f == 0)
+ removeItem("REPLAYGAIN_TRACK_GAIN");
+ else
+ addValue("REPLAYGAIN_TRACK_GAIN", String::number(f) + " dB", true);
+}
+
+void APE::Tag::setRGTrackPeak(float f)
+{
+ if (f == 0)
+ removeItem("REPLAYGAIN_TRACK_PEAK");
+ else
+ addValue("REPLAYGAIN_TRACK_PEAK", String::number(f), true);
+}
+
+APE::Footer *APE::Tag::footer() const
+{
+ return &d->footer;
+}
+
+const APE::ItemListMap& APE::Tag::itemListMap() const
+{
+ return d->itemListMap;
+}
+
+void APE::Tag::removeItem(const String &key)
+{
+ Map::Iterator it = d->itemListMap.find(key.upper());
+ if(it != d->itemListMap.end())
+ d->itemListMap.erase(it);
+}
+
+void APE::Tag::addValue(const String &key, const String &value, bool replace)
+{
+ if(replace)
+ removeItem(key);
+ if(!value.isEmpty()) {
+ if(d->itemListMap.contains(key) || !replace)
+ d->itemListMap[key.upper()].appendValue(value);
+ else
+ setItem(key, Item(key, value));
+ }
+}
+
+void APE::Tag::setItem(const String &key, const Item &item)
+{
+ d->itemListMap.insert(key.upper(), item);
+}
+
+bool APE::Tag::isEmpty() const
+{
+ return d->itemListMap.isEmpty();
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// protected methods
+////////////////////////////////////////////////////////////////////////////////
+
+void APE::Tag::read()
+{
+ if(d->file && d->file->isValid()) {
+
+ d->file->seek(d->footerLocation);
+ d->footer.setData(d->file->readBlock(Footer::size()));
+
+ if(d->footer.tagSize() <= Footer::size() ||
+ d->footer.tagSize() > uint(d->file->length()))
+ return;
+
+ d->file->seek(d->footerLocation + Footer::size() - d->footer.tagSize());
+ parse(d->file->readBlock(d->footer.tagSize() - Footer::size()));
+ }
+}
+
+ByteVector APE::Tag::render() const
+{
+ ByteVector data;
+ uint itemCount = 0;
+
+ {
+ for(Map::ConstIterator it = d->itemListMap.begin();
+ it != d->itemListMap.end(); ++it)
+ {
+ data.append(it->second.render());
+ itemCount++;
+ }
+ }
+
+ d->footer.setItemCount(itemCount);
+ d->footer.setTagSize(data.size() + Footer::size());
+ d->footer.setHeaderPresent(true);
+
+ return d->footer.renderHeader() + data + d->footer.renderFooter();
+}
+
+void APE::Tag::parse(const ByteVector &data)
+{
+ uint pos = 0;
+
+ // 11 bytes is the minimum size for an APE item
+
+ for(uint i = 0; i < d->footer.itemCount() && pos <= data.size() - 11; i++) {
+ APE::Item item;
+ item.parse(data.mid(pos));
+
+ d->itemListMap.insert(item.key().upper(), item);
+
+ pos += item.size();
+ }
+}
diff --git a/Frameworks/TagLib/taglib/taglib/ape/apetag.h b/Frameworks/TagLib/taglib/taglib/ape/apetag.h
new file mode 100644
index 000000000..5cda8a7a0
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/ape/apetag.h
@@ -0,0 +1,178 @@
+/***************************************************************************
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_APETAG_H
+#define TAGLIB_APETAG_H
+
+#include "tag.h"
+#include "tbytevector.h"
+#include "tmap.h"
+#include "tstring.h"
+#include "taglib_export.h"
+
+#include "apeitem.h"
+
+namespace TagLib {
+
+ class File;
+
+ //! An implementation of the APE tagging format
+
+ namespace APE {
+
+ class Footer;
+
+ /*!
+ * A mapping between a list of item names, or keys, and the associated item.
+ *
+ * \see APE::Tag::itemListMap()
+ */
+ typedef Map ItemListMap;
+
+
+ //! An APE tag implementation
+
+ class TAGLIB_EXPORT Tag : public TagLib::Tag
+ {
+ public:
+ /*!
+ * Create an APE tag with default values.
+ */
+ Tag();
+
+ /*!
+ * Create an APE tag and parse the data in \a file with APE footer at
+ * \a tagOffset.
+ */
+ Tag(TagLib::File *file, long footerLocation);
+
+ /*!
+ * Destroys this Tag instance.
+ */
+ virtual ~Tag();
+
+ /*!
+ * Renders the in memory values to a ByteVector suitable for writing to
+ * the file.
+ */
+ ByteVector render() const;
+
+ /*!
+ * Returns the string "APETAGEX" suitable for usage in locating the tag in a
+ * file.
+ */
+ static ByteVector fileIdentifier();
+
+ // Reimplementations.
+
+ virtual String title() const;
+ virtual String artist() const;
+ virtual String album() const;
+ virtual String comment() const;
+ virtual String genre() const;
+ virtual uint year() const;
+ virtual uint track() const;
+ virtual float rgAlbumGain() const;
+ virtual float rgAlbumPeak() const;
+ virtual float rgTrackGain() const;
+ virtual float rgTrackPeak() const;
+
+ virtual void setTitle(const String &s);
+ virtual void setArtist(const String &s);
+ virtual void setAlbum(const String &s);
+ virtual void setComment(const String &s);
+ virtual void setGenre(const String &s);
+ virtual void setYear(uint i);
+ virtual void setTrack(uint i);
+ virtual void setRGAlbumGain(float f);
+ virtual void setRGAlbumPeak(float f);
+ virtual void setRGTrackGain(float f);
+ virtual void setRGTrackPeak(float f);
+
+ /*!
+ * Returns a pointer to the tag's footer.
+ */
+ Footer *footer() const;
+
+ /*!
+ * Returns a reference to the item list map. This is an ItemListMap of
+ * all of the items in the tag.
+ *
+ * This is the most powerfull structure for accessing the items of the tag.
+ *
+ * APE tags are case-insensitive, all keys in this map have been converted
+ * to upper case.
+ *
+ * \warning You should not modify this data structure directly, instead
+ * use setItem() and removeItem().
+ */
+ const ItemListMap &itemListMap() const;
+
+ /*!
+ * Removes the \a key item from the tag
+ */
+ void removeItem(const String &key);
+
+ /*!
+ * Adds to the item specified by \a key the data \a value. If \a replace
+ * is true, then all of the other values on the same key will be removed
+ * first.
+ */
+ void addValue(const String &key, const String &value, bool replace = true);
+
+ /*!
+ * Sets the \a key item to the value of \a item. If an item with the \a key is already
+ * present, it will be replaced.
+ */
+ void setItem(const String &key, const Item &item);
+
+ /*!
+ * Returns true if the tag does not contain any data.
+ */
+ bool isEmpty() const;
+
+ protected:
+
+ /*!
+ * Reads from the file specified in the constructor.
+ */
+ void read();
+
+ /*!
+ * Parses the body of the tag in \a data.
+ */
+ void parse(const ByteVector &data);
+
+ private:
+ Tag(const Tag &);
+ Tag &operator=(const Tag &);
+
+ class TagPrivate;
+ TagPrivate *d;
+ };
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/asf/asfattribute.cpp b/Frameworks/TagLib/taglib/taglib/asf/asfattribute.cpp
new file mode 100644
index 000000000..ecdf1f618
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/asf/asfattribute.cpp
@@ -0,0 +1,356 @@
+/**************************************************************************
+ copyright : (C) 2005-2007 by Lukáš Lalinský
+ email : lalinsky@gmail.com
+ **************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include
+#endif
+
+#ifdef WITH_ASF
+
+#include
+#include
+#include "asfattribute.h"
+#include "asffile.h"
+
+using namespace TagLib;
+
+class ASF::Attribute::AttributePrivate : public RefCounter
+{
+public:
+ AttributePrivate()
+ : pictureValue(ASF::Picture::fromInvalid()),
+ stream(0),
+ language(0) {}
+ AttributeTypes type;
+ String stringValue;
+ ByteVector byteVectorValue;
+ ASF::Picture pictureValue;
+ union {
+ unsigned int intValue;
+ unsigned short shortValue;
+ unsigned long long longLongValue;
+ bool boolValue;
+ };
+ int stream;
+ int language;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+ASF::Attribute::Attribute()
+{
+ d = new AttributePrivate;
+ d->type = UnicodeType;
+}
+
+ASF::Attribute::Attribute(const ASF::Attribute &other)
+ : d(other.d)
+{
+ d->ref();
+}
+
+ASF::Attribute &ASF::Attribute::operator=(const ASF::Attribute &other)
+{
+ if(d->deref())
+ delete d;
+ d = other.d;
+ d->ref();
+ return *this;
+}
+
+ASF::Attribute::~Attribute()
+{
+ if(d->deref())
+ delete d;
+}
+
+ASF::Attribute::Attribute(const String &value)
+{
+ d = new AttributePrivate;
+ d->type = UnicodeType;
+ d->stringValue = value;
+}
+
+ASF::Attribute::Attribute(const ByteVector &value)
+{
+ d = new AttributePrivate;
+ d->type = BytesType;
+ d->byteVectorValue = value;
+}
+
+ASF::Attribute::Attribute(const ASF::Picture &value)
+{
+ d = new AttributePrivate;
+ d->type = BytesType;
+ d->pictureValue = value;
+}
+
+ASF::Attribute::Attribute(unsigned int value)
+{
+ d = new AttributePrivate;
+ d->type = DWordType;
+ d->intValue = value;
+}
+
+ASF::Attribute::Attribute(unsigned long long value)
+{
+ d = new AttributePrivate;
+ d->type = QWordType;
+ d->longLongValue = value;
+}
+
+ASF::Attribute::Attribute(unsigned short value)
+{
+ d = new AttributePrivate;
+ d->type = WordType;
+ d->shortValue = value;
+}
+
+ASF::Attribute::Attribute(bool value)
+{
+ d = new AttributePrivate;
+ d->type = BoolType;
+ d->boolValue = value;
+}
+
+ASF::Attribute::AttributeTypes ASF::Attribute::type() const
+{
+ return d->type;
+}
+
+String ASF::Attribute::toString() const
+{
+ return d->stringValue;
+}
+
+ByteVector ASF::Attribute::toByteVector() const
+{
+ if(d->pictureValue.isValid())
+ return d->pictureValue.render();
+ return d->byteVectorValue;
+}
+
+unsigned short ASF::Attribute::toBool() const
+{
+ return d->shortValue;
+}
+
+unsigned short ASF::Attribute::toUShort() const
+{
+ return d->shortValue;
+}
+
+unsigned int ASF::Attribute::toUInt() const
+{
+ return d->intValue;
+}
+
+unsigned long long ASF::Attribute::toULongLong() const
+{
+ return d->longLongValue;
+}
+
+ASF::Picture ASF::Attribute::toPicture() const
+{
+ return d->pictureValue;
+}
+
+String ASF::Attribute::parse(ASF::File &f, int kind)
+{
+ uint size, nameLength;
+ String name;
+ d->pictureValue = Picture::fromInvalid();
+ // extended content descriptor
+ if(kind == 0) {
+ nameLength = f.readWORD();
+ name = f.readString(nameLength);
+ d->type = ASF::Attribute::AttributeTypes(f.readWORD());
+ size = f.readWORD();
+ }
+ // metadata & metadata library
+ else {
+ int temp = f.readWORD();
+ // metadata library
+ if(kind == 2) {
+ d->language = temp;
+ }
+ d->stream = f.readWORD();
+ nameLength = f.readWORD();
+ d->type = ASF::Attribute::AttributeTypes(f.readWORD());
+ size = f.readDWORD();
+ name = f.readString(nameLength);
+ }
+
+ if(kind != 2 && size > 65535) {
+ debug("ASF::Attribute::parse() -- Value larger than 64kB");
+ }
+
+ switch(d->type) {
+ case WordType:
+ d->shortValue = f.readWORD();
+ break;
+
+ case BoolType:
+ if(kind == 0) {
+ d->boolValue = f.readDWORD() == 1;
+ }
+ else {
+ d->boolValue = f.readWORD() == 1;
+ }
+ break;
+
+ case DWordType:
+ d->intValue = f.readDWORD();
+ break;
+
+ case QWordType:
+ d->longLongValue = f.readQWORD();
+ break;
+
+ case UnicodeType:
+ d->stringValue = f.readString(size);
+ break;
+
+ case BytesType:
+ case GuidType:
+ d->byteVectorValue = f.readBlock(size);
+ break;
+ }
+
+ if(d->type == BytesType && name == "WM/Picture") {
+ d->pictureValue.parse(d->byteVectorValue);
+ if(d->pictureValue.isValid()) {
+ d->byteVectorValue.clear();
+ }
+ }
+
+ return name;
+}
+
+int ASF::Attribute::dataSize() const
+{
+ switch (d->type) {
+ case WordType:
+ return 2;
+ case BoolType:
+ return 4;
+ case DWordType:
+ return 4;
+ case QWordType:
+ return 5;
+ case UnicodeType:
+ return d->stringValue.size() * 2 + 2;
+ case BytesType:
+ if(d->pictureValue.isValid())
+ return d->pictureValue.dataSize();
+ case GuidType:
+ return d->byteVectorValue.size();
+ }
+ return 0;
+}
+
+ByteVector ASF::Attribute::render(const String &name, int kind) const
+{
+ ByteVector data;
+
+ switch (d->type) {
+ case WordType:
+ data.append(ByteVector::fromShort(d->shortValue, false));
+ break;
+
+ case BoolType:
+ if(kind == 0) {
+ data.append(ByteVector::fromUInt(d->boolValue ? 1 : 0, false));
+ }
+ else {
+ data.append(ByteVector::fromShort(d->boolValue ? 1 : 0, false));
+ }
+ break;
+
+ case DWordType:
+ data.append(ByteVector::fromUInt(d->intValue, false));
+ break;
+
+ case QWordType:
+ data.append(ByteVector::fromLongLong(d->longLongValue, false));
+ break;
+
+ case UnicodeType:
+ data.append(File::renderString(d->stringValue));
+ break;
+
+ case BytesType:
+ if(d->pictureValue.isValid()) {
+ data.append(d->pictureValue.render());
+ break;
+ }
+ case GuidType:
+ data.append(d->byteVectorValue);
+ break;
+ }
+
+ if(kind == 0) {
+ data = File::renderString(name, true) +
+ ByteVector::fromShort((int)d->type, false) +
+ ByteVector::fromShort(data.size(), false) +
+ data;
+ }
+ else {
+ ByteVector nameData = File::renderString(name);
+ data = ByteVector::fromShort(kind == 2 ? d->language : 0, false) +
+ ByteVector::fromShort(d->stream, false) +
+ ByteVector::fromShort(nameData.size(), false) +
+ ByteVector::fromShort((int)d->type, false) +
+ ByteVector::fromUInt(data.size(), false) +
+ nameData +
+ data;
+ }
+
+ return data;
+}
+
+int ASF::Attribute::language() const
+{
+ return d->language;
+}
+
+void ASF::Attribute::setLanguage(int value)
+{
+ d->language = value;
+}
+
+int ASF::Attribute::stream() const
+{
+ return d->stream;
+}
+
+void ASF::Attribute::setStream(int value)
+{
+ d->stream = value;
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/asf/asfattribute.h b/Frameworks/TagLib/taglib/taglib/asf/asfattribute.h
new file mode 100644
index 000000000..561869997
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/asf/asfattribute.h
@@ -0,0 +1,203 @@
+/**************************************************************************
+ copyright : (C) 2005-2007 by Lukáš Lalinský
+ email : lalinsky@gmail.com
+ **************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_ASFATTRIBUTE_H
+#define TAGLIB_ASFATTRIBUTE_H
+
+#include "tstring.h"
+#include "tbytevector.h"
+#include "taglib_export.h"
+#include "asfpicture.h"
+
+namespace TagLib
+{
+
+ namespace ASF
+ {
+
+ class File;
+ class Picture;
+
+ class TAGLIB_EXPORT Attribute
+ {
+ public:
+
+ /*!
+ * Enum of types an Attribute can have.
+ */
+ enum AttributeTypes {
+ UnicodeType = 0,
+ BytesType = 1,
+ BoolType = 2,
+ DWordType = 3,
+ QWordType = 4,
+ WordType = 5,
+ GuidType = 6
+ };
+
+ /*!
+ * Constructs an empty attribute.
+ */
+ Attribute();
+
+ /*!
+ * Constructs an attribute with \a key and a UnicodeType \a value.
+ */
+ Attribute(const String &value);
+
+ /*!
+ * Constructs an attribute with \a key and a BytesType \a value.
+ */
+ Attribute(const ByteVector &value);
+
+ /*!
+ * Constructs an attribute with \a key and a Picture \a value.
+ *
+ * This attribute is compatible with the ID3 frame, APIC. The ID3 specification for the APIC frame stipulates that,
+ * while there may be any number of APIC frames associated with a file,
+ * only one may be of type 1 and only one may be of type 2.
+ *
+ * The specification also states that the description of the picture can be no longer than 64 characters, but can be empty.
+ * WM/Picture attributes added with TagLib::ASF are not automatically validated to conform to ID3 specifications.
+ * You must add code in your application to perform validations if you want to maintain complete compatibility with ID3.
+ */
+ Attribute(const Picture &value);
+
+ /*!
+ * Constructs an attribute with \a key and a DWordType \a value.
+ */
+ Attribute(unsigned int value);
+
+ /*!
+ * Constructs an attribute with \a key and a QWordType \a value.
+ */
+ Attribute(unsigned long long value);
+
+ /*!
+ * Constructs an attribute with \a key and a WordType \a value.
+ */
+ Attribute(unsigned short value);
+
+ /*!
+ * Constructs an attribute with \a key and a BoolType \a value.
+ */
+ Attribute(bool value);
+
+ /*!
+ * Construct an attribute as a copy of \a other.
+ */
+ Attribute(const Attribute &item);
+
+ /*!
+ * Copies the contents of \a other into this item.
+ */
+ ASF::Attribute &operator=(const Attribute &other);
+
+ /*!
+ * Destroys the attribute.
+ */
+ virtual ~Attribute();
+
+ /*!
+ * Returns type of the value.
+ */
+ AttributeTypes type() const;
+
+ /*!
+ * Returns the BoolType \a value.
+ */
+ unsigned short toBool() const;
+
+ /*!
+ * Returns the WordType \a value.
+ */
+ unsigned short toUShort() const;
+
+ /*!
+ * Returns the DWordType \a value.
+ */
+ unsigned int toUInt() const;
+
+ /*!
+ * Returns the QWordType \a value.
+ */
+ unsigned long long toULongLong() const;
+
+ /*!
+ * Returns the UnicodeType \a value.
+ */
+ String toString() const;
+
+ /*!
+ * Returns the BytesType \a value.
+ */
+ ByteVector toByteVector() const;
+
+ /*!
+ * Returns the Picture \a value.
+ */
+ Picture toPicture() const;
+
+ /*!
+ * Returns the language number, or 0 is no stream number was set.
+ */
+ int language() const;
+
+ /*!
+ * Sets the language number.
+ */
+ void setLanguage(int value);
+
+ /*!
+ * Returns the stream number, or 0 is no stream number was set.
+ */
+ int stream() const;
+
+ /*!
+ * Sets the stream number.
+ */
+ void setStream(int value);
+
+#ifndef DO_NOT_DOCUMENT
+ /* THIS IS PRIVATE, DON'T TOUCH IT! */
+ String parse(ASF::File &file, int kind = 0);
+#endif
+
+ //! Returns the size of the stored data
+ int dataSize() const;
+
+ private:
+ friend class File;
+
+ ByteVector render(const String &name, int kind = 0) const;
+
+ class AttributePrivate;
+ AttributePrivate *d;
+ };
+ }
+
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/asf/asffile.cpp b/Frameworks/TagLib/taglib/taglib/asf/asffile.cpp
new file mode 100644
index 000000000..0a947472a
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/asf/asffile.cpp
@@ -0,0 +1,543 @@
+/**************************************************************************
+ copyright : (C) 2005-2007 by Lukáš Lalinský
+ email : lalinsky@gmail.com
+ **************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include
+#endif
+
+#ifdef WITH_ASF
+
+#include
+#include
+#include
+#include "asffile.h"
+#include "asftag.h"
+#include "asfproperties.h"
+
+using namespace TagLib;
+
+class ASF::File::FilePrivate
+{
+public:
+ FilePrivate():
+ size(0),
+ tag(0),
+ properties(0),
+ contentDescriptionObject(0),
+ extendedContentDescriptionObject(0),
+ headerExtensionObject(0),
+ metadataObject(0),
+ metadataLibraryObject(0) {}
+ unsigned long long size;
+ ASF::Tag *tag;
+ ASF::Properties *properties;
+ List objects;
+ ASF::File::ContentDescriptionObject *contentDescriptionObject;
+ ASF::File::ExtendedContentDescriptionObject *extendedContentDescriptionObject;
+ ASF::File::HeaderExtensionObject *headerExtensionObject;
+ ASF::File::MetadataObject *metadataObject;
+ ASF::File::MetadataLibraryObject *metadataLibraryObject;
+};
+
+static ByteVector headerGuid("\x30\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C", 16);
+static ByteVector filePropertiesGuid("\xA1\xDC\xAB\x8C\x47\xA9\xCF\x11\x8E\xE4\x00\xC0\x0C\x20\x53\x65", 16);
+static ByteVector streamPropertiesGuid("\x91\x07\xDC\xB7\xB7\xA9\xCF\x11\x8E\xE6\x00\xC0\x0C\x20\x53\x65", 16);
+static ByteVector contentDescriptionGuid("\x33\x26\xB2\x75\x8E\x66\xCF\x11\xA6\xD9\x00\xAA\x00\x62\xCE\x6C", 16);
+static ByteVector extendedContentDescriptionGuid("\x40\xA4\xD0\xD2\x07\xE3\xD2\x11\x97\xF0\x00\xA0\xC9\x5E\xA8\x50", 16);
+static ByteVector headerExtensionGuid("\xb5\x03\xbf_.\xa9\xcf\x11\x8e\xe3\x00\xc0\x0c Se", 16);
+static ByteVector metadataGuid("\xEA\xCB\xF8\xC5\xAF[wH\204g\xAA\214D\xFAL\xCA", 16);
+static ByteVector metadataLibraryGuid("\224\034#D\230\224\321I\241A\x1d\x13NEpT", 16);
+
+class ASF::File::BaseObject
+{
+public:
+ ByteVector data;
+ virtual ~BaseObject() {}
+ virtual ByteVector guid() = 0;
+ virtual void parse(ASF::File *file, unsigned int size);
+ virtual ByteVector render(ASF::File *file);
+};
+
+class ASF::File::UnknownObject : public ASF::File::BaseObject
+{
+ ByteVector myGuid;
+public:
+ UnknownObject(const ByteVector &guid);
+ ByteVector guid();
+};
+
+class ASF::File::FilePropertiesObject : public ASF::File::BaseObject
+{
+public:
+ ByteVector guid();
+ void parse(ASF::File *file, uint size);
+};
+
+class ASF::File::StreamPropertiesObject : public ASF::File::BaseObject
+{
+public:
+ ByteVector guid();
+ void parse(ASF::File *file, uint size);
+};
+
+class ASF::File::ContentDescriptionObject : public ASF::File::BaseObject
+{
+public:
+ ByteVector guid();
+ void parse(ASF::File *file, uint size);
+ ByteVector render(ASF::File *file);
+};
+
+class ASF::File::ExtendedContentDescriptionObject : public ASF::File::BaseObject
+{
+public:
+ ByteVectorList attributeData;
+ ByteVector guid();
+ void parse(ASF::File *file, uint size);
+ ByteVector render(ASF::File *file);
+};
+
+class ASF::File::MetadataObject : public ASF::File::BaseObject
+{
+public:
+ ByteVectorList attributeData;
+ ByteVector guid();
+ void parse(ASF::File *file, uint size);
+ ByteVector render(ASF::File *file);
+};
+
+class ASF::File::MetadataLibraryObject : public ASF::File::BaseObject
+{
+public:
+ ByteVectorList attributeData;
+ ByteVector guid();
+ void parse(ASF::File *file, uint size);
+ ByteVector render(ASF::File *file);
+};
+
+class ASF::File::HeaderExtensionObject : public ASF::File::BaseObject
+{
+public:
+ List objects;
+ ByteVector guid();
+ void parse(ASF::File *file, uint size);
+ ByteVector render(ASF::File *file);
+};
+
+void ASF::File::BaseObject::parse(ASF::File *file, unsigned int size)
+{
+ data.clear();
+ if (size > 24 && size <= (unsigned int)(file->length()))
+ data = file->readBlock(size - 24);
+ else
+ data = ByteVector::null;
+}
+
+ByteVector ASF::File::BaseObject::render(ASF::File * /*file*/)
+{
+ return guid() + ByteVector::fromLongLong(data.size() + 24, false) + data;
+}
+
+ASF::File::UnknownObject::UnknownObject(const ByteVector &guid) : myGuid(guid)
+{
+}
+
+ByteVector ASF::File::UnknownObject::guid()
+{
+ return myGuid;
+}
+
+ByteVector ASF::File::FilePropertiesObject::guid()
+{
+ return filePropertiesGuid;
+}
+
+void ASF::File::FilePropertiesObject::parse(ASF::File *file, uint size)
+{
+ BaseObject::parse(file, size);
+ file->d->properties->setLength((int)(data.mid(40, 8).toLongLong(false) / 10000000L - data.mid(56, 8).toLongLong(false) / 1000L));
+}
+
+ByteVector ASF::File::StreamPropertiesObject::guid()
+{
+ return streamPropertiesGuid;
+}
+
+void ASF::File::StreamPropertiesObject::parse(ASF::File *file, uint size)
+{
+ BaseObject::parse(file, size);
+ file->d->properties->setChannels(data.mid(56, 2).toShort(false));
+ file->d->properties->setSampleRate(data.mid(58, 4).toUInt(false));
+ file->d->properties->setBitrate(data.mid(62, 4).toUInt(false) * 8 / 1000);
+}
+
+ByteVector ASF::File::ContentDescriptionObject::guid()
+{
+ return contentDescriptionGuid;
+}
+
+void ASF::File::ContentDescriptionObject::parse(ASF::File *file, uint /*size*/)
+{
+ file->d->contentDescriptionObject = this;
+ int titleLength = file->readWORD();
+ int artistLength = file->readWORD();
+ int copyrightLength = file->readWORD();
+ int commentLength = file->readWORD();
+ int ratingLength = file->readWORD();
+ file->d->tag->setTitle(file->readString(titleLength));
+ file->d->tag->setArtist(file->readString(artistLength));
+ file->d->tag->setCopyright(file->readString(copyrightLength));
+ file->d->tag->setComment(file->readString(commentLength));
+ file->d->tag->setRating(file->readString(ratingLength));
+}
+
+ByteVector ASF::File::ContentDescriptionObject::render(ASF::File *file)
+{
+ ByteVector v1 = file->renderString(file->d->tag->title());
+ ByteVector v2 = file->renderString(file->d->tag->artist());
+ ByteVector v3 = file->renderString(file->d->tag->copyright());
+ ByteVector v4 = file->renderString(file->d->tag->comment());
+ ByteVector v5 = file->renderString(file->d->tag->rating());
+ data.clear();
+ data.append(ByteVector::fromShort(v1.size(), false));
+ data.append(ByteVector::fromShort(v2.size(), false));
+ data.append(ByteVector::fromShort(v3.size(), false));
+ data.append(ByteVector::fromShort(v4.size(), false));
+ data.append(ByteVector::fromShort(v5.size(), false));
+ data.append(v1);
+ data.append(v2);
+ data.append(v3);
+ data.append(v4);
+ data.append(v5);
+ return BaseObject::render(file);
+}
+
+ByteVector ASF::File::ExtendedContentDescriptionObject::guid()
+{
+ return extendedContentDescriptionGuid;
+}
+
+void ASF::File::ExtendedContentDescriptionObject::parse(ASF::File *file, uint /*size*/)
+{
+ file->d->extendedContentDescriptionObject = this;
+ int count = file->readWORD();
+ while(count--) {
+ ASF::Attribute attribute;
+ String name = attribute.parse(*file);
+ file->d->tag->addAttribute(name, attribute);
+ }
+}
+
+ByteVector ASF::File::ExtendedContentDescriptionObject::render(ASF::File *file)
+{
+ data.clear();
+ data.append(ByteVector::fromShort(attributeData.size(), false));
+ data.append(attributeData.toByteVector(ByteVector::null));
+ return BaseObject::render(file);
+}
+
+ByteVector ASF::File::MetadataObject::guid()
+{
+ return metadataGuid;
+}
+
+void ASF::File::MetadataObject::parse(ASF::File *file, uint /*size*/)
+{
+ file->d->metadataObject = this;
+ int count = file->readWORD();
+ while(count--) {
+ ASF::Attribute attribute;
+ String name = attribute.parse(*file, 1);
+ file->d->tag->addAttribute(name, attribute);
+ }
+}
+
+ByteVector ASF::File::MetadataObject::render(ASF::File *file)
+{
+ data.clear();
+ data.append(ByteVector::fromShort(attributeData.size(), false));
+ data.append(attributeData.toByteVector(ByteVector::null));
+ return BaseObject::render(file);
+}
+
+ByteVector ASF::File::MetadataLibraryObject::guid()
+{
+ return metadataLibraryGuid;
+}
+
+void ASF::File::MetadataLibraryObject::parse(ASF::File *file, uint /*size*/)
+{
+ file->d->metadataLibraryObject = this;
+ int count = file->readWORD();
+ while(count--) {
+ ASF::Attribute attribute;
+ String name = attribute.parse(*file, 2);
+ file->d->tag->addAttribute(name, attribute);
+ }
+}
+
+ByteVector ASF::File::MetadataLibraryObject::render(ASF::File *file)
+{
+ data.clear();
+ data.append(ByteVector::fromShort(attributeData.size(), false));
+ data.append(attributeData.toByteVector(ByteVector::null));
+ return BaseObject::render(file);
+}
+
+ByteVector ASF::File::HeaderExtensionObject::guid()
+{
+ return headerExtensionGuid;
+}
+
+void ASF::File::HeaderExtensionObject::parse(ASF::File *file, uint /*size*/)
+{
+ file->d->headerExtensionObject = this;
+ file->seek(18, File::Current);
+ long long dataSize = file->readDWORD();
+ long long dataPos = 0;
+ while(dataPos < dataSize) {
+ ByteVector guid = file->readBlock(16);
+ long long size = file->readQWORD();
+ BaseObject *obj;
+ if(guid == metadataGuid) {
+ obj = new MetadataObject();
+ }
+ else if(guid == metadataLibraryGuid) {
+ obj = new MetadataLibraryObject();
+ }
+ else {
+ obj = new UnknownObject(guid);
+ }
+ obj->parse(file, size);
+ objects.append(obj);
+ dataPos += size;
+ }
+}
+
+ByteVector ASF::File::HeaderExtensionObject::render(ASF::File *file)
+{
+ data.clear();
+ for(unsigned int i = 0; i < objects.size(); i++) {
+ data.append(objects[i]->render(file));
+ }
+ data = ByteVector("\x11\xD2\xD3\xAB\xBA\xA9\xcf\x11\x8E\xE6\x00\xC0\x0C\x20\x53\x65\x06\x00", 18) + ByteVector::fromUInt(data.size(), false) + data;
+ return BaseObject::render(file);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+ASF::File::File(FileName file, bool readProperties, Properties::ReadStyle propertiesStyle)
+ : TagLib::File(file)
+{
+ d = new FilePrivate;
+ read(readProperties, propertiesStyle);
+}
+
+ASF::File::~File()
+{
+ for(unsigned int i = 0; i < d->objects.size(); i++) {
+ delete d->objects[i];
+ }
+ if(d->tag) {
+ delete d->tag;
+ }
+ if(d->properties) {
+ delete d->properties;
+ }
+ delete d;
+}
+
+ASF::Tag *ASF::File::tag() const
+{
+ return d->tag;
+}
+
+ASF::Properties *ASF::File::audioProperties() const
+{
+ return d->properties;
+}
+
+void ASF::File::read(bool /*readProperties*/, Properties::ReadStyle /*propertiesStyle*/)
+{
+ if(!isValid())
+ return;
+
+ ByteVector guid = readBlock(16);
+ if(guid != headerGuid) {
+ debug("ASF: Not an ASF file.");
+ return;
+ }
+
+ d->tag = new ASF::Tag();
+ d->properties = new ASF::Properties();
+
+ d->size = readQWORD();
+ int numObjects = readDWORD();
+ seek(2, Current);
+
+ for(int i = 0; i < numObjects; i++) {
+ ByteVector guid = readBlock(16);
+ long size = (long)readQWORD();
+ BaseObject *obj;
+ if(guid == filePropertiesGuid) {
+ obj = new FilePropertiesObject();
+ }
+ else if(guid == streamPropertiesGuid) {
+ obj = new StreamPropertiesObject();
+ }
+ else if(guid == contentDescriptionGuid) {
+ obj = new ContentDescriptionObject();
+ }
+ else if(guid == extendedContentDescriptionGuid) {
+ obj = new ExtendedContentDescriptionObject();
+ }
+ else if(guid == headerExtensionGuid) {
+ obj = new HeaderExtensionObject();
+ }
+ else {
+ obj = new UnknownObject(guid);
+ }
+ obj->parse(this, size);
+ d->objects.append(obj);
+ }
+}
+
+bool ASF::File::save()
+{
+ if(readOnly()) {
+ debug("ASF: File is read-only.");
+ return false;
+ }
+
+ if(!d->contentDescriptionObject) {
+ d->contentDescriptionObject = new ContentDescriptionObject();
+ d->objects.append(d->contentDescriptionObject);
+ }
+ if(!d->extendedContentDescriptionObject) {
+ d->extendedContentDescriptionObject = new ExtendedContentDescriptionObject();
+ d->objects.append(d->extendedContentDescriptionObject);
+ }
+ if(!d->headerExtensionObject) {
+ d->headerExtensionObject = new HeaderExtensionObject();
+ d->objects.append(d->headerExtensionObject);
+ }
+ if(!d->metadataObject) {
+ d->metadataObject = new MetadataObject();
+ d->headerExtensionObject->objects.append(d->metadataObject);
+ }
+ if(!d->metadataLibraryObject) {
+ d->metadataLibraryObject = new MetadataLibraryObject();
+ d->headerExtensionObject->objects.append(d->metadataLibraryObject);
+ }
+
+ ASF::AttributeListMap::ConstIterator it = d->tag->attributeListMap().begin();
+ for(; it != d->tag->attributeListMap().end(); it++) {
+ const String &name = it->first;
+ const AttributeList &attributes = it->second;
+ bool inExtendedContentDescriptionObject = false;
+ bool inMetadataObject = false;
+ for(unsigned int j = 0; j < attributes.size(); j++) {
+ const Attribute &attribute = attributes[j];
+ bool largeValue = attribute.dataSize() > 65535;
+ if(!inExtendedContentDescriptionObject && !largeValue && attribute.language() == 0 && attribute.stream() == 0) {
+ d->extendedContentDescriptionObject->attributeData.append(attribute.render(name));
+ inExtendedContentDescriptionObject = true;
+ }
+ else if(!inMetadataObject && !largeValue && attribute.language() == 0 && attribute.stream() != 0) {
+ d->metadataObject->attributeData.append(attribute.render(name, 1));
+ inMetadataObject = true;
+ }
+ else {
+ d->metadataLibraryObject->attributeData.append(attribute.render(name, 2));
+ }
+ }
+ }
+
+ ByteVector data;
+ for(unsigned int i = 0; i < d->objects.size(); i++) {
+ data.append(d->objects[i]->render(this));
+ }
+ data = headerGuid + ByteVector::fromLongLong(data.size() + 30, false) + ByteVector::fromUInt(d->objects.size(), false) + ByteVector("\x01\x02", 2) + data;
+ insert(data, 0, d->size);
+
+ return true;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// protected members
+////////////////////////////////////////////////////////////////////////////////
+
+int ASF::File::readBYTE()
+{
+ ByteVector v = readBlock(1);
+ return v[0];
+}
+
+int ASF::File::readWORD()
+{
+ ByteVector v = readBlock(2);
+ return v.toUShort(false);
+}
+
+unsigned int ASF::File::readDWORD()
+{
+ ByteVector v = readBlock(4);
+ return v.toUInt(false);
+}
+
+long long ASF::File::readQWORD()
+{
+ ByteVector v = readBlock(8);
+ return v.toLongLong(false);
+}
+
+String ASF::File::readString(int length)
+{
+ ByteVector data = readBlock(length);
+ unsigned int size = data.size();
+ while (size >= 2) {
+ if(data[size - 1] != '\0' || data[size - 2] != '\0') {
+ break;
+ }
+ size -= 2;
+ }
+ if(size != data.size()) {
+ data.resize(size);
+ }
+ return String(data, String::UTF16LE);
+}
+
+ByteVector ASF::File::renderString(const String &str, bool includeLength)
+{
+ ByteVector data = str.data(String::UTF16LE) + ByteVector::fromShort(0, false);
+ if(includeLength) {
+ data = ByteVector::fromShort(data.size(), false) + data;
+ }
+ return data;
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/asf/asffile.h b/Frameworks/TagLib/taglib/taglib/asf/asffile.h
new file mode 100644
index 000000000..9242aa68d
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/asf/asffile.h
@@ -0,0 +1,120 @@
+/**************************************************************************
+ copyright : (C) 2005-2007 by Lukáš Lalinský
+ email : lalinsky@gmail.com
+ **************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_ASFFILE_H
+#define TAGLIB_ASFFILE_H
+
+#include "tag.h"
+#include "tfile.h"
+#include "taglib_export.h"
+#include "asfproperties.h"
+#include "asftag.h"
+
+namespace TagLib {
+
+ //! An implementation of ASF (WMA) metadata
+ namespace ASF {
+
+ /*!
+ * This implements and provides an interface for ASF files to the
+ * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
+ * the abstract TagLib::File API as well as providing some additional
+ * information specific to ASF files.
+ */
+ class TAGLIB_EXPORT File : public TagLib::File
+ {
+ public:
+
+ /*!
+ * Contructs an ASF file from \a file. If \a readProperties is true the
+ * file's audio properties will also be read using \a propertiesStyle. If
+ * false, \a propertiesStyle is ignored.
+ *
+ * \note In the current implementation, both \a readProperties and
+ * \a propertiesStyle are ignored.
+ */
+ File(FileName file, bool readProperties = true, Properties::ReadStyle propertiesStyle = Properties::Average);
+
+ /*!
+ * Destroys this instance of the File.
+ */
+ virtual ~File();
+
+ /*!
+ * Returns a pointer to the ASF tag of the file.
+ *
+ * ASF::Tag implements the tag interface, so this serves as the
+ * reimplementation of TagLib::File::tag().
+ *
+ * \note The Tag is still owned by the ASF::File and should not be
+ * deleted by the user. It will be deleted when the file (object) is
+ * destroyed.
+ */
+ virtual Tag *tag() const;
+
+ /*!
+ * Returns the ASF audio properties for this file.
+ */
+ virtual Properties *audioProperties() const;
+
+ /*!
+ * Save the file.
+ *
+ * This returns true if the save was successful.
+ */
+ virtual bool save();
+
+ private:
+
+ int readBYTE();
+ int readWORD();
+ unsigned int readDWORD();
+ long long readQWORD();
+ static ByteVector renderString(const String &str, bool includeLength = false);
+ String readString(int len);
+ void read(bool readProperties, Properties::ReadStyle propertiesStyle);
+
+ friend class Attribute;
+ friend class Picture;
+
+ class BaseObject;
+ class UnknownObject;
+ class FilePropertiesObject;
+ class StreamPropertiesObject;
+ class ContentDescriptionObject;
+ class ExtendedContentDescriptionObject;
+ class HeaderExtensionObject;
+ class MetadataObject;
+ class MetadataLibraryObject;
+
+ class FilePrivate;
+ FilePrivate *d;
+ };
+
+ }
+
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/asf/asfproperties.cpp b/Frameworks/TagLib/taglib/taglib/asf/asfproperties.cpp
new file mode 100644
index 000000000..02d2d942a
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/asf/asfproperties.cpp
@@ -0,0 +1,107 @@
+/**************************************************************************
+ copyright : (C) 2005-2007 by Lukáš Lalinský
+ email : lalinsky@gmail.com
+ **************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include
+#endif
+
+#ifdef WITH_ASF
+
+#include
+#include
+#include "asfproperties.h"
+
+using namespace TagLib;
+
+class ASF::Properties::PropertiesPrivate
+{
+public:
+ PropertiesPrivate(): length(0), bitrate(0), sampleRate(0), channels(0) {}
+ int length;
+ int bitrate;
+ int sampleRate;
+ int channels;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+ASF::Properties::Properties() : AudioProperties(AudioProperties::Average)
+{
+ d = new PropertiesPrivate;
+}
+
+ASF::Properties::~Properties()
+{
+ if(d)
+ delete d;
+}
+
+int ASF::Properties::length() const
+{
+ return d->length;
+}
+
+int ASF::Properties::bitrate() const
+{
+ return d->bitrate;
+}
+
+int ASF::Properties::sampleRate() const
+{
+ return d->sampleRate;
+}
+
+int ASF::Properties::channels() const
+{
+ return d->channels;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+void ASF::Properties::setLength(int length)
+{
+ d->length = length;
+}
+
+void ASF::Properties::setBitrate(int length)
+{
+ d->bitrate = length;
+}
+
+void ASF::Properties::setSampleRate(int length)
+{
+ d->sampleRate = length;
+}
+
+void ASF::Properties::setChannels(int length)
+{
+ d->channels = length;
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/asf/asfproperties.h b/Frameworks/TagLib/taglib/taglib/asf/asfproperties.h
new file mode 100644
index 000000000..290eac772
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/asf/asfproperties.h
@@ -0,0 +1,74 @@
+/**************************************************************************
+ copyright : (C) 2005-2007 by Lukáš Lalinský
+ email : lalinsky@gmail.com
+ **************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_ASFPROPERTIES_H
+#define TAGLIB_ASFPROPERTIES_H
+
+#include "audioproperties.h"
+#include "tstring.h"
+#include "taglib_export.h"
+
+namespace TagLib {
+
+ namespace ASF {
+
+ //! An implementation of ASF audio properties
+ class TAGLIB_EXPORT Properties : public AudioProperties
+ {
+ public:
+
+ /*!
+ * Create an instance of ASF::Properties.
+ */
+ Properties();
+
+ /*!
+ * Destroys this ASF::Properties instance.
+ */
+ virtual ~Properties();
+
+ // Reimplementations.
+ virtual int length() const;
+ virtual int bitrate() const;
+ virtual int sampleRate() const;
+ virtual int channels() const;
+
+#ifndef DO_NOT_DOCUMENT
+ void setLength(int value);
+ void setBitrate(int value);
+ void setSampleRate(int value);
+ void setChannels(int value);
+#endif
+
+ private:
+ class PropertiesPrivate;
+ PropertiesPrivate *d;
+ };
+
+ }
+
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/asf/asftag.cpp b/Frameworks/TagLib/taglib/taglib/asf/asftag.cpp
new file mode 100644
index 000000000..6c6e96794
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/asf/asftag.cpp
@@ -0,0 +1,245 @@
+/**************************************************************************
+ copyright : (C) 2005-2007 by Lukáš Lalinský
+ email : lalinsky@gmail.com
+ **************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include
+#endif
+
+#ifdef WITH_ASF
+
+#include "asftag.h"
+
+using namespace TagLib;
+
+class ASF::Tag::TagPrivate
+{
+public:
+ String title;
+ String artist;
+ String copyright;
+ String comment;
+ String rating;
+ AttributeListMap attributeListMap;
+};
+
+ASF::Tag::Tag()
+: TagLib::Tag()
+{
+ d = new TagPrivate;
+}
+
+ASF::Tag::~Tag()
+{
+ if(d)
+ delete d;
+}
+
+String ASF::Tag::title() const
+{
+ return d->title;
+}
+
+String ASF::Tag::artist() const
+{
+ return d->artist;
+}
+
+String ASF::Tag::album() const
+{
+ if(d->attributeListMap.contains("WM/AlbumTitle"))
+ return d->attributeListMap["WM/AlbumTitle"][0].toString();
+ return String::null;
+}
+
+String ASF::Tag::copyright() const
+{
+ return d->copyright;
+}
+
+String ASF::Tag::comment() const
+{
+ return d->comment;
+}
+
+String ASF::Tag::rating() const
+{
+ return d->rating;
+}
+
+unsigned int ASF::Tag::year() const
+{
+ if(d->attributeListMap.contains("WM/Year"))
+ return d->attributeListMap["WM/Year"][0].toString().toInt();
+ return 0;
+}
+
+unsigned int ASF::Tag::track() const
+{
+ if(d->attributeListMap.contains("WM/TrackNumber")) {
+ const ASF::Attribute attr = d->attributeListMap["WM/TrackNumber"][0];
+ if(attr.type() == ASF::Attribute::DWordType)
+ return attr.toUInt();
+ else
+ return attr.toString().toInt();
+ }
+ if(d->attributeListMap.contains("WM/Track"))
+ return d->attributeListMap["WM/Track"][0].toUInt();
+ return 0;
+}
+
+String ASF::Tag::genre() const
+{
+ if(d->attributeListMap.contains("WM/Genre"))
+ return d->attributeListMap["WM/Genre"][0].toString();
+ return String::null;
+}
+
+float
+ASF::Tag::rgAlbumGain() const
+{
+ return 0;
+}
+
+float
+ASF::Tag::rgAlbumPeak() const
+{
+ return 0;
+}
+
+float
+ASF::Tag::rgTrackGain() const
+{
+ return 0;
+}
+
+float
+ASF::Tag::rgTrackPeak() const
+{
+ return 0;
+}
+
+void ASF::Tag::setTitle(const String &value)
+{
+ d->title = value;
+}
+
+void ASF::Tag::setArtist(const String &value)
+{
+ d->artist = value;
+}
+
+void ASF::Tag::setCopyright(const String &value)
+{
+ d->copyright = value;
+}
+
+void ASF::Tag::setComment(const String &value)
+{
+ d->comment = value;
+}
+
+void ASF::Tag::setRating(const String &value)
+{
+ d->rating = value;
+}
+
+void ASF::Tag::setAlbum(const String &value)
+{
+ setAttribute("WM/AlbumTitle", value);
+}
+
+void ASF::Tag::setGenre(const String &value)
+{
+ setAttribute("WM/Genre", value);
+}
+
+void ASF::Tag::setYear(uint value)
+{
+ setAttribute("WM/Year", String::number(value));
+}
+
+void ASF::Tag::setTrack(uint value)
+{
+ setAttribute("WM/TrackNumber", String::number(value));
+}
+
+void
+ASF::Tag::setRGAlbumGain(float)
+{
+}
+
+void
+ASF::Tag::setRGAlbumPeak(float)
+{
+}
+
+void
+ASF::Tag::setRGTrackGain(float)
+{
+}
+
+void
+ASF::Tag::setRGTrackPeak(float)
+{
+}
+
+ASF::AttributeListMap& ASF::Tag::attributeListMap()
+{
+ return d->attributeListMap;
+}
+
+void ASF::Tag::removeItem(const String &key)
+{
+ AttributeListMap::Iterator it = d->attributeListMap.find(key);
+ if(it != d->attributeListMap.end())
+ d->attributeListMap.erase(it);
+}
+
+void ASF::Tag::setAttribute(const String &name, const Attribute &attribute)
+{
+ AttributeList value;
+ value.append(attribute);
+ d->attributeListMap.insert(name, value);
+}
+
+void ASF::Tag::addAttribute(const String &name, const Attribute &attribute)
+{
+ if(d->attributeListMap.contains(name)) {
+ d->attributeListMap[name].append(attribute);
+ }
+ else {
+ setAttribute(name, attribute);
+ }
+}
+
+bool ASF::Tag::isEmpty() const
+{
+ return TagLib::Tag::isEmpty() &&
+ copyright().isEmpty() &&
+ rating().isEmpty() &&
+ d->attributeListMap.isEmpty();
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/asf/asftag.h b/Frameworks/TagLib/taglib/taglib/asf/asftag.h
new file mode 100644
index 000000000..69820cbcc
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/asf/asftag.h
@@ -0,0 +1,196 @@
+/**************************************************************************
+ copyright : (C) 2005-2007 by Lukáš Lalinský
+ email : lalinsky@gmail.com
+ **************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_ASFTAG_H
+#define TAGLIB_ASFTAG_H
+
+#include "tag.h"
+#include "tlist.h"
+#include "tmap.h"
+#include "taglib_export.h"
+#include "asfattribute.h"
+
+namespace TagLib {
+
+ namespace ASF {
+
+ typedef List AttributeList;
+ typedef Map AttributeListMap;
+
+ class TAGLIB_EXPORT Tag : public TagLib::Tag {
+
+ friend class File;
+
+ public:
+
+ Tag();
+
+ virtual ~Tag();
+
+ /*!
+ * Returns the track name.
+ */
+ virtual String title() const;
+
+ /*!
+ * Returns the artist name.
+ */
+ virtual String artist() const;
+
+ /*!
+ * Returns the album name; if no album name is present in the tag
+ * String::null will be returned.
+ */
+ virtual String album() const;
+
+ /*!
+ * Returns the track comment.
+ */
+ virtual String comment() const;
+
+ /*!
+ * Returns the genre name; if no genre is present in the tag String::null
+ * will be returned.
+ */
+ virtual String genre() const;
+
+ /*!
+ * Returns the rating.
+ */
+ virtual String rating() const;
+
+ /*!
+ * Returns the genre name; if no genre is present in the tag String::null
+ * will be returned.
+ */
+ virtual String copyright() const;
+
+ /*!
+ * Returns the year; if there is no year set, this will return 0.
+ */
+ virtual uint year() const;
+
+ /*!
+ * Returns the track number; if there is no track number set, this will
+ * return 0.
+ */
+ virtual uint track() const;
+
+ virtual float rgAlbumGain() const;
+ virtual float rgAlbumPeak() const;
+ virtual float rgTrackGain() const;
+ virtual float rgTrackPeak() const;
+
+ /*!
+ * Sets the title to \a s.
+ */
+ virtual void setTitle(const String &s);
+
+ /*!
+ * Sets the artist to \a s.
+ */
+ virtual void setArtist(const String &s);
+
+ /*!
+ * Sets the album to \a s. If \a s is String::null then this value will be
+ * cleared.
+ */
+ virtual void setAlbum(const String &s);
+
+ /*!
+ * Sets the comment to \a s.
+ */
+ virtual void setComment(const String &s);
+
+ /*!
+ * Sets the rating to \a s.
+ */
+ virtual void setRating(const String &s);
+
+ /*!
+ * Sets the copyright to \a s.
+ */
+ virtual void setCopyright(const String &s);
+
+ /*!
+ * Sets the genre to \a s.
+ */
+ virtual void setGenre(const String &s);
+
+ /*!
+ * Sets the year to \a i. If \a s is 0 then this value will be cleared.
+ */
+ virtual void setYear(uint i);
+
+ /*!
+ * Sets the track to \a i. If \a s is 0 then this value will be cleared.
+ */
+ virtual void setTrack(uint i);
+
+ virtual void setRGAlbumGain(float f);
+ virtual void setRGAlbumPeak(float f);
+ virtual void setRGTrackGain(float f);
+ virtual void setRGTrackPeak(float f);
+
+ /*!
+ * Returns true if the tag does not contain any data. This should be
+ * reimplemented in subclasses that provide more than the basic tagging
+ * abilities in this class.
+ */
+ virtual bool isEmpty() const;
+
+ /*!
+ * Returns a reference to the item list map. This is an AttributeListMap of
+ * all of the items in the tag.
+ *
+ * This is the most powerfull structure for accessing the items of the tag.
+ */
+ AttributeListMap &attributeListMap();
+
+ /*!
+ * Removes the \a key attribute from the tag
+ */
+ void removeItem(const String &name);
+
+ /*!
+ * Sets the \a key attribute to the value of \a attribute. If an attribute
+ * with the \a key is already present, it will be replaced.
+ */
+ void setAttribute(const String &name, const Attribute &attribute);
+
+ /*!
+ * Sets the \a key attribute to the value of \a attribute. If an attribute
+ * with the \a key is already present, it will be added to the list.
+ */
+ void addAttribute(const String &name, const Attribute &attribute);
+
+ private:
+
+ class TagPrivate;
+ TagPrivate *d;
+ };
+ }
+}
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/audioproperties.cpp b/Frameworks/TagLib/taglib/taglib/audioproperties.cpp
new file mode 100644
index 000000000..298b97da1
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/audioproperties.cpp
@@ -0,0 +1,51 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include "audioproperties.h"
+
+using namespace TagLib;
+
+class AudioProperties::AudioPropertiesPrivate
+{
+
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public methods
+////////////////////////////////////////////////////////////////////////////////
+
+AudioProperties::~AudioProperties()
+{
+
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// protected methods
+////////////////////////////////////////////////////////////////////////////////
+
+AudioProperties::AudioProperties(ReadStyle)
+{
+
+}
diff --git a/Frameworks/TagLib/taglib/taglib/audioproperties.h b/Frameworks/TagLib/taglib/taglib/audioproperties.h
new file mode 100644
index 000000000..e9844fa0c
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/audioproperties.h
@@ -0,0 +1,110 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_AUDIOPROPERTIES_H
+#define TAGLIB_AUDIOPROPERTIES_H
+
+#include "taglib_export.h"
+
+namespace TagLib {
+
+ //! A simple, abstract interface to common audio properties
+
+ /*!
+ * The values here are common to most audio formats. For more specific, codec
+ * dependant values, please see see the subclasses APIs. This is meant to
+ * compliment the TagLib::File and TagLib::Tag APIs in providing a simple
+ * interface that is sufficient for most applications.
+ */
+
+ class TAGLIB_EXPORT AudioProperties
+ {
+ public:
+
+ /*!
+ * Reading audio properties from a file can sometimes be very time consuming
+ * and for the most accurate results can often involve reading the entire
+ * file. Because in many situations speed is critical or the accuracy of the
+ * values is not particularly important this allows the level of desired
+ * accuracy to be set.
+ */
+ enum ReadStyle {
+ //! Read as little of the file as possible
+ Fast,
+ //! Read more of the file and make better values guesses
+ Average,
+ //! Read as much of the file as needed to report accurate values
+ Accurate
+ };
+
+ /*!
+ * Destroys this AudioProperties instance.
+ */
+ virtual ~AudioProperties();
+
+ /*!
+ * Returns the length of the file in seconds.
+ */
+ virtual int length() const = 0;
+
+ /*!
+ * Returns the most appropriate bit rate for the file in kb/s. For constant
+ * bitrate formats this is simply the bitrate of the file. For variable
+ * bitrate formats this is either the average or nominal bitrate.
+ */
+ virtual int bitrate() const = 0;
+
+ /*!
+ * Returns the sample rate in Hz.
+ */
+ virtual int sampleRate() const = 0;
+
+ /*!
+ * Returns the number of audio channels.
+ */
+ virtual int channels() const = 0;
+
+ protected:
+
+ /*!
+ * Construct an audio properties instance. This is protected as this class
+ * should not be instantiated directly, but should be instantiated via its
+ * subclasses and can be fetched from the FileRef or File APIs.
+ *
+ * \see ReadStyle
+ */
+ AudioProperties(ReadStyle style);
+
+ private:
+ AudioProperties(const AudioProperties &);
+ AudioProperties &operator=(const AudioProperties &);
+
+ class AudioPropertiesPrivate;
+ AudioPropertiesPrivate *d;
+ };
+
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/fileref.cpp b/Frameworks/TagLib/taglib/taglib/fileref.cpp
new file mode 100644
index 000000000..11e5a331c
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/fileref.cpp
@@ -0,0 +1,282 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+
+ copyright : (C) 2010 by Alex Novichkov
+ email : novichko@atnet.ru
+ (added APE file support)
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifdef HAVE_CONFIG_H
+#include
+#endif
+
+#include
+#include
+#include
+
+#include "fileref.h"
+#include "asffile.h"
+#include "mpegfile.h"
+#include "vorbisfile.h"
+#include "flacfile.h"
+#include "oggflacfile.h"
+#include "mpcfile.h"
+#include "mp4file.h"
+#include "wavpackfile.h"
+#include "speexfile.h"
+#include "opusfile.h"
+#include "trueaudiofile.h"
+#include "aifffile.h"
+#include "wavfile.h"
+#include "apefile.h"
+
+using namespace TagLib;
+
+class FileRef::FileRefPrivate : public RefCounter
+{
+public:
+ FileRefPrivate(File *f) : RefCounter(), file(f) {}
+ ~FileRefPrivate() {
+ delete file;
+ }
+
+ File *file;
+ static List fileTypeResolvers;
+};
+
+List FileRef::FileRefPrivate::fileTypeResolvers;
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+FileRef::FileRef()
+{
+ d = new FileRefPrivate(0);
+}
+
+FileRef::FileRef(FileName fileName, bool readAudioProperties,
+ AudioProperties::ReadStyle audioPropertiesStyle)
+{
+ d = new FileRefPrivate(create(fileName, readAudioProperties, audioPropertiesStyle));
+}
+
+FileRef::FileRef(File *file)
+{
+ d = new FileRefPrivate(file);
+}
+
+FileRef::FileRef(const FileRef &ref) : d(ref.d)
+{
+ d->ref();
+}
+
+FileRef::~FileRef()
+{
+ if(d->deref())
+ delete d;
+}
+
+Tag *FileRef::tag() const
+{
+ if(isNull()) {
+ debug("FileRef::tag() - Called without a valid file.");
+ return 0;
+ }
+ return d->file->tag();
+}
+
+AudioProperties *FileRef::audioProperties() const
+{
+ if(isNull()) {
+ debug("FileRef::audioProperties() - Called without a valid file.");
+ return 0;
+ }
+ return d->file->audioProperties();
+}
+
+File *FileRef::file() const
+{
+ return d->file;
+}
+
+bool FileRef::save()
+{
+ if(isNull()) {
+ debug("FileRef::save() - Called without a valid file.");
+ return false;
+ }
+ return d->file->save();
+}
+
+const FileRef::FileTypeResolver *FileRef::addFileTypeResolver(const FileRef::FileTypeResolver *resolver) // static
+{
+ FileRefPrivate::fileTypeResolvers.prepend(resolver);
+ return resolver;
+}
+
+StringList FileRef::defaultFileExtensions()
+{
+ StringList l;
+
+ l.append("ogg");
+ l.append("flac");
+ l.append("oga");
+ l.append("mp3");
+ l.append("mpc");
+ l.append("wv");
+ l.append("spx");
+ l.append("tta");
+#ifdef TAGLIB_WITH_MP4
+ l.append("m4a");
+ l.append("m4b");
+ l.append("m4p");
+ l.append("3g2");
+ l.append("mp4");
+#endif
+#ifdef TAGLIB_WITH_ASF
+ l.append("wma");
+ l.append("asf");
+#endif
+ l.append("aif");
+ l.append("aiff");
+ l.append("wav");
+ l.append("ape");
+ l.append("ac3");
+ l.append("opus");
+ l.append("tak");
+ l.append("ac3");
+ l.append("apl");
+ l.append("dts");
+ l.append("dtshd");
+
+ return l;
+}
+
+bool FileRef::isNull() const
+{
+ return !d->file || !d->file->isValid();
+}
+
+FileRef &FileRef::operator=(const FileRef &ref)
+{
+ if(&ref == this)
+ return *this;
+
+ if(d->deref())
+ delete d;
+
+ d = ref.d;
+ d->ref();
+
+ return *this;
+}
+
+bool FileRef::operator==(const FileRef &ref) const
+{
+ return ref.d->file == d->file;
+}
+
+bool FileRef::operator!=(const FileRef &ref) const
+{
+ return ref.d->file != d->file;
+}
+
+File *FileRef::create(FileName fileName, bool readAudioProperties,
+ AudioProperties::ReadStyle audioPropertiesStyle) // static
+{
+
+ List::ConstIterator it = FileRefPrivate::fileTypeResolvers.begin();
+
+ for(; it != FileRefPrivate::fileTypeResolvers.end(); ++it) {
+ File *file = (*it)->createFile(fileName, readAudioProperties, audioPropertiesStyle);
+ if(file)
+ return file;
+ }
+
+ // Ok, this is really dumb for now, but it works for testing.
+
+ String s;
+
+#ifdef _WIN32
+ s = (wcslen((const wchar_t *) fileName) > 0) ? String((const wchar_t *) fileName) : String((const char *) fileName);
+#else
+ s = fileName;
+#endif
+
+ // If this list is updated, the method defaultFileExtensions() should also be
+ // updated. However at some point that list should be created at the same time
+ // that a default file type resolver is created.
+
+ int pos = s.rfind(".");
+ if(pos != -1) {
+ String ext = s.substr(pos + 1).upper();
+ if(ext == "MP3")
+ return new MPEG::File(fileName, readAudioProperties, audioPropertiesStyle);
+ if(ext == "OGG")
+ return new Ogg::Vorbis::File(fileName, readAudioProperties, audioPropertiesStyle);
+ if(ext == "OPUS")
+ return new Ogg::Opus::File(fileName, readAudioProperties, audioPropertiesStyle);
+ if(ext == "OGA") {
+ /* .oga can be any audio in the Ogg container. First try FLAC, then Vorbis. */
+ File *file = new Ogg::FLAC::File(fileName, readAudioProperties, audioPropertiesStyle);
+ if (file->isValid())
+ return file;
+ delete file;
+ file = new Ogg::Opus::File(fileName, readAudioProperties, audioPropertiesStyle);
+ if (file->isValid())
+ return file;
+ delete file;
+ return new Ogg::Vorbis::File(fileName, readAudioProperties, audioPropertiesStyle);
+ }
+ if(ext == "FLAC")
+ return new FLAC::File(fileName, readAudioProperties, audioPropertiesStyle);
+ if(ext == "MPC")
+ return new MPC::File(fileName, readAudioProperties, audioPropertiesStyle);
+ if(ext == "WV")
+ return new WavPack::File(fileName, readAudioProperties, audioPropertiesStyle);
+ if(ext == "SPX")
+ return new Ogg::Speex::File(fileName, readAudioProperties, audioPropertiesStyle);
+ if(ext == "TTA")
+ return new TrueAudio::File(fileName, readAudioProperties, audioPropertiesStyle);
+#ifdef TAGLIB_WITH_MP4
+ if(ext == "M4A" || ext == "M4B" || ext == "M4P" || ext == "MP4" || ext == "3G2")
+ return new MP4::File(fileName, readAudioProperties, audioPropertiesStyle);
+#endif
+#ifdef TAGLIB_WITH_ASF
+ if(ext == "WMA" || ext == "ASF")
+ return new ASF::File(fileName, readAudioProperties, audioPropertiesStyle);
+#endif
+ if(ext == "AIF" || ext == "AIFF")
+ return new RIFF::AIFF::File(fileName, readAudioProperties, audioPropertiesStyle);
+ if(ext == "WAV")
+ return new RIFF::WAV::File(fileName, readAudioProperties, audioPropertiesStyle);
+ if(ext == "APE")
+ return new APE::File(fileName, readAudioProperties, audioPropertiesStyle);
+ if(ext == "TAK" || ext == "AC3" || ext == "APL" || ext == "DTS" || ext == "DTSHD")
+ return new APE::File(fileName, false, audioPropertiesStyle);
+ }
+
+ return 0;
+}
diff --git a/Frameworks/TagLib/taglib/taglib/fileref.h b/Frameworks/TagLib/taglib/taglib/fileref.h
new file mode 100644
index 000000000..0f0c21a4d
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/fileref.h
@@ -0,0 +1,263 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_FILEREF_H
+#define TAGLIB_FILEREF_H
+
+#include "tfile.h"
+#include "tstringlist.h"
+
+#include "taglib_export.h"
+#include "audioproperties.h"
+
+namespace TagLib {
+
+ class Tag;
+
+ //! This class provides a simple abstraction for creating and handling files
+
+ /*!
+ * FileRef exists to provide a minimal, generic and value-based wrapper around
+ * a File. It is lightweight and implicitly shared, and as such suitable for
+ * pass-by-value use. This hides some of the uglier details of TagLib::File
+ * and the non-generic portions of the concrete file implementations.
+ *
+ * This class is useful in a "simple usage" situation where it is desirable
+ * to be able to get and set some of the tag information that is similar
+ * across file types.
+ *
+ * Also note that it is probably a good idea to plug this into your mime
+ * type system rather than using the constructor that accepts a file name using
+ * the FileTypeResolver.
+ *
+ * \see FileTypeResolver
+ * \see addFileTypeResolver()
+ */
+
+ class TAGLIB_EXPORT FileRef
+ {
+ public:
+
+ //! A class for pluggable file type resolution.
+
+ /*!
+ * This class is used to add extend TagLib's very basic file name based file
+ * type resolution.
+ *
+ * This can be accomplished with:
+ *
+ * \code
+ *
+ * class MyFileTypeResolver : FileTypeResolver
+ * {
+ * TagLib::File *createFile(TagLib::FileName *fileName, bool, AudioProperties::ReadStyle)
+ * {
+ * if(someCheckForAnMP3File(fileName))
+ * return new TagLib::MPEG::File(fileName);
+ * return 0;
+ * }
+ * }
+ *
+ * FileRef::addFileTypeResolver(new MyFileTypeResolver);
+ *
+ * \endcode
+ *
+ * Naturally a less contrived example would be slightly more complex. This
+ * can be used to plug in mime-type detection systems or to add new file types
+ * to TagLib.
+ */
+
+ class TAGLIB_EXPORT FileTypeResolver
+ {
+ TAGLIB_IGNORE_MISSING_DESTRUCTOR
+ public:
+ /*!
+ * This method must be overridden to provide an additional file type
+ * resolver. If the resolver is able to determine the file type it should
+ * return a valid File object; if not it should return 0.
+ *
+ * \note The created file is then owned by the FileRef and should not be
+ * deleted. Deletion will happen automatically when the FileRef passes
+ * out of scope.
+ */
+ virtual File *createFile(FileName fileName,
+ bool readAudioProperties = true,
+ AudioProperties::ReadStyle
+ audioPropertiesStyle = AudioProperties::Average) const = 0;
+ };
+
+ /*!
+ * Creates a null FileRef.
+ */
+ FileRef();
+
+ /*!
+ * Create a FileRef from \a fileName. If \a readAudioProperties is true then
+ * the audio properties will be read using \a audioPropertiesStyle. If
+ * \a readAudioProperties is false then \a audioPropertiesStyle will be
+ * ignored.
+ *
+ * Also see the note in the class documentation about why you may not want to
+ * use this method in your application.
+ */
+ explicit FileRef(FileName fileName,
+ bool readAudioProperties = true,
+ AudioProperties::ReadStyle
+ audioPropertiesStyle = AudioProperties::Average);
+
+ /*!
+ * Contruct a FileRef using \a file. The FileRef now takes ownership of the
+ * pointer and will delete the File when it passes out of scope.
+ */
+ explicit FileRef(File *file);
+
+ /*!
+ * Make a copy of \a ref.
+ */
+ FileRef(const FileRef &ref);
+
+ /*!
+ * Destroys this FileRef instance.
+ */
+ virtual ~FileRef();
+
+ /*!
+ * Returns a pointer to represented file's tag.
+ *
+ * \warning This pointer will become invalid when this FileRef and all
+ * copies pass out of scope.
+ *
+ * \warning Do not cast it to any subclasses of \class Tag.
+ * Use tag returning methods of appropriate subclasses of \class File instead.
+ *
+ * \see File::tag()
+ */
+ Tag *tag() const;
+
+ /*!
+ * Returns the audio properties for this FileRef. If no audio properties
+ * were read then this will returns a null pointer.
+ */
+ AudioProperties *audioProperties() const;
+
+ /*!
+ * Returns a pointer to the file represented by this handler class.
+ *
+ * As a general rule this call should be avoided since if you need to work
+ * with file objects directly, you are probably better served instantiating
+ * the File subclasses (i.e. MPEG::File) manually and working with their APIs.
+ *
+ * This handle exists to provide a minimal, generic and value-based
+ * wrapper around a File. Accessing the file directly generally indicates
+ * a moving away from this simplicity (and into things beyond the scope of
+ * FileRef).
+ *
+ * \warning This pointer will become invalid when this FileRef and all
+ * copies pass out of scope.
+ */
+ File *file() const;
+
+ /*!
+ * Saves the file. Returns true on success.
+ */
+ bool save();
+
+ /*!
+ * Adds a FileTypeResolver to the list of those used by TagLib. Each
+ * additional FileTypeResolver is added to the front of a list of resolvers
+ * that are tried. If the FileTypeResolver returns zero the next resolver
+ * is tried.
+ *
+ * Returns a pointer to the added resolver (the same one that's passed in --
+ * this is mostly so that static inialializers have something to use for
+ * assignment).
+ *
+ * \see FileTypeResolver
+ */
+ static const FileTypeResolver *addFileTypeResolver(const FileTypeResolver *resolver);
+
+ /*!
+ * As is mentioned elsewhere in this class's documentation, the default file
+ * type resolution code provided by TagLib only works by comparing file
+ * extensions.
+ *
+ * This method returns the list of file extensions that are used by default.
+ *
+ * The extensions are all returned in lowercase, though the comparison used
+ * by TagLib for resolution is case-insensitive.
+ *
+ * \note This does not account for any additional file type resolvers that
+ * are plugged in. Also note that this is not intended to replace a propper
+ * mime-type resolution system, but is just here for reference.
+ *
+ * \see FileTypeResolver
+ */
+ static StringList defaultFileExtensions();
+
+ /*!
+ * Returns true if the file (and as such other pointers) are null.
+ */
+ bool isNull() const;
+
+ /*!
+ * Assign the file pointed to by \a ref to this FileRef.
+ */
+ FileRef &operator=(const FileRef &ref);
+
+ /*!
+ * Returns true if this FileRef and \a ref point to the same File object.
+ */
+ bool operator==(const FileRef &ref) const;
+
+ /*!
+ * Returns true if this FileRef and \a ref do not point to the same File
+ * object.
+ */
+ bool operator!=(const FileRef &ref) const;
+
+ /*!
+ * A simple implementation of file type guessing. If \a readAudioProperties
+ * is true then the audio properties will be read using
+ * \a audioPropertiesStyle. If \a readAudioProperties is false then
+ * \a audioPropertiesStyle will be ignored.
+ *
+ * \note You generally shouldn't use this method, but instead the constructor
+ * directly.
+ *
+ * \deprecated
+ */
+ static File *create(FileName fileName,
+ bool readAudioProperties = true,
+ AudioProperties::ReadStyle audioPropertiesStyle = AudioProperties::Average);
+
+
+ private:
+ class FileRefPrivate;
+ FileRefPrivate *d;
+ };
+
+} // namespace TagLib
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/flac/flacfile.cpp b/Frameworks/TagLib/taglib/taglib/flac/flacfile.cpp
new file mode 100644
index 000000000..c8cc1fb85
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/flac/flacfile.cpp
@@ -0,0 +1,499 @@
+/***************************************************************************
+ copyright : (C) 2003-2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+#include
+#include
+#include
+
+#include
+#include
+#include
+#include
+
+#include "flacpicture.h"
+#include "flacfile.h"
+#include "flacmetadatablock.h"
+#include "flacunknownmetadatablock.h"
+
+using namespace TagLib;
+
+namespace
+{
+ enum { XiphIndex = 0, ID3v2Index = 1, ID3v1Index = 2 };
+ enum { MinPaddingLength = 4096 };
+ enum { LastBlockFlag = 0x80 };
+}
+
+class FLAC::File::FilePrivate
+{
+public:
+ FilePrivate() :
+ ID3v2FrameFactory(ID3v2::FrameFactory::instance()),
+ ID3v2Location(-1),
+ ID3v2OriginalSize(0),
+ ID3v1Location(-1),
+ properties(0),
+ flacStart(0),
+ streamStart(0),
+ streamLength(0),
+ scanned(false),
+ hasXiphComment(false),
+ hasID3v2(false),
+ hasID3v1(false)
+ {
+ }
+
+ ~FilePrivate()
+ {
+ for(uint i = 0; i < blocks.size(); i++) {
+ delete blocks[i];
+ }
+ delete properties;
+ }
+
+ const ID3v2::FrameFactory *ID3v2FrameFactory;
+ long ID3v2Location;
+ uint ID3v2OriginalSize;
+
+ long ID3v1Location;
+
+ TagUnion tag;
+
+ Properties *properties;
+ ByteVector streamInfoData;
+ ByteVector xiphCommentData;
+ List blocks;
+
+ long flacStart;
+ long streamStart;
+ long streamLength;
+ bool scanned;
+
+ bool hasXiphComment;
+ bool hasID3v2;
+ bool hasID3v1;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+FLAC::File::File(FileName file, bool readProperties,
+ Properties::ReadStyle propertiesStyle) :
+ TagLib::File(file)
+{
+ d = new FilePrivate;
+ read(readProperties, propertiesStyle);
+}
+
+FLAC::File::File(FileName file, ID3v2::FrameFactory *frameFactory,
+ bool readProperties, Properties::ReadStyle propertiesStyle) :
+ TagLib::File(file)
+{
+ d = new FilePrivate;
+ d->ID3v2FrameFactory = frameFactory;
+ read(readProperties, propertiesStyle);
+}
+
+FLAC::File::~File()
+{
+ delete d;
+}
+
+TagLib::Tag *FLAC::File::tag() const
+{
+ return &d->tag;
+}
+
+FLAC::Properties *FLAC::File::audioProperties() const
+{
+ return d->properties;
+}
+
+
+bool FLAC::File::save()
+{
+ if(readOnly()) {
+ debug("FLAC::File::save() - Cannot save to a read only file.");
+ return false;
+ }
+
+ if(!isValid()) {
+ debug("FLAC::File::save() -- Trying to save invalid file.");
+ return false;
+ }
+
+ // Create new vorbis comments
+
+ Tag::duplicate(&d->tag, xiphComment(true), true);
+
+ d->xiphCommentData = xiphComment()->render(false);
+
+ // Replace metadata blocks
+
+ bool foundVorbisCommentBlock = false;
+ List newBlocks;
+ for(uint i = 0; i < d->blocks.size(); i++) {
+ MetadataBlock *block = d->blocks[i];
+ if(block->code() == MetadataBlock::VorbisComment) {
+ // Set the new Vorbis Comment block
+ block = new UnknownMetadataBlock(MetadataBlock::VorbisComment, d->xiphCommentData);
+ foundVorbisCommentBlock = true;
+ }
+ if(block->code() == MetadataBlock::Padding) {
+ continue;
+ }
+ newBlocks.append(block);
+ }
+ if(!foundVorbisCommentBlock) {
+ newBlocks.append(new UnknownMetadataBlock(MetadataBlock::VorbisComment, d->xiphCommentData));
+ foundVorbisCommentBlock = true;
+ }
+ d->blocks = newBlocks;
+
+ // Render data for the metadata blocks
+
+ ByteVector data;
+ for(uint i = 0; i < newBlocks.size(); i++) {
+ FLAC::MetadataBlock *block = newBlocks[i];
+ ByteVector blockData = block->render();
+ ByteVector blockHeader = ByteVector::fromUInt(blockData.size());
+ blockHeader[0] = block->code();
+ data.append(blockHeader);
+ data.append(blockData);
+ }
+
+ // Adjust the padding block(s)
+
+ long originalLength = d->streamStart - d->flacStart;
+ int paddingLength = originalLength - data.size() - 4;
+ if (paddingLength < 0) {
+ paddingLength = MinPaddingLength;
+ }
+ ByteVector padding = ByteVector::fromUInt(paddingLength);
+ padding.resize(paddingLength + 4);
+ padding[0] = FLAC::MetadataBlock::Padding | LastBlockFlag;
+ data.append(padding);
+
+ // Write the data to the file
+
+ insert(data, d->flacStart, originalLength);
+ d->hasXiphComment = true;
+
+ // Update ID3 tags
+
+ if(ID3v2Tag()) {
+ if(d->hasID3v2) {
+ if(d->ID3v2Location < d->flacStart)
+ debug("FLAC::File::save() -- This can't be right -- an ID3v2 tag after the "
+ "start of the FLAC bytestream? Not writing the ID3v2 tag.");
+ else
+ insert(ID3v2Tag()->render(), d->ID3v2Location, d->ID3v2OriginalSize);
+ }
+ else
+ insert(ID3v2Tag()->render(), 0, 0);
+ }
+
+ if(ID3v1Tag()) {
+ seek(-128, End);
+ writeBlock(ID3v1Tag()->render());
+ }
+
+ return true;
+}
+
+ID3v2::Tag *FLAC::File::ID3v2Tag(bool create)
+{
+ if(!create || d->tag[ID3v2Index])
+ return static_cast(d->tag[ID3v2Index]);
+
+ d->tag.set(ID3v2Index, new ID3v2::Tag);
+ return static_cast(d->tag[ID3v2Index]);
+}
+
+ID3v1::Tag *FLAC::File::ID3v1Tag(bool create)
+{
+ return d->tag.access(ID3v1Index, create);
+}
+
+Ogg::XiphComment *FLAC::File::xiphComment(bool create)
+{
+ return d->tag.access(XiphIndex, create);
+}
+
+void FLAC::File::setID3v2FrameFactory(const ID3v2::FrameFactory *factory)
+{
+ d->ID3v2FrameFactory = factory;
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+void FLAC::File::read(bool readProperties, Properties::ReadStyle propertiesStyle)
+{
+ // Look for an ID3v2 tag
+
+ d->ID3v2Location = findID3v2();
+
+ if(d->ID3v2Location >= 0) {
+
+ d->tag.set(ID3v2Index, new ID3v2::Tag(this, d->ID3v2Location, d->ID3v2FrameFactory));
+
+ d->ID3v2OriginalSize = ID3v2Tag()->header()->completeTagSize();
+
+ if(ID3v2Tag()->header()->tagSize() <= 0)
+ d->tag.set(ID3v2Index, 0);
+ else
+ d->hasID3v2 = true;
+ }
+
+ // Look for an ID3v1 tag
+
+ d->ID3v1Location = findID3v1();
+
+ if(d->ID3v1Location >= 0) {
+ d->tag.set(ID3v1Index, new ID3v1::Tag(this, d->ID3v1Location));
+ d->hasID3v1 = true;
+ }
+
+ // Look for FLAC metadata, including vorbis comments
+
+ scan();
+
+ if(!isValid())
+ return;
+
+ if(d->hasXiphComment)
+ d->tag.set(XiphIndex, new Ogg::XiphComment(xiphCommentData()));
+ else
+ d->tag.set(XiphIndex, new Ogg::XiphComment);
+
+ if(readProperties)
+ d->properties = new Properties(streamInfoData(), streamLength(), propertiesStyle);
+}
+
+ByteVector FLAC::File::streamInfoData()
+{
+ return isValid() ? d->streamInfoData : ByteVector();
+}
+
+ByteVector FLAC::File::xiphCommentData() const
+{
+ return (isValid() && d->hasXiphComment) ? d->xiphCommentData : ByteVector();
+}
+
+long FLAC::File::streamLength()
+{
+ return d->streamLength;
+}
+
+void FLAC::File::scan()
+{
+ // Scan the metadata pages
+
+ if(d->scanned)
+ return;
+
+ if(!isValid())
+ return;
+
+ long nextBlockOffset;
+
+ if(d->hasID3v2)
+ nextBlockOffset = find("fLaC", d->ID3v2Location + d->ID3v2OriginalSize);
+ else
+ nextBlockOffset = find("fLaC");
+
+ if(nextBlockOffset < 0) {
+ debug("FLAC::File::scan() -- FLAC stream not found");
+ setValid(false);
+ return;
+ }
+
+ nextBlockOffset += 4;
+ d->flacStart = nextBlockOffset;
+
+ seek(nextBlockOffset);
+
+ ByteVector header = readBlock(4);
+
+ // Header format (from spec):
+ // <1> Last-metadata-block flag
+ // <7> BLOCK_TYPE
+ // 0 : STREAMINFO
+ // 1 : PADDING
+ // ..
+ // 4 : VORBIS_COMMENT
+ // ..
+ // <24> Length of metadata to follow
+
+ char blockType = header[0] & 0x7f;
+ bool isLastBlock = (header[0] & 0x80) != 0;
+ uint length = header.mid(1, 3).toUInt();
+
+ // First block should be the stream_info metadata
+
+ if(blockType != MetadataBlock::StreamInfo) {
+ debug("FLAC::File::scan() -- invalid FLAC stream");
+ setValid(false);
+ return;
+ }
+
+ d->streamInfoData = readBlock(length);
+ d->blocks.append(new UnknownMetadataBlock(blockType, d->streamInfoData));
+ nextBlockOffset += length + 4;
+
+ // Search through the remaining metadata
+ while(!isLastBlock) {
+
+ header = readBlock(4);
+ blockType = header[0] & 0x7f;
+ isLastBlock = (header[0] & 0x80) != 0;
+ length = header.mid(1, 3).toUInt();
+
+ ByteVector data = readBlock(length);
+ if(data.size() != length) {
+ debug("FLAC::File::scan() -- FLAC stream corrupted");
+ setValid(false);
+ return;
+ }
+
+ MetadataBlock *block = 0;
+
+ // Found the vorbis-comment
+ if(blockType == MetadataBlock::VorbisComment) {
+ if(!d->hasXiphComment) {
+ d->xiphCommentData = data;
+ d->hasXiphComment = true;
+ }
+ else {
+ debug("FLAC::File::scan() -- multiple Vorbis Comment blocks found, using the first one");
+ }
+ }
+ else if(blockType == MetadataBlock::Picture) {
+ FLAC::Picture *picture = new FLAC::Picture();
+ if(picture->parse(data)) {
+ block = picture;
+ }
+ else {
+ debug("FLAC::File::scan() -- invalid picture found, discarting");
+ delete picture;
+ }
+ }
+
+ if(!block) {
+ block = new UnknownMetadataBlock(blockType, data);
+ }
+ if(block->code() != MetadataBlock::Padding) {
+ d->blocks.append(block);
+ }
+ else {
+ delete block;
+ }
+
+ nextBlockOffset += length + 4;
+
+ if(nextBlockOffset >= File::length()) {
+ debug("FLAC::File::scan() -- FLAC stream corrupted");
+ setValid(false);
+ return;
+ }
+ seek(nextBlockOffset);
+ }
+
+ // End of metadata, now comes the datastream
+
+ d->streamStart = nextBlockOffset;
+ d->streamLength = File::length() - d->streamStart;
+
+ if(d->hasID3v1)
+ d->streamLength -= 128;
+
+ d->scanned = true;
+}
+
+long FLAC::File::findID3v1()
+{
+ if(!isValid())
+ return -1;
+
+ seek(-128, End);
+ long p = tell();
+
+ if(readBlock(3) == ID3v1::Tag::fileIdentifier())
+ return p;
+
+ return -1;
+}
+
+long FLAC::File::findID3v2()
+{
+ if(!isValid())
+ return -1;
+
+ seek(0);
+
+ if(readBlock(3) == ID3v2::Header::fileIdentifier())
+ return 0;
+
+ return -1;
+}
+
+List FLAC::File::pictureList()
+{
+ List pictures;
+ for(uint i = 0; i < d->blocks.size(); i++) {
+ Picture *picture = dynamic_cast(d->blocks[i]);
+ if(picture) {
+ pictures.append(picture);
+ }
+ }
+ return pictures;
+}
+
+void FLAC::File::addPicture(Picture *picture)
+{
+ d->blocks.append(picture);
+}
+
+void FLAC::File::removePictures()
+{
+ List newBlocks;
+ for(uint i = 0; i < d->blocks.size(); i++) {
+ Picture *picture = dynamic_cast(d->blocks[i]);
+ if(picture) {
+ delete picture;
+ }
+ else {
+ newBlocks.append(d->blocks[i]);
+ }
+ }
+ d->blocks = newBlocks;
+}
+
diff --git a/Frameworks/TagLib/taglib/taglib/flac/flacfile.h b/Frameworks/TagLib/taglib/taglib/flac/flacfile.h
new file mode 100644
index 000000000..64e67bc06
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/flac/flacfile.h
@@ -0,0 +1,222 @@
+/***************************************************************************
+ copyright : (C) 2003 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_FLACFILE_H
+#define TAGLIB_FLACFILE_H
+
+#include "taglib_export.h"
+#include "tfile.h"
+#include "tlist.h"
+
+#include "flacpicture.h"
+#include "flacproperties.h"
+
+namespace TagLib {
+
+ class Tag;
+
+ namespace ID3v2 { class FrameFactory; class Tag; }
+ namespace ID3v1 { class Tag; }
+ namespace Ogg { class XiphComment; }
+
+ //! An implementation of FLAC metadata
+
+ /*!
+ * This is implementation of FLAC metadata for non-Ogg FLAC files. At some
+ * point when Ogg / FLAC is more common there will be a similar implementation
+ * under the Ogg hiearchy.
+ *
+ * This supports ID3v1, ID3v2 and Xiph style comments as well as reading stream
+ * properties from the file.
+ */
+
+ namespace FLAC {
+
+ //! An implementation of TagLib::File with FLAC specific methods
+
+ /*!
+ * This implements and provides an interface for FLAC files to the
+ * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
+ * the abstract TagLib::File API as well as providing some additional
+ * information specific to FLAC files.
+ */
+
+ class TAGLIB_EXPORT File : public TagLib::File
+ {
+ public:
+ /*!
+ * Contructs a FLAC file from \a file. If \a readProperties is true the
+ * file's audio properties will also be read using \a propertiesStyle. If
+ * false, \a propertiesStyle is ignored.
+ *
+ * \deprecated This constructor will be dropped in favor of the one below
+ * in a future version.
+ */
+ File(FileName file, bool readProperties = true,
+ Properties::ReadStyle propertiesStyle = Properties::Average);
+
+ /*!
+ * Contructs a FLAC file from \a file. If \a readProperties is true the
+ * file's audio properties will also be read using \a propertiesStyle. If
+ * false, \a propertiesStyle is ignored.
+ *
+ * If this file contains and ID3v2 tag the frames will be created using
+ * \a frameFactory.
+ */
+ // BIC: merge with the above constructor
+ File(FileName file, ID3v2::FrameFactory *frameFactory,
+ bool readProperties = true,
+ Properties::ReadStyle propertiesStyle = Properties::Average);
+
+ /*!
+ * Destroys this instance of the File.
+ */
+ virtual ~File();
+
+ /*!
+ * Returns the Tag for this file. This will be a union of XiphComment,
+ * ID3v1 and ID3v2 tags.
+ *
+ * \see ID3v2Tag()
+ * \see ID3v1Tag()
+ * \see XiphComment()
+ */
+ virtual TagLib::Tag *tag() const;
+
+ /*!
+ * Returns the FLAC::Properties for this file. If no audio properties
+ * were read then this will return a null pointer.
+ */
+ virtual Properties *audioProperties() const;
+
+ /*!
+ * Save the file. This will primarily save the XiphComment, but
+ * will also keep any old ID3-tags up to date. If the file
+ * has no XiphComment, one will be constructed from the ID3-tags.
+ *
+ * This returns true if the save was successful.
+ */
+ virtual bool save();
+
+ /*!
+ * Returns a pointer to the ID3v2 tag of the file.
+ *
+ * If \a create is false (the default) this will return a null pointer
+ * if there is no valid ID3v2 tag. If \a create is true it will create
+ * an ID3v2 tag if one does not exist.
+ *
+ * \note The Tag is still owned by the FLAC::File and should not be
+ * deleted by the user. It will be deleted when the file (object) is
+ * destroyed.
+ */
+ ID3v2::Tag *ID3v2Tag(bool create = false);
+
+ /*!
+ * Returns a pointer to the ID3v1 tag of the file.
+ *
+ * If \a create is false (the default) this will return a null pointer
+ * if there is no valid ID3v1 tag. If \a create is true it will create
+ * an ID3v1 tag if one does not exist.
+ *
+ * \note The Tag is still owned by the FLAC::File and should not be
+ * deleted by the user. It will be deleted when the file (object) is
+ * destroyed.
+ */
+ ID3v1::Tag *ID3v1Tag(bool create = false);
+
+ /*!
+ * Returns a pointer to the XiphComment for the file.
+ *
+ * If \a create is false (the default) this will return a null pointer
+ * if there is no valid XiphComment. If \a create is true it will create
+ * a XiphComment if one does not exist.
+ *
+ * \note The Tag is still owned by the FLAC::File and should not be
+ * deleted by the user. It will be deleted when the file (object) is
+ * destroyed.
+ */
+ Ogg::XiphComment *xiphComment(bool create = false);
+
+ /*!
+ * Set the ID3v2::FrameFactory to something other than the default. This
+ * can be used to specify the way that ID3v2 frames will be interpreted
+ * when
+ *
+ * \see ID3v2FrameFactory
+ */
+ void setID3v2FrameFactory(const ID3v2::FrameFactory *factory);
+
+ /*!
+ * Returns the block of data used by FLAC::Properties for parsing the
+ * stream properties.
+ *
+ * \deprecated This method will not be public in a future release.
+ */
+ ByteVector streamInfoData(); // BIC: remove
+
+ /*!
+ * Returns the length of the audio-stream, used by FLAC::Properties for
+ * calculating the bitrate.
+ *
+ * \deprecated This method will not be public in a future release.
+ */
+ long streamLength(); // BIC: remove
+
+ /*!
+ * Returns a list of pictures attached to the FLAC file.
+ */
+ List pictureList();
+
+ /*!
+ * Remove all attached images.
+ */
+ void removePictures();
+
+ /*!
+ * Add a new picture to the file. The file takes ownership of the
+ * picture and will handle freeing its memory.
+ *
+ * \note The file will be saved only after calling save().
+ */
+ void addPicture(Picture *picture);
+
+ private:
+ File(const File &);
+ File &operator=(const File &);
+
+ void read(bool readProperties, Properties::ReadStyle propertiesStyle);
+ void scan();
+ long findID3v2();
+ long findID3v1();
+ ByteVector xiphCommentData() const;
+ long findPaddingBreak(long nextPageOffset, long targetOffset, bool *isLast);
+
+ class FilePrivate;
+ FilePrivate *d;
+ };
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/flac/flacproperties.cpp b/Frameworks/TagLib/taglib/taglib/flac/flacproperties.cpp
new file mode 100644
index 000000000..d36d26ec6
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/flac/flacproperties.cpp
@@ -0,0 +1,158 @@
+/***************************************************************************
+ copyright : (C) 2003 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+
+#include "flacproperties.h"
+#include "flacfile.h"
+
+using namespace TagLib;
+
+class FLAC::Properties::PropertiesPrivate
+{
+public:
+ PropertiesPrivate(ByteVector d, long st, ReadStyle s) :
+ data(d),
+ streamLength(st),
+ style(s),
+ length(0),
+ bitrate(0),
+ sampleRate(0),
+ sampleWidth(0),
+ channels(0) {}
+
+ ByteVector data;
+ long streamLength;
+ ReadStyle style;
+ int length;
+ int bitrate;
+ int sampleRate;
+ int sampleWidth;
+ int channels;
+ ByteVector signature;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+FLAC::Properties::Properties(ByteVector data, long streamLength, ReadStyle style) : AudioProperties(style)
+{
+ d = new PropertiesPrivate(data, streamLength, style);
+ read();
+}
+
+FLAC::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style)
+{
+ d = new PropertiesPrivate(file->streamInfoData(), file->streamLength(), style);
+ read();
+}
+
+FLAC::Properties::~Properties()
+{
+ delete d;
+}
+
+int FLAC::Properties::length() const
+{
+ return d->length;
+}
+
+int FLAC::Properties::bitrate() const
+{
+ return d->bitrate;
+}
+
+int FLAC::Properties::sampleRate() const
+{
+ return d->sampleRate;
+}
+
+int FLAC::Properties::sampleWidth() const
+{
+ return d->sampleWidth;
+}
+
+int FLAC::Properties::channels() const
+{
+ return d->channels;
+}
+
+ByteVector FLAC::Properties::signature() const
+{
+ return d->signature;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+void FLAC::Properties::read()
+{
+ if(d->data.size() < 18) {
+ debug("FLAC::Properties::read() - FLAC properties must contain at least 18 bytes.");
+ return;
+ }
+
+ int pos = 0;
+
+ // Minimum block size (in samples)
+ pos += 2;
+
+ // Maximum block size (in samples)
+ pos += 2;
+
+ // Minimum frame size (in bytes)
+ pos += 3;
+
+ // Maximum frame size (in bytes)
+ pos += 3;
+
+ uint flags = d->data.mid(pos, 4).toUInt(true);
+ d->sampleRate = flags >> 12;
+ d->channels = ((flags >> 9) & 7) + 1;
+ d->sampleWidth = ((flags >> 4) & 31) + 1;
+
+ // The last 4 bits are the most significant 4 bits for the 36 bit
+ // stream length in samples. (Audio files measured in days)
+
+ uint highLength =d->sampleRate > 0 ? (((flags & 0xf) << 28) / d->sampleRate) << 4 : 0;
+ pos += 4;
+
+ d->length = d->sampleRate > 0 ?
+ (d->data.mid(pos, 4).toUInt(true)) / d->sampleRate + highLength : 0;
+ pos += 4;
+
+ // Uncompressed bitrate:
+
+ //d->bitrate = ((d->sampleRate * d->channels) / 1000) * d->sampleWidth;
+
+ // Real bitrate:
+
+ d->bitrate = d->length > 0 ? ((d->streamLength * 8UL) / d->length) / 1000 : 0;
+
+ d->signature = d->data.mid(pos, 32);
+}
diff --git a/Frameworks/TagLib/taglib/taglib/flac/flacproperties.h b/Frameworks/TagLib/taglib/taglib/flac/flacproperties.h
new file mode 100644
index 000000000..5bba6417b
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/flac/flacproperties.h
@@ -0,0 +1,98 @@
+/***************************************************************************
+ copyright : (C) 2003 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_FLACPROPERTIES_H
+#define TAGLIB_FLACPROPERTIES_H
+
+#include "taglib_export.h"
+#include "audioproperties.h"
+
+namespace TagLib {
+
+ namespace FLAC {
+
+ class File;
+
+ //! An implementation of audio property reading for FLAC
+
+ /*!
+ * This reads the data from an FLAC stream found in the AudioProperties
+ * API.
+ */
+
+ class TAGLIB_EXPORT Properties : public AudioProperties
+ {
+ public:
+ /*!
+ * Create an instance of FLAC::Properties with the data read from the
+ * ByteVector \a data.
+ */
+ // BIC: switch to const reference
+ Properties(ByteVector data, long streamLength, ReadStyle style = Average);
+
+ /*!
+ * Create an instance of FLAC::Properties with the data read from the
+ * FLAC::File \a file.
+ */
+ // BIC: remove
+ Properties(File *file, ReadStyle style = Average);
+
+ /*!
+ * Destroys this FLAC::Properties instance.
+ */
+ virtual ~Properties();
+
+ // Reimplementations.
+
+ virtual int length() const;
+ virtual int bitrate() const;
+ virtual int sampleRate() const;
+ virtual int channels() const;
+
+ /*!
+ * Returns the sample width as read from the FLAC identification
+ * header.
+ */
+ int sampleWidth() const;
+
+ /*!
+ * Returns the MD5 signature of the uncompressed audio stream as read
+ * from the stream info header header.
+ */
+ ByteVector signature() const;
+
+ private:
+ Properties(const Properties &);
+ Properties &operator=(const Properties &);
+
+ void read();
+
+ class PropertiesPrivate;
+ PropertiesPrivate *d;
+ };
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpc/mpcfile.cpp b/Frameworks/TagLib/taglib/taglib/mpc/mpcfile.cpp
new file mode 100644
index 000000000..9e9d6b883
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpc/mpcfile.cpp
@@ -0,0 +1,325 @@
+/***************************************************************************
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+#include
+#include
+
+#include "mpcfile.h"
+#include "id3v1tag.h"
+#include "id3v2header.h"
+#include "apetag.h"
+#include "apefooter.h"
+
+using namespace TagLib;
+
+namespace
+{
+ enum { APEIndex, ID3v1Index };
+}
+
+class MPC::File::FilePrivate
+{
+public:
+ FilePrivate() :
+ APELocation(-1),
+ APESize(0),
+ ID3v1Location(-1),
+ ID3v2Header(0),
+ ID3v2Location(-1),
+ ID3v2Size(0),
+ properties(0),
+ scanned(false),
+ hasAPE(false),
+ hasID3v1(false),
+ hasID3v2(false) {}
+
+ ~FilePrivate()
+ {
+ delete ID3v2Header;
+ delete properties;
+ }
+
+ long APELocation;
+ uint APESize;
+
+ long ID3v1Location;
+
+ ID3v2::Header *ID3v2Header;
+ long ID3v2Location;
+ uint ID3v2Size;
+
+ TagUnion tag;
+
+ Properties *properties;
+ bool scanned;
+
+ // These indicate whether the file *on disk* has these tags, not if
+ // this data structure does. This is used in computing offsets.
+
+ bool hasAPE;
+ bool hasID3v1;
+ bool hasID3v2;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+MPC::File::File(FileName file, bool readProperties,
+ Properties::ReadStyle propertiesStyle) : TagLib::File(file)
+{
+ d = new FilePrivate;
+ read(readProperties, propertiesStyle);
+}
+
+MPC::File::~File()
+{
+ delete d;
+}
+
+TagLib::Tag *MPC::File::tag() const
+{
+ return &d->tag;
+}
+
+MPC::Properties *MPC::File::audioProperties() const
+{
+ return d->properties;
+}
+
+bool MPC::File::save()
+{
+ if(readOnly()) {
+ debug("MPC::File::save() -- File is read only.");
+ return false;
+ }
+
+ // Possibly strip ID3v2 tag
+
+ if(d->hasID3v2 && !d->ID3v2Header) {
+ removeBlock(d->ID3v2Location, d->ID3v2Size);
+ d->hasID3v2 = false;
+ if(d->hasID3v1)
+ d->ID3v1Location -= d->ID3v2Size;
+ if(d->hasAPE)
+ d->APELocation -= d->ID3v2Size;
+ }
+
+ // Update ID3v1 tag
+
+ if(ID3v1Tag()) {
+ if(d->hasID3v1) {
+ seek(d->ID3v1Location);
+ writeBlock(ID3v1Tag()->render());
+ }
+ else {
+ seek(0, End);
+ d->ID3v1Location = tell();
+ writeBlock(ID3v1Tag()->render());
+ d->hasID3v1 = true;
+ }
+ } else
+ if(d->hasID3v1) {
+ removeBlock(d->ID3v1Location, 128);
+ d->hasID3v1 = false;
+ if(d->hasAPE) {
+ if(d->APELocation > d->ID3v1Location)
+ d->APELocation -= 128;
+ }
+ }
+
+ // Update APE tag
+
+ if(APETag()) {
+ if(d->hasAPE)
+ insert(APETag()->render(), d->APELocation, d->APESize);
+ else {
+ if(d->hasID3v1) {
+ insert(APETag()->render(), d->ID3v1Location, 0);
+ d->APESize = APETag()->footer()->completeTagSize();
+ d->hasAPE = true;
+ d->APELocation = d->ID3v1Location;
+ d->ID3v1Location += d->APESize;
+ }
+ else {
+ seek(0, End);
+ d->APELocation = tell();
+ writeBlock(APETag()->render());
+ d->APESize = APETag()->footer()->completeTagSize();
+ d->hasAPE = true;
+ }
+ }
+ }
+ else
+ if(d->hasAPE) {
+ removeBlock(d->APELocation, d->APESize);
+ d->hasAPE = false;
+ if(d->hasID3v1) {
+ if(d->ID3v1Location > d->APELocation)
+ d->ID3v1Location -= d->APESize;
+ }
+ }
+
+ return true;
+}
+
+ID3v1::Tag *MPC::File::ID3v1Tag(bool create)
+{
+ return d->tag.access(ID3v1Index, create);
+}
+
+APE::Tag *MPC::File::APETag(bool create)
+{
+ return d->tag.access(APEIndex, create);
+}
+
+void MPC::File::strip(int tags)
+{
+ if(tags & ID3v1) {
+ d->tag.set(ID3v1Index, 0);
+ APETag(true);
+ }
+
+ if(tags & ID3v2) {
+ delete d->ID3v2Header;
+ d->ID3v2Header = 0;
+ }
+
+ if(tags & APE) {
+ d->tag.set(APEIndex, 0);
+
+ if(!ID3v1Tag())
+ APETag(true);
+ }
+}
+
+void MPC::File::remove(int tags)
+{
+ strip(tags);
+}
+
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+void MPC::File::read(bool readProperties, Properties::ReadStyle /* propertiesStyle */)
+{
+ // Look for an ID3v1 tag
+
+ d->ID3v1Location = findID3v1();
+
+ if(d->ID3v1Location >= 0) {
+ d->tag.set(ID3v1Index, new ID3v1::Tag(this, d->ID3v1Location));
+ d->hasID3v1 = true;
+ }
+
+ // Look for an APE tag
+
+ findAPE();
+
+ d->APELocation = findAPE();
+
+ if(d->APELocation >= 0) {
+ d->tag.set(APEIndex, new APE::Tag(this, d->APELocation));
+
+ d->APESize = APETag()->footer()->completeTagSize();
+ d->APELocation = d->APELocation + APETag()->footer()->size() - d->APESize;
+ d->hasAPE = true;
+ }
+
+ if(!d->hasID3v1)
+ APETag(true);
+
+ // Look for and skip an ID3v2 tag
+
+ d->ID3v2Location = findID3v2();
+
+ if(d->ID3v2Location >= 0) {
+ seek(d->ID3v2Location);
+ d->ID3v2Header = new ID3v2::Header(readBlock(ID3v2::Header::size()));
+ d->ID3v2Size = d->ID3v2Header->completeTagSize();
+ d->hasID3v2 = true;
+ }
+
+ if(d->hasID3v2)
+ seek(d->ID3v2Location + d->ID3v2Size);
+ else
+ seek(0);
+
+ // Look for MPC metadata
+
+ if(readProperties) {
+ d->properties = new Properties(readBlock(MPC::HeaderSize),
+ length() - d->ID3v2Size - d->APESize);
+ }
+}
+
+long MPC::File::findAPE()
+{
+ if(!isValid())
+ return -1;
+
+ if(d->hasID3v1)
+ seek(-160, End);
+ else
+ seek(-32, End);
+
+ long p = tell();
+
+ if(readBlock(8) == APE::Tag::fileIdentifier())
+ return p;
+
+ return -1;
+}
+
+long MPC::File::findID3v1()
+{
+ if(!isValid())
+ return -1;
+
+ seek(-128, End);
+ long p = tell();
+
+ if(readBlock(3) == ID3v1::Tag::fileIdentifier())
+ return p;
+
+ return -1;
+}
+
+long MPC::File::findID3v2()
+{
+ if(!isValid())
+ return -1;
+
+ seek(0);
+
+ if(readBlock(3) == ID3v2::Header::fileIdentifier())
+ return 0;
+
+ return -1;
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpc/mpcfile.h b/Frameworks/TagLib/taglib/taglib/mpc/mpcfile.h
new file mode 100644
index 000000000..6adc0ffb9
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpc/mpcfile.h
@@ -0,0 +1,175 @@
+/***************************************************************************
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_MPCFILE_H
+#define TAGLIB_MPCFILE_H
+
+#include "taglib_export.h"
+#include "tfile.h"
+
+#include "mpcproperties.h"
+
+namespace TagLib {
+
+ class Tag;
+
+ namespace ID3v1 { class Tag; }
+ namespace APE { class Tag; }
+
+ //! An implementation of MPC metadata
+
+ /*!
+ * This is implementation of MPC metadata.
+ *
+ * This supports ID3v1 and APE (v1 and v2) style comments as well as reading stream
+ * properties from the file. ID3v2 tags are invalid in MPC-files, but will be skipped
+ * and ignored.
+ */
+
+ namespace MPC {
+
+ //! An implementation of TagLib::File with MPC specific methods
+
+ /*!
+ * This implements and provides an interface for MPC files to the
+ * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
+ * the abstract TagLib::File API as well as providing some additional
+ * information specific to MPC files.
+ * The only invalid tag combination supported is an ID3v1 tag after an APE tag.
+ */
+
+ class TAGLIB_EXPORT File : public TagLib::File
+ {
+ public:
+ /*!
+ * This set of flags is used for various operations and is suitable for
+ * being OR-ed together.
+ */
+ enum TagTypes {
+ //! Empty set. Matches no tag types.
+ NoTags = 0x0000,
+ //! Matches ID3v1 tags.
+ ID3v1 = 0x0001,
+ //! Matches ID3v2 tags.
+ ID3v2 = 0x0002,
+ //! Matches APE tags.
+ APE = 0x0004,
+ //! Matches all tag types.
+ AllTags = 0xffff
+ };
+
+ /*!
+ * Contructs an MPC file from \a file. If \a readProperties is true the
+ * file's audio properties will also be read using \a propertiesStyle. If
+ * false, \a propertiesStyle is ignored.
+ */
+ File(FileName file, bool readProperties = true,
+ Properties::ReadStyle propertiesStyle = Properties::Average);
+
+ /*!
+ * Destroys this instance of the File.
+ */
+ virtual ~File();
+
+ /*!
+ * Returns the Tag for this file. This will be an APE tag, an ID3v1 tag
+ * or a combination of the two.
+ */
+ virtual TagLib::Tag *tag() const;
+
+ /*!
+ * Returns the MPC::Properties for this file. If no audio properties
+ * were read then this will return a null pointer.
+ */
+ virtual Properties *audioProperties() const;
+
+ /*!
+ * Saves the file.
+ */
+ virtual bool save();
+
+ /*!
+ * Returns a pointer to the ID3v1 tag of the file.
+ *
+ * If \a create is false (the default) this will return a null pointer
+ * if there is no valid ID3v1 tag. If \a create is true it will create
+ * an ID3v1 tag if one does not exist. If there is already an APE tag, the
+ * new ID3v1 tag will be placed after it.
+ *
+ * \note The Tag is still owned by the APE::File and should not be
+ * deleted by the user. It will be deleted when the file (object) is
+ * destroyed.
+ */
+ ID3v1::Tag *ID3v1Tag(bool create = false);
+
+ /*!
+ * Returns a pointer to the APE tag of the file.
+ *
+ * If \a create is false (the default) this will return a null pointer
+ * if there is no valid APE tag. If \a create is true it will create
+ * a APE tag if one does not exist. If there is already an ID3v1 tag, thes
+ * new APE tag will be placed before it.
+ *
+ * \note The Tag is still owned by the APE::File and should not be
+ * deleted by the user. It will be deleted when the file (object) is
+ * destroyed.
+ */
+ APE::Tag *APETag(bool create = false);
+
+ /*!
+ * This will remove the tags that match the OR-ed together TagTypes from the
+ * file. By default it removes all tags.
+ *
+ * \warning This will also invalidate pointers to the tags
+ * as their memory will be freed.
+ *
+ * \note In order to make the removal permanent save() still needs to be called.
+ */
+ void strip(int tags = AllTags);
+
+ /*!
+ * \deprecated
+ * \see strip
+ */
+ void remove(int tags = AllTags);
+
+
+ private:
+ File(const File &);
+ File &operator=(const File &);
+
+ void read(bool readProperties, Properties::ReadStyle propertiesStyle);
+ void scan();
+ long findAPE();
+ long findID3v1();
+ long findID3v2();
+
+ class FilePrivate;
+ FilePrivate *d;
+ };
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpc/mpcproperties.cpp b/Frameworks/TagLib/taglib/taglib/mpc/mpcproperties.cpp
new file mode 100644
index 000000000..9adc69246
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpc/mpcproperties.cpp
@@ -0,0 +1,140 @@
+/***************************************************************************
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+#include
+
+#include "mpcproperties.h"
+#include "mpcfile.h"
+
+using namespace TagLib;
+
+class MPC::Properties::PropertiesPrivate
+{
+public:
+ PropertiesPrivate(const ByteVector &d, long length, ReadStyle s) :
+ data(d),
+ streamLength(length),
+ style(s),
+ version(0),
+ length(0),
+ bitrate(0),
+ sampleRate(0),
+ channels(0) {}
+
+ ByteVector data;
+ long streamLength;
+ ReadStyle style;
+ int version;
+ int length;
+ int bitrate;
+ int sampleRate;
+ int channels;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+MPC::Properties::Properties(const ByteVector &data, long streamLength, ReadStyle style) : AudioProperties(style)
+{
+ d = new PropertiesPrivate(data, streamLength, style);
+ read();
+}
+
+MPC::Properties::~Properties()
+{
+ delete d;
+}
+
+int MPC::Properties::length() const
+{
+ return d->length;
+}
+
+int MPC::Properties::bitrate() const
+{
+ return d->bitrate;
+}
+
+int MPC::Properties::sampleRate() const
+{
+ return d->sampleRate;
+}
+
+int MPC::Properties::channels() const
+{
+ return d->channels;
+}
+
+int MPC::Properties::mpcVersion() const
+{
+ return d->version;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+static const unsigned short sftable [4] = { 44100, 48000, 37800, 32000 };
+
+void MPC::Properties::read()
+{
+ if(!d->data.startsWith("MP+"))
+ return;
+
+ d->version = d->data[3] & 15;
+
+ unsigned int frames;
+
+ if(d->version >= 7) {
+ frames = d->data.mid(4, 4).toUInt(false);
+
+ std::bitset<32> flags(TAGLIB_CONSTRUCT_BITSET(d->data.mid(8, 4).toUInt(false)));
+ d->sampleRate = sftable[flags[17] * 2 + flags[16]];
+ d->channels = 2;
+ }
+ else {
+ uint headerData = d->data.mid(0, 4).toUInt(false);
+
+ d->bitrate = (headerData >> 23) & 0x01ff;
+ d->version = (headerData >> 11) & 0x03ff;
+ d->sampleRate = 44100;
+ d->channels = 2;
+
+ if(d->version >= 5)
+ frames = d->data.mid(4, 4).toUInt(false);
+ else
+ frames = d->data.mid(6, 2).toUInt(false);
+ }
+
+ uint samples = frames * 1152 - 576;
+
+ d->length = d->sampleRate > 0 ? (samples + (d->sampleRate / 2)) / d->sampleRate : 0;
+
+ if(!d->bitrate)
+ d->bitrate = d->length > 0 ? ((d->streamLength * 8L) / d->length) / 1000 : 0;
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpc/mpcproperties.h b/Frameworks/TagLib/taglib/taglib/mpc/mpcproperties.h
new file mode 100644
index 000000000..d1593458f
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpc/mpcproperties.h
@@ -0,0 +1,85 @@
+/***************************************************************************
+ copyright : (C) 2004 by Allan Sandfeld Jensen
+ email : kde@carewolf.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_MPCPROPERTIES_H
+#define TAGLIB_MPCPROPERTIES_H
+
+#include "taglib_export.h"
+#include "audioproperties.h"
+
+namespace TagLib {
+
+ namespace MPC {
+
+ class File;
+
+ static const uint HeaderSize = 8*7;
+
+ //! An implementation of audio property reading for MPC
+
+ /*!
+ * This reads the data from an MPC stream found in the AudioProperties
+ * API.
+ */
+
+ class TAGLIB_EXPORT Properties : public AudioProperties
+ {
+ public:
+ /*!
+ * Create an instance of MPC::Properties with the data read from the
+ * ByteVector \a data.
+ */
+ Properties(const ByteVector &data, long streamLength, ReadStyle style = Average);
+
+ /*!
+ * Destroys this MPC::Properties instance.
+ */
+ virtual ~Properties();
+
+ // Reimplementations.
+
+ virtual int length() const;
+ virtual int bitrate() const;
+ virtual int sampleRate() const;
+ virtual int channels() const;
+
+ /*!
+ * Returns the version of the bitstream (SV4-SV7)
+ */
+ int mpcVersion() const;
+
+ private:
+ Properties(const Properties &);
+ Properties &operator=(const Properties &);
+
+ void read();
+
+ class PropertiesPrivate;
+ PropertiesPrivate *d;
+ };
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v1/id3v1genres.cpp b/Frameworks/TagLib/taglib/taglib/mpeg/id3v1/id3v1genres.cpp
new file mode 100644
index 000000000..7893c72ce
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v1/id3v1genres.cpp
@@ -0,0 +1,219 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include "id3v1genres.h"
+
+using namespace TagLib;
+
+namespace TagLib {
+ namespace ID3v1 {
+
+ static const int genresSize = 148;
+ static const String genres[] = {
+ "Blues",
+ "Classic Rock",
+ "Country",
+ "Dance",
+ "Disco",
+ "Funk",
+ "Grunge",
+ "Hip-Hop",
+ "Jazz",
+ "Metal",
+ "New Age",
+ "Oldies",
+ "Other",
+ "Pop",
+ "R&B",
+ "Rap",
+ "Reggae",
+ "Rock",
+ "Techno",
+ "Industrial",
+ "Alternative",
+ "Ska",
+ "Death Metal",
+ "Pranks",
+ "Soundtrack",
+ "Euro-Techno",
+ "Ambient",
+ "Trip-Hop",
+ "Vocal",
+ "Jazz+Funk",
+ "Fusion",
+ "Trance",
+ "Classical",
+ "Instrumental",
+ "Acid",
+ "House",
+ "Game",
+ "Sound Clip",
+ "Gospel",
+ "Noise",
+ "Alternative Rock",
+ "Bass",
+ "Soul",
+ "Punk",
+ "Space",
+ "Meditative",
+ "Instrumental Pop",
+ "Instrumental Rock",
+ "Ethnic",
+ "Gothic",
+ "Darkwave",
+ "Techno-Industrial",
+ "Electronic",
+ "Pop-Folk",
+ "Eurodance",
+ "Dream",
+ "Southern Rock",
+ "Comedy",
+ "Cult",
+ "Gangsta",
+ "Top 40",
+ "Christian Rap",
+ "Pop/Funk",
+ "Jungle",
+ "Native American",
+ "Cabaret",
+ "New Wave",
+ "Psychedelic",
+ "Rave",
+ "Showtunes",
+ "Trailer",
+ "Lo-Fi",
+ "Tribal",
+ "Acid Punk",
+ "Acid Jazz",
+ "Polka",
+ "Retro",
+ "Musical",
+ "Rock & Roll",
+ "Hard Rock",
+ "Folk",
+ "Folk/Rock",
+ "National Folk",
+ "Swing",
+ "Fusion",
+ "Bebob",
+ "Latin",
+ "Revival",
+ "Celtic",
+ "Bluegrass",
+ "Avantgarde",
+ "Gothic Rock",
+ "Progressive Rock",
+ "Psychedelic Rock",
+ "Symphonic Rock",
+ "Slow Rock",
+ "Big Band",
+ "Chorus",
+ "Easy Listening",
+ "Acoustic",
+ "Humour",
+ "Speech",
+ "Chanson",
+ "Opera",
+ "Chamber Music",
+ "Sonata",
+ "Symphony",
+ "Booty Bass",
+ "Primus",
+ "Porn Groove",
+ "Satire",
+ "Slow Jam",
+ "Club",
+ "Tango",
+ "Samba",
+ "Folklore",
+ "Ballad",
+ "Power Ballad",
+ "Rhythmic Soul",
+ "Freestyle",
+ "Duet",
+ "Punk Rock",
+ "Drum Solo",
+ "A Cappella",
+ "Euro-House",
+ "Dance Hall",
+ "Goa",
+ "Drum & Bass",
+ "Club-House",
+ "Hardcore",
+ "Terror",
+ "Indie",
+ "BritPop",
+ "Negerpunk",
+ "Polsk Punk",
+ "Beat",
+ "Christian Gangsta Rap",
+ "Heavy Metal",
+ "Black Metal",
+ "Crossover",
+ "Contemporary Christian",
+ "Christian Rock",
+ "Merengue",
+ "Salsa",
+ "Thrash Metal",
+ "Anime",
+ "Jpop",
+ "Synthpop"
+ };
+ }
+}
+
+StringList ID3v1::genreList()
+{
+ static StringList l;
+ if(l.isEmpty()) {
+ for(int i = 0; i < genresSize; i++)
+ l.append(genres[i]);
+ }
+ return l;
+}
+
+ID3v1::GenreMap ID3v1::genreMap()
+{
+ static GenreMap m;
+ if(m.isEmpty()) {
+ for(int i = 0; i < genresSize; i++)
+ m.insert(genres[i], i);
+ }
+ return m;
+}
+
+String ID3v1::genre(int i)
+{
+ if(i >= 0 && i < genresSize)
+ return genres[i];
+ return String::null;
+}
+
+int ID3v1::genreIndex(const String &name)
+{
+ if(genreMap().contains(name))
+ return genreMap()[name];
+ return 255;
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v1/id3v1genres.h b/Frameworks/TagLib/taglib/taglib/mpeg/id3v1/id3v1genres.h
new file mode 100644
index 000000000..271f72590
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v1/id3v1genres.h
@@ -0,0 +1,66 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_ID3V1GENRE_H
+#define TAGLIB_ID3V1GENRE_H
+
+#include "tmap.h"
+#include "tstringlist.h"
+#include "taglib_export.h"
+
+namespace TagLib {
+ namespace ID3v1 {
+
+ typedef Map GenreMap;
+
+ /*!
+ * Returns the list of canonical ID3v1 genre names in the order that they
+ * are listed in the standard.
+ */
+ StringList TAGLIB_EXPORT genreList();
+
+ /*!
+ * A "reverse mapping" that goes from the canonical ID3v1 genre name to the
+ * respective genre number. genreMap()["Rock"] ==
+ */
+ GenreMap TAGLIB_EXPORT genreMap();
+
+ /*!
+ * Returns the name of the genre at \a index in the ID3v1 genre list. If
+ * \a index is out of range -- less than zero or greater than 146 -- a null
+ * string will be returned.
+ */
+ String TAGLIB_EXPORT genre(int index);
+
+ /*!
+ * Returns the genre index for the (case sensitive) genre \a name. If the
+ * genre is not in the list 255 (which signifies an unknown genre in ID3v1)
+ * will be returned.
+ */
+ int TAGLIB_EXPORT genreIndex(const String &name);
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v1/id3v1tag.cpp b/Frameworks/TagLib/taglib/taglib/mpeg/id3v1/id3v1tag.cpp
new file mode 100644
index 000000000..206db26f0
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v1/id3v1tag.cpp
@@ -0,0 +1,284 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+
+#include "id3v1tag.h"
+#include "id3v1genres.h"
+
+using namespace TagLib;
+using namespace ID3v1;
+
+class ID3v1::Tag::TagPrivate
+{
+public:
+ TagPrivate() : file(0), tagOffset(-1), track(0), genre(255) {}
+
+ File *file;
+ long tagOffset;
+
+ String title;
+ String artist;
+ String album;
+ String year;
+ String comment;
+ uchar track;
+ uchar genre;
+
+ static const StringHandler *stringHandler;
+};
+
+const ID3v1::StringHandler *ID3v1::Tag::TagPrivate::stringHandler = new StringHandler;
+
+////////////////////////////////////////////////////////////////////////////////
+// StringHandler implementation
+////////////////////////////////////////////////////////////////////////////////
+
+String ID3v1::StringHandler::parse(const ByteVector &data) const
+{
+ return String(data, String::Latin1).stripWhiteSpace();
+}
+
+ByteVector ID3v1::StringHandler::render(const String &s) const
+{
+ if(!s.isLatin1())
+ {
+ return ByteVector();
+ }
+
+ return s.data(String::Latin1);
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// public methods
+////////////////////////////////////////////////////////////////////////////////
+
+ID3v1::Tag::Tag() : TagLib::Tag()
+{
+ d = new TagPrivate;
+}
+
+ID3v1::Tag::Tag(File *file, long tagOffset) : TagLib::Tag()
+{
+ d = new TagPrivate;
+ d->file = file;
+ d->tagOffset = tagOffset;
+
+ read();
+}
+
+ID3v1::Tag::~Tag()
+{
+ delete d;
+}
+
+ByteVector ID3v1::Tag::render() const
+{
+ ByteVector data;
+
+ data.append(fileIdentifier());
+ data.append(TagPrivate::stringHandler->render(d->title).resize(30));
+ data.append(TagPrivate::stringHandler->render(d->artist).resize(30));
+ data.append(TagPrivate::stringHandler->render(d->album).resize(30));
+ data.append(TagPrivate::stringHandler->render(d->year).resize(4));
+ data.append(TagPrivate::stringHandler->render(d->comment).resize(28));
+ data.append(char(0));
+ data.append(char(d->track));
+ data.append(char(d->genre));
+
+ return data;
+}
+
+ByteVector ID3v1::Tag::fileIdentifier()
+{
+ return ByteVector::fromCString("TAG");
+}
+
+String ID3v1::Tag::title() const
+{
+ return d->title;
+}
+
+String ID3v1::Tag::artist() const
+{
+ return d->artist;
+}
+
+String ID3v1::Tag::album() const
+{
+ return d->album;
+}
+
+String ID3v1::Tag::comment() const
+{
+ return d->comment;
+}
+
+String ID3v1::Tag::genre() const
+{
+ return ID3v1::genre(d->genre);
+}
+
+TagLib::uint ID3v1::Tag::year() const
+{
+ return d->year.toInt();
+}
+
+TagLib::uint ID3v1::Tag::track() const
+{
+ return d->track;
+}
+
+float ID3v1::Tag::rgAlbumGain() const
+{
+ return 0;
+}
+
+float ID3v1::Tag::rgAlbumPeak() const
+{
+ return 0;
+}
+
+float ID3v1::Tag::rgTrackGain() const
+{
+ return 0;
+}
+
+float ID3v1::Tag::rgTrackPeak() const
+{
+ return 0;
+}
+
+void ID3v1::Tag::setTitle(const String &s)
+{
+ d->title = s;
+}
+
+void ID3v1::Tag::setArtist(const String &s)
+{
+ d->artist = s;
+}
+
+void ID3v1::Tag::setAlbum(const String &s)
+{
+ d->album = s;
+}
+
+void ID3v1::Tag::setComment(const String &s)
+{
+ d->comment = s;
+}
+
+void ID3v1::Tag::setGenre(const String &s)
+{
+ d->genre = ID3v1::genreIndex(s);
+}
+
+void ID3v1::Tag::setYear(uint i)
+{
+ d->year = i > 0 ? String::number(i) : String::null;
+}
+
+void ID3v1::Tag::setTrack(uint i)
+{
+ d->track = i < 256 ? i : 0;
+}
+
+void ID3v1::Tag::setStringHandler(const StringHandler *handler)
+{
+ delete TagPrivate::stringHandler;
+ TagPrivate::stringHandler = handler;
+}
+
+void ID3v1::Tag::setRGAlbumGain(float)
+{
+}
+
+void ID3v1::Tag::setRGAlbumPeak(float)
+{
+}
+
+void ID3v1::Tag::setRGTrackGain(float)
+{
+}
+
+void ID3v1::Tag::setRGTrackPeak(float)
+{
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// protected methods
+////////////////////////////////////////////////////////////////////////////////
+
+void ID3v1::Tag::read()
+{
+ if(d->file && d->file->isValid()) {
+ d->file->seek(d->tagOffset);
+ // read the tag -- always 128 bytes
+ ByteVector data = d->file->readBlock(128);
+
+ // some initial sanity checking
+ if(data.size() == 128 && data.startsWith("TAG"))
+ parse(data);
+ else
+ debug("ID3v1 tag is not valid or could not be read at the specified offset.");
+ }
+}
+
+void ID3v1::Tag::parse(const ByteVector &data)
+{
+ int offset = 3;
+
+ d->title = TagPrivate::stringHandler->parse(data.mid(offset, 30));
+ offset += 30;
+
+ d->artist = TagPrivate::stringHandler->parse(data.mid(offset, 30));
+ offset += 30;
+
+ d->album = TagPrivate::stringHandler->parse(data.mid(offset, 30));
+ offset += 30;
+
+ d->year = TagPrivate::stringHandler->parse(data.mid(offset, 4));
+ offset += 4;
+
+ // Check for ID3v1.1 -- Note that ID3v1 *does not* support "track zero" -- this
+ // is not a bug in TagLib. Since a zeroed byte is what we would expect to
+ // indicate the end of a C-String, specifically the comment string, a value of
+ // zero must be assumed to be just that.
+
+ if(data[offset + 28] == 0 && data[offset + 29] != 0) {
+ // ID3v1.1 detected
+
+ d->comment = TagPrivate::stringHandler->parse(data.mid(offset, 28));
+ d->track = uchar(data[offset + 29]);
+ }
+ else
+ d->comment = data.mid(offset, 30);
+
+ offset += 30;
+
+ d->genre = uchar(data[offset]);
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v1/id3v1tag.h b/Frameworks/TagLib/taglib/taglib/mpeg/id3v1/id3v1tag.h
new file mode 100644
index 000000000..0b509daf8
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v1/id3v1tag.h
@@ -0,0 +1,189 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_ID3V1TAG_H
+#define TAGLIB_ID3V1TAG_H
+
+#include "tag.h"
+#include "tbytevector.h"
+#include "taglib_export.h"
+
+namespace TagLib {
+
+ class File;
+
+ //! An ID3v1 implementation
+
+ namespace ID3v1 {
+
+ //! A abstraction for the string to data encoding in ID3v1 tags.
+
+ /*!
+ * ID3v1 should in theory always contain ISO-8859-1 (Latin1) data. In
+ * practice it does not. TagLib by default only supports ISO-8859-1 data
+ * in ID3v1 tags.
+ *
+ * However by subclassing this class and reimplementing parse() and render()
+ * and setting your reimplementation as the default with
+ * ID3v1::Tag::setStringHandler() you can define how you would like these
+ * transformations to be done.
+ *
+ * \warning It is advisable not to write non-ISO-8859-1 data to ID3v1
+ * tags. Please consider disabling the writing of ID3v1 tags in the case
+ * that the data is not ISO-8859-1.
+ *
+ * \see ID3v1::Tag::setStringHandler()
+ */
+
+ class TAGLIB_EXPORT StringHandler
+ {
+ TAGLIB_IGNORE_MISSING_DESTRUCTOR
+ public:
+ // BIC: Add virtual destructor.
+
+ /*!
+ * Decode a string from \a data. The default implementation assumes that
+ * \a data is an ISO-8859-1 (Latin1) character array.
+ */
+ virtual String parse(const ByteVector &data) const;
+
+ /*!
+ * Encode a ByteVector with the data from \a s. The default implementation
+ * assumes that \a s is an ISO-8859-1 (Latin1) string. If the string is
+ * does not conform to ISO-8859-1, no value is written.
+ *
+ * \warning It is recommended that you not override this method, but
+ * instead do not write an ID3v1 tag in the case that the data is not
+ * ISO-8859-1.
+ */
+ virtual ByteVector render(const String &s) const;
+ };
+
+ //! The main class in the ID3v1 implementation
+
+ /*!
+ * This is an implementation of the ID3v1 format. ID3v1 is both the simplist
+ * and most common of tag formats but is rather limited. Because of its
+ * pervasiveness and the way that applications have been written around the
+ * fields that it provides, the generic TagLib::Tag API is a mirror of what is
+ * provided by ID3v1.
+ *
+ * ID3v1 tags should generally only contain Latin1 information. However because
+ * many applications do not follow this rule there is now support for overriding
+ * the ID3v1 string handling using the ID3v1::StringHandler class. Please see
+ * the documentation for that class for more information.
+ *
+ * \see StringHandler
+ *
+ * \note Most fields are truncated to a maximum of 28-30 bytes. The
+ * truncation happens automatically when the tag is rendered.
+ */
+
+ class TAGLIB_EXPORT Tag : public TagLib::Tag
+ {
+ public:
+ /*!
+ * Create an ID3v1 tag with default values.
+ */
+ Tag();
+
+ /*!
+ * Create an ID3v1 tag and parse the data in \a file starting at
+ * \a tagOffset.
+ */
+ Tag(File *file, long tagOffset);
+
+ /*!
+ * Destroys this Tag instance.
+ */
+ virtual ~Tag();
+
+ /*!
+ * Renders the in memory values to a ByteVector suitable for writing to
+ * the file.
+ */
+ ByteVector render() const;
+
+ /*!
+ * Returns the string "TAG" suitable for usage in locating the tag in a
+ * file.
+ */
+ static ByteVector fileIdentifier();
+
+ // Reimplementations.
+
+ virtual String title() const;
+ virtual String artist() const;
+ virtual String album() const;
+ virtual String comment() const;
+ virtual String genre() const;
+ virtual uint year() const;
+ virtual uint track() const;
+ virtual float rgAlbumGain() const;
+ virtual float rgAlbumPeak() const;
+ virtual float rgTrackGain() const;
+ virtual float rgTrackPeak() const;
+
+ virtual void setTitle(const String &s);
+ virtual void setArtist(const String &s);
+ virtual void setAlbum(const String &s);
+ virtual void setComment(const String &s);
+ virtual void setGenre(const String &s);
+ virtual void setYear(uint i);
+ virtual void setTrack(uint i);
+ virtual void setRGAlbumGain(float f);
+ virtual void setRGAlbumPeak(float f);
+ virtual void setRGTrackGain(float f);
+ virtual void setRGTrackPeak(float f);
+
+ /*!
+ * Sets the string handler that decides how the ID3v1 data will be
+ * converted to and from binary data.
+ *
+ * \see StringHandler
+ */
+ static void setStringHandler(const StringHandler *handler);
+
+ protected:
+ /*!
+ * Reads from the file specified in the constructor.
+ */
+ void read();
+ /*!
+ * Pareses the body of the tag in \a data.
+ */
+ void parse(const ByteVector &data);
+
+ private:
+ Tag(const Tag &);
+ Tag &operator=(const Tag &);
+
+ class TagPrivate;
+ TagPrivate *d;
+ };
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/attachedpictureframe.cpp b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/attachedpictureframe.cpp
new file mode 100644
index 000000000..e4e97d01f
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/attachedpictureframe.cpp
@@ -0,0 +1,222 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include "attachedpictureframe.h"
+
+#include
+#include
+
+using namespace TagLib;
+using namespace ID3v2;
+
+class AttachedPictureFrame::AttachedPictureFramePrivate
+{
+public:
+ AttachedPictureFramePrivate() : textEncoding(String::Latin1),
+ type(AttachedPictureFrame::Other) {}
+
+ String::Type textEncoding;
+ String mimeType;
+ AttachedPictureFrame::Type type;
+ String description;
+ ByteVector data;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+AttachedPictureFrame::AttachedPictureFrame() : Frame("APIC")
+{
+ d = new AttachedPictureFramePrivate;
+}
+
+AttachedPictureFrame::AttachedPictureFrame(const ByteVector &data) : Frame(data)
+{
+ d = new AttachedPictureFramePrivate;
+ setData(data);
+}
+
+AttachedPictureFrame::~AttachedPictureFrame()
+{
+ delete d;
+}
+
+String AttachedPictureFrame::toString() const
+{
+ String s = "[" + d->mimeType + "]";
+ return d->description.isEmpty() ? s : d->description + " " + s;
+}
+
+String::Type AttachedPictureFrame::textEncoding() const
+{
+ return d->textEncoding;
+}
+
+void AttachedPictureFrame::setTextEncoding(String::Type t)
+{
+ d->textEncoding = t;
+}
+
+String AttachedPictureFrame::mimeType() const
+{
+ return d->mimeType;
+}
+
+void AttachedPictureFrame::setMimeType(const String &m)
+{
+ d->mimeType = m;
+}
+
+AttachedPictureFrame::Type AttachedPictureFrame::type() const
+{
+ return d->type;
+}
+
+void AttachedPictureFrame::setType(Type t)
+{
+ d->type = t;
+}
+
+String AttachedPictureFrame::description() const
+{
+ return d->description;
+}
+
+void AttachedPictureFrame::setDescription(const String &desc)
+{
+ d->description = desc;
+}
+
+ByteVector AttachedPictureFrame::picture() const
+{
+ return d->data;
+}
+
+void AttachedPictureFrame::setPicture(const ByteVector &p)
+{
+ d->data = p;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// protected members
+////////////////////////////////////////////////////////////////////////////////
+
+void AttachedPictureFrame::parseFields(const ByteVector &data)
+{
+ if(data.size() < 5) {
+ debug("A picture frame must contain at least 5 bytes.");
+ return;
+ }
+
+ d->textEncoding = String::Type(data[0]);
+
+ int pos = 1;
+
+ d->mimeType = readStringField(data, String::Latin1, &pos);
+ /* Now we need at least two more bytes available */
+ if (uint(pos) + 1 >= data.size()) {
+ debug("Truncated picture frame.");
+ return;
+ }
+
+ d->type = (TagLib::ID3v2::AttachedPictureFrame::Type)data[pos++];
+ d->description = readStringField(data, d->textEncoding, &pos);
+
+ d->data = data.mid(pos);
+}
+
+ByteVector AttachedPictureFrame::renderFields() const
+{
+ ByteVector data;
+
+ String::Type encoding = checkEncoding(d->description, d->textEncoding);
+
+ data.append(char(encoding));
+ data.append(d->mimeType.data(String::Latin1));
+ data.append(textDelimiter(String::Latin1));
+ data.append(char(d->type));
+ data.append(d->description.data(encoding));
+ data.append(textDelimiter(encoding));
+ data.append(d->data);
+
+ return data;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+AttachedPictureFrame::AttachedPictureFrame(const ByteVector &data, Header *h) : Frame(h)
+{
+ d = new AttachedPictureFramePrivate;
+ parseFields(fieldData(data));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// support for ID3v2.2 PIC frames
+////////////////////////////////////////////////////////////////////////////////
+
+void AttachedPictureFrameV22::parseFields(const ByteVector &data)
+{
+ if(data.size() < 5) {
+ debug("A picture frame must contain at least 5 bytes.");
+ return;
+ }
+
+ d->textEncoding = String::Type(data[0]);
+
+ int pos = 1;
+
+ String fixedString = String(data.mid(pos, 3), String::Latin1);
+ pos += 3;
+ // convert fixed string image type to mime string
+ if (fixedString.upper() == "JPG") {
+ d->mimeType = "image/jpeg";
+ } else if (fixedString.upper() == "PNG") {
+ d->mimeType = "image/png";
+ } else {
+ debug("probably unsupported image type");
+ d->mimeType = "image/" + fixedString;
+ }
+
+ d->type = (TagLib::ID3v2::AttachedPictureFrame::Type)data[pos++];
+ d->description = readStringField(data, d->textEncoding, &pos);
+
+ d->data = data.mid(pos);
+}
+
+AttachedPictureFrameV22::AttachedPictureFrameV22(const ByteVector &data, Header *h)
+{
+ // set v2.2 header to make fieldData work correctly
+ setHeader(h, true);
+
+ parseFields(fieldData(data));
+
+ // now set the v2.4 header
+ Frame::Header *newHeader = new Frame::Header("APIC");
+ newHeader->setFrameSize(h->frameSize());
+ setHeader(newHeader, true);
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/attachedpictureframe.h b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/attachedpictureframe.h
new file mode 100644
index 000000000..55067bd2d
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/attachedpictureframe.h
@@ -0,0 +1,230 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_ATTACHEDPICTUREFRAME_H
+#define TAGLIB_ATTACHEDPICTUREFRAME_H
+
+#include "id3v2frame.h"
+#include "id3v2header.h"
+#include "taglib_export.h"
+
+namespace TagLib {
+
+ namespace ID3v2 {
+
+ //! An ID3v2 attached picture frame implementation
+
+ /*!
+ * This is an implementation of ID3v2 attached pictures. Pictures may be
+ * included in tags, one per APIC frame (but there may be multiple APIC
+ * frames in a single tag). These pictures are usually in either JPEG or
+ * PNG format.
+ */
+
+ class TAGLIB_EXPORT AttachedPictureFrame : public Frame
+ {
+ friend class FrameFactory;
+
+ public:
+
+ /*!
+ * This describes the function or content of the picture.
+ */
+ enum Type {
+ //! A type not enumerated below
+ Other = 0x00,
+ //! 32x32 PNG image that should be used as the file icon
+ FileIcon = 0x01,
+ //! File icon of a different size or format
+ OtherFileIcon = 0x02,
+ //! Front cover image of the album
+ FrontCover = 0x03,
+ //! Back cover image of the album
+ BackCover = 0x04,
+ //! Inside leaflet page of the album
+ LeafletPage = 0x05,
+ //! Image from the album itself
+ Media = 0x06,
+ //! Picture of the lead artist or soloist
+ LeadArtist = 0x07,
+ //! Picture of the artist or performer
+ Artist = 0x08,
+ //! Picture of the conductor
+ Conductor = 0x09,
+ //! Picture of the band or orchestra
+ Band = 0x0A,
+ //! Picture of the composer
+ Composer = 0x0B,
+ //! Picture of the lyricist or text writer
+ Lyricist = 0x0C,
+ //! Picture of the recording location or studio
+ RecordingLocation = 0x0D,
+ //! Picture of the artists during recording
+ DuringRecording = 0x0E,
+ //! Picture of the artists during performance
+ DuringPerformance = 0x0F,
+ //! Picture from a movie or video related to the track
+ MovieScreenCapture = 0x10,
+ //! Picture of a large, coloured fish
+ ColouredFish = 0x11,
+ //! Illustration related to the track
+ Illustration = 0x12,
+ //! Logo of the band or performer
+ BandLogo = 0x13,
+ //! Logo of the publisher (record company)
+ PublisherLogo = 0x14
+ };
+
+ /*!
+ * Constructs an empty picture frame. The description, content and text
+ * encoding should be set manually.
+ */
+ AttachedPictureFrame();
+
+ /*!
+ * Constructs an AttachedPicture frame based on \a data.
+ */
+ explicit AttachedPictureFrame(const ByteVector &data);
+
+ /*!
+ * Destroys the AttahcedPictureFrame instance.
+ */
+ virtual ~AttachedPictureFrame();
+
+ /*!
+ * Returns a string containing the description and mime-type
+ */
+ virtual String toString() const;
+
+ /*!
+ * Returns the text encoding used for the description.
+ *
+ * \see setTextEncoding()
+ * \see description()
+ */
+ String::Type textEncoding() const;
+
+ /*!
+ * Set the text encoding used for the description.
+ *
+ * \see description()
+ */
+ void setTextEncoding(String::Type t);
+
+ /*!
+ * Returns the mime type of the image. This should in most cases be
+ * "image/png" or "image/jpeg".
+ */
+ String mimeType() const;
+
+ /*!
+ * Sets the mime type of the image. This should in most cases be
+ * "image/png" or "image/jpeg".
+ */
+ void setMimeType(const String &m);
+
+ /*!
+ * Returns the type of the image.
+ *
+ * \see Type
+ * \see setType()
+ */
+ Type type() const;
+
+ /*!
+ * Sets the type for the image.
+ *
+ * \see Type
+ * \see type()
+ */
+ void setType(Type t);
+
+ /*!
+ * Returns a text description of the image.
+ *
+ * \see setDescription()
+ * \see textEncoding()
+ * \see setTextEncoding()
+ */
+
+ String description() const;
+
+ /*!
+ * Sets a textual description of the image to \a desc.
+ *
+ * \see description()
+ * \see textEncoding()
+ * \see setTextEncoding()
+ */
+
+ void setDescription(const String &desc);
+
+ /*!
+ * Returns the image data as a ByteVector.
+ *
+ * \note ByteVector has a data() method that returns a const char * which
+ * should make it easy to export this data to external programs.
+ *
+ * \see setPicture()
+ * \see mimeType()
+ */
+ ByteVector picture() const;
+
+ /*!
+ * Sets the image data to \a p. \a p should be of the type specified in
+ * this frame's mime-type specification.
+ *
+ * \see picture()
+ * \see mimeType()
+ * \see setMimeType()
+ */
+ void setPicture(const ByteVector &p);
+
+ protected:
+ virtual void parseFields(const ByteVector &data);
+ virtual ByteVector renderFields() const;
+ class AttachedPictureFramePrivate;
+ AttachedPictureFramePrivate *d;
+
+ private:
+ AttachedPictureFrame(const AttachedPictureFrame &);
+ AttachedPictureFrame &operator=(const AttachedPictureFrame &);
+ AttachedPictureFrame(const ByteVector &data, Header *h);
+
+ };
+
+ //! support for ID3v2.2 PIC frames
+ class TAGLIB_EXPORT AttachedPictureFrameV22 : public AttachedPictureFrame
+ {
+ protected:
+ virtual void parseFields(const ByteVector &data);
+ private:
+ AttachedPictureFrameV22(const ByteVector &data, Header *h);
+ friend class FrameFactory;
+ };
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/commentsframe.cpp b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/commentsframe.cpp
new file mode 100644
index 000000000..406598d99
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/commentsframe.cpp
@@ -0,0 +1,178 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+#include
+#include
+
+#include "commentsframe.h"
+
+using namespace TagLib;
+using namespace ID3v2;
+
+class CommentsFrame::CommentsFramePrivate
+{
+public:
+ CommentsFramePrivate() : textEncoding(String::Latin1) {}
+ String::Type textEncoding;
+ ByteVector language;
+ String description;
+ String text;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+CommentsFrame::CommentsFrame(String::Type encoding) : Frame("COMM")
+{
+ d = new CommentsFramePrivate;
+ d->textEncoding = encoding;
+}
+
+CommentsFrame::CommentsFrame(const ByteVector &data) : Frame(data)
+{
+ d = new CommentsFramePrivate;
+ setData(data);
+}
+
+CommentsFrame::~CommentsFrame()
+{
+ delete d;
+}
+
+String CommentsFrame::toString() const
+{
+ return d->text;
+}
+
+ByteVector CommentsFrame::language() const
+{
+ return d->language;
+}
+
+String CommentsFrame::description() const
+{
+ return d->description;
+}
+
+String CommentsFrame::text() const
+{
+ return d->text;
+}
+
+void CommentsFrame::setLanguage(const ByteVector &languageEncoding)
+{
+ d->language = languageEncoding.mid(0, 3);
+}
+
+void CommentsFrame::setDescription(const String &s)
+{
+ d->description = s;
+}
+
+void CommentsFrame::setText(const String &s)
+{
+ d->text = s;
+}
+
+String::Type CommentsFrame::textEncoding() const
+{
+ return d->textEncoding;
+}
+
+void CommentsFrame::setTextEncoding(String::Type encoding)
+{
+ d->textEncoding = encoding;
+}
+
+CommentsFrame *CommentsFrame::findByDescription(const ID3v2::Tag *tag, const String &d) // static
+{
+ ID3v2::FrameList comments = tag->frameList("COMM");
+
+ for(ID3v2::FrameList::ConstIterator it = comments.begin();
+ it != comments.end();
+ ++it)
+ {
+ CommentsFrame *frame = dynamic_cast(*it);
+ if(frame && frame->description() == d)
+ return frame;
+ }
+
+ return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// protected members
+////////////////////////////////////////////////////////////////////////////////
+
+void CommentsFrame::parseFields(const ByteVector &data)
+{
+ if(data.size() < 5) {
+ debug("A comment frame must contain at least 5 bytes.");
+ return;
+ }
+
+ d->textEncoding = String::Type(data[0]);
+ d->language = data.mid(1, 3);
+
+ int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
+
+ ByteVectorList l = ByteVectorList::split(data.mid(4), textDelimiter(d->textEncoding), byteAlign, 2);
+
+ if(l.size() == 2) {
+ d->description = String(l.front(), d->textEncoding);
+ d->text = String(l.back(), d->textEncoding);
+ }
+}
+
+ByteVector CommentsFrame::renderFields() const
+{
+ ByteVector v;
+
+ String::Type encoding = d->textEncoding;
+
+ encoding = checkEncoding(d->description, encoding);
+ encoding = checkEncoding(d->text, encoding);
+
+ v.append(char(encoding));
+ v.append(d->language.size() == 3 ? d->language : "XXX");
+ v.append(d->description.data(encoding));
+ v.append(textDelimiter(encoding));
+ v.append(d->text.data(encoding));
+
+ return v;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+CommentsFrame::CommentsFrame(const ByteVector &data, Header *h) : Frame(h)
+{
+ d = new CommentsFramePrivate();
+ parseFields(fieldData(data));
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/commentsframe.h b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/commentsframe.h
new file mode 100644
index 000000000..def01dcfc
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/commentsframe.h
@@ -0,0 +1,168 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_COMMENTSFRAME_H
+#define TAGLIB_COMMENTSFRAME_H
+
+#include "id3v2frame.h"
+#include "taglib_export.h"
+
+namespace TagLib {
+
+ namespace ID3v2 {
+
+ //! An implementation of ID3v2 comments
+
+ /*!
+ * This implements the ID3v2 comment format. An ID3v2 comment concists of
+ * a language encoding, a description and a single text field.
+ */
+
+ class TAGLIB_EXPORT CommentsFrame : public Frame
+ {
+ friend class FrameFactory;
+
+ public:
+ /*!
+ * Construct an empty comment frame that will use the text encoding
+ * \a encoding.
+ */
+ explicit CommentsFrame(String::Type encoding = String::Latin1);
+
+ /*!
+ * Construct a comment based on the data in \a data.
+ */
+ explicit CommentsFrame(const ByteVector &data);
+
+ /*!
+ * Destroys this CommentFrame instance.
+ */
+ virtual ~CommentsFrame();
+
+ /*!
+ * Returns the text of this comment.
+ *
+ * \see text()
+ */
+ virtual String toString() const;
+
+ /*!
+ * Returns the language encoding as a 3 byte encoding as specified by
+ * ISO-639-2.
+ *
+ * \note Most taggers simply ignore this value.
+ *
+ * \see setLanguage()
+ */
+ ByteVector language() const;
+
+ /*!
+ * Returns the description of this comment.
+ *
+ * \note Most taggers simply ignore this value.
+ *
+ * \see setDescription()
+ */
+ String description() const;
+
+ /*!
+ * Returns the text of this comment.
+ *
+ * \see setText()
+ */
+ String text() const;
+
+ /*!
+ * Set the language using the 3 byte language code from
+ * ISO-639-2 to
+ * \a languageCode.
+ *
+ * \see language()
+ */
+ void setLanguage(const ByteVector &languageCode);
+
+ /*!
+ * Sets the description of the comment to \a s.
+ *
+ * \see decription()
+ */
+ void setDescription(const String &s);
+
+ /*!
+ * Sets the text portion of the comment to \a s.
+ *
+ * \see text()
+ */
+ virtual void setText(const String &s);
+
+ /*!
+ * Returns the text encoding that will be used in rendering this frame.
+ * This defaults to the type that was either specified in the constructor
+ * or read from the frame when parsed.
+ *
+ * \see setTextEncoding()
+ * \see render()
+ */
+ String::Type textEncoding() const;
+
+ /*!
+ * Sets the text encoding to be used when rendering this frame to
+ * \a encoding.
+ *
+ * \see textEncoding()
+ * \see render()
+ */
+ void setTextEncoding(String::Type encoding);
+
+ /*!
+ * Comments each have a unique description. This searches for a comment
+ * frame with the decription \a d and returns a pointer to it. If no
+ * frame is found that matches the given description null is returned.
+ *
+ * \see description()
+ */
+ static CommentsFrame *findByDescription(const Tag *tag, const String &d);
+
+ protected:
+ // Reimplementations.
+
+ virtual void parseFields(const ByteVector &data);
+ virtual ByteVector renderFields() const;
+
+ private:
+ /*!
+ * The constructor used by the FrameFactory.
+ */
+ CommentsFrame(const ByteVector &data, Header *h);
+ CommentsFrame(const CommentsFrame &);
+ CommentsFrame &operator=(const CommentsFrame &);
+
+ class CommentsFramePrivate;
+ CommentsFramePrivate *d;
+ };
+
+ }
+}
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/generalencapsulatedobjectframe.cpp b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/generalencapsulatedobjectframe.cpp
new file mode 100644
index 000000000..fa3509b13
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/generalencapsulatedobjectframe.cpp
@@ -0,0 +1,176 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ copyright : (C) 2006 by Aaron VonderHaar
+ email : avh4@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+
+#include "generalencapsulatedobjectframe.h"
+
+using namespace TagLib;
+using namespace ID3v2;
+
+class GeneralEncapsulatedObjectFrame::GeneralEncapsulatedObjectFramePrivate
+{
+public:
+ GeneralEncapsulatedObjectFramePrivate() : textEncoding(String::Latin1) {}
+
+ String::Type textEncoding;
+ String mimeType;
+ String fileName;
+ String description;
+ ByteVector data;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+GeneralEncapsulatedObjectFrame::GeneralEncapsulatedObjectFrame() : Frame("GEOB")
+{
+ d = new GeneralEncapsulatedObjectFramePrivate;
+}
+
+GeneralEncapsulatedObjectFrame::GeneralEncapsulatedObjectFrame(const ByteVector &data) : Frame(data)
+{
+ d = new GeneralEncapsulatedObjectFramePrivate;
+ setData(data);
+}
+
+GeneralEncapsulatedObjectFrame::~GeneralEncapsulatedObjectFrame()
+{
+ delete d;
+}
+
+String GeneralEncapsulatedObjectFrame::toString() const
+{
+ String text = "[" + d->mimeType + "]";
+
+ if(!d->fileName.isEmpty())
+ text += " " + d->fileName;
+
+ if(!d->description.isEmpty())
+ text += " \"" + d->description + "\"";
+
+ return text;
+}
+
+String::Type GeneralEncapsulatedObjectFrame::textEncoding() const
+{
+ return d->textEncoding;
+}
+
+void GeneralEncapsulatedObjectFrame::setTextEncoding(String::Type encoding)
+{
+ d->textEncoding = encoding;
+}
+
+String GeneralEncapsulatedObjectFrame::mimeType() const
+{
+ return d->mimeType;
+}
+
+void GeneralEncapsulatedObjectFrame::setMimeType(const String &type)
+{
+ d->mimeType = type;
+}
+
+String GeneralEncapsulatedObjectFrame::fileName() const
+{
+ return d->fileName;
+}
+
+void GeneralEncapsulatedObjectFrame::setFileName(const String &name)
+{
+ d->fileName = name;
+}
+
+String GeneralEncapsulatedObjectFrame::description() const
+{
+ return d->description;
+}
+
+void GeneralEncapsulatedObjectFrame::setDescription(const String &desc)
+{
+ d->description = desc;
+}
+
+ByteVector GeneralEncapsulatedObjectFrame::object() const
+{
+ return d->data;
+}
+
+void GeneralEncapsulatedObjectFrame::setObject(const ByteVector &data)
+{
+ d->data = data;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// protected members
+////////////////////////////////////////////////////////////////////////////////
+
+void GeneralEncapsulatedObjectFrame::parseFields(const ByteVector &data)
+{
+ if(data.size() < 4) {
+ debug("An object frame must contain at least 4 bytes.");
+ return;
+ }
+
+ d->textEncoding = String::Type(data[0]);
+
+ int pos = 1;
+
+ d->mimeType = readStringField(data, String::Latin1, &pos);
+ d->fileName = readStringField(data, d->textEncoding, &pos);
+ d->description = readStringField(data, d->textEncoding, &pos);
+
+ d->data = data.mid(pos);
+}
+
+ByteVector GeneralEncapsulatedObjectFrame::renderFields() const
+{
+ ByteVector data;
+
+ data.append(char(d->textEncoding));
+ data.append(d->mimeType.data(String::Latin1));
+ data.append(textDelimiter(String::Latin1));
+ data.append(d->fileName.data(d->textEncoding));
+ data.append(textDelimiter(d->textEncoding));
+ data.append(d->description.data(d->textEncoding));
+ data.append(textDelimiter(d->textEncoding));
+ data.append(d->data);
+
+ return data;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+GeneralEncapsulatedObjectFrame::GeneralEncapsulatedObjectFrame(const ByteVector &data, Header *h) : Frame(h)
+{
+ d = new GeneralEncapsulatedObjectFramePrivate;
+ parseFields(fieldData(data));
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/generalencapsulatedobjectframe.h b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/generalencapsulatedobjectframe.h
new file mode 100644
index 000000000..42f854ccd
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/generalencapsulatedobjectframe.h
@@ -0,0 +1,178 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ copyright : (C) 2006 by Aaron VonderHaar
+ email : avh4@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_GENERALENCAPSULATEDOBJECT_H
+#define TAGLIB_GENERALENCAPSULATEDOBJECT_H
+
+#include "id3v2frame.h"
+#include "id3v2header.h"
+#include "taglib_export.h"
+
+namespace TagLib {
+
+ namespace ID3v2 {
+
+ //! An ID3v2 general encapsulated object frame implementation
+
+ /*!
+ * This is an implementation of ID3v2 general encapsulated objects.
+ * Arbitrary binary data may be included in tags, stored in GEOB frames.
+ * There may be multiple GEOB frames in a single tag. Each GEOB it
+ * labelled with a content description (which may be blank), a required
+ * mime-type, and a file name (may be blank). The content description
+ * uniquely identifies the GEOB frame in the tag.
+ */
+
+ class TAGLIB_EXPORT GeneralEncapsulatedObjectFrame : public Frame
+ {
+ friend class FrameFactory;
+
+ public:
+
+ /*!
+ * Constructs an empty object frame. The description, file name and text
+ * encoding should be set manually.
+ */
+ GeneralEncapsulatedObjectFrame();
+
+ /*!
+ * Constructs a GeneralEncapsulatedObjectFrame frame based on \a data.
+ *
+ * \warning This is \em not data for the encapsulated object, for that use
+ * setObject(). This constructor is used when reading the frame from the
+ * disk.
+ */
+ explicit GeneralEncapsulatedObjectFrame(const ByteVector &data);
+
+ /*!
+ * Destroys the GeneralEncapsulatedObjectFrame instance.
+ */
+ virtual ~GeneralEncapsulatedObjectFrame();
+
+ /*!
+ * Returns a string containing the description, file name and mime-type
+ */
+ virtual String toString() const;
+
+ /*!
+ * Returns the text encoding used for the description and file name.
+ *
+ * \see setTextEncoding()
+ * \see description()
+ * \see fileName()
+ */
+ String::Type textEncoding() const;
+
+ /*!
+ * Set the text encoding used for the description and file name.
+ *
+ * \see description()
+ * \see fileName()
+ */
+ void setTextEncoding(String::Type encoding);
+
+ /*!
+ * Returns the mime type of the object.
+ */
+ String mimeType() const;
+
+ /*!
+ * Sets the mime type of the object.
+ */
+ void setMimeType(const String &type);
+
+ /*!
+ * Returns the file name of the object.
+ *
+ * \see setFileName()
+ */
+ String fileName() const;
+
+ /*!
+ * Sets the file name for the object.
+ *
+ * \see fileName()
+ */
+ void setFileName(const String &name);
+
+ /*!
+ * Returns the content description of the object.
+ *
+ * \see setDescription()
+ * \see textEncoding()
+ * \see setTextEncoding()
+ */
+
+ String description() const;
+
+ /*!
+ * Sets the content description of the object to \a desc.
+ *
+ * \see description()
+ * \see textEncoding()
+ * \see setTextEncoding()
+ */
+
+ void setDescription(const String &desc);
+
+ /*!
+ * Returns the object data as a ByteVector.
+ *
+ * \note ByteVector has a data() method that returns a const char * which
+ * should make it easy to export this data to external programs.
+ *
+ * \see setObject()
+ * \see mimeType()
+ */
+ ByteVector object() const;
+
+ /*!
+ * Sets the object data to \a data. \a data should be of the type specified in
+ * this frame's mime-type specification.
+ *
+ * \see object()
+ * \see mimeType()
+ * \see setMimeType()
+ */
+ void setObject(const ByteVector &object);
+
+ protected:
+ virtual void parseFields(const ByteVector &data);
+ virtual ByteVector renderFields() const;
+
+ private:
+ GeneralEncapsulatedObjectFrame(const ByteVector &data, Header *h);
+ GeneralEncapsulatedObjectFrame(const GeneralEncapsulatedObjectFrame &);
+ GeneralEncapsulatedObjectFrame &operator=(const GeneralEncapsulatedObjectFrame &);
+
+ class GeneralEncapsulatedObjectFramePrivate;
+ GeneralEncapsulatedObjectFramePrivate *d;
+ };
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/relativevolumeframe.cpp b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/relativevolumeframe.cpp
new file mode 100644
index 000000000..955b3ad03
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/relativevolumeframe.cpp
@@ -0,0 +1,236 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+
+#include "relativevolumeframe.h"
+
+using namespace TagLib;
+using namespace ID3v2;
+
+static inline int bitsToBytes(int i)
+{
+ return i % 8 == 0 ? i / 8 : (i - i % 8) / 8 + 1;
+}
+
+struct ChannelData
+{
+ ChannelData() : channelType(RelativeVolumeFrame::Other), volumeAdjustment(0) {}
+
+ RelativeVolumeFrame::ChannelType channelType;
+ short volumeAdjustment;
+ RelativeVolumeFrame::PeakVolume peakVolume;
+};
+
+class RelativeVolumeFrame::RelativeVolumeFramePrivate
+{
+public:
+ String identification;
+ Map channels;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+RelativeVolumeFrame::RelativeVolumeFrame() : Frame("RVA2")
+{
+ d = new RelativeVolumeFramePrivate;
+}
+
+RelativeVolumeFrame::RelativeVolumeFrame(const ByteVector &data) : Frame(data)
+{
+ d = new RelativeVolumeFramePrivate;
+ setData(data);
+}
+
+RelativeVolumeFrame::~RelativeVolumeFrame()
+{
+ delete d;
+}
+
+String RelativeVolumeFrame::toString() const
+{
+ return d->identification;
+}
+
+List RelativeVolumeFrame::channels() const
+{
+ List l;
+
+ Map::ConstIterator it = d->channels.begin();
+ for(; it != d->channels.end(); ++it)
+ l.append((*it).first);
+
+ return l;
+}
+
+// deprecated
+
+RelativeVolumeFrame::ChannelType RelativeVolumeFrame::channelType() const
+{
+ return MasterVolume;
+}
+
+// deprecated
+
+void RelativeVolumeFrame::setChannelType(ChannelType)
+{
+
+}
+
+short RelativeVolumeFrame::volumeAdjustmentIndex(ChannelType type) const
+{
+ return d->channels.contains(type) ? d->channels[type].volumeAdjustment : 0;
+}
+
+short RelativeVolumeFrame::volumeAdjustmentIndex() const
+{
+ return volumeAdjustmentIndex(MasterVolume);
+}
+
+void RelativeVolumeFrame::setVolumeAdjustmentIndex(short index, ChannelType type)
+{
+ d->channels[type].volumeAdjustment = index;
+}
+
+void RelativeVolumeFrame::setVolumeAdjustmentIndex(short index)
+{
+ setVolumeAdjustmentIndex(index, MasterVolume);
+}
+
+float RelativeVolumeFrame::volumeAdjustment(ChannelType type) const
+{
+ return d->channels.contains(type) ? float(d->channels[type].volumeAdjustment) / float(512) : 0;
+}
+
+float RelativeVolumeFrame::volumeAdjustment() const
+{
+ return volumeAdjustment(MasterVolume);
+}
+
+void RelativeVolumeFrame::setVolumeAdjustment(float adjustment, ChannelType type)
+{
+ d->channels[type].volumeAdjustment = short(adjustment * float(512));
+}
+
+void RelativeVolumeFrame::setVolumeAdjustment(float adjustment)
+{
+ setVolumeAdjustment(adjustment, MasterVolume);
+}
+
+RelativeVolumeFrame::PeakVolume RelativeVolumeFrame::peakVolume(ChannelType type) const
+{
+ return d->channels.contains(type) ? d->channels[type].peakVolume : PeakVolume();
+}
+
+RelativeVolumeFrame::PeakVolume RelativeVolumeFrame::peakVolume() const
+{
+ return peakVolume(MasterVolume);
+}
+
+void RelativeVolumeFrame::setPeakVolume(const PeakVolume &peak, ChannelType type)
+{
+ d->channels[type].peakVolume = peak;
+}
+
+void RelativeVolumeFrame::setPeakVolume(const PeakVolume &peak)
+{
+ setPeakVolume(peak, MasterVolume);
+}
+
+String RelativeVolumeFrame::identification() const
+{
+ return d->identification;
+}
+
+void RelativeVolumeFrame::setIdentification(const String &s)
+{
+ d->identification = s;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// protected members
+////////////////////////////////////////////////////////////////////////////////
+
+void RelativeVolumeFrame::parseFields(const ByteVector &data)
+{
+ int pos = 0;
+ d->identification = readStringField(data, String::Latin1, &pos);
+
+ // Each channel is at least 4 bytes.
+
+ while(pos <= (int)data.size() - 4) {
+
+
+ ChannelType type = ChannelType(data[pos]);
+ pos += 1;
+
+ ChannelData &channel = d->channels[type];
+
+ channel.volumeAdjustment = data.mid(pos, 2).toShort();
+ pos += 2;
+
+ channel.peakVolume.bitsRepresentingPeak = data[pos];
+ pos += 1;
+
+ int bytes = bitsToBytes(channel.peakVolume.bitsRepresentingPeak);
+ channel.peakVolume.peakVolume = data.mid(pos, bytes);
+ pos += bytes;
+ }
+}
+
+ByteVector RelativeVolumeFrame::renderFields() const
+{
+ ByteVector data;
+
+ data.append(d->identification.data(String::Latin1));
+ data.append(textDelimiter(String::Latin1));
+
+ Map::ConstIterator it = d->channels.begin();
+
+ for(; it != d->channels.end(); ++it) {
+ ChannelType type = (*it).first;
+ const ChannelData &channel = (*it).second;
+
+ data.append(char(type));
+ data.append(ByteVector::fromShort(channel.volumeAdjustment));
+ data.append(char(channel.peakVolume.bitsRepresentingPeak));
+ data.append(channel.peakVolume.peakVolume);
+ }
+
+ return data;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+RelativeVolumeFrame::RelativeVolumeFrame(const ByteVector &data, Header *h) : Frame(h)
+{
+ d = new RelativeVolumeFramePrivate;
+ parseFields(fieldData(data));
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/relativevolumeframe.h b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/relativevolumeframe.h
new file mode 100644
index 000000000..dad4e7d4e
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/relativevolumeframe.h
@@ -0,0 +1,274 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_RELATIVEVOLUMEFRAME_H
+#define TAGLIB_RELATIVEVOLUMEFRAME_H
+
+#include "tlist.h"
+#include "id3v2frame.h"
+#include "taglib_export.h"
+
+namespace TagLib {
+
+ namespace ID3v2 {
+
+ //! An ID3v2 relative volume adjustment frame implementation
+
+ /*!
+ * This is an implementation of ID3v2 relative volume adjustment. The
+ * presence of this frame makes it possible to specify an increase in volume
+ * for an audio file or specific audio tracks in that file.
+ *
+ * Multiple relative volume adjustment frames may be present in the tag
+ * each with a unique identification and describing volume adjustment for
+ * different channel types.
+ */
+
+ class TAGLIB_EXPORT RelativeVolumeFrame : public Frame
+ {
+ friend class FrameFactory;
+
+ public:
+
+ /*!
+ * This indicates the type of volume adjustment that should be applied.
+ */
+ enum ChannelType {
+ //! A type not enumerated below
+ Other = 0x00,
+ //! The master volume for the track
+ MasterVolume = 0x01,
+ //! The front right audio channel
+ FrontRight = 0x02,
+ //! The front left audio channel
+ FrontLeft = 0x03,
+ //! The back right audio channel
+ BackRight = 0x04,
+ //! The back left audio channel
+ BackLeft = 0x05,
+ //! The front center audio channel
+ FrontCentre = 0x06,
+ //! The back center audio channel
+ BackCentre = 0x07,
+ //! The subwoofer audio channel
+ Subwoofer = 0x08
+ };
+
+ //! Struct that stores the relevant values for ID3v2 peak volume
+
+ /*!
+ * The peak volume is described as a series of bits that is padded to fill
+ * a block of bytes. These two values should always be updated in tandem.
+ */
+ struct PeakVolume
+ {
+ /*!
+ * Constructs an empty peak volume description.
+ */
+ PeakVolume() : bitsRepresentingPeak(0) {}
+ /*!
+ * The number of bits (in the range of 0 to 255) used to describe the
+ * peak volume.
+ */
+ unsigned char bitsRepresentingPeak;
+ /*!
+ * The array of bits (represented as a series of bytes) used to describe
+ * the peak volume.
+ */
+ ByteVector peakVolume;
+ };
+
+ /*!
+ * Constructs a RelativeVolumeFrame. The relevant data should be set
+ * manually.
+ */
+ RelativeVolumeFrame();
+
+ /*!
+ * Constructs a RelativeVolumeFrame based on the contents of \a data.
+ */
+ RelativeVolumeFrame(const ByteVector &data);
+
+ /*!
+ * Destroys the RelativeVolumeFrame instance.
+ */
+ virtual ~RelativeVolumeFrame();
+
+ /*!
+ * Returns the frame's identification.
+ *
+ * \see identification()
+ */
+ virtual String toString() const;
+
+ /*!
+ * Returns a list of channels with information currently in the frame.
+ */
+ List channels() const;
+
+ /*!
+ * \deprecated Always returns master volume.
+ */
+ ChannelType channelType() const;
+
+ /*!
+ * \deprecated This method no longer has any effect.
+ */
+ void setChannelType(ChannelType t);
+
+ /*
+ * There was a terrible API goof here, and while this can't be changed to
+ * the way it appears below for binary compaibility reasons, let's at
+ * least pretend that it looks clean.
+ */
+
+#ifdef DOXYGEN
+
+ /*!
+ * Returns the relative volume adjustment "index". As indicated by the
+ * ID3v2 standard this is a 16-bit signed integer that reflects the
+ * decibils of adjustment when divided by 512.
+ *
+ * This defaults to returning the value for the master volume channel if
+ * available and returns 0 if the specified channel does not exist.
+ *
+ * \see setVolumeAdjustmentIndex()
+ * \see volumeAjustment()
+ */
+ short volumeAdjustmentIndex(ChannelType type = MasterVolume) const;
+
+ /*!
+ * Set the volume adjustment to \a index. As indicated by the ID3v2
+ * standard this is a 16-bit signed integer that reflects the decibils of
+ * adjustment when divided by 512.
+ *
+ * By default this sets the value for the master volume.
+ *
+ * \see volumeAdjustmentIndex()
+ * \see setVolumeAjustment()
+ */
+ void setVolumeAdjustmentIndex(short index, ChannelType type = MasterVolume);
+
+ /*!
+ * Returns the relative volume adjustment in decibels.
+ *
+ * \note Because this is actually stored internally as an "index" to this
+ * value the value returned by this method may not be identical to the
+ * value set using setVolumeAdjustment().
+ *
+ * This defaults to returning the value for the master volume channel if
+ * available and returns 0 if the specified channel does not exist.
+ *
+ * \see setVolumeAdjustment()
+ * \see volumeAdjustmentIndex()
+ */
+ float volumeAdjustment(ChannelType type = MasterVolume) const;
+
+ /*!
+ * Set the relative volume adjustment in decibels to \a adjustment.
+ *
+ * By default this sets the value for the master volume.
+ *
+ * \note Because this is actually stored internally as an "index" to this
+ * value the value set by this method may not be identical to the one
+ * returned by volumeAdjustment().
+ *
+ * \see setVolumeAdjustment()
+ * \see volumeAdjustmentIndex()
+ */
+ void setVolumeAdjustment(float adjustment, ChannelType type = MasterVolume);
+
+ /*!
+ * Returns the peak volume (represented as a length and a string of bits).
+ *
+ * This defaults to returning the value for the master volume channel if
+ * available and returns 0 if the specified channel does not exist.
+ *
+ * \see setPeakVolume()
+ */
+ PeakVolume peakVolume(ChannelType type = MasterVolume) const;
+
+ /*!
+ * Sets the peak volume to \a peak.
+ *
+ * By default this sets the value for the master volume.
+ *
+ * \see peakVolume()
+ */
+ void setPeakVolume(const PeakVolume &peak, ChannelType type = MasterVolume);
+
+#else
+
+ // BIC: Combine each of the following pairs of functions (or maybe just
+ // rework this junk altogether).
+
+ short volumeAdjustmentIndex(ChannelType type) const;
+ short volumeAdjustmentIndex() const;
+
+ void setVolumeAdjustmentIndex(short index, ChannelType type);
+ void setVolumeAdjustmentIndex(short index);
+
+ float volumeAdjustment(ChannelType type) const;
+ float volumeAdjustment() const;
+
+ void setVolumeAdjustment(float adjustment, ChannelType type);
+ void setVolumeAdjustment(float adjustment);
+
+ PeakVolume peakVolume(ChannelType type) const;
+ PeakVolume peakVolume() const;
+
+ void setPeakVolume(const PeakVolume &peak, ChannelType type);
+ void setPeakVolume(const PeakVolume &peak);
+
+#endif
+
+ /*!
+ * Returns the identification for this frame.
+ */
+ String identification() const;
+
+ /*!
+ * Sets the identification of the frame to \a s. The string
+ * is used to identify the situation and/or device where this
+ * adjustment should apply.
+ */
+ void setIdentification(const String &s);
+
+ protected:
+ virtual void parseFields(const ByteVector &data);
+ virtual ByteVector renderFields() const;
+
+ private:
+ RelativeVolumeFrame(const ByteVector &data, Header *h);
+ RelativeVolumeFrame(const RelativeVolumeFrame &);
+ RelativeVolumeFrame &operator=(const RelativeVolumeFrame &);
+
+ class RelativeVolumeFramePrivate;
+ RelativeVolumeFramePrivate *d;
+ };
+
+ }
+}
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/textidentificationframe.cpp b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/textidentificationframe.cpp
new file mode 100644
index 000000000..7c2ab9095
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/textidentificationframe.cpp
@@ -0,0 +1,271 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+
+#include "textidentificationframe.h"
+
+using namespace TagLib;
+using namespace ID3v2;
+
+class TextIdentificationFrame::TextIdentificationFramePrivate
+{
+public:
+ TextIdentificationFramePrivate() : textEncoding(String::Latin1) {}
+ String::Type textEncoding;
+ StringList fieldList;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// TextIdentificationFrame public members
+////////////////////////////////////////////////////////////////////////////////
+
+TextIdentificationFrame::TextIdentificationFrame(const ByteVector &type, String::Type encoding) :
+ Frame(type)
+{
+ d = new TextIdentificationFramePrivate;
+ d->textEncoding = encoding;
+}
+
+TextIdentificationFrame::TextIdentificationFrame(const ByteVector &data) :
+ Frame(data)
+{
+ d = new TextIdentificationFramePrivate;
+ setData(data);
+}
+
+TextIdentificationFrame::~TextIdentificationFrame()
+{
+ delete d;
+}
+
+void TextIdentificationFrame::setText(const StringList &l)
+{
+ d->fieldList = l;
+}
+
+void TextIdentificationFrame::setText(const String &s)
+{
+ d->fieldList = s;
+}
+
+String TextIdentificationFrame::toString() const
+{
+ return d->fieldList.toString();
+}
+
+StringList TextIdentificationFrame::fieldList() const
+{
+ return d->fieldList;
+}
+
+String::Type TextIdentificationFrame::textEncoding() const
+{
+ return d->textEncoding;
+}
+
+void TextIdentificationFrame::setTextEncoding(String::Type encoding)
+{
+ d->textEncoding = encoding;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// TextIdentificationFrame protected members
+////////////////////////////////////////////////////////////////////////////////
+
+void TextIdentificationFrame::parseFields(const ByteVector &data)
+{
+ // Don't try to parse invalid frames
+
+ if(data.size() < 2)
+ return;
+
+ // read the string data type (the first byte of the field data)
+
+ d->textEncoding = String::Type(data[0]);
+
+ // split the byte array into chunks based on the string type (two byte delimiter
+ // for unicode encodings)
+
+ int byteAlign = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
+
+ // build a small counter to strip nulls off the end of the field
+
+ int dataLength = data.size() - 1;
+
+ while(dataLength > 0 && data[dataLength] == 0)
+ dataLength--;
+
+ while(dataLength % byteAlign != 0)
+ dataLength++;
+
+ ByteVectorList l = ByteVectorList::split(data.mid(1, dataLength), textDelimiter(d->textEncoding), byteAlign);
+
+ d->fieldList.clear();
+
+ // append those split values to the list and make sure that the new string's
+ // type is the same specified for this frame
+
+ for(ByteVectorList::Iterator it = l.begin(); it != l.end(); it++) {
+ if(!(*it).isEmpty()) {
+ String s(*it, d->textEncoding);
+ d->fieldList.append(s);
+ }
+ }
+}
+
+ByteVector TextIdentificationFrame::renderFields() const
+{
+ String::Type encoding = checkEncoding(d->fieldList, d->textEncoding);
+
+ ByteVector v;
+
+ v.append(char(encoding));
+
+ for(StringList::ConstIterator it = d->fieldList.begin(); it != d->fieldList.end(); it++) {
+
+ // Since the field list is null delimited, if this is not the first
+ // element in the list, append the appropriate delimiter for this
+ // encoding.
+
+ if(it != d->fieldList.begin())
+ v.append(textDelimiter(encoding));
+
+ v.append((*it).data(encoding));
+ }
+
+ return v;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// TextIdentificationFrame private members
+////////////////////////////////////////////////////////////////////////////////
+
+TextIdentificationFrame::TextIdentificationFrame(const ByteVector &data, Header *h) : Frame(h)
+{
+ d = new TextIdentificationFramePrivate;
+ parseFields(fieldData(data));
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// UserTextIdentificationFrame public members
+////////////////////////////////////////////////////////////////////////////////
+
+UserTextIdentificationFrame::UserTextIdentificationFrame(String::Type encoding) :
+ TextIdentificationFrame("TXXX", encoding),
+ d(0)
+{
+ StringList l;
+ l.append(String::null);
+ l.append(String::null);
+ setText(l);
+}
+
+
+UserTextIdentificationFrame::UserTextIdentificationFrame(const ByteVector &data) :
+ TextIdentificationFrame(data)
+{
+ checkFields();
+}
+
+String UserTextIdentificationFrame::toString() const
+{
+ return "[" + description() + "] " + fieldList().toString();
+}
+
+String UserTextIdentificationFrame::description() const
+{
+ return !TextIdentificationFrame::fieldList().isEmpty()
+ ? TextIdentificationFrame::fieldList().front()
+ : String::null;
+}
+
+StringList UserTextIdentificationFrame::fieldList() const
+{
+ // TODO: remove this function
+
+ return TextIdentificationFrame::fieldList();
+}
+
+void UserTextIdentificationFrame::setText(const String &text)
+{
+ if(description().isEmpty())
+ setDescription(String::null);
+
+ TextIdentificationFrame::setText(StringList(description()).append(text));
+}
+
+void UserTextIdentificationFrame::setText(const StringList &fields)
+{
+ if(description().isEmpty())
+ setDescription(String::null);
+
+ TextIdentificationFrame::setText(StringList(description()).append(fields));
+}
+
+void UserTextIdentificationFrame::setDescription(const String &s)
+{
+ StringList l = fieldList();
+
+ if(l.isEmpty())
+ l.append(s);
+ else
+ l[0] = s;
+
+ TextIdentificationFrame::setText(l);
+}
+
+UserTextIdentificationFrame *UserTextIdentificationFrame::find(
+ ID3v2::Tag *tag, const String &description) // static
+{
+ FrameList l = tag->frameList("TXXX");
+ for(FrameList::Iterator it = l.begin(); it != l.end(); ++it) {
+ UserTextIdentificationFrame *f = dynamic_cast(*it);
+ if(f && f->description() == description)
+ return f;
+ }
+ return 0;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// UserTextIdentificationFrame private members
+////////////////////////////////////////////////////////////////////////////////
+
+UserTextIdentificationFrame::UserTextIdentificationFrame(const ByteVector &data, Header *h) :
+ TextIdentificationFrame(data, h)
+{
+ checkFields();
+}
+
+void UserTextIdentificationFrame::checkFields()
+{
+ int fields = fieldList().size();
+
+ if(fields == 0)
+ setDescription(String::null);
+ if(fields <= 1)
+ setText(String::null);
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/textidentificationframe.h b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/textidentificationframe.h
new file mode 100644
index 000000000..418ef9704
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/textidentificationframe.h
@@ -0,0 +1,258 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_TEXTIDENTIFICATIONFRAME_H
+#define TAGLIB_TEXTIDENTIFICATIONFRAME_H
+
+#include "tstringlist.h"
+#include "taglib_export.h"
+
+#include "id3v2frame.h"
+
+namespace TagLib {
+
+ namespace ID3v2 {
+
+ class Tag;
+
+ //! An ID3v2 text identification frame implementation
+
+ /*!
+ * This is an implementation of the most common type of ID3v2 frame -- text
+ * identification frames. There are a number of variations on this. Those
+ * enumerated in the ID3v2.4 standard are:
+ *
+ *
+ * - TALB Album/Movie/Show title
+ * - TBPM BPM (beats per minute)
+ * - TCOM Composer
+ * - TCON Content type
+ * - TCOP Copyright message
+ * - TDEN Encoding time
+ * - TDLY Playlist delay
+ * - TDOR Original release time
+ * - TDRC Recording time
+ * - TDRL Release time
+ * - TDTG Tagging time
+ * - TENC Encoded by
+ * - TEXT Lyricist/Text writer
+ * - TFLT File type
+ * - TIPL Involved people list
+ * - TIT1 Content group description
+ * - TIT2 Title/songname/content description
+ * - TIT3 Subtitle/Description refinement
+ * - TKEY Initial key
+ * - TLAN Language(s)
+ * - TLEN Length
+ * - TMCL Musician credits list
+ * - TMED Media type
+ * - TMOO Mood
+ * - TOAL Original album/movie/show title
+ * - TOFN Original filename
+ * - TOLY Original lyricist(s)/text writer(s)
+ * - TOPE Original artist(s)/performer(s)
+ * - TOWN File owner/licensee
+ * - 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
+ * - TRCK Track number/Position in set
+ * - TRSN Internet radio station name
+ * - TRSO Internet radio station owner
+ * - TSOA Album sort order
+ * - TSOP Performer sort order
+ * - TSOT Title sort order
+ * - TSRC ISRC (international standard recording code)
+ * - TSSE Software/Hardware and settings used for encoding
+ * - TSST Set subtitle
+ *
+ *
+ * The ID3v2 Frames document gives a description of each of these formats
+ * and the expected order of strings in each. ID3v2::Header::frameID() can
+ * be used to determine the frame type.
+ *
+ * \note If non-Latin1 compatible strings are used with this class, even if
+ * the text encoding is set to Latin1, the frame will be written using UTF8
+ * (with the encoding flag appropriately set in the output).
+ */
+
+ class TAGLIB_EXPORT TextIdentificationFrame : public Frame
+ {
+ friend class FrameFactory;
+
+ public:
+ /*!
+ * Construct an empty frame of type \a type. Uses \a encoding as the
+ * default text encoding.
+ *
+ * \note In this case you must specify the text encoding as it
+ * resolves the ambiguity between constructors.
+ *
+ * \note Please see the note in the class description regarding Latin1.
+ */
+ TextIdentificationFrame(const ByteVector &type, String::Type encoding);
+
+ /*!
+ * This is a dual purpose constructor. \a data can either be binary data
+ * that should be parsed or (at a minimum) the frame ID.
+ */
+ explicit TextIdentificationFrame(const ByteVector &data);
+
+ /*!
+ * Destroys this TextIdentificationFrame instance.
+ */
+ virtual ~TextIdentificationFrame();
+
+ /*!
+ * Text identification frames are a list of string fields.
+ *
+ * This function will accept either a StringList or a String (using the
+ * StringList constructor that accepts a single String).
+ *
+ * \note This will not change the text encoding of the frame even if the
+ * strings passed in are not of the same encoding. Please use
+ * setEncoding(s.type()) if you wish to change the encoding of the frame.
+ */
+ void setText(const StringList &l);
+
+ // Reimplementations.
+
+ virtual void setText(const String &s);
+ virtual String toString() const;
+
+ /*!
+ * Returns the text encoding that will be used in rendering this frame.
+ * This defaults to the type that was either specified in the constructor
+ * or read from the frame when parsed.
+ *
+ * \note Please see the note in the class description regarding Latin1.
+ *
+ * \see setTextEncoding()
+ * \see render()
+ */
+ String::Type textEncoding() const;
+
+ /*!
+ * Sets the text encoding to be used when rendering this frame to
+ * \a encoding.
+ *
+ * \note Please see the note in the class description regarding Latin1.
+ *
+ * \see textEncoding()
+ * \see render()
+ */
+ void setTextEncoding(String::Type encoding);
+
+ /*!
+ * Returns a list of the strings in this frame.
+ */
+ StringList fieldList() const;
+
+ protected:
+ // Reimplementations.
+
+ virtual void parseFields(const ByteVector &data);
+ virtual ByteVector renderFields() const;
+
+ /*!
+ * The constructor used by the FrameFactory.
+ */
+ TextIdentificationFrame(const ByteVector &data, Header *h);
+
+ private:
+ TextIdentificationFrame(const TextIdentificationFrame &);
+ TextIdentificationFrame &operator=(const TextIdentificationFrame &);
+
+ class TextIdentificationFramePrivate;
+ TextIdentificationFramePrivate *d;
+ };
+
+ /*!
+ * This is a specialization of text identification frames that allows for
+ * user defined entries. Each entry has a description in addition to the
+ * normal list of fields that a text identification frame has.
+ *
+ * This description identifies the frame and must be unique.
+ */
+
+ //! An ID3v2 custom text identification frame implementationx
+
+ class TAGLIB_EXPORT UserTextIdentificationFrame : public TextIdentificationFrame
+ {
+ friend class FrameFactory;
+
+ public:
+ /*!
+ * Constructs an empty user defined text identification frame. For this to be
+ * a useful frame both a description and text must be set.
+ */
+ explicit UserTextIdentificationFrame(String::Type encoding = String::Latin1);
+
+ /*!
+ * Creates a frame based on \a data.
+ */
+ explicit UserTextIdentificationFrame(const ByteVector &data);
+
+ virtual String toString() const;
+
+ /*!
+ * Returns the description for this frame.
+ */
+ String description() const;
+
+ /*!
+ * Sets the description of the frame to \a s. \a s must be unique. You can
+ * check for the presence of another user defined text frame of the same type
+ * using find() and testing for null.
+ */
+ void setDescription(const String &s);
+
+ StringList fieldList() const;
+ void setText(const String &text);
+ void setText(const StringList &fields);
+
+ /*!
+ * Searches for the user defined text frame with the description \a description
+ * in \a tag. This returns null if no matching frames were found.
+ */
+ static UserTextIdentificationFrame *find(Tag *tag, const String &description);
+
+ private:
+ UserTextIdentificationFrame(const ByteVector &data, Header *h);
+ UserTextIdentificationFrame(const TextIdentificationFrame &);
+ UserTextIdentificationFrame &operator=(const UserTextIdentificationFrame &);
+
+ void checkFields();
+
+ class UserTextIdentificationFramePrivate;
+ UserTextIdentificationFramePrivate *d;
+ };
+
+ }
+}
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp
new file mode 100644
index 000000000..e12583ade
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp
@@ -0,0 +1,118 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include
+#include
+
+#include "uniquefileidentifierframe.h"
+
+using namespace TagLib;
+using namespace ID3v2;
+
+class UniqueFileIdentifierFrame::UniqueFileIdentifierFramePrivate
+{
+public:
+ String owner;
+ ByteVector identifier;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public methods
+////////////////////////////////////////////////////////////////////////////////
+
+UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const ByteVector &data) :
+ ID3v2::Frame(data)
+{
+ d = new UniqueFileIdentifierFramePrivate;
+ setData(data);
+}
+
+UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const String &owner, const ByteVector &id) :
+ ID3v2::Frame("UFID")
+{
+ d = new UniqueFileIdentifierFramePrivate;
+ d->owner = owner;
+ d->identifier = id;
+}
+
+UniqueFileIdentifierFrame::~UniqueFileIdentifierFrame()
+{
+ delete d;
+}
+
+String UniqueFileIdentifierFrame::owner() const
+{
+ return d->owner;
+}
+
+ByteVector UniqueFileIdentifierFrame::identifier() const
+{
+ return d->identifier;
+}
+
+void UniqueFileIdentifierFrame::setOwner(const String &s)
+{
+ d->owner = s;
+}
+
+void UniqueFileIdentifierFrame::setIdentifier(const ByteVector &v)
+{
+ d->identifier = v;
+}
+
+String UniqueFileIdentifierFrame::toString() const
+{
+ return String::null;
+}
+
+void UniqueFileIdentifierFrame::parseFields(const ByteVector &data)
+{
+ if(data.size() < 1) {
+ debug("An UFID frame must contain at least 1 byte.");
+ return;
+ }
+
+ int pos = 0;
+ d->owner = readStringField(data, String::Latin1, &pos);
+ d->identifier = data.mid(pos);
+}
+
+ByteVector UniqueFileIdentifierFrame::renderFields() const
+{
+ ByteVector data;
+
+ data.append(d->owner.data(String::Latin1));
+ data.append(char(0));
+ data.append(d->identifier);
+
+ return data;
+}
+
+UniqueFileIdentifierFrame::UniqueFileIdentifierFrame(const ByteVector &data, Header *h) :
+ Frame(h)
+{
+ d = new UniqueFileIdentifierFramePrivate;
+ parseFields(fieldData(data));
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h
new file mode 100644
index 000000000..1292b3929
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h
@@ -0,0 +1,113 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_UNIQUEFILEIDENTIFIERFRAME
+#define TAGLIB_UNIQUEFILEIDENTIFIERFRAME
+
+#include "id3v2frame.h"
+
+namespace TagLib {
+
+ namespace ID3v2 {
+
+ /*!
+ * This is an implementation of ID3v2 unique file identifier frames. This
+ * frame is used to identify the file in an arbitrary database identified
+ * by the owner field.
+ */
+
+ //! An implementation of ID3v2 unique identifier frames
+
+ class TAGLIB_EXPORT UniqueFileIdentifierFrame : public ID3v2::Frame
+ {
+ friend class FrameFactory;
+
+ public:
+ /*!
+ * Creates a uniqe file identifier frame based on \a data.
+ */
+ UniqueFileIdentifierFrame(const ByteVector &data);
+
+ /*!
+ * Creates a unique file identifier frame with the owner \a owner and
+ * the identification \a id.
+ */
+ UniqueFileIdentifierFrame(const String &owner, const ByteVector &id);
+
+ /*!
+ * Destroys the frame.
+ */
+ ~UniqueFileIdentifierFrame();
+
+ /*!
+ * Returns the owner for the frame; essentially this is the key for
+ * determining which identification scheme this key belongs to. This
+ * will usually either be an email address or URL for the person or tool
+ * used to create the unique identifier.
+ *
+ * \see setOwner()
+ */
+ String owner() const;
+
+ /*!
+ * Returns the unique identifier. Though sometimes this is a text string
+ * it also may be binary data and as much should be assumed when handling
+ * it.
+ */
+ ByteVector identifier() const;
+
+ /*!
+ * Sets the owner of the identification scheme to \a s.
+ *
+ * \see owner()
+ */
+ void setOwner(const String &s);
+
+ /*!
+ * Sets the unique file identifier to \a v.
+ *
+ * \see identifier()
+ */
+ void setIdentifier(const ByteVector &v);
+
+ virtual String toString() const;
+
+ protected:
+ virtual void parseFields(const ByteVector &data);
+ virtual ByteVector renderFields() const;
+
+ private:
+ UniqueFileIdentifierFrame(const UniqueFileIdentifierFrame &);
+ UniqueFileIdentifierFrame &operator=(UniqueFileIdentifierFrame &);
+
+ UniqueFileIdentifierFrame(const ByteVector &data, Header *h);
+
+ class UniqueFileIdentifierFramePrivate;
+ UniqueFileIdentifierFramePrivate *d;
+ };
+ }
+}
+
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/unknownframe.cpp b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/unknownframe.cpp
new file mode 100644
index 000000000..4def028ba
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/unknownframe.cpp
@@ -0,0 +1,84 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include "unknownframe.h"
+
+using namespace TagLib;
+using namespace ID3v2;
+
+class UnknownFrame::UnknownFramePrivate
+{
+public:
+ ByteVector fieldData;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+UnknownFrame::UnknownFrame(const ByteVector &data) : Frame(data)
+{
+ d = new UnknownFramePrivate;
+ setData(data);
+}
+
+UnknownFrame::~UnknownFrame()
+{
+ delete d;
+}
+
+String UnknownFrame::toString() const
+{
+ return String::null;
+}
+
+ByteVector UnknownFrame::data() const
+{
+ return d->fieldData;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// protected members
+////////////////////////////////////////////////////////////////////////////////
+
+void UnknownFrame::parseFields(const ByteVector &data)
+{
+ d->fieldData = data;
+}
+
+ByteVector UnknownFrame::renderFields() const
+{
+ return d->fieldData;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+UnknownFrame::UnknownFrame(const ByteVector &data, Header *h) : Frame(h)
+{
+ d = new UnknownFramePrivate;
+ parseFields(fieldData(data));
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/unknownframe.h b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/unknownframe.h
new file mode 100644
index 000000000..6559f4ed2
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/unknownframe.h
@@ -0,0 +1,79 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_UNKNOWNFRAME_H
+#define TAGLIB_UNKNOWNFRAME_H
+
+#include "id3v2frame.h"
+#include "taglib_export.h"
+
+namespace TagLib {
+
+ namespace ID3v2 {
+
+ //! A frame type \e unknown to TagLib.
+
+ /*!
+ * This class represents a frame type not known (or more often simply
+ * unimplemented) in TagLib. This is here provide a basic API for
+ * manipulating the binary data of unknown frames and to provide a means
+ * of rendering such \e unknown frames.
+ *
+ * Please note that a cleaner way of handling frame types that TagLib
+ * does not understand is to subclass ID3v2::Frame and ID3v2::FrameFactory
+ * to have your frame type supported through the standard ID3v2 mechanism.
+ */
+
+ class TAGLIB_EXPORT UnknownFrame : public Frame
+ {
+ friend class FrameFactory;
+
+ public:
+ UnknownFrame(const ByteVector &data);
+ virtual ~UnknownFrame();
+
+ virtual String toString() const;
+
+ /*!
+ * Returns the field data (everything but the header) for this frame.
+ */
+ ByteVector data() const;
+
+ protected:
+ virtual void parseFields(const ByteVector &data);
+ virtual ByteVector renderFields() const;
+
+ private:
+ UnknownFrame(const ByteVector &data, Header *h);
+ UnknownFrame(const UnknownFrame &);
+ UnknownFrame &operator=(const UnknownFrame &);
+
+ class UnknownFramePrivate;
+ UnknownFramePrivate *d;
+ };
+
+ }
+}
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/unsynchronizedlyricsframe.cpp b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/unsynchronizedlyricsframe.cpp
new file mode 100644
index 000000000..0a8927e7f
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/unsynchronizedlyricsframe.cpp
@@ -0,0 +1,162 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ copyright : (C) 2006 by Urs Fleisch
+ email : ufleisch@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include "unsynchronizedlyricsframe.h"
+#include
+#include
+
+using namespace TagLib;
+using namespace ID3v2;
+
+class UnsynchronizedLyricsFrame::UnsynchronizedLyricsFramePrivate
+{
+public:
+ UnsynchronizedLyricsFramePrivate() : textEncoding(String::Latin1) {}
+ String::Type textEncoding;
+ ByteVector language;
+ String description;
+ String text;
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+UnsynchronizedLyricsFrame::UnsynchronizedLyricsFrame(String::Type encoding) :
+ Frame("USLT")
+{
+ d = new UnsynchronizedLyricsFramePrivate;
+ d->textEncoding = encoding;
+}
+
+UnsynchronizedLyricsFrame::UnsynchronizedLyricsFrame(const ByteVector &data) :
+ Frame(data)
+{
+ d = new UnsynchronizedLyricsFramePrivate;
+ setData(data);
+}
+
+UnsynchronizedLyricsFrame::~UnsynchronizedLyricsFrame()
+{
+ delete d;
+}
+
+String UnsynchronizedLyricsFrame::toString() const
+{
+ return d->text;
+}
+
+ByteVector UnsynchronizedLyricsFrame::language() const
+{
+ return d->language;
+}
+
+String UnsynchronizedLyricsFrame::description() const
+{
+ return d->description;
+}
+
+String UnsynchronizedLyricsFrame::text() const
+{
+ return d->text;
+}
+
+void UnsynchronizedLyricsFrame::setLanguage(const ByteVector &languageEncoding)
+{
+ d->language = languageEncoding.mid(0, 3);
+}
+
+void UnsynchronizedLyricsFrame::setDescription(const String &s)
+{
+ d->description = s;
+}
+
+void UnsynchronizedLyricsFrame::setText(const String &s)
+{
+ d->text = s;
+}
+
+
+String::Type UnsynchronizedLyricsFrame::textEncoding() const
+{
+ return d->textEncoding;
+}
+
+void UnsynchronizedLyricsFrame::setTextEncoding(String::Type encoding)
+{
+ d->textEncoding = encoding;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// protected members
+////////////////////////////////////////////////////////////////////////////////
+
+void UnsynchronizedLyricsFrame::parseFields(const ByteVector &data)
+{
+ if(data.size() < 5) {
+ debug("An unsynchronized lyrics frame must contain at least 5 bytes.");
+ return;
+ }
+
+ d->textEncoding = String::Type(data[0]);
+ d->language = data.mid(1, 3);
+
+ int byteAlign
+ = d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8 ? 1 : 2;
+
+ ByteVectorList l =
+ ByteVectorList::split(data.mid(4), textDelimiter(d->textEncoding), byteAlign, 2);
+
+ if(l.size() == 2) {
+ d->description = String(l.front(), d->textEncoding);
+ d->text = String(l.back(), d->textEncoding);
+ }
+}
+
+ByteVector UnsynchronizedLyricsFrame::renderFields() const
+{
+ ByteVector v;
+
+ v.append(char(d->textEncoding));
+ v.append(d->language.size() == 3 ? d->language : "XXX");
+ v.append(d->description.data(d->textEncoding));
+ v.append(textDelimiter(d->textEncoding));
+ v.append(d->text.data(d->textEncoding));
+
+ return v;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+UnsynchronizedLyricsFrame::UnsynchronizedLyricsFrame(const ByteVector &data, Header *h)
+ : Frame(h)
+{
+ d = new UnsynchronizedLyricsFramePrivate();
+ parseFields(fieldData(data));
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/unsynchronizedlyricsframe.h b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/unsynchronizedlyricsframe.h
new file mode 100644
index 000000000..0f8260e47
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/unsynchronizedlyricsframe.h
@@ -0,0 +1,157 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ copyright : (C) 2006 by Urs Fleisch
+ email : ufleisch@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_UNSYNCHRONIZEDLYRICSFRAME_H
+#define TAGLIB_UNSYNCHRONIZEDLYRICSFRAME_H
+
+#include "id3v2frame.h"
+
+namespace TagLib {
+
+ namespace ID3v2 {
+
+ //! ID3v2 unsynchronized lyrics frame
+ /*!
+ * An implementation of ID3v2 unsynchronized lyrics.
+ */
+ class TAGLIB_EXPORT UnsynchronizedLyricsFrame : public Frame
+ {
+ friend class FrameFactory;
+
+ public:
+ /*!
+ * Construct an empty unsynchronized lyrics frame that will use the text encoding
+ * \a encoding.
+ */
+ explicit UnsynchronizedLyricsFrame(String::Type encoding = String::Latin1);
+
+ /*!
+ * Construct a unsynchronized lyrics frame based on the data in \a data.
+ */
+ explicit UnsynchronizedLyricsFrame(const ByteVector &data);
+
+ /*!
+ * Destroys this UnsynchronizedLyricsFrame instance.
+ */
+ virtual ~UnsynchronizedLyricsFrame();
+
+ /*!
+ * Returns the text of this unsynchronized lyrics frame.
+ *
+ * \see text()
+ */
+ virtual String toString() const;
+
+ /*!
+ * Returns the language encoding as a 3 byte encoding as specified by
+ * ISO-639-2.
+ *
+ * \note Most taggers simply ignore this value.
+ *
+ * \see setLanguage()
+ */
+ ByteVector language() const;
+
+ /*!
+ * Returns the description of this unsynchronized lyrics frame.
+ *
+ * \note Most taggers simply ignore this value.
+ *
+ * \see setDescription()
+ */
+ String description() const;
+
+ /*!
+ * Returns the text of this unsynchronized lyrics frame.
+ *
+ * \see setText()
+ */
+ String text() const;
+
+ /*!
+ * Set the language using the 3 byte language code from
+ * ISO-639-2 to
+ * \a languageCode.
+ *
+ * \see language()
+ */
+ void setLanguage(const ByteVector &languageCode);
+
+ /*!
+ * Sets the description of the unsynchronized lyrics frame to \a s.
+ *
+ * \see decription()
+ */
+ void setDescription(const String &s);
+
+ /*!
+ * Sets the text portion of the unsynchronized lyrics frame to \a s.
+ *
+ * \see text()
+ */
+ virtual void setText(const String &s);
+
+ /*!
+ * Returns the text encoding that will be used in rendering this frame.
+ * This defaults to the type that was either specified in the constructor
+ * or read from the frame when parsed.
+ *
+ * \see setTextEncoding()
+ * \see render()
+ */
+ String::Type textEncoding() const;
+
+ /*!
+ * Sets the text encoding to be used when rendering this frame to
+ * \a encoding.
+ *
+ * \see textEncoding()
+ * \see render()
+ */
+ void setTextEncoding(String::Type encoding);
+
+ protected:
+ // Reimplementations.
+
+ virtual void parseFields(const ByteVector &data);
+ virtual ByteVector renderFields() const;
+
+ private:
+ /*!
+ * The constructor used by the FrameFactory.
+ */
+ UnsynchronizedLyricsFrame(const ByteVector &data, Header *h);
+ UnsynchronizedLyricsFrame(const UnsynchronizedLyricsFrame &);
+ UnsynchronizedLyricsFrame &operator=(const UnsynchronizedLyricsFrame &);
+
+ class UnsynchronizedLyricsFramePrivate;
+ UnsynchronizedLyricsFramePrivate *d;
+ };
+
+ }
+}
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/urllinkframe.cpp b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/urllinkframe.cpp
new file mode 100644
index 000000000..7756c4ad9
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/urllinkframe.cpp
@@ -0,0 +1,192 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ copyright : (C) 2006 by Urs Fleisch
+ email : ufleisch@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#include "urllinkframe.h"
+#include
+#include
+
+using namespace TagLib;
+using namespace ID3v2;
+
+class UrlLinkFrame::UrlLinkFramePrivate
+{
+public:
+ String url;
+};
+
+class UserUrlLinkFrame::UserUrlLinkFramePrivate
+{
+public:
+ UserUrlLinkFramePrivate() : textEncoding(String::Latin1) {}
+ String::Type textEncoding;
+ String description;
+};
+
+UrlLinkFrame::UrlLinkFrame(const ByteVector &data) :
+ Frame(data)
+{
+ d = new UrlLinkFramePrivate;
+ setData(data);
+}
+
+UrlLinkFrame::~UrlLinkFrame()
+{
+ delete d;
+}
+
+void UrlLinkFrame::setUrl(const String &s)
+{
+ d->url = s;
+}
+
+String UrlLinkFrame::url() const
+{
+ return d->url;
+}
+
+void UrlLinkFrame::setText(const String &s)
+{
+ setUrl(s);
+}
+
+String UrlLinkFrame::toString() const
+{
+ return url();
+}
+
+void UrlLinkFrame::parseFields(const ByteVector &data)
+{
+ d->url = String(data);
+}
+
+ByteVector UrlLinkFrame::renderFields() const
+{
+ return d->url.data(String::Latin1);
+}
+
+UrlLinkFrame::UrlLinkFrame(const ByteVector &data, Header *h) : Frame(h)
+{
+ d = new UrlLinkFramePrivate;
+ parseFields(fieldData(data));
+}
+
+
+UserUrlLinkFrame::UserUrlLinkFrame(String::Type encoding) :
+ UrlLinkFrame("WXXX")
+{
+ d = new UserUrlLinkFramePrivate;
+ d->textEncoding = encoding;
+}
+
+UserUrlLinkFrame::UserUrlLinkFrame(const ByteVector &data) :
+ UrlLinkFrame(data)
+{
+ d = new UserUrlLinkFramePrivate;
+ setData(data);
+}
+
+UserUrlLinkFrame::~UserUrlLinkFrame()
+{
+ delete d;
+}
+
+String UserUrlLinkFrame::toString() const
+{
+ return "[" + description() + "] " + url();
+}
+
+String::Type UserUrlLinkFrame::textEncoding() const
+{
+ return d->textEncoding;
+}
+
+void UserUrlLinkFrame::setTextEncoding(String::Type encoding)
+{
+ d->textEncoding = encoding;
+}
+
+String UserUrlLinkFrame::description() const
+{
+ return d->description;
+}
+
+void UserUrlLinkFrame::setDescription(const String &s)
+{
+ d->description = s;
+}
+
+void UserUrlLinkFrame::parseFields(const ByteVector &data)
+{
+ if(data.size() < 2) {
+ debug("A user URL link frame must contain at least 2 bytes.");
+ return;
+ }
+
+ int pos = 0;
+
+ d->textEncoding = String::Type(data[0]);
+ pos += 1;
+
+ if(d->textEncoding == String::Latin1 || d->textEncoding == String::UTF8) {
+ int offset = data.find(textDelimiter(d->textEncoding), pos);
+ if(offset < pos)
+ return;
+
+ d->description = String(data.mid(pos, offset - pos), d->textEncoding);
+ pos = offset + 1;
+ }
+ else {
+ int len = data.mid(pos).find(textDelimiter(d->textEncoding), 0, 2);
+ if(len < 0)
+ return;
+
+ d->description = String(data.mid(pos, len), d->textEncoding);
+ pos += len + 2;
+ }
+
+ setUrl(String(data.mid(pos)));
+}
+
+ByteVector UserUrlLinkFrame::renderFields() const
+{
+ ByteVector v;
+
+ String::Type encoding = checkEncoding(d->description, d->textEncoding);
+
+ v.append(char(encoding));
+ v.append(d->description.data(encoding));
+ v.append(textDelimiter(encoding));
+ v.append(url().data(String::Latin1));
+
+ return v;
+}
+
+UserUrlLinkFrame::UserUrlLinkFrame(const ByteVector &data, Header *h) : UrlLinkFrame(data, h)
+{
+ d = new UserUrlLinkFramePrivate;
+ parseFields(fieldData(data));
+}
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/urllinkframe.h b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/urllinkframe.h
new file mode 100644
index 000000000..f89faad0a
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/frames/urllinkframe.h
@@ -0,0 +1,172 @@
+/***************************************************************************
+ copyright : (C) 2002 - 2008 by Scott Wheeler
+ email : wheeler@kde.org
+ copyright : (C) 2006 by Urs Fleisch
+ email : ufleisch@users.sourceforge.net
+ ***************************************************************************/
+
+/***************************************************************************
+ * This library is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU Lesser General Public License version *
+ * 2.1 as published by the Free Software Foundation. *
+ * *
+ * This library is distributed in the hope that it will be useful, but *
+ * WITHOUT ANY WARRANTY; without even the implied warranty of *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
+ * Lesser General Public License for more details. *
+ * *
+ * You should have received a copy of the GNU Lesser General Public *
+ * License along with this library; if not, write to the Free Software *
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
+ * 02110-1301 USA *
+ * *
+ * Alternatively, this file is available under the Mozilla Public *
+ * License Version 1.1. You may obtain a copy of the License at *
+ * http://www.mozilla.org/MPL/ *
+ ***************************************************************************/
+
+#ifndef TAGLIB_URLLINKFRAME_H
+#define TAGLIB_URLLINKFRAME_H
+
+#include "id3v2frame.h"
+
+namespace TagLib {
+
+ namespace ID3v2 {
+
+ //! ID3v2 URL frame
+ /*!
+ * An implementation of ID3v2 URL link frames.
+ */
+ class TAGLIB_EXPORT UrlLinkFrame : public Frame
+ {
+ friend class FrameFactory;
+
+ public:
+ /*!
+ * This is a dual purpose constructor. \a data can either be binary data
+ * that should be parsed or (at a minimum) the frame ID.
+ */
+ explicit UrlLinkFrame(const ByteVector &data);
+
+ /*!
+ * Destroys this UrlLinkFrame instance.
+ */
+ virtual ~UrlLinkFrame();
+
+ /*!
+ * Returns the URL.
+ */
+ virtual String url() const;
+
+ /*!
+ * Sets the URL to \a s.
+ */
+ virtual void setUrl(const String &s);
+
+ // Reimplementations.
+
+ virtual void setText(const String &s);
+ virtual String toString() const;
+
+ protected:
+ virtual void parseFields(const ByteVector &data);
+ virtual ByteVector renderFields() const;
+
+ /*!
+ * The constructor used by the FrameFactory.
+ */
+ UrlLinkFrame(const ByteVector &data, Header *h);
+
+ private:
+ UrlLinkFrame(const UrlLinkFrame &);
+ UrlLinkFrame &operator=(const UrlLinkFrame &);
+
+ class UrlLinkFramePrivate;
+ UrlLinkFramePrivate *d;
+ };
+
+ //! ID3v2 User defined URL frame
+
+ /*!
+ * This is a specialization of URL link frames that allows for
+ * user defined entries. Each entry has a description in addition to the
+ * normal list of fields that a URL link frame has.
+ *
+ * This description identifies the frame and must be unique.
+ */
+ class TAGLIB_EXPORT UserUrlLinkFrame : public UrlLinkFrame
+ {
+ friend class FrameFactory;
+
+ public:
+ /*!
+ * Constructs an empty user defined URL link frame. For this to be
+ * a useful frame both a description and text must be set.
+ */
+ explicit UserUrlLinkFrame(String::Type encoding = String::Latin1);
+
+ /*!
+ * This is a dual purpose constructor. \a data can either be binary data
+ * that should be parsed or (at a minimum) the frame ID.
+ */
+ explicit UserUrlLinkFrame(const ByteVector &data);
+
+ /*!
+ * Destroys this UserUrlLinkFrame instance.
+ */
+ virtual ~UserUrlLinkFrame();
+
+ // Reimplementations.
+
+ virtual String toString() const;
+
+ /*!
+ * Returns the text encoding that will be used in rendering this frame.
+ * This defaults to the type that was either specified in the constructor
+ * or read from the frame when parsed.
+ *
+ * \see setTextEncoding()
+ * \see render()
+ */
+ String::Type textEncoding() const;
+
+ /*!
+ * Sets the text encoding to be used when rendering this frame to
+ * \a encoding.
+ *
+ * \see textEncoding()
+ * \see render()
+ */
+ void setTextEncoding(String::Type encoding);
+
+ /*!
+ * Returns the description for this frame.
+ */
+ String description() const;
+
+ /*!
+ * Sets the description of the frame to \a s. \a s must be unique.
+ */
+ void setDescription(const String &s);
+
+ protected:
+ virtual void parseFields(const ByteVector &data);
+ virtual ByteVector renderFields() const;
+
+ /*!
+ * The constructor used by the FrameFactory.
+ */
+ UserUrlLinkFrame(const ByteVector &data, Header *h);
+
+ private:
+ UserUrlLinkFrame(const UserUrlLinkFrame &);
+ UserUrlLinkFrame &operator=(const UserUrlLinkFrame &);
+
+ class UserUrlLinkFramePrivate;
+ UserUrlLinkFramePrivate *d;
+ };
+
+ }
+}
+#endif
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/id3v2.2.0.txt b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/id3v2.2.0.txt
new file mode 100644
index 000000000..a69bddd32
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/id3v2.2.0.txt
@@ -0,0 +1,1660 @@
+
+Informal standard M. Nilsson
+Document: id3v2-00.txt 26th March 1998
+
+
+ ID3 tag version 2
+
+Status of this document
+
+ This document is an Informal standard and is released so that
+ implementors could have a set standard before the formal standard is
+ set. The formal standard will use another version number if not
+ identical to what is described in this document. The contents in this
+ document may change for clarifications but never for added or altered
+ functionallity.
+
+ Distribution of this document is unlimited.
+
+
+Abstract
+
+ The recent gain of popularity for MPEG layer III audio files on the
+ internet forced a standardised way of storing information about an
+ audio file within itself to determinate its origin and contents.
+
+ Today the most accepted way to do this is with the so called ID3 tag,
+ which is simple but very limited and in some cases very unsuitable.
+ The ID3 tag has very limited space in every field, very limited
+ numbers of fields, not expandable or upgradeable and is placed at the
+ end of a the file, which is unsuitable for streaming audio. This draft
+ is an attempt to answer these issues with a new version of the ID3
+ tag.
+
+
+1. Table of contents
+
+ 2. Conventions in this document
+ 3. ID3v2 overview
+ 3.1. ID3v2 header
+ 3.2. ID3v2 frames overview
+ 4. Declared ID3v2 frames
+ 4.1. Unique file identifier
+ 4.2. Text information frames
+ 4.2.1. Text information frames - details
+ 4.2.2. User defined text information frame
+ 4.3. URL link frames
+ 4.3.1. URL link frames - details
+ 4.3.2. User defined URL link frame
+ 4.4. Involved people list
+ 4.5. Music CD Identifier
+ 4.6. Event timing codes
+ 4.7. MPEG location lookup table
+ 4.8. Synced tempo codes
+ 4.9. Unsychronised lyrics/text transcription
+ 4.10. Synchronised lyrics/text
+ 4.11. Comments
+ 4.12. Relative volume adjustment
+ 4.13. Equalisation
+ 4.14. Reverb
+ 4.15. Attached picture
+ 4.16. General encapsulated object
+ 4.17. Play counter
+ 4.18. Popularimeter
+ 4.19. Recommended buffer size
+ 4.20. Encrypted meta frame
+ 4.21. Audio encryption
+ 4.22. Linked information
+ 5. The 'unsynchronisation scheme'
+ 6. Copyright
+ 7. References
+ 8. Appendix
+ A. Appendix A - ID3-Tag Specification V1.1
+ A.1. Overview
+ A.2. ID3v1 Implementation
+ A.3. Genre List
+ A.4. Track addition - ID3v1.1
+ 9. Author's Address
+
+
+2. Conventions in this document
+
+ In the examples, text within "" is a text string exactly as it appears
+ in a file. Numbers preceded with $ are hexadecimal and numbers
+ preceded with % are binary. $xx is used to indicate a byte with
+ unknown content. %x is used to indicate a bit with unknown content.
+ The most significant bit (MSB) of a byte is called 'bit 7' and the
+ least significant bit (LSB) is called 'bit 0'.
+
+ A tag is the whole tag described in this document. A frame is a block
+ of information in the tag. The tag consists of a header, frames and
+ optional padding. A field is a piece of information; one value, a
+ string etc. A numeric string is a string that consists of the
+ characters 0-9 only.
+
+
+3. ID3v2 overview
+
+ The two biggest design goals were to be able to implement ID3v2
+ without disturbing old software too much and that ID3v2 should be
+ expandable.
+
+ The first criterion is met by the simple fact that the MPEG [MPEG]
+ decoding software uses a syncsignal, embedded in the audiostream, to
+ 'lock on to' the audio. Since the ID3v2 tag doesn't contain a valid
+ syncsignal, no software will attempt to play the tag. If, for any
+ reason, coincidence make a syncsignal appear within the tag it will be
+ taken care of by the 'unsynchronisation scheme' described in section
+ 5.
+
+ The second criterion has made a more noticeable impact on the design
+ of the ID3v2 tag. It is constructed as a container for several
+ information blocks, called frames, whose format need not be known to
+ the software that encounters them. At the start of every frame there
+ is an identifier that explains the frames's format and content, and a
+ size descriptor that allows software to skip unknown frames.
+
+ If a total revision of the ID3v2 tag should be needed, there is a
+ version number and a size descriptor in the ID3v2 header.
+
+ The ID3 tag described in this document is mainly targeted to files
+ encoded with MPEG-2 layer I, MPEG-2 layer II, MPEG-2 layer III and
+ MPEG-2.5, but may work with other types of encoded audio.
+
+ The bitorder in ID3v2 is most significant bit first (MSB). The
+ byteorder in multibyte numbers is most significant byte first (e.g.
+ $12345678 would be encoded $12 34 56 78).
+
+ It is permitted to include padding after all the final frame (at the
+ end of the ID3 tag), making the size of all the frames together
+ smaller than the size given in the head of the tag. A possible purpose
+ of this padding is to allow for adding a few additional frames or
+ enlarge existing frames within the tag without having to rewrite the
+ entire file. The value of the padding bytes must be $00.
+
+
+3.1. ID3v2 header
+
+ The ID3v2 tag header, which should be the first information in the
+ file, is 10 bytes as follows:
+
+ ID3/file identifier "ID3"
+ ID3 version $02 00
+ ID3 flags %xx000000
+ ID3 size 4 * %0xxxxxxx
+
+ The first three bytes of the tag are always "ID3" to indicate that
+ this is an ID3 tag, directly followed by the two version bytes. The
+ first byte of ID3 version is it's major version, while the second byte
+ is its revision number. All revisions are backwards compatible while
+ major versions are not. If software with ID3v2 and below support
+ should encounter version three or higher it should simply ignore the
+ whole tag. Version and revision will never be $FF.
+
+ The first bit (bit 7) in the 'ID3 flags' is indicating whether or not
+ unsynchronisation is used (see section 5 for details); a set bit
+ indicates usage.
+
+ The second bit (bit 6) is indicating whether or not compression is
+ used; a set bit indicates usage. Since no compression scheme has been
+ decided yet, the ID3 decoder (for now) should just ignore the entire
+ tag if the compression bit is set.
+
+ The ID3 tag size is encoded with four bytes where the first bit (bit
+ 7) is set to zero in every byte, making a total of 28 bits. The zeroed
+ bits are ignored, so a 257 bytes long tag is represented as $00 00 02
+ 01.
+
+ The ID3 tag size is the size of the complete tag after
+ unsychronisation, including padding, excluding the header (total tag
+ size - 10). The reason to use 28 bits (representing up to 256MB) for
+ size description is that we don't want to run out of space here.
+
+ A ID3v2 tag can be detected with the following pattern:
+ $49 44 33 yy yy xx zz zz zz zz
+ Where yy is less than $FF, xx is the 'flags' byte and zz is less than
+ $80.
+
+
+3.2. ID3v2 frames overview
+
+ The headers of the frames are similar in their construction. They
+ consist of one three character identifier (capital A-Z and 0-9) and
+ one three byte size field, making a total of six bytes. The header is
+ excluded from the size. Identifiers beginning with "X", "Y" and "Z"
+ are for experimental use and free for everyone to use. Have in mind
+ that someone else might have used the same identifier as you. All
+ other identifiers are either used or reserved for future use.
+
+ The three character frame identifier is followed by a three byte size
+ descriptor, making a total header size of six bytes in every frame.
+ The size is calculated as framesize excluding frame identifier and
+ size descriptor (frame size - 6).
+
+ There is no fixed order of the frames' appearance in the tag, although
+ it is desired that the frames are arranged in order of significance
+ concerning the recognition of the file. An example of such order:
+ UFI, MCI, TT2 ...
+
+ A tag must contain at least one frame. A frame must be at least 1 byte
+ big, excluding the 6-byte header.
+
+ If nothing else is said a string is represented as ISO-8859-1
+ [ISO-8859-1] characters in the range $20 - $FF. All unicode strings
+ [UNICODE] use 16-bit unicode 2.0 (ISO/IEC 10646-1:1993, UCS-2). All
+ numeric strings are always encoded as ISO-8859-1. Terminated strings
+ are terminated with $00 if encoded with ISO-8859-1 and $00 00 if
+ encoded as unicode. If nothing else is said newline character is
+ forbidden. In ISO-8859-1 a new line is represented, when allowed, with
+ $0A only. Frames that allow different types of text encoding have a
+ text encoding description byte directly after the frame size. If
+ ISO-8859-1 is used this byte should be $00, if unicode is used it
+ should be $01.
+
+ The three byte language field is used to describe the language of the
+ frame's content, according to ISO-639-2 [ISO-639-2].
+
+ All URLs [URL] may be relative, e.g. "picture.png", "../doc.txt".
+
+ If a frame is longer than it should be, e.g. having more fields than
+ specified in this document, that indicates that additions to the
+ frame have been made in a later version of the ID3 standard. This
+ is reflected by the revision number in the header of the tag.
+
+
+4. Declared ID3v2 frames
+
+ The following frames are declared in this draft.
+
+ 4.19 BUF Recommended buffer size
+
+ 4.17 CNT Play counter
+ 4.11 COM Comments
+ 4.21 CRA Audio encryption
+ 4.20 CRM Encrypted meta frame
+
+ 4.6 ETC Event timing codes
+ 4.13 EQU Equalization
+
+ 4.16 GEO General encapsulated object
+
+ 4.4 IPL Involved people list
+
+ 4.22 LNK Linked information
+
+ 4.5 MCI Music CD Identifier
+ 4.7 MLL MPEG location lookup table
+
+ 4.15 PIC Attached picture
+ 4.18 POP Popularimeter
+
+ 4.14 REV Reverb
+ 4.12 RVA Relative volume adjustment
+
+ 4.10 SLT Synchronized lyric/text
+ 4.8 STC Synced tempo codes
+
+ 4.2.1 TAL Album/Movie/Show title
+ 4.2.1 TBP BPM (Beats Per Minute)
+ 4.2.1 TCM Composer
+ 4.2.1 TCO Content type
+ 4.2.1 TCR Copyright message
+ 4.2.1 TDA Date
+ 4.2.1 TDY Playlist delay
+ 4.2.1 TEN Encoded by
+ 4.2.1 TFT File type
+ 4.2.1 TIM Time
+ 4.2.1 TKE Initial key
+ 4.2.1 TLA Language(s)
+ 4.2.1 TLE Length
+ 4.2.1 TMT Media type
+ 4.2.1 TOA Original artist(s)/performer(s)
+ 4.2.1 TOF Original filename
+ 4.2.1 TOL Original Lyricist(s)/text writer(s)
+ 4.2.1 TOR Original release year
+ 4.2.1 TOT Original album/Movie/Show title
+ 4.2.1 TP1 Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group
+ 4.2.1 TP2 Band/Orchestra/Accompaniment
+ 4.2.1 TP3 Conductor/Performer refinement
+ 4.2.1 TP4 Interpreted, remixed, or otherwise modified by
+ 4.2.1 TPA Part of a set
+ 4.2.1 TPB Publisher
+ 4.2.1 TRC ISRC (International Standard Recording Code)
+ 4.2.1 TRD Recording dates
+ 4.2.1 TRK Track number/Position in set
+ 4.2.1 TSI Size
+ 4.2.1 TSS Software/hardware and settings used for encoding
+ 4.2.1 TT1 Content group description
+ 4.2.1 TT2 Title/Songname/Content description
+ 4.2.1 TT3 Subtitle/Description refinement
+ 4.2.1 TXT Lyricist/text writer
+ 4.2.2 TXX User defined text information frame
+ 4.2.1 TYE Year
+
+ 4.1 UFI Unique file identifier
+ 4.9 ULT Unsychronized lyric/text transcription
+
+ 4.3.1 WAF Official audio file webpage
+ 4.3.1 WAR Official artist/performer webpage
+ 4.3.1 WAS Official audio source webpage
+ 4.3.1 WCM Commercial information
+ 4.3.1 WCP Copyright/Legal information
+ 4.3.1 WPB Publishers official webpage
+ 4.3.2 WXX User defined URL link frame
+
+
+4.1. Unique file identifier
+
+ This frame's purpose is to be able to identify the audio file in a
+ database that may contain more information relevant to the content.
+ Since standardisation of such a database is beyond this document, all
+ frames begin with a null-terminated string with a URL [URL] containing
+ an email address, or a link to a location where an email address can
+ be found, that belongs to the organisation responsible for this
+ specific database implementation. Questions regarding the database
+ should be sent to the indicated email address. The URL should not be
+ used for the actual database queries. If a $00 is found directly after
+ the 'Frame size' the whole frame should be ignored, and preferably be
+ removed. The 'Owner identifier' is then followed by the actual
+ identifier, which may be up to 64 bytes. There may be more than one
+ "UFI" frame in a tag, but only one with the same 'Owner identifier'.
+
+ Unique file identifier "UFI"
+ Frame size $xx xx xx
+ Owner identifier $00
+ Identifier
+
+
+4.2. Text information frames
+
+ The text information frames are the most important frames, containing
+ information like artist, album and more. There may only be one text
+ information frame of its kind in an tag. If the textstring is followed
+ by a termination ($00 (00)) all the following information should be
+ ignored and not be displayed. All the text information frames have the
+ following format:
+
+ Text information identifier "T00" - "TZZ" , excluding "TXX",
+ described in 4.2.2.
+ Frame size $xx xx xx
+ Text encoding $xx
+ Information
+
+
+4.2.1. Text information frames - details
+
+ TT1
+ The 'Content group description' frame is used if the sound belongs to
+ a larger category of sounds/music. For example, classical music is
+ often sorted in different musical sections (e.g. "Piano Concerto",
+ "Weather - Hurricane").
+
+ TT2
+ The 'Title/Songname/Content description' frame is the actual name of
+ the piece (e.g. "Adagio", "Hurricane Donna").
+
+ TT3
+ The 'Subtitle/Description refinement' frame is used for information
+ directly related to the contents title (e.g. "Op. 16" or "Performed
+ live at wembley").
+
+ TP1
+ The 'Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group' is
+ used for the main artist(s). They are seperated with the "/"
+ character.
+
+ TP2
+ The 'Band/Orchestra/Accompaniment' frame is used for additional
+ information about the performers in the recording.
+
+ TP3
+ The 'Conductor' frame is used for the name of the conductor.
+
+ TP4
+ The 'Interpreted, remixed, or otherwise modified by' frame contains
+ more information about the people behind a remix and similar
+ interpretations of another existing piece.
+
+ TCM
+ The 'Composer(s)' frame is intended for the name of the composer(s).
+ They are seperated with the "/" character.
+
+ TXT
+ The 'Lyricist(s)/text writer(s)' frame is intended for the writer(s)
+ of the text or lyrics in the recording. They are seperated with the
+ "/" character.
+
+ TLA
+ The 'Language(s)' frame should contain the languages of the text or
+ lyrics in the audio file. The language is represented with three
+ characters according to ISO-639-2. If more than one language is used
+ in the text their language codes should follow according to their
+ usage.
+
+ TCO
+ The content type, which previously (in ID3v1.1, see appendix A) was
+ stored as a one byte numeric value only, is now a numeric string. You
+ may use one or several of the types as ID3v1.1 did or, since the
+ category list would be impossible to maintain with accurate and up to
+ date categories, define your own.
+ References to the ID3v1 genres can be made by, as first byte, enter
+ "(" followed by a number from the genres list (section A.3.) and
+ ended with a ")" character. This is optionally followed by a
+ refinement, e.g. "(21)" or "(4)Eurodisco". Several references can be
+ made in the same frame, e.g. "(51)(39)". If the refinement should
+ begin with a "(" character it should be replaced with "((", e.g. "((I
+ can figure out any genre)" or "(55)((I think...)". The following new
+ content types is defined in ID3v2 and is implemented in the same way
+ as the numerig content types, e.g. "(RX)".
+
+ RX Remix
+ CR Cover
+
+ TAL
+ The 'Album/Movie/Show title' frame is intended for the title of the
+ recording(/source of sound) which the audio in the file is taken from.
+
+ TPA
+ The 'Part of a set' frame is a numeric string that describes which
+ part of a set the audio came from. This frame is used if the source
+ described in the "TAL" frame is divided into several mediums, e.g. a
+ double CD. The value may be extended with a "/" character and a
+ numeric string containing the total number of parts in the set. E.g.
+ "1/2".
+
+ TRK
+ The 'Track number/Position in set' frame is a numeric string
+ containing the order number of the audio-file on its original
+ recording. This may be extended with a "/" character and a numeric
+ string containing the total numer of tracks/elements on the original
+ recording. E.g. "4/9".
+
+ TRC
+ The 'ISRC' frame should contian the International Standard Recording
+ Code [ISRC].
+
+ TYE
+ The 'Year' frame is a numeric string with a year of the recording.
+ This frames is always four characters long (until the year 10000).
+
+ TDA
+ The 'Date' frame is a numeric string in the DDMM format containing
+ the date for the recording. This field is always four characters
+ long.
+
+ TIM
+ The 'Time' frame is a numeric string in the HHMM format containing
+ the time for the recording. This field is always four characters
+ long.
+
+ TRD
+ The 'Recording dates' frame is a intended to be used as complement to
+ the "TYE", "TDA" and "TIM" frames. E.g. "4th-7th June, 12th June" in
+ combination with the "TYE" frame.
+
+ TMT
+ The 'Media type' frame describes from which media the sound
+ originated. This may be a textstring or a reference to the predefined
+ media types found in the list below. References are made within "("
+ and ")" and are optionally followed by a text refinement, e.g. "(MC)
+ with four channels". If a text refinement should begin with a "("
+ character it should be replaced with "((" in the same way as in the
+ "TCO" frame. Predefined refinements is appended after the media type,
+ e.g. "(CD/S)" or "(VID/PAL/VHS)".
+
+ DIG Other digital media
+ /A Analog transfer from media
+
+ ANA Other analog media
+ /WAC Wax cylinder
+ /8CA 8-track tape cassette
+
+ CD CD
+ /A Analog transfer from media
+ /DD DDD
+ /AD ADD
+ /AA AAD
+
+ LD Laserdisc
+ /A Analog transfer from media
+
+ TT Turntable records
+ /33 33.33 rpm
+ /45 45 rpm
+ /71 71.29 rpm
+ /76 76.59 rpm
+ /78 78.26 rpm
+ /80 80 rpm
+
+ MD MiniDisc
+ /A Analog transfer from media
+
+ DAT DAT
+ /A Analog transfer from media
+ /1 standard, 48 kHz/16 bits, linear
+ /2 mode 2, 32 kHz/16 bits, linear
+ /3 mode 3, 32 kHz/12 bits, nonlinear, low speed
+ /4 mode 4, 32 kHz/12 bits, 4 channels
+ /5 mode 5, 44.1 kHz/16 bits, linear
+ /6 mode 6, 44.1 kHz/16 bits, 'wide track' play
+
+ DCC DCC
+ /A Analog transfer from media
+
+ DVD DVD
+ /A Analog transfer from media
+
+ TV Television
+ /PAL PAL
+ /NTSC NTSC
+ /SECAM SECAM
+
+ VID Video
+ /PAL PAL
+ /NTSC NTSC
+ /SECAM SECAM
+ /VHS VHS
+ /SVHS S-VHS
+ /BETA BETAMAX
+
+ RAD Radio
+ /FM FM
+ /AM AM
+ /LW LW
+ /MW MW
+
+ TEL Telephone
+ /I ISDN
+
+ MC MC (normal cassette)
+ /4 4.75 cm/s (normal speed for a two sided cassette)
+ /9 9.5 cm/s
+ /I Type I cassette (ferric/normal)
+ /II Type II cassette (chrome)
+ /III Type III cassette (ferric chrome)
+ /IV Type IV cassette (metal)
+
+ REE Reel
+ /9 9.5 cm/s
+ /19 19 cm/s
+ /38 38 cm/s
+ /76 76 cm/s
+ /I Type I cassette (ferric/normal)
+ /II Type II cassette (chrome)
+ /III Type III cassette (ferric chrome)
+ /IV Type IV cassette (metal)
+
+ TFT
+ The 'File type' frame indicates which type of audio this tag defines.
+ The following type and refinements are defined:
+
+ MPG MPEG Audio
+ /1 MPEG 2 layer I
+ /2 MPEG 2 layer II
+ /3 MPEG 2 layer III
+ /2.5 MPEG 2.5
+ /AAC Advanced audio compression
+
+ but other types may be used, not for these types though. This is used
+ in a similar way to the predefined types in the "TMT" frame, but
+ without parenthesis. If this frame is not present audio type is
+ assumed to be "MPG".
+
+ TBP
+ BPM is short for beats per minute, and is easily computed by
+ dividing the number of beats in a musical piece with its length. To
+ get a more accurate result, do the BPM calculation on the main-part
+ only. To acquire best result measure the time between each beat and
+ calculate individual BPM for each beat and use the median value as
+ result. BPM is an integer and represented as a numerical string.
+
+ TCR
+ The 'Copyright message' frame, which must begin with a year and a
+ space character (making five characters), is intended for the
+ copyright holder of the original sound, not the audio file itself. The
+ absence of this frame means only that the copyright information is
+ unavailable or has been removed, and must not be interpreted to mean
+ that the sound is public domain. Every time this field is displayed
+ the field must be preceded with "Copyright " (C) " ", where (C) is one
+ character showing a C in a circle.
+
+ TPB
+ The 'Publisher' frame simply contains the name of the label or
+ publisher.
+
+ TEN
+ The 'Encoded by' frame contains the name of the person or
+ organisation that encoded the audio file. This field may contain a
+ copyright message, if the audio file also is copyrighted by the
+ encoder.
+
+ TSS
+ The 'Software/hardware and settings used for encoding' frame
+ includes the used audio encoder and its settings when the file was
+ encoded. Hardware refers to hardware encoders, not the computer on
+ which a program was run.
+
+ TOF
+ The 'Original filename' frame contains the preferred filename for the
+ file, since some media doesn't allow the desired length of the
+ filename. The filename is case sensitive and includes its suffix.
+
+ TLE
+ The 'Length' frame contains the length of the audiofile in
+ milliseconds, represented as a numeric string.
+
+ TSI
+ The 'Size' frame contains the size of the audiofile in bytes
+ excluding the tag, represented as a numeric string.
+
+ TDY
+ The 'Playlist delay' defines the numbers of milliseconds of silence
+ between every song in a playlist. The player should use the "ETC"
+ frame, if present, to skip initial silence and silence at the end of
+ the audio to match the 'Playlist delay' time. The time is represented
+ as a numeric string.
+
+ TKE
+ The 'Initial key' frame contains the musical key in which the sound
+ starts. It is represented as a string with a maximum length of three
+ characters. The ground keys are represented with "A","B","C","D","E",
+ "F" and "G" and halfkeys represented with "b" and "#". Minor is
+ represented as "m". Example "Cbm". Off key is represented with an "o"
+ only.
+
+ TOT
+ The 'Original album/Movie/Show title' frame is intended for the title
+ of the original recording(/source of sound), if for example the music
+ in the file should be a cover of a previously released song.
+
+ TOA
+ The 'Original artist(s)/performer(s)' frame is intended for the
+ performer(s) of the original recording, if for example the music in
+ the file should be a cover of a previously released song. The
+ performers are seperated with the "/" character.
+
+ TOL
+ The 'Original Lyricist(s)/text writer(s)' frame is intended for the
+ text writer(s) of the original recording, if for example the music in
+ the file should be a cover of a previously released song. The text
+ writers are seperated with the "/" character.
+
+ TOR
+ The 'Original release year' frame is intended for the year when the
+ original recording, if for example the music in the file should be a
+ cover of a previously released song, was released. The field is
+ formatted as in the "TDY" frame.
+
+
+4.2.2. User defined text information frame
+
+ This frame is intended for one-string text information concerning the
+ audiofile in a similar way to the other "T"xx frames. The frame body
+ consists of a description of the string, represented as a terminated
+ string, followed by the actual string. There may be more than one
+ "TXX" frame in each tag, but only one with the same description.
+
+ User defined... "TXX"
+ Frame size $xx xx xx
+ Text encoding $xx
+ Description $00 (00)
+ Value
+
+
+4.3. URL link frames
+
+ With these frames dynamic data such as webpages with touring
+ information, price information or plain ordinary news can be added to
+ the tag. There may only be one URL [URL] link frame of its kind in an
+ tag, except when stated otherwise in the frame description. If the
+ textstring is followed by a termination ($00 (00)) all the following
+ information should be ignored and not be displayed. All URL link
+ frames have the following format:
+
+ URL link frame "W00" - "WZZ" , excluding "WXX"
+ (described in 4.3.2.)
+ Frame size $xx xx xx
+ URL
+
+
+4.3.1. URL link frames - details
+
+ WAF
+ The 'Official audio file webpage' frame is a URL pointing at a file
+ specific webpage.
+
+ WAR
+ The 'Official artist/performer webpage' frame is a URL pointing at
+ the artists official webpage. There may be more than one "WAR" frame
+ in a tag if the audio contains more than one performer.
+
+ WAS
+ The 'Official audio source webpage' frame is a URL pointing at the
+ official webpage for the source of the audio file, e.g. a movie.
+
+ WCM
+ The 'Commercial information' frame is a URL pointing at a webpage
+ with information such as where the album can be bought. There may be
+ more than one "WCM" frame in a tag.
+
+ WCP
+ The 'Copyright/Legal information' frame is a URL pointing at a
+ webpage where the terms of use and ownership of the file is described.
+
+ WPB
+ The 'Publishers official webpage' frame is a URL pointing at the
+ official wepage for the publisher.
+
+
+4.3.2. User defined URL link frame
+
+ This frame is intended for URL [URL] links concerning the audiofile in
+ a similar way to the other "W"xx frames. The frame body consists of a
+ description of the string, represented as a terminated string,
+ followed by the actual URL. The URL is always encoded with ISO-8859-1
+ [ISO-8859-1]. There may be more than one "WXX" frame in each tag, but
+ only one with the same description.
+
+ User defined... "WXX"
+ Frame size $xx xx xx
+ Text encoding $xx
+ Description $00 (00)
+ URL
+
+
+4.4. Involved people list
+
+ Since there might be a lot of people contributing to an audio file in
+ various ways, such as musicians and technicians, the 'Text
+ information frames' are often insufficient to list everyone involved
+ in a project. The 'Involved people list' is a frame containing the
+ names of those involved, and how they were involved. The body simply
+ contains a terminated string with the involvement directly followed by
+ a terminated string with the involvee followed by a new involvement
+ and so on. There may only be one "IPL" frame in each tag.
+
+ Involved people list "IPL"
+ Frame size $xx xx xx
+ Text encoding $xx
+ People list strings
+
+
+4.5. Music CD Identifier
+
+ This frame is intended for music that comes from a CD, so that the CD
+ can be identified in databases such as the CDDB [CDDB]. The frame
+ consists of a binary dump of the Table Of Contents, TOC, from the CD,
+ which is a header of 4 bytes and then 8 bytes/track on the CD making a
+ maximum of 804 bytes. This frame requires a present and valid "TRK"
+ frame. There may only be one "MCI" frame in each tag.
+
+ Music CD identifier "MCI"
+ Frame size $xx xx xx
+ CD TOC
+
+
+4.6. Event timing codes
+
+ This frame allows synchronisation with key events in a song or sound.
+ The head is:
+
+ Event timing codes "ETC"
+ Frame size $xx xx xx
+ Time stamp format $xx
+
+ Where time stamp format is:
+
+ $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit
+ $02 Absolute time, 32 bit sized, using milliseconds as unit
+
+ Abolute time means that every stamp contains the time from the
+ beginning of the 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 should be sorted in
+ chronological order. The type of event is as follows:
+
+ $00 padding (has no meaning)
+ $01 end of initial silence
+ $02 intro start
+ $03 mainpart start
+ $04 outro start
+ $05 outro end
+ $06 verse begins
+ $07 refrain begins
+ $08 interlude
+ $09 theme start
+ $0A variation
+ $0B key change
+ $0C time change
+ $0D unwanted noise (Snap, Crackle & Pop)
+
+ $0E-$DF reserved for future use
+
+ $E0-$EF not predefined sync 0-F
+
+ $F0-$FC reserved for future use
+
+ $FD audio end (start of silence)
+ $FE audio file ends
+ $FF one more byte of events follows (all the following bytes with
+ the value $FF have the same function)
+
+ The 'Not predefined sync's ($E0-EF) are for user events. You might
+ want to synchronise your music to something, like setting of an
+ explosion on-stage, turning on your screensaver etc.
+
+ There may only be one "ETC" frame in each tag.
+
+
+4.7. MPEG location lookup table
+
+ To increase performance and accuracy of jumps within a MPEG [MPEG]
+ audio file, frames with timecodes in different locations in the file
+ might be useful. The ID3 frame includes references that the software
+ can use to calculate positions in the file. After the frame header is
+ a descriptor of how much the 'frame counter' should increase for every
+ reference. If this value is two then the first reference points out
+ the second frame, the 2nd reference the 4th frame, the 3rd reference
+ the 6th frame etc. In a similar way the 'bytes between reference' and
+ 'milliseconds between reference' points out bytes and milliseconds
+ respectively.
+
+ Each reference consists of two parts; a certain number of bits, as
+ defined in 'bits for bytes deviation', that describes the difference
+ between what is said in 'bytes between reference' and the reality and
+ a certain number of bits, as defined in 'bits for milliseconds
+ deviation', that describes the difference between what is said in
+ 'milliseconds between reference' and the reality. The number of bits
+ in every reference, i.e. 'bits for bytes deviation'+'bits for
+ milliseconds deviation', must be a multiple of four. There may only be
+ one "MLL" frame in each tag.
+
+ Location lookup table "MLL"
+ ID3 frame size $xx xx xx
+ 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....
+
+
+4.8. Synced tempo codes
+
+ For a more accurate description of the tempo of a musical piece this
+ frame might be used. After the header follows one byte describing
+ which time stamp format should be used. Then follows one or more tempo
+ codes. Each tempo code consists of one tempo part and one time part.
+ The tempo is in BPM described with one or two bytes. If the first byte
+ has the value $FF, one more byte follows, which is added to the first
+ giving a range from 2 - 510 BPM, since $00 and $01 is reserved. $00 is
+ used to describe a beat-free time period, which is not the same as a
+ music-free time period. $01 is used to indicate one single beat-stroke
+ followed by a beat-free period.
+
+ The tempo descriptor is followed by a time stamp. Every time the tempo
+ in the music changes, a tempo descriptor may indicate this for the
+ player. All tempo descriptors should be sorted in chronological order.
+ The first beat-stroke in a time-period is at the same time as the beat
+ description occurs. There may only be one "STC" frame in each tag.
+
+ Synced tempo codes "STC"
+ Frame size $xx xx xx
+ Time stamp format $xx
+ Tempo data
+
+ Where time stamp format is:
+
+ $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit
+ $02 Absolute time, 32 bit sized, using milliseconds as unit
+
+ Abolute time means that every stamp contains the time from the
+ beginning of the file.
+
+
+4.9. Unsychronised lyrics/text transcription
+
+ This frame contains the lyrics of the song or a text transcription of
+ other vocal activities. The head includes an encoding descriptor and
+ a content descriptor. The body consists of the actual text. The
+ 'Content descriptor' is a terminated string. If no descriptor is
+ entered, 'Content descriptor' is $00 (00) only. Newline characters
+ are allowed in the text. Maximum length for the descriptor is 64
+ bytes. There may be more than one lyrics/text frame in each tag, but
+ only one with the same language and content descriptor.
+
+ Unsynced lyrics/text "ULT"
+ Frame size $xx xx xx
+ Text encoding $xx
+ Language $xx xx xx
+ Content descriptor $00 (00)
+ Lyrics/text
+
+
+4.10. Synchronised lyrics/text
+
+ This is another way of incorporating the words, said or sung lyrics,
+ in the audio file as text, this time, however, in sync with the audio.
+ It might also be used to describing events e.g. occurring on a stage
+ or on the screen in sync with the audio. The header includes a content
+ descriptor, represented with as terminated textstring. If no
+ descriptor is entered, 'Content descriptor' is $00 (00) only.
+
+ Synced lyrics/text "SLT"
+ Frame size $xx xx xx
+ Text encoding $xx
+ Language $xx xx xx
+ Time stamp format $xx
+ Content type $xx
+ Content descriptor $00 (00)
+
+
+ Encoding: $00 ISO-8859-1 [ISO-8859-1] character set is used => $00
+ is sync identifier.
+ $01 Unicode [UNICODE] character set is used => $00 00 is
+ sync identifier.
+
+ Content type: $00 is other
+ $01 is lyrics
+ $02 is text transcription
+ $03 is movement/part name (e.g. "Adagio")
+ $04 is events (e.g. "Don Quijote enters the stage")
+ $05 is chord (e.g. "Bb F Fsus")
+
+ Time stamp format is:
+
+ $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit
+ $02 Absolute time, 32 bit sized, using milliseconds as unit
+
+ Abolute time means that every stamp contains the time from the
+ beginning of the file.
+
+ The text that follows the frame header differs from that of the
+ unsynchronised lyrics/text transcription in one major way. Each
+ syllable (or whatever size of text is considered to be convenient by
+ the encoder) is a null terminated string followed by a time stamp
+ denoting where in the sound file it belongs. Each sync thus has the
+ following structure:
+
+ Terminated text to be synced (typically a syllable)
+ Sync identifier (terminator to above string) $00 (00)
+ Time stamp $xx (xx ...)
+
+ The 'time stamp' is set to zero or the whole sync is omitted if
+ located directly at the beginning of the sound. All time stamps should
+ be sorted in chronological order. The sync can be considered as a
+ validator of the subsequent string.
+
+ Newline characters are allowed in all "SLT" frames and should be used
+ after every entry (name, event etc.) in a frame with the content type
+ $03 - $04.
+
+ A few considerations regarding whitespace characters: Whitespace
+ separating words should mark the beginning of a new word, thus
+ occurring in front of the first syllable of a new word. This is also
+ valid for new line characters. A syllable followed by a comma should
+ not be broken apart with a sync (both the syllable and the comma
+ should be before the sync).
+
+ An example: The "ULT" passage
+
+ "Strangers in the night" $0A "Exchanging glances"
+
+ would be "SLT" encoded as:
+
+ "Strang" $00 xx xx "ers" $00 xx xx " in" $00 xx xx " the" $00 xx xx
+ " night" $00 xx xx 0A "Ex" $00 xx xx "chang" $00 xx xx "ing" $00 xx
+ xx "glan" $00 xx xx "ces" $00 xx xx
+
+ There may be more than one "SLT" frame in each tag, but only one with
+ the same language and content descriptor.
+
+
+4.11. Comments
+
+ This frame replaces the old 30-character comment field in ID3v1. It
+ consists of a frame head followed by encoding, language and content
+ descriptors and is ended with the actual comment as a text string.
+ Newline characters are allowed in the comment text string. There may
+ be more than one comment frame in each tag, but only one with the same
+ language and content descriptor.
+
+ Comment "COM"
+ Frame size $xx xx xx
+ Text encoding $xx
+ Language $xx xx xx
+ Short content description $00 (00)
+ The actual text
+
+
+4.12. Relative volume adjustment
+
+ This is a more subjective function than the previous ones. It allows
+ the user to say how much he wants to increase/decrease the volume on
+ each channel while the file is played. The purpose is to be able to
+ align all files to a reference volume, so that you don't have to
+ change the volume constantly. This frame may also be used to balance
+ adjust the audio. If the volume peak levels are known then this could
+ be described with the 'Peak volume right' and 'Peak volume left'
+ field. If Peakvolume is not known these fields could be left zeroed
+ or completely omitted. There may only be one "RVA" frame in each
+ tag.
+
+ Relative volume adjustment "RVA"
+ Frame size $xx xx xx
+ Increment/decrement %000000xx
+ Bits used for volume descr. $xx
+ Relative volume change, right $xx xx (xx ...)
+ Relative volume change, left $xx xx (xx ...)
+ Peak volume right $xx xx (xx ...)
+ Peak volume left $xx xx (xx ...)
+
+ In the increment/decrement field bit 0 is used to indicate the right
+ channel and bit 1 is used to indicate the left channel. 1 is
+ increment and 0 is decrement.
+
+ The 'bits used for volume description' field is normally $10 (16 bits)
+ for MPEG 2 layer I, II and III [MPEG] and MPEG 2.5. This value may not
+ be $00. The volume is always represented with whole bytes, padded in
+ the beginning (highest bits) when 'bits used for volume description'
+ is not a multiple of eight.
+
+
+4.13. Equalisation
+
+ This is another subjective, alignment frame. It allows the user to
+ predefine an equalisation curve within the audio file. There may only
+ be one "EQU" frame in each tag.
+
+ Equalisation "EQU"
+ Frame size $xx xx xx
+ Adjustment bits $xx
+
+ The 'adjustment bits' field defines the number of bits used for
+ representation of the adjustment. This is normally $10 (16 bits) for
+ MPEG 2 layer I, II and III [MPEG] and MPEG 2.5. This value may not be
+ $00.
+
+ 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 ...)
+
+ The increment/decrement bit is 1 for increment and 0 for decrement.
+ The equalisation bands should be ordered increasingly with reference
+ to frequency. All frequencies don't have to be declared. Adjustments
+ with the value $00 should be omitted. A frequency should only be
+ described once in the frame.
+
+
+4.14. Reverb
+
+ Yet another subjective one. You may here adjust echoes of different
+ kinds. Reverb left/right is the delay between every bounce in ms.
+ Reverb bounces left/right is the number of bounces that should be
+ made. $FF equals an infinite number of bounces. Feedback is the amount
+ of volume that should be returned to the next echo bounce. $00 is 0%,
+ $FF is 100%. If this value were $7F, there would be 50% volume
+ reduction on the first bounce, yet 50% on the second and so on. Left
+ to left means the sound from the left bounce to be played in the left
+ speaker, while left to right means sound from the left bounce to be
+ played in the right speaker.
+
+ 'Premix left to right' is the amount of left sound to be mixed in the
+ right before any reverb is applied, where $00 id 0% and $FF is 100%.
+ 'Premix right to left' does the same thing, but right to left. Setting
+ both premix to $FF would result in a mono output (if the reverb is
+ applied symmetric). There may only be one "REV" frame in each tag.
+
+ Reverb settings "REV"
+ Frame size $00 00 0C
+ 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
+
+
+4.15. Attached picture
+
+ This frame contains a picture directly related to the audio file.
+ Image format is preferably "PNG" [PNG] or "JPG" [JFIF]. Description
+ is a short description of the picture, represented as a terminated
+ textstring. The description has a maximum length of 64 characters,
+ but may be empty. There may be several pictures attached to one file,
+ each in their individual "PIC" frame, but only one with the same
+ content descriptor. There may only be one picture with the picture
+ type declared as picture type $01 and $02 respectively. There is a
+ possibility to put only a link to the image file by using the 'image
+ format' "-->" and having a complete URL [URL] instead of picture data.
+ The use of linked files should however be used restrictively since
+ there is the risk of separation of files.
+
+ Attached picture "PIC"
+ Frame size $xx xx xx
+ Text encoding $xx
+ Image format $xx xx xx
+ Picture type $xx
+ Description $00 (00)
+ Picture data
+
+
+ Picture type: $00 Other
+ $01 32x32 pixels 'file icon' (PNG only)
+ $02 Other file icon
+ $03 Cover (front)
+ $04 Cover (back)
+ $05 Leaflet page
+ $06 Media (e.g. lable side of CD)
+ $07 Lead artist/lead performer/soloist
+ $08 Artist/performer
+ $09 Conductor
+ $0A Band/Orchestra
+ $0B Composer
+ $0C Lyricist/text writer
+ $0D Recording Location
+ $0E During recording
+ $0F During performance
+ $10 Movie/video screen capture
+ $11 A bright coloured fish
+ $12 Illustration
+ $13 Band/artist logotype
+ $14 Publisher/Studio logotype
+
+
+4.16. General encapsulated object
+
+ In this frame any type of file can be encapsulated. After the header,
+ 'Frame size' and 'Encoding' follows 'MIME type' [MIME] and 'Filename'
+ for the encapsulated object, both represented as terminated strings
+ encoded with ISO 8859-1 [ISO-8859-1]. The filename is case sensitive.
+ Then follows a content description as terminated string, encoded as
+ 'Encoding'. The last thing in the frame is the actual object. The
+ first two strings may be omitted, leaving only their terminations.
+ MIME type is always an ISO-8859-1 text string. There may be more than
+ one "GEO" frame in each tag, but only one with the same content
+ descriptor.
+
+ General encapsulated object "GEO"
+ Frame size $xx xx xx
+ Text encoding $xx
+ MIME type $00
+ Filename $00 (00)
+ Content description $00 (00)
+ Encapsulated object
+
+
+4.17. Play counter
+
+ This is simply a counter of the number of times a file has been
+ played. The value is increased by one every time the file begins to
+ play. There may only be one "CNT" 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. The counter must be at least
+ 32-bits long to begin with.
+
+ Play counter "CNT"
+ Frame size $xx xx xx
+ Counter $xx xx xx xx (xx ...)
+
+
+4.18. Popularimeter
+
+ The purpose of this frame is to specify how good an audio file is.
+ Many interesting applications could be found to this frame such as a
+ playlist that features better audiofiles more often than others or it
+ could be used to profile a persons taste and find other 'good' files
+ by comparing people's profiles. The frame is very simple. It contains
+ the email address to the user, one rating byte and a four byte play
+ counter, intended to be increased with one for every time the file is
+ played. The email is a terminated string. The rating is 1-255 where
+ 1 is worst and 255 is best. 0 is unknown. If no personal counter is
+ wanted it may be omitted. When the counter reaches all one's, one
+ byte is inserted in front of the counter thus making the counter
+ eight bits bigger in the same away as the play counter ("CNT").
+ There may be more than one "POP" frame in each tag, but only one with
+ the same email address.
+
+ Popularimeter "POP"
+ Frame size $xx xx xx
+ Email to user $00
+ Rating $xx
+ Counter $xx xx xx xx (xx ...)
+
+
+4.19. Recommended buffer size
+
+ Sometimes the server from which a audio file is streamed is aware of
+ transmission or coding problems resulting in interruptions in the
+ audio stream. In these cases, the size of the buffer can be
+ recommended by the server using this frame. If the 'embedded info
+ flag' is true (1) then this indicates that an ID3 tag with the
+ maximum size described in 'Buffer size' may occur in the audiostream.
+ In such case the tag should reside between two MPEG [MPEG] frames, if
+ the audio is MPEG encoded. If the position of the next tag is known,
+ 'offset to next tag' may be used. The offset is calculated from the
+ end of tag in which this frame resides to the first byte of the header
+ in the next. This field may be omitted. Embedded tags is currently not
+ recommended since this could render unpredictable behaviour from
+ present software/hardware. The 'Buffer size' should be kept to a
+ minimum. There may only be one "BUF" frame in each tag.
+
+ Recommended buffer size "BUF"
+ Frame size $xx xx xx
+ Buffer size $xx xx xx
+ Embedded info flag %0000000x
+ Offset to next tag $xx xx xx xx
+
+
+4.20. Encrypted meta frame
+
+ This frame contains one or more encrypted frames. This enables
+ protection of copyrighted information such as pictures and text, that
+ people might want to pay extra for. Since standardisation of such an
+ encryption scheme is beyond this document, all "CRM" frames begin with
+ a terminated string with a URL [URL] containing an email address, or a
+ link to a location where an email adress can be found, that belongs to
+ the organisation responsible for this specific encrypted meta frame.
+
+ Questions regarding the encrypted frame should be sent to the
+ indicated email address. If a $00 is found directly after the 'Frame
+ size', the whole frame should be ignored, and preferably be removed.
+ The 'Owner identifier' is then followed by a short content description
+ and explanation as to why it's encrypted. After the
+ 'content/explanation' description, the actual encrypted block follows.
+
+ When an ID3v2 decoder encounters a "CRM" frame, it should send the
+ datablock to the 'plugin' with the corresponding 'owner identifier'
+ and expect to receive either a datablock with one or several ID3v2
+ frames after each other or an error. There may be more than one "CRM"
+ frames in a tag, but only one with the same 'owner identifier'.
+
+ Encrypted meta frame "CRM"
+ Frame size $xx xx xx
+ Owner identifier $00 (00)
+ Content/explanation $00 (00)
+ Encrypted datablock
+
+
+4.21. Audio encryption
+
+ This frame indicates if the actual audio stream is encrypted, and by
+ whom. Since standardisation of such encrypion scheme is beyond this
+ document, all "CRA" frames begin with a terminated string with a
+ URL containing an email address, or a link to a location where an
+ email address can be found, that belongs to the organisation
+ responsible for this specific encrypted audio file. Questions
+ regarding the encrypted audio should be sent to the email address
+ specified. If a $00 is found directly after the 'Frame size' and the
+ audiofile indeed is encrypted, the whole file may be considered
+ useless.
+
+ After the 'Owner identifier', a pointer to an unencrypted part of the
+ audio can be specified. The 'Preview start' and 'Preview length' is
+ described in frames. If no part is unencrypted, these fields should be
+ left zeroed. After the 'preview length' field follows optionally a
+ datablock required for decryption of the audio. There may be more than
+ one "CRA" frames in a tag, but only one with the same 'Owner
+ identifier'.
+
+ Audio encryption "CRA"
+ Frame size $xx xx xx
+ Owner identifier $00 (00)
+ Preview start $xx xx
+ Preview length $xx xx
+ Encryption info
+
+
+4.22. Linked information
+
+ To keep space waste as low as possible this frame may be used to link
+ information from another ID3v2 tag that might reside in another audio
+ file or alone in a binary file. It is recommended that this method is
+ only used when the files are stored on a CD-ROM or other circumstances
+ when the risk of file seperation is low. The frame contains a frame
+ identifier, which is the frame that should be linked into this tag, a
+ URL [URL] field, where a reference to the file where the frame is
+ given, and additional ID data, if needed. Data should be retrieved
+ from the first tag found in the file to which this link points. There
+ may be more than one "LNK" frame in a tag, but only one with the same
+ contents. A linked frame is to be considered as part of the tag and
+ has the same restrictions as if it was a physical part of the tag
+ (i.e. only one "REV" frame allowed, whether it's linked or not).
+
+ Linked information "LNK"
+ Frame size $xx xx xx
+ Frame identifier $xx xx xx
+ URL $00 (00)
+ Additional ID data
+
+ Frames that may be linked and need no additional data are "IPL",
+ "MCI", "ETC", "LLT", "STC", "RVA", "EQU", "REV", "BUF", the text
+ information frames and the URL link frames.
+
+ The "TXX", "PIC", "GEO", "CRM" and "CRA" frames may be linked with the
+ content descriptor as additional ID data.
+
+ The "COM", "SLT" and "ULT" frames may be linked with three bytes of
+ language descriptor directly followed by a content descriptor as
+ additional ID data.
+
+
+5. The 'unsynchronisation scheme'
+
+ The only purpose of the 'unsychronisation scheme' is to make the ID3v2
+ tag as compatible as possible with existing software. There is no use
+ in 'unsynchronising' tags if the file is only to be processed by new
+ software. Unsynchronisation may only be made with MPEG 2 layer I, II
+ and III and MPEG 2.5 files.
+
+ Whenever a false synchronisation is found within the tag, one zeroed
+ byte is inserted after the first false synchronisation byte. The
+ format of a correct sync that should be altered by ID3 encoders is as
+ follows:
+
+ %11111111 111xxxxx
+
+ And should be replaced with:
+
+ %11111111 00000000 111xxxxx
+
+ This has the side effect that all $FF 00 combinations have to be
+ altered, so they won't be affected by the decoding process. Therefore
+ all the $FF 00 combinations have to be replaced with the $FF 00 00
+ combination during the unsynchonisation.
+
+ To indicate usage of the unsynchronisation, the first bit in 'ID3
+ flags' should be set. This bit should only be set if the tag
+ contained a, now corrected, false synchronisation. The bit should
+ only be clear if the tag does not contain any false synchronisations.
+
+ Do bear in mind, that if a compression scheme is used by the encoder,
+ the unsyncronisation scheme should be applied *afterwards*. When
+ decoding a compressed, 'unsyncronised' file, the 'unsyncronisation
+ scheme' should be parsed first, compression afterwards.
+
+
+6. Copyright
+
+ Copyright (C) Martin Nilsson 1998. All Rights Reserved.
+
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that a reference to this document is included on all
+ such copies and derivative works. However, this document itself may
+ not be modified in any way and reissued as the original document.
+
+ The limited permissions granted above are perpetual and will not be
+ revoked.
+
+ This document and the information contained herein is provided on an
+ "AS IS" basis and THE AUTHORS DISCLAIMS ALL WARRANTIES, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE
+ INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
+ WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+
+7. References
+
+ [CDDB] Compact Disc Data Base
+
+
+
+ [ISO-639-2] ISO/FDIS 639-2.
+ Codes for the representation of names of languages, Part 2: Alpha-3
+ code. Technical committee / subcommittee: TC 37 / SC 2
+
+ [ISO-8859-1] ISO/IEC DIS 8859-1.
+ 8-bit single-byte coded graphic character sets, Part 1: Latin
+ alphabet No. 1. Technical committee / subcommittee: JTC 1 / SC 2
+
+ [ISRC] ISO 3901:1986
+ International Standard Recording Code (ISRC).
+ Technical committee / subcommittee: TC 46 / SC 9
+
+ [JFIF] JPEG File Interchange Format, version 1.02
+
+
+
+ [MIME] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
+ Extensions (MIME) Part One: Format of Internet Message Bodies",
+ RFC 2045, November 1996.
+
+
+
+ [MPEG] ISO/IEC 11172-3:1993.
+ Coding of moving pictures and associated audio for digital storage
+ media at up to about 1,5 Mbit/s, Part 3: Audio.
+ Technical committee / subcommittee: JTC 1 / SC 29
+ and
+ ISO/IEC 13818-3:1995
+ Generic coding of moving pictures and associated audio information,
+ Part 3: Audio.
+ Technical committee / subcommittee: JTC 1 / SC 29
+ and
+ ISO/IEC DIS 13818-3
+ Generic coding of moving pictures and associated audio information,
+ Part 3: Audio (Revision of ISO/IEC 13818-3:1995)
+
+
+ [PNG] Portable Network Graphics, version 1.0
+
+
+
+ [UNICODE] ISO/IEC 10646-1:1993.
+ Universal Multiple-Octet Coded Character Set (UCS), Part 1:
+ Architecture and Basic Multilingual Plane. Technical committee
+ / subcommittee: JTC 1 / SC 2
+
+
+
+ [URL] T. Berners-Lee, L. Masinter & M. McCahill, "Uniform Resource
+ Locators (URL).", RFC 1738, December 1994.
+
+
+
+
+8. Appendix
+
+
+A. Appendix A - ID3-Tag Specification V1.1
+
+ ID3-Tag Specification V1.1 (12 dec 1997) by Michael Mutschler
+ , edited for space and clarity
+ reasons.
+
+
+A.1. Overview
+
+ The ID3-Tag is an information field for MPEG Layer 3 audio files.
+ Since a standalone MP3 doesn't provide a method of storing other
+ information than those directly needed for replay reasons, the
+ ID3-tag was invented by Eric Kemp in 1996.
+
+ A revision from ID3v1 to ID3v1.1 was made by Michael Mutschler to
+ support track number information is described in A.4.
+
+
+A.2. ID3v1 Implementation
+
+ The Information is stored in the last 128 bytes of an MP3. The Tag
+ has got the following fields, and the offsets given here, are from
+ 0-127.
+
+ Field Length Offsets
+ Tag 3 0-2
+ Songname 30 3-32
+ Artist 30 33-62
+ Album 30 63-92
+ Year 4 93-96
+ Comment 30 97-126
+ Genre 1 127
+
+
+ The string-fields contain ASCII-data, coded in ISO-Latin 1 codepage.
+ Strings which are smaller than the field length are padded with zero-
+ bytes.
+
+ Tag: The tag is valid if this field contains the string "TAG". This
+ has to be uppercase!
+
+ Songname: This field contains the title of the MP3 (string as
+ above).
+
+ Artist: This field contains the artist of the MP3 (string as above).
+
+ Album: this field contains the album where the MP3 comes from
+ (string as above).
+
+ Year: this field contains the year when this song has originally
+ been released (string as above).
+
+ Comment: this field contains a comment for the MP3 (string as
+ above). Revision to this field has been made in ID3v1.1. See
+ A.4.
+
+ Genre: this byte contains the offset of a genre in a predefined
+ list the byte is treated as an unsigned byte. The offset is
+ starting from 0. See A.3.
+
+
+A.3. Genre List
+
+ The following genres is defined in ID3v1
+
+ 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.AlternRock
+ 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
+ 60.Top 40
+ 61.Christian Rap
+ 62.Pop/Funk
+ 63.Jungle
+ 64.Native American
+ 65.Cabaret
+ 66.New Wave
+ 67.Psychadelic
+ 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
+
+ The following genres are Winamp extensions
+
+ 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 capella
+ 124.Euro-House
+ 125.Dance Hall
+
+
+A.4. Track addition - ID3v1.1
+
+ In ID3v1.1, Michael Mutschler revised the specification of the
+ comment field in order to implement the track number. The new format
+ of the comment field is a 28 character string followed by a mandatory
+ null ($00) character and the original album tracknumber stored as an
+ unsigned byte-size integer. In such cases where the 29th byte is not
+ the null character or when the 30th is a null character, the
+ tracknumber is to be considered undefined.
+
+
+9. Author's Address
+
+ Martin Nilsson
+ Rydsvägen 246 C. 30
+ S-584 34 Linköping
+ Sweden
+
+ Email: nilsson@id3.org
+
+ Co-authors:
+
+ Johan Sundström Email: johan@id3.org
+
+
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/id3v2.3.0.txt b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/id3v2.3.0.txt
new file mode 100644
index 000000000..b4ed763ee
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/id3v2.3.0.txt
@@ -0,0 +1,2022 @@
+Informal standard M. Nilsson
+Document: id3v2.3.0.txt 3rd February 1999
+
+
+ ID3 tag version 2.3.0
+
+Status of this document
+
+ This document is an informal standard and replaces the ID3v2.2.0
+ standard [ID3v2]. The informal standard is released so that
+ implementors could have a set standard before a formal standard is
+ set. The formal standard will use another version or revision number
+ if not identical to what is described in this document. The contents
+ in this document may change for clarifications but never for added or
+ altered functionallity.
+
+ Distribution of this document is unlimited.
+
+
+Abstract
+
+ This document describes the ID3v2.3.0, which is a more developed
+ version of the ID3v2 informal standard [ID3v2] (version 2.2.0),
+ evolved from the ID3 tagging system. The ID3v2 offers a flexible way
+ of storing information about an audio file within itself to determine
+ its origin and contents. The information may be technical
+ information, such as equalisation curves, as well as related meta
+ information, such as title, performer, copyright etc.
+
+
+1. Table of contents
+
+ 2. Conventions in this document
+ 3. ID3v2 overview
+ 3.1. ID3v2 header
+ 3.2. ID3v2 extended header
+ 3.3. ID3v2 frames overview
+ 3.3.1. Frame header flags
+ 3.3.2. Default flags
+ 4. Declared ID3v2 frames
+ 4.1. Unique file identifier
+ 4.2. Text information frames
+ 4.2.1. Text information frames - details
+ 4.2.2. User defined text information frame
+ 4.3. URL link frames
+ 4.3.1. URL link frames - details
+ 4.3.2. User defined URL link frame
+ 4.4. Involved people list
+ 4.5. Music CD Identifier
+ 4.6. Event timing codes
+ 4.7. MPEG location lookup table
+ 4.8. Synced tempo codes
+ 4.9. Unsychronised lyrics/text transcription
+ 4.10. Synchronised lyrics/text
+ 4.11. Comments
+ 4.12. Relative volume adjustment
+ 4.13. Equalisation
+ 4.14. Reverb
+ 4.15. Attached picture
+ 4.16. General encapsulated object
+ 4.17. Play counter
+ 4.18. Popularimeter
+ 4.19. Recommended buffer size
+ 4.20. Audio encryption
+ 4.21. Linked information
+ 4.22. Position synchronisation frame
+ 4.23. Terms of use
+ 4.24. Ownership frame
+ 4.25. Commercial frame
+ 4.26. Encryption method registration
+ 4.27. Group identification registration
+ 4.28. Private frame
+ 5. The 'unsynchronisation scheme'
+ 6. Copyright
+ 7. References
+ 8. Appendix
+ A. Appendix A - Genre List from ID3v1
+ 9. Author's Address
+
+
+2. Conventions in this document
+
+ In the examples, text within "" is a text string exactly as it
+ appears in a file. Numbers preceded with $ are hexadecimal and
+ numbers preceded with % are binary. $xx is used to indicate a byte
+ with unknown content. %x is used to indicate a bit with unknown
+ content. The most significant bit (MSB) of a byte is called 'bit 7'
+ and the least significant bit (LSB) is called 'bit 0'.
+
+ A tag is the whole tag described in this document. A frame is a block
+ of information in the tag. The tag consists of a header, frames and
+ optional padding. A field is a piece of information; one value, a
+ string etc. A numeric string is a string that consists of the
+ characters 0-9 only.
+
+
+3. ID3v2 overview
+
+ The two biggest design goals were to be able to implement ID3v2
+ without disturbing old software too much and that ID3v2 should be
+ as flexible and expandable as possible.
+
+ The first criterion is met by the simple fact that the MPEG [MPEG]
+ decoding software uses a syncsignal, embedded in the audiostream, to
+ 'lock on to' the audio. Since the ID3v2 tag doesn't contain a valid
+ syncsignal, no software will attempt to play the tag. If, for any
+ reason, coincidence make a syncsignal appear within the tag it will
+ be taken care of by the 'unsynchronisation scheme' described in
+ section 5.
+
+ The second criterion has made a more noticeable impact on the design
+ of the ID3v2 tag. It is constructed as a container for several
+ information blocks, called frames, whose format need not be known to
+ the software that encounters them. At the start of every frame there
+ is an identifier that explains the frames' format and content, and a
+ size descriptor that allows software to skip unknown frames.
+
+ If a total revision of the ID3v2 tag should be needed, there is a
+ version number and a size descriptor in the ID3v2 header.
+
+ The ID3 tag described in this document is mainly targeted at files
+ encoded with MPEG-1/2 layer I, MPEG-1/2 layer II, MPEG-1/2 layer III
+ and MPEG-2.5, but may work with other types of encoded audio.
+
+ The bitorder in ID3v2 is most significant bit first (MSB). The
+ byteorder in multibyte numbers is most significant byte first (e.g.
+ $12345678 would be encoded $12 34 56 78).
+
+ It is permitted to include padding after all the final frame (at the
+ end of the ID3 tag), making the size of all the frames together
+ smaller than the size given in the head of the tag. A possible
+ purpose of this padding is to allow for adding a few additional
+ frames or enlarge existing frames within the tag without having to
+ rewrite the entire file. The value of the padding bytes must be $00.
+
+
+3.1. ID3v2 header
+
+ The ID3v2 tag header, which should be the first information in the
+ file, is 10 bytes as follows:
+
+ ID3v2/file identifier "ID3"
+ ID3v2 version $03 00
+ ID3v2 flags %abc00000
+ ID3v2 size 4 * %0xxxxxxx
+
+ The first three bytes of the tag are always "ID3" to indicate that
+ this is an ID3v2 tag, directly followed by the two version bytes. The
+ first byte of ID3v2 version is it's major version, while the second
+ byte is its revision number. In this case this is ID3v2.3.0. All
+ revisions are backwards compatible while major versions are not. If
+ software with ID3v2.2.0 and below support should encounter version
+ three or higher it should simply ignore the whole tag. Version and
+ revision will never be $FF.
+
+ The version is followed by one the ID3v2 flags field, of which
+ currently only three flags are used.
+
+
+ a - Unsynchronisation
+
+ Bit 7 in the 'ID3v2 flags' indicates whether or not
+ unsynchronisation is used (see section 5 for details); a set bit
+ indicates usage.
+
+
+ b - Extended header
+
+ The second bit (bit 6) indicates whether or not the header is
+ followed by an extended header. The extended header is described in
+ section 3.2.
+
+
+ c - Experimental indicator
+
+ The third bit (bit 5) should be used as an 'experimental
+ indicator'. This flag should always be set when the tag is in an
+ experimental stage.
+
+ All the other flags should be cleared. If one of these undefined
+ flags are set that might mean that the tag is not readable for a
+ parser that does not know the flags function.
+
+ The ID3v2 tag size is encoded with four bytes where the most
+ significant bit (bit 7) is set to zero in every byte, making a total
+ of 28 bits. The zeroed bits are ignored, so a 257 bytes long tag is
+ represented as $00 00 02 01.
+
+ The ID3v2 tag size is the size of the complete tag after
+ unsychronisation, including padding, excluding the header but not
+ excluding the extended header (total tag size - 10). Only 28 bits
+ (representing up to 256MB) are used in the size description to avoid
+ the introducuction of 'false syncsignals'.
+
+ An ID3v2 tag can be detected with the following pattern:
+ $49 44 33 yy yy xx zz zz zz zz
+ Where yy is less than $FF, xx is the 'flags' byte and zz is less than
+ $80.
+
+
+3.2. ID3v2 extended header
+
+ The extended header contains information that is not vital to the
+ correct parsing of the tag information, hence the extended header is
+ optional.
+
+ Extended header size $xx xx xx xx
+ Extended Flags $xx xx
+ Size of padding $xx xx xx xx
+
+ Where the 'Extended header size', currently 6 or 10 bytes, excludes
+ itself. The 'Size of padding' is simply the total tag size excluding
+ the frames and the headers, in other words the padding. The extended
+ header is considered separate from the header proper, and as such is
+ subject to unsynchronisation.
+
+ The extended flags are a secondary flag set which describes further
+ attributes of the tag. These attributes are currently defined as
+ follows
+
+ %x0000000 00000000
+
+
+ x - CRC data present
+
+ If this flag is set four bytes of CRC-32 data is appended to the
+ extended header. The CRC should be calculated before
+ unsynchronisation on the data between the extended header and the
+ padding, i.e. the frames and only the frames.
+
+ Total frame CRC $xx xx xx xx
+
+
+3.3. ID3v2 frame overview
+
+ As the tag consists of a tag header and a tag body with one or more
+ frames, all the frames consists of a frame header followed by one or
+ more fields containing the actual information. The layout of the
+ frame header:
+
+ Frame ID $xx xx xx xx (four characters)
+ Size $xx xx xx xx
+ Flags $xx xx
+
+ The frame ID made out of the characters capital A-Z and 0-9.
+ Identifiers beginning with "X", "Y" and "Z" are for experimental use
+ and free for everyone to use, without the need to set the
+ experimental bit in the tag header. Have in mind that someone else
+ might have used the same identifier as you. All other identifiers are
+ either used or reserved for future use.
+
+ The frame ID is followed by a size descriptor, making a total header
+ size of ten bytes in every frame. The size is calculated as frame
+ size excluding frame header (frame size - 10).
+
+ In the frame header the size descriptor is followed by two flags
+ bytes. These flags are described in section 3.3.1.
+
+ There is no fixed order of the frames' appearance in the tag,
+ although it is desired that the frames are arranged in order of
+ significance concerning the recognition of the file. An example of
+ such order: UFID, TIT2, MCDI, TRCK ...
+
+ A tag must contain at least one frame. A frame must be at least 1
+ byte big, excluding the header.
+
+ If nothing else is said a string is represented as ISO-8859-1
+ [ISO-8859-1] characters in the range $20 - $FF. Such strings are
+ represented as , or if newlines are
+ allowed, in the frame descriptions. All Unicode strings [UNICODE] use
+ 16-bit unicode 2.0 (ISO/IEC 10646-1:1993, UCS-2). Unicode strings
+ must begin with the Unicode BOM ($FF FE or $FE FF) to identify the
+ byte order.
+
+ All numeric strings and URLs [URL] are always encoded as ISO-8859-1.
+ Terminated strings are terminated with $00 if encoded with ISO-8859-1
+ and $00 00 if encoded as unicode. If nothing else is said newline
+ character is forbidden. In ISO-8859-1 a new line is represented, when
+ allowed, with $0A only. Frames that allow different types of text
+ encoding have a text encoding description byte directly after the
+ frame size. If ISO-8859-1 is used this byte should be $00, if Unicode
+ is used it should be $01. Strings dependent on encoding is
+ represented as , or if newlines are allowed. Any empty
+ Unicode strings which are NULL-terminated may have the Unicode BOM
+ followed by a Unicode NULL ($FF FE 00 00 or $FE FF 00 00).
+
+ The three byte language field is used to describe the language of the
+ frame's content, according to ISO-639-2 [ISO-639-2].
+
+ All URLs [URL] may be relative, e.g. "picture.png", "../doc.txt".
+
+ If a frame is longer than it should be, e.g. having more fields than
+ specified in this document, that indicates that additions to the
+ frame have been made in a later version of the ID3v2 standard. This
+ is reflected by the revision number in the header of the tag.
+
+
+3.3.1. Frame header flags
+
+ In the frame header the size descriptor is followed by two flags
+ bytes. All unused flags must be cleared. The first byte is for
+ 'status messages' and the second byte is for encoding purposes. If an
+ unknown flag is set in the first byte the frame may not be changed
+ without the bit cleared. If an unknown flag is set in the second byte
+ it is likely to not be readable. The flags field is defined as
+ follows.
+
+ %abc00000 %ijk00000
+
+
+ a - Tag alter preservation
+
+ This flag tells the software what to do with this frame if it is
+ unknown and the tag is altered in any way. This applies to all
+ kinds of alterations, including adding more padding and reordering
+ the frames.
+
+ 0 Frame should be preserved.
+ 1 Frame should be discarded.
+
+
+ b - File alter preservation
+
+ This flag tells the software what to do with this frame if it is
+ unknown and the file, excluding the tag, is altered. This does not
+ apply when the audio is completely replaced with other audio data.
+
+ 0 Frame should be preserved.
+ 1 Frame should be discarded.
+
+
+ c - Read only
+
+ This flag, if set, tells the software that the contents of this
+ frame is intended to be read only. Changing the contents might
+ break something, e.g. a signature. If the contents are changed,
+ without knowledge in why the frame was flagged read only and
+ without taking the proper means to compensate, e.g. recalculating
+ the signature, the bit should be cleared.
+
+
+ i - Compression
+
+ This flag indicates whether or not the frame is compressed.
+
+ 0 Frame is not compressed.
+ 1 Frame is compressed using zlib [zlib] with 4 bytes for
+ 'decompressed size' appended to the frame header.
+
+
+ j - Encryption
+
+ This flag indicates wether or not the frame is enrypted. If set
+ one byte indicating with which method it was encrypted will be
+ appended to the frame header. See section 4.26. for more
+ information about encryption method registration.
+
+ 0 Frame is not encrypted.
+ 1 Frame is encrypted.
+
+
+ k - Grouping identity
+
+ This flag indicates whether or not this frame belongs in a group
+ with other frames. If set a group identifier byte is added to the
+ frame header. Every frame with the same group identifier belongs
+ to the same group.
+
+ 0 Frame does not contain group information
+ 1 Frame contains group information
+
+
+ Some flags indicates that the frame header is extended with
+ additional information. This information will be added to the frame
+ header in the same order as the flags indicating the additions. I.e.
+ the four bytes of decompressed size will preceed the encryption
+ method byte. These additions to the frame header, while not included
+ in the frame header size but are included in the 'frame size' field,
+ are not subject to encryption or compression.
+
+
+3.3.2. Default flags
+
+ The default settings for the frames described in this document can be
+ divided into the following classes. The flags may be set differently
+ if found more suitable by the software.
+
+ 1. Discarded if tag is altered, discarded if file is altered.
+
+ None.
+
+ 2. Discarded if tag is altered, preserved if file is altered.
+
+ None.
+
+ 3. Preserved if tag is altered, discarded if file is altered.
+
+ AENC, ETCO, EQUA, MLLT, POSS, SYLT, SYTC, RVAD, TENC, TLEN, TSIZ
+
+ 4. Preserved if tag is altered, preserved if file is altered.
+
+ The rest of the frames.
+
+
+4. Declared ID3v2 frames
+
+ The following frames are declared in this draft.
+
+ 4.21 AENC Audio encryption
+ 4.15 APIC Attached picture
+
+ 4.11 COMM Comments
+ 4.25 COMR Commercial frame
+
+ 4.26 ENCR Encryption method registration
+ 4.13 EQUA Equalization
+ 4.6 ETCO Event timing codes
+
+ 4.16 GEOB General encapsulated object
+ 4.27 GRID Group identification registration
+
+ 4.4 IPLS Involved people list
+
+ 4.21 LINK Linked information
+
+ 4.5 MCDI Music CD identifier
+ 4.7 MLLT MPEG location lookup table
+
+ 4.24 OWNE Ownership frame
+
+ 4.28. PRIV Private frame
+ 4.17 PCNT Play counter
+ 4.18 POPM Popularimeter
+ 4.22 POSS Position synchronisation frame
+
+ 4.19 RBUF Recommended buffer size
+ 4.12 RVAD Relative volume adjustment
+ 4.14 RVRB Reverb
+
+ 4.10 SYLT Synchronized lyric/text
+ 4.8 SYTC Synchronized tempo codes
+
+ 4.2.1 TALB Album/Movie/Show title
+ 4.2.1 TBPM BPM (beats per minute)
+ 4.2.1 TCOM Composer
+ 4.2.1 TCON Content type
+ 4.2.1 TCOP Copyright message
+ 4.2.1 TDAT Date
+ 4.2.1 TDLY Playlist delay
+ 4.2.1 TENC Encoded by
+ 4.2.1 TEXT Lyricist/Text writer
+ 4.2.1 TFLT File type
+ 4.2.1 TIME Time
+ 4.2.1 TIT1 Content group description
+ 4.2.1 TIT2 Title/songname/content description
+ 4.2.1 TIT3 Subtitle/Description refinement
+ 4.2.1 TKEY Initial key
+ 4.2.1 TLAN Language(s)
+ 4.2.1 TLEN Length
+ 4.2.1 TMED Media type
+ 4.2.1 TOAL Original album/movie/show title
+ 4.2.1 TOFN Original filename
+ 4.2.1 TOLY Original lyricist(s)/text writer(s)
+ 4.2.1 TOPE Original artist(s)/performer(s)
+ 4.2.1 TORY Original release year
+ 4.2.1 TOWN File owner/licensee
+ 4.2.1 TPE1 Lead performer(s)/Soloist(s)
+ 4.2.1 TPE2 Band/orchestra/accompaniment
+ 4.2.1 TPE3 Conductor/performer refinement
+ 4.2.1 TPE4 Interpreted, remixed, or otherwise modified by
+ 4.2.1 TPOS Part of a set
+ 4.2.1 TPUB Publisher
+ 4.2.1 TRCK Track number/Position in set
+ 4.2.1 TRDA Recording dates
+ 4.2.1 TRSN Internet radio station name
+ 4.2.1 TRSO Internet radio station owner
+ 4.2.1 TSIZ Size
+ 4.2.1 TSRC ISRC (international standard recording code)
+ 4.2.1 TSSE Software/Hardware and settings used for encoding
+ 4.2.1 TYER Year
+ 4.2.2 TXXX User defined text information frame
+
+ 4.1 UFID Unique file identifier
+ 4.23 USER Terms of use
+ 4.9 USLT Unsychronized lyric/text transcription
+
+ 4.3.1 WCOM Commercial information
+ 4.3.1 WCOP Copyright/Legal information
+ 4.3.1 WOAF Official audio file webpage
+ 4.3.1 WOAR Official artist/performer webpage
+ 4.3.1 WOAS Official audio source webpage
+ 4.3.1 WORS Official internet radio station homepage
+ 4.3.1 WPAY Payment
+ 4.3.1 WPUB Publishers official webpage
+ 4.3.2 WXXX User defined URL link frame
+
+
+4.1. Unique file identifier
+
+ This frame's purpose is to be able to identify the audio file in a
+ database that may contain more information relevant to the content.
+ Since standardisation of such a database is beyond this document, all
+ frames begin with a null-terminated string with a URL [URL]
+ containing an email address, or a link to a location where an email
+ address can be found, that belongs to the organisation responsible
+ for this specific database implementation. Questions regarding the
+ database should be sent to the indicated email address. The URL
+ should not be used for the actual database queries. The string
+ "http://www.id3.org/dummy/ufid.html" should be used for tests.
+ Software that isn't told otherwise may safely remove such frames. The
+ 'Owner identifier' must be non-empty (more than just a termination).
+ The 'Owner identifier' is then followed by the actual identifier,
+ which may be up to 64 bytes. There may be more than one "UFID" frame
+ in a tag, but only one with the same 'Owner identifier'.
+
+
+ Owner identifier $00
+ Identifier
+
+
+4.2. Text information frames
+
+ The text information frames are the most important frames, containing
+ information like artist, album and more. There may only be one text
+ information frame of its kind in an tag. If the textstring is
+ followed by a termination ($00 (00)) all the following information
+ should be ignored and not be displayed. All text frame identifiers
+ begin with "T". Only text frame identifiers begin with "T", with the
+ exception of the "TXXX" frame. All the text information frames have
+ the following format:
+
+
+ Text encoding $xx
+ Information
+
+
+4.2.1. Text information frames - details
+
+ TALB
+ The 'Album/Movie/Show title' frame is intended for the title of the
+ recording(/source of sound) which the audio in the file is taken
+ from.
+
+ TBPM
+ The 'BPM' frame contains the number of beats per minute in the
+ mainpart of the audio. The BPM is an integer and represented as a
+ numerical string.
+
+ TCOM
+ The 'Composer(s)' frame is intended for the name of the composer(s).
+ They are seperated with the "/" character.
+
+ TCON
+ The 'Content type', which previously was stored as a one byte numeric
+ value only, is now a numeric string. You may use one or several of
+ the types as ID3v1.1 did or, since the category list would be
+ impossible to maintain with accurate and up to date categories,
+ define your own.
+
+ References to the ID3v1 genres can be made by, as first byte, enter
+ "(" followed by a number from the genres list (appendix A.) and
+ ended with a ")" character. This is optionally followed by a
+ refinement, e.g. "(21)" or "(4)Eurodisco". Several references can be
+ made in the same frame, e.g. "(51)(39)". If the refinement should
+ begin with a "(" character it should be replaced with "((", e.g. "((I
+ can figure out any genre)" or "(55)((I think...)". The following new
+ content types is defined in ID3v2 and is implemented in the same way
+ as the numerig content types, e.g. "(RX)".
+
+ RX Remix
+ CR Cover
+
+ TCOP
+ The 'Copyright message' frame, which must begin with a year and a
+ space character (making five characters), is intended for the
+ copyright holder of the original sound, not the audio file itself.
+ The absence of this frame means only that the copyright information
+ is unavailable or has been removed, and must not be interpreted to
+ mean that the sound is public domain. Every time this field is
+ displayed the field must be preceded with "Copyright " (C) " ", where
+ (C) is one character showing a C in a circle.
+
+ TDAT
+ The 'Date' frame is a numeric string in the DDMM format containing
+ the date for the recording. This field is always four characters
+ long.
+
+ TDLY
+ The 'Playlist delay' defines the numbers of milliseconds of silence
+ between every song in a playlist. The player should use the "ETC"
+ frame, if present, to skip initial silence and silence at the end of
+ the audio to match the 'Playlist delay' time. The time is represented
+ as a numeric string.
+
+ TENC
+ The 'Encoded by' frame contains the name of the person or
+ organisation that encoded the audio file. This field may contain a
+ copyright message, if the audio file also is copyrighted by the
+ encoder.
+
+ TEXT
+ The 'Lyricist(s)/Text writer(s)' frame is intended for the writer(s)
+ of the text or lyrics in the recording. They are seperated with the
+ "/" character.
+
+ TFLT
+ The 'File type' frame indicates which type of audio this tag defines.
+ The following type and refinements are defined:
+
+ MPG MPEG Audio
+ /1 MPEG 1/2 layer I
+ /2 MPEG 1/2 layer II
+ /3 MPEG 1/2 layer III
+ /2.5 MPEG 2.5
+ /AAC Advanced audio compression
+ VQF Transform-domain Weighted Interleave Vector Quantization
+ PCM Pulse Code Modulated audio
+
+ but other types may be used, not for these types though. This is used
+ in a similar way to the predefined types in the "TMED" frame, but
+ without parentheses. If this frame is not present audio type is
+ assumed to be "MPG".
+
+ TIME
+ The 'Time' frame is a numeric string in the HHMM format containing
+ the time for the recording. This field is always four characters
+ long.
+
+ TIT1
+ The 'Content group description' frame is used if the sound belongs to
+ a larger category of sounds/music. For example, classical music is
+ often sorted in different musical sections (e.g. "Piano Concerto",
+ "Weather - Hurricane").
+
+ TIT2
+ The 'Title/Songname/Content description' frame is the actual name of
+ the piece (e.g. "Adagio", "Hurricane Donna").
+
+ TIT3
+ The 'Subtitle/Description refinement' frame is used for information
+ directly related to the contents title (e.g. "Op. 16" or "Performed
+ live at Wembley").
+
+ TKEY
+ The 'Initial key' frame contains the musical key in which the sound
+ starts. It is represented as a string with a maximum length of three
+ characters. The ground keys are represented with "A","B","C","D","E",
+ "F" and "G" and halfkeys represented with "b" and "#". Minor is
+ represented as "m". Example "Cbm". Off key is represented with an "o"
+ only.
+
+ TLAN
+ The 'Language(s)' frame should contain the languages of the text or
+ lyrics spoken or sung in the audio. The language is represented with
+ three characters according to ISO-639-2. If more than one language is
+ used in the text their language codes should follow according to
+ their usage.
+
+ TLEN
+ The 'Length' frame contains the length of the audiofile in
+ milliseconds, represented as a numeric string.
+
+ TMED
+ The 'Media type' frame describes from which media the sound
+ originated. This may be a text string or a reference to the
+ predefined media types found in the list below. References are made
+ within "(" and ")" and are optionally followed by a text refinement,
+ e.g. "(MC) with four channels". If a text refinement should begin
+ with a "(" character it should be replaced with "((" in the same way
+ as in the "TCO" frame. Predefined refinements is appended after the
+ media type, e.g. "(CD/A)" or "(VID/PAL/VHS)".
+
+ DIG Other digital media
+ /A Analog transfer from media
+
+ ANA Other analog media
+ /WAC Wax cylinder
+ /8CA 8-track tape cassette
+
+ CD CD
+ /A Analog transfer from media
+ /DD DDD
+ /AD ADD
+ /AA AAD
+
+ LD Laserdisc
+ /A Analog transfer from media
+
+ TT Turntable records
+ /33 33.33 rpm
+ /45 45 rpm
+ /71 71.29 rpm
+ /76 76.59 rpm
+ /78 78.26 rpm
+ /80 80 rpm
+
+ MD MiniDisc
+ /A Analog transfer from media
+
+ DAT DAT
+ /A Analog transfer from media
+ /1 standard, 48 kHz/16 bits, linear
+ /2 mode 2, 32 kHz/16 bits, linear
+ /3 mode 3, 32 kHz/12 bits, nonlinear, low speed
+ /4 mode 4, 32 kHz/12 bits, 4 channels
+ /5 mode 5, 44.1 kHz/16 bits, linear
+ /6 mode 6, 44.1 kHz/16 bits, 'wide track' play
+
+ DCC DCC
+ /A Analog transfer from media
+
+ DVD DVD
+ /A Analog transfer from media
+
+ TV Television
+ /PAL PAL
+ /NTSC NTSC
+ /SECAM SECAM
+
+ VID Video
+ /PAL PAL
+ /NTSC NTSC
+ /SECAM SECAM
+ /VHS VHS
+ /SVHS S-VHS
+ /BETA BETAMAX
+
+ RAD Radio
+ /FM FM
+ /AM AM
+ /LW LW
+ /MW MW
+
+ TEL Telephone
+ /I ISDN
+
+ MC MC (normal cassette)
+ /4 4.75 cm/s (normal speed for a two sided cassette)
+ /9 9.5 cm/s
+ /I Type I cassette (ferric/normal)
+ /II Type II cassette (chrome)
+ /III Type III cassette (ferric chrome)
+ /IV Type IV cassette (metal)
+
+ REE Reel
+ /9 9.5 cm/s
+ /19 19 cm/s
+ /38 38 cm/s
+ /76 76 cm/s
+ /I Type I cassette (ferric/normal)
+ /II Type II cassette (chrome)
+ /III Type III cassette (ferric chrome)
+ /IV Type IV cassette (metal)
+
+ TOAL
+ The 'Original album/movie/show title' frame is intended for the title
+ of the original recording (or source of sound), if for example the
+ music in the file should be a cover of a previously released song.
+
+ TOFN
+ The 'Original filename' frame contains the preferred filename for the
+ file, since some media doesn't allow the desired length of the
+ filename. The filename is case sensitive and includes its suffix.
+
+ TOLY
+ The 'Original lyricist(s)/text writer(s)' frame is intended for the
+ text writer(s) of the original recording, if for example the music in
+ the file should be a cover of a previously released song. The text
+ writers are seperated with the "/" character.
+
+ TOPE
+ The 'Original artist(s)/performer(s)' frame is intended for the
+ performer(s) of the original recording, if for example the music in
+ the file should be a cover of a previously released song. The
+ performers are seperated with the "/" character.
+
+ TORY
+ The 'Original release year' frame is intended for the year when the
+ original recording, if for example the music in the file should be a
+ cover of a previously released song, was released. The field is
+ formatted as in the "TYER" frame.
+
+ TOWN
+ The 'File owner/licensee' frame contains the name of the owner or
+ licensee of the file and it's contents.
+
+ TPE1
+ The 'Lead artist(s)/Lead performer(s)/Soloist(s)/Performing group' is
+ used for the main artist(s). They are seperated with the "/"
+ character.
+
+ TPE2
+ The 'Band/Orchestra/Accompaniment' frame is used for additional
+ information about the performers in the recording.
+
+ TPE3
+ The 'Conductor' frame is used for the name of the conductor.
+
+ TPE4
+ The 'Interpreted, remixed, or otherwise modified by' frame contains
+ more information about the people behind a remix and similar
+ interpretations of another existing piece.
+
+ TPOS
+ The 'Part of a set' frame is a numeric string that describes which
+ part of a set the audio came from. This frame is used if the source
+ described in the "TALB" frame is divided into several mediums, e.g. a
+ double CD. The value may be extended with a "/" character and a
+ numeric string containing the total number of parts in the set. E.g.
+ "1/2".
+
+ TPUB
+ The 'Publisher' frame simply contains the name of the label or
+ publisher.
+
+ TRCK
+ The 'Track number/Position in set' frame is a numeric string
+ containing the order number of the audio-file on its original
+ recording. This may be extended with a "/" character and a numeric
+ string containing the total numer of tracks/elements on the original
+ recording. E.g. "4/9".
+
+ TRDA
+ The 'Recording dates' frame is a intended to be used as complement to
+ the "TYER", "TDAT" and "TIME" frames. E.g. "4th-7th June, 12th June"
+ in combination with the "TYER" frame.
+
+ TRSN
+ The 'Internet radio station name' frame contains the name of the
+ internet radio station from which the audio is streamed.
+
+ TRSO
+ The 'Internet radio station owner' frame contains the name of the
+ owner of the internet radio station from which the audio is
+ streamed.
+
+ TSIZ
+ The 'Size' frame contains the size of the audiofile in bytes,
+ excluding the ID3v2 tag, represented as a numeric string.
+
+ TSRC
+ The 'ISRC' frame should contain the International Standard Recording
+ Code [ISRC] (12 characters).
+
+ TSSE
+ The 'Software/Hardware and settings used for encoding' frame
+ includes the used audio encoder and its settings when the file was
+ encoded. Hardware refers to hardware encoders, not the computer on
+ which a program was run.
+
+ TYER
+ The 'Year' frame is a numeric string with a year of the recording.
+ This frames is always four characters long (until the year 10000).
+
+
+4.2.2. User defined text information frame
+
+ This frame is intended for one-string text information concerning the
+ audiofile in a similar way to the other "T"-frames. The frame body
+ consists of a description of the string, represented as a terminated
+ string, followed by the actual string. There may be more than one
+ "TXXX" frame in each tag, but only one with the same description.
+
+
+ Text encoding $xx
+ Description $00 (00)
+ Value
+
+
+4.3. URL link frames
+
+ With these frames dynamic data such as webpages with touring
+ information, price information or plain ordinary news can be added to
+ the tag. There may only be one URL [URL] link frame of its kind in an
+ tag, except when stated otherwise in the frame description. If the
+ textstring is followed by a termination ($00 (00)) all the following
+ information should be ignored and not be displayed. All URL link
+ frame identifiers begins with "W". Only URL link frame identifiers
+ begins with "W". All URL link frames have the following format:
+
+
+ URL
+
+
+4.3.1. URL link frames - details
+
+ WCOM
+ The 'Commercial information' frame is a URL pointing at a webpage
+ with information such as where the album can be bought. There may be
+ more than one "WCOM" frame in a tag, but not with the same content.
+
+ WCOP
+ The 'Copyright/Legal information' frame is a URL pointing at a
+ webpage where the terms of use and ownership of the file is
+ described.
+
+ WOAF
+ The 'Official audio file webpage' frame is a URL pointing at a file
+ specific webpage.
+
+ WOAR
+ The 'Official artist/performer webpage' frame is a URL pointing at
+ the artists official webpage. There may be more than one "WOAR" frame
+ in a tag if the audio contains more than one performer, but not with
+ the same content.
+
+ WOAS
+ The 'Official audio source webpage' frame is a URL pointing at the
+ official webpage for the source of the audio file, e.g. a movie.
+
+ WORS
+ The 'Official internet radio station homepage' contains a URL
+ pointing at the homepage of the internet radio station.
+
+ WPAY
+ The 'Payment' frame is a URL pointing at a webpage that will handle
+ the process of paying for this file.
+
+ WPUB
+ The 'Publishers official webpage' frame is a URL pointing at the
+ official wepage for the publisher.
+
+
+4.3.2. User defined URL link frame
+
+ This frame is intended for URL [URL] links concerning the audiofile
+ in a similar way to the other "W"-frames. The frame body consists
+ of a description of the string, represented as a terminated string,
+ followed by the actual URL. The URL is always encoded with ISO-8859-1
+ [ISO-8859-1]. There may be more than one "WXXX" frame in each tag,
+ but only one with the same description.
+
+
+ Text encoding $xx
+ Description $00 (00)
+ URL
+
+
+4.4. Involved people list
+
+ Since there might be a lot of people contributing to an audio file in
+ various ways, such as musicians and technicians, the 'Text
+ information frames' are often insufficient to list everyone involved
+ in a project. The 'Involved people list' is a frame containing the
+ names of those involved, and how they were involved. The body simply
+ contains a terminated string with the involvement directly followed
+ by a terminated string with the involvee followed by a new
+ involvement and so on. There may only be one "IPLS" frame in each
+ tag.
+
+
+ Text encoding $xx
+ People list strings
+
+
+4.5. Music CD identifier
+
+ This frame is intended for music that comes from a CD, so that the CD
+ can be identified in databases such as the CDDB [CDDB]. The frame
+ consists of a binary dump of the Table Of Contents, TOC, from the CD,
+ which is a header of 4 bytes and then 8 bytes/track on the CD plus 8
+ bytes for the 'lead out' making a maximum of 804 bytes. The offset to
+ the beginning of every track on the CD should be described with a
+ four bytes absolute CD-frame address per track, and not with absolute
+ time. This frame requires a present and valid "TRCK" frame, even if
+ the CD's only got one track. There may only be one "MCDI" frame in
+ each tag.
+
+
+ CD TOC
+
+
+4.6. Event timing codes
+
+ This frame allows synchronisation with key events in a song or sound.
+ The header is:
+
+
+ Time stamp format $xx
+
+ Where time stamp format is:
+
+ $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit
+ $02 Absolute time, 32 bit sized, using milliseconds as unit
+
+ Abolute time means that every stamp contains the time from the
+ beginning of the 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 should be sorted in
+ chronological order. The type of event is as follows:
+
+ $00 padding (has no meaning)
+ $01 end of initial silence
+ $02 intro start
+ $03 mainpart start
+ $04 outro start
+ $05 outro end
+ $06 verse start
+ $07 refrain start
+ $08 interlude start
+ $09 theme start
+ $0A variation start
+ $0B key change
+ $0C time change
+ $0D momentary unwanted noise (Snap, Crackle & Pop)
+ $0E sustained noise
+ $0F sustained noise end
+ $10 intro end
+ $11 mainpart end
+ $12 verse end
+ $13 refrain end
+ $14 theme end
+
+ $15-$DF reserved for future use
+
+ $E0-$EF not predefined sync 0-F
+
+ $F0-$FC reserved for future use
+
+ $FD audio end (start of silence)
+ $FE audio file ends
+ $FF one more byte of events follows (all the following bytes with
+ the value $FF have the same function)
+
+ Terminating the start events such as "intro start" is not required.
+ The 'Not predefined sync's ($E0-EF) are for user events. You might
+ want to synchronise your music to something, like setting of an
+ explosion on-stage, turning on your screensaver etc.
+
+ There may only be one "ETCO" frame in each tag.
+
+
+4.7. MPEG location lookup table
+
+ To increase performance and accuracy of jumps within a MPEG [MPEG]
+ audio file, frames with timecodes in different locations in the file
+ might be useful. The ID3v2 frame includes references that the
+ software can use to calculate positions in the file. After the frame
+ header is a descriptor of how much the 'frame counter' should
+ increase for every reference. If this value is two then the first
+ reference points out the second frame, the 2nd reference the 4th
+ frame, the 3rd reference the 6th frame etc. In a similar way the
+ 'bytes between reference' and 'milliseconds between reference' points
+ out bytes and milliseconds respectively.
+
+ Each reference consists of two parts; a certain number of bits, as
+ defined in 'bits for bytes deviation', that describes the difference
+ between what is said in 'bytes between reference' and the reality and
+ a certain number of bits, as defined in 'bits for milliseconds
+ deviation', that describes the difference between what is said in
+ 'milliseconds between reference' and the reality. The number of bits
+ in every reference, i.e. 'bits for bytes deviation'+'bits for
+ milliseconds deviation', must be a multiple of four. There may only
+ be one "MLLT" frame in each tag.
+
+
+ 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....
+
+
+4.8. Synchronised tempo codes
+
+ For a more accurate description of the tempo of a musical piece this
+ frame might be used. After the header follows one byte describing
+ which time stamp format should be used. Then follows one or more
+ tempo codes. Each tempo code consists of one tempo part and one time
+ part. The tempo is in BPM described with one or two bytes. If the
+ first byte has the value $FF, one more byte follows, which is added
+ to the first giving a range from 2 - 510 BPM, since $00 and $01 is
+ reserved. $00 is used to describe a beat-free time period, which is
+ not the same as a music-free time period. $01 is used to indicate one
+ single beat-stroke followed by a beat-free period.
+
+ The tempo descriptor is followed by a time stamp. Every time the
+ tempo in the music changes, a tempo descriptor may indicate this for
+ the player. All tempo descriptors should be sorted in chronological
+ order. The first beat-stroke in a time-period is at the same time as
+ the beat description occurs. There may only be one "SYTC" frame in
+ each tag.
+
+
+ Time stamp format $xx
+ Tempo data
+
+ Where time stamp format is:
+
+ $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit
+ $02 Absolute time, 32 bit sized, using milliseconds as unit
+
+ Abolute time means that every stamp contains the time from the
+ beginning of the file.
+
+
+4.9. Unsychronised lyrics/text transcription
+
+ This frame contains the lyrics of the song or a text transcription of
+ other vocal activities. The head includes an encoding descriptor and
+ a content descriptor. The body consists of the actual text. The
+ 'Content descriptor' is a terminated string. If no descriptor is
+ entered, 'Content descriptor' is $00 (00) only. Newline characters
+ are allowed in the text. There may be more than one 'Unsynchronised
+ lyrics/text transcription' frame in each tag, but only one with the
+ same language and content descriptor.
+
+
+ Text encoding $xx
+ Language $xx xx xx
+ Content descriptor $00 (00)
+ Lyrics/text
+
+
+4.10. Synchronised lyrics/text
+
+ This is another way of incorporating the words, said or sung lyrics,
+ in the audio file as text, this time, however, in sync with the
+ audio. It might also be used to describing events e.g. occurring on a
+ stage or on the screen in sync with the audio. The header includes a
+ content descriptor, represented with as terminated textstring. If no
+ descriptor is entered, 'Content descriptor' is $00 (00) only.
+
+
+ Text encoding $xx
+ Language $xx xx xx
+ Time stamp format $xx
+ Content type $xx
+ Content descriptor $00 (00)
+
+
+ Encoding: $00 ISO-8859-1 [ISO-8859-1] character set is used => $00
+ is sync identifier.
+ $01 Unicode [UNICODE] character set is used => $00 00 is
+ sync identifier.
+
+ Content type: $00 is other
+ $01 is lyrics
+ $02 is text transcription
+ $03 is movement/part name (e.g. "Adagio")
+ $04 is events (e.g. "Don Quijote enters the stage")
+ $05 is chord (e.g. "Bb F Fsus")
+ $06 is trivia/'pop up' information
+
+ Time stamp format is:
+
+ $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit
+ $02 Absolute time, 32 bit sized, using milliseconds as unit
+
+ Abolute time means that every stamp contains the time from the
+ beginning of the file.
+
+ The text that follows the frame header differs from that of the
+ unsynchronised lyrics/text transcription in one major way. Each
+ syllable (or whatever size of text is considered to be convenient by
+ the encoder) is a null terminated string followed by a time stamp
+ denoting where in the sound file it belongs. Each sync thus has the
+ following structure:
+
+ Terminated text to be synced (typically a syllable)
+ Sync identifier (terminator to above string) $00 (00)
+ Time stamp $xx (xx ...)
+
+ The 'time stamp' is set to zero or the whole sync is omitted if
+ located directly at the beginning of the sound. All time stamps
+ should be sorted in chronological order. The sync can be considered
+ as a validator of the subsequent string.
+
+ Newline ($0A) characters are allowed in all "SYLT" frames and should
+ be used after every entry (name, event etc.) in a frame with the
+ content type $03 - $04.
+
+ A few considerations regarding whitespace characters: Whitespace
+ separating words should mark the beginning of a new word, thus
+ occurring in front of the first syllable of a new word. This is also
+ valid for new line characters. A syllable followed by a comma should
+ not be broken apart with a sync (both the syllable and the comma
+ should be before the sync).
+
+ An example: The "USLT" passage
+
+ "Strangers in the night" $0A "Exchanging glances"
+
+ would be "SYLT" encoded as:
+
+ "Strang" $00 xx xx "ers" $00 xx xx " in" $00 xx xx " the" $00 xx xx
+ " night" $00 xx xx 0A "Ex" $00 xx xx "chang" $00 xx xx "ing" $00 xx
+ xx "glan" $00 xx xx "ces" $00 xx xx
+
+ There may be more than one "SYLT" frame in each tag, but only one
+ with the same language and content descriptor.
+
+
+4.11. Comments
+
+ This frame is indended for any kind of full text information that
+ does not fit in any other frame. It consists of a frame header
+ followed by encoding, language and content descriptors and is ended
+ with the actual comment as a text string. Newline characters are
+ allowed in the comment text string. There may be more than one
+ comment frame in each tag, but only one with the same language and
+ content descriptor.
+
+
+ Text encoding $xx
+ Language $xx xx xx
+ Short content descrip. $00 (00)
+ The actual text
+
+
+4.12. Relative volume adjustment
+
+ This is a more subjective function than the previous ones. It allows
+ the user to say how much he wants to increase/decrease the volume on
+ each channel while the file is played. The purpose is to be able to
+ align all files to a reference volume, so that you don't have to
+ change the volume constantly. This frame may also be used to balance
+ adjust the audio. If the volume peak levels are known then this could
+ be described with the 'Peak volume right' and 'Peak volume left'
+ field. If Peakvolume is not known these fields could be left zeroed
+ or, if no other data follows, be completely omitted. There may only
+ be one "RVAD" frame in each tag.
+
+
+ Increment/decrement %00xxxxxx
+ Bits used for volume descr. $xx
+ Relative volume change, right $xx xx (xx ...)
+ Relative volume change, left $xx xx (xx ...)
+ Peak volume right $xx xx (xx ...)
+ Peak volume left $xx xx (xx ...)
+
+ In the increment/decrement field bit 0 is used to indicate the right
+ channel and bit 1 is used to indicate the left channel. 1 is
+ increment and 0 is decrement.
+
+ The 'bits used for volume description' field is normally $10 (16
+ bits) for MPEG 2 layer I, II and III [MPEG] and MPEG 2.5. This value
+ may not be $00. The volume is always represented with whole bytes,
+ padded in the beginning (highest bits) when 'bits used for volume
+ description' is not a multiple of eight.
+
+ This datablock is then optionally followed by a volume definition for
+ the left and right back channels. If this information is appended to
+ the frame the first two channels will be treated as front channels.
+ In the increment/decrement field bit 2 is used to indicate the right
+ back channel and bit 3 for the left back channel.
+
+ Relative volume change, right back $xx xx (xx ...)
+ Relative volume change, left back $xx xx (xx ...)
+ Peak volume right back $xx xx (xx ...)
+ Peak volume left back $xx xx (xx ...)
+
+ If the center channel adjustment is present the following is appended
+ to the existing frame, after the left and right back channels. The
+ center channel is represented by bit 4 in the increase/decrease
+ field.
+
+ Relative volume change, center $xx xx (xx ...)
+ Peak volume center $xx xx (xx ...)
+
+ If the bass channel adjustment is present the following is appended
+ to the existing frame, after the center channel. The bass channel is
+ represented by bit 5 in the increase/decrease field.
+
+ Relative volume change, bass $xx xx (xx ...)
+ Peak volume bass $xx xx (xx ...)
+
+
+4.13. Equalisation
+
+ This is another subjective, alignment frame. It allows the user to
+ predefine an equalisation curve within the audio file. There may only
+ be one "EQUA" frame in each tag.
+
+
+ Adjustment bits $xx
+
+ The 'adjustment bits' field defines the number of bits used for
+ representation of the adjustment. This is normally $10 (16 bits) for
+ MPEG 2 layer I, II and III [MPEG] and MPEG 2.5. This value may not be
+ $00.
+
+ 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 ...)
+
+ The increment/decrement bit is 1 for increment and 0 for decrement.
+ The equalisation bands should be ordered increasingly with reference
+ to frequency. All frequencies don't have to be declared. The
+ equalisation curve in the reading software should be interpolated
+ between the values in this frame. Three equal adjustments for three
+ subsequent frequencies. A frequency should only be described once in
+ the frame.
+
+
+4.14. Reverb
+
+ Yet another subjective one. You may here adjust echoes of different
+ kinds. Reverb left/right is the delay between every bounce in ms.
+ Reverb bounces left/right is the number of bounces that should be
+ made. $FF equals an infinite number of bounces. Feedback is the
+ amount of volume that should be returned to the next echo bounce. $00
+ is 0%, $FF is 100%. If this value were $7F, there would be 50% volume
+ reduction on the first bounce, 50% of that on the second and so on.
+ Left to left means the sound from the left bounce to be played in the
+ left speaker, while left to right means sound from the left bounce to
+ be played in the right speaker.
+
+ 'Premix left to right' is the amount of left sound to be mixed in the
+ right before any reverb is applied, where $00 id 0% and $FF is 100%.
+ 'Premix right to left' does the same thing, but right to left.
+ Setting both premix to $FF would result in a mono output (if the
+ reverb is applied symmetric). There may only be one "RVRB" frame in
+ each tag.
+
+
+ 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
+
+
+4.15. Attached picture
+
+ This frame contains a picture directly related to the audio file.
+ Image format is the MIME type and subtype [MIME] for the image. In
+ the event that the MIME media type name is omitted, "image/" will be
+ implied. The "image/png" [PNG] or "image/jpeg" [JFIF] picture format
+ should be used when interoperability is wanted. Description is a
+ short description of the picture, represented as a terminated
+ textstring. The description has a maximum length of 64 characters,
+ but may be empty. There may be several pictures attached to one file,
+ each in their individual "APIC" frame, but only one with the same
+ content descriptor. There may only be one picture with the picture
+ type declared as picture type $01 and $02 respectively. There is the
+ possibility to put only a link to the image file by using the 'MIME
+ type' "-->" and having a complete URL [URL] instead of picture data.
+ The use of linked files should however be used sparingly since there
+ is the risk of separation of files.
+
+
+ Text encoding $xx
+ MIME type $00
+ Picture type $xx
+ Description $00 (00)
+ Picture data
+
+
+ Picture type: $00 Other
+ $01 32x32 pixels 'file icon' (PNG only)
+ $02 Other file icon
+ $03 Cover (front)
+ $04 Cover (back)
+ $05 Leaflet page
+ $06 Media (e.g. lable side of CD)
+ $07 Lead artist/lead performer/soloist
+ $08 Artist/performer
+ $09 Conductor
+ $0A Band/Orchestra
+ $0B Composer
+ $0C Lyricist/text writer
+ $0D Recording Location
+ $0E During recording
+ $0F During performance
+ $10 Movie/video screen capture
+ $11 A bright coloured fish
+ $12 Illustration
+ $13 Band/artist logotype
+ $14 Publisher/Studio logotype
+
+
+4.16. General encapsulated object
+
+ In this frame any type of file can be encapsulated. After the header,
+ 'Frame size' and 'Encoding' follows 'MIME type' [MIME] represented as
+ as a terminated string encoded with ISO 8859-1 [ISO-8859-1]. The
+ filename is case sensitive and is encoded as 'Encoding'. Then follows
+ a content description as terminated string, encoded as 'Encoding'.
+ The last thing in the frame is the actual object. The first two
+ strings may be omitted, leaving only their terminations. MIME type is
+ always an ISO-8859-1 text string. There may be more than one "GEOB"
+ frame in each tag, but only one with the same content descriptor.
+
+
+ Text encoding $xx
+ MIME type $00
+ Filename $00 (00)
+ Content description $00 (00)
+ Encapsulated object
+
+
+4.17. Play counter
+
+ This is simply a counter of the number of times a file has been
+ played. The value is increased by one every time the file begins to
+ play. 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. The counter must
+ be at least 32-bits long to begin with.
+
+
+ Counter $xx xx xx xx (xx ...)
+
+
+4.18. Popularimeter
+
+ The purpose of this frame is to specify how good an audio file is.
+ Many interesting applications could be found to this frame such as a
+ playlist that features better audiofiles more often than others or it
+ could be used to profile a person's taste and find other 'good' files
+ by comparing people's profiles. The frame is very simple. It contains
+ the email address to the user, one rating byte and a four byte play
+ counter, intended to be increased with one for every time the file is
+ played. The email is a terminated string. The rating is 1-255 where
+ 1 is worst and 255 is best. 0 is unknown. If no personal counter is
+ wanted it may be omitted. When the counter reaches all one's, one
+ byte is inserted in front of the counter thus making the counter
+ eight bits bigger in the same away as the play counter ("PCNT").
+ There may be more than one "POPM" frame in each tag, but only one
+ with the same email address.
+
+
+ Email to user $00
+ Rating $xx
+ Counter $xx xx xx xx (xx ...)
+
+
+4.19. Recommended buffer size
+
+ Sometimes the server from which a audio file is streamed is aware of
+ transmission or coding problems resulting in interruptions in the
+ audio stream. In these cases, the size of the buffer can be
+ recommended by the server using this frame. If the 'embedded info
+ flag' is true (1) then this indicates that an ID3 tag with the
+ maximum size described in 'Buffer size' may occur in the audiostream.
+ In such case the tag should reside between two MPEG [MPEG] frames, if
+ the audio is MPEG encoded. If the position of the next tag is known,
+ 'offset to next tag' may be used. The offset is calculated from the
+ end of tag in which this frame resides to the first byte of the
+ header in the next. This field may be omitted. Embedded tags are
+ generally not recommended since this could render unpredictable
+ behaviour from present software/hardware.
+
+ For applications like streaming audio it might be an idea to embed
+ tags into the audio stream though. If the clients connects to
+ individual connections like HTTP and there is a possibility to begin
+ every transmission with a tag, then this tag should include a
+ 'recommended buffer size' frame. If the client is connected to a
+ arbitrary point in the stream, such as radio or multicast, then the
+ 'recommended buffer size' frame should be included in every tag.
+ Every tag that is picked up after the initial/first tag is to be
+ considered as an update of the previous one. E.g. if there is a
+ "TIT2" frame in the first received tag and one in the second tag,
+ then the first should be 'replaced' with the second.
+
+ The 'Buffer size' should be kept to a minimum. There may only be one
+ "RBUF" frame in each tag.
+
+
+ Buffer size $xx xx xx
+ Embedded info flag %0000000x
+ Offset to next tag $xx xx xx xx
+
+
+4.20. Audio encryption
+
+ This frame indicates if the actual audio stream is encrypted, and by
+ whom. Since standardisation of such encrypion scheme is beyond this
+ document, all "AENC" frames begin with a terminated string with a
+ URL containing an email address, or a link to a location where an
+ email address can be found, that belongs to the organisation
+ responsible for this specific encrypted audio file. Questions
+ regarding the encrypted audio should be sent to the email address
+ specified. If a $00 is found directly after the 'Frame size' and the
+ audiofile indeed is encrypted, the whole file may be considered
+ useless.
+
+ After the 'Owner identifier', a pointer to an unencrypted part of the
+ audio can be specified. The 'Preview start' and 'Preview length' is
+ described in frames. If no part is unencrypted, these fields should
+ be left zeroed. After the 'preview length' field follows optionally a
+ datablock required for decryption of the audio. There may be more
+ than one "AENC" frames in a tag, but only one with the same 'Owner
+ identifier'.
+
+
+ Owner identifier $00
+ Preview start $xx xx
+ Preview length $xx xx
+ Encryption info
+
+
+4.21. Linked information
+
+ To keep space waste as low as possible this frame may be used to link
+ information from another ID3v2 tag that might reside in another audio
+ file or alone in a binary file. It is recommended that this method is
+ only used when the files are stored on a CD-ROM or other
+ circumstances when the risk of file seperation is low. The frame
+ contains a frame identifier, which is the frame that should be linked
+ into this tag, a URL [URL] field, where a reference to the file where
+ the frame is given, and additional ID data, if needed. Data should be
+ retrieved from the first tag found in the file to which this link
+ points. There may be more than one "LINK" frame in a tag, but only
+ one with the same contents. A linked frame is to be considered as
+ part of the tag and has the same restrictions as if it was a physical
+ part of the tag (i.e. only one "RVRB" frame allowed, whether it's
+ linked or not).
+
+
+ Frame identifier $xx xx xx
+ URL $00
+ ID and additional data
+
+ Frames that may be linked and need no additional data are "IPLS",
+ "MCID", "ETCO", "MLLT", "SYTC", "RVAD", "EQUA", "RVRB", "RBUF", the
+ text information frames and the URL link frames.
+
+ The "TXXX", "APIC", "GEOB" and "AENC" frames may be linked with
+ the content descriptor as additional ID data.
+
+ The "COMM", "SYLT" and "USLT" frames may be linked with three bytes
+ of language descriptor directly followed by a content descriptor as
+ additional ID data.
+
+
+4.22. Position synchronisation frame
+
+ This frame delivers information to the listener of how far into the
+ audio stream he picked up; in effect, it states the time offset of
+ the first frame in the stream. The frame layout is:
+
+
+ Time stamp format $xx
+ Position $xx (xx ...)
+
+ Where time stamp format is:
+
+ $01 Absolute time, 32 bit sized, using MPEG frames as unit
+ $02 Absolute time, 32 bit sized, using milliseconds as unit
+
+ and position is where in the audio the listener starts to receive,
+ i.e. the beginning of the next frame. If this frame is used in the
+ beginning of a file the value is always 0. There may only be one
+ "POSS" frame in each tag.
+
+
+4.23. Terms of use frame
+
+ This frame contains a brief description of the terms of use and
+ ownership of the file. More detailed information concerning the legal
+ terms might be available through the "WCOP" frame. Newlines are
+ allowed in the text. There may only be one "USER" frame in a tag.
+
+
+ Text encoding $xx
+ Language $xx xx xx
+ The actual text
+
+
+4.24. Ownership frame
+
+ The ownership frame might be used as a reminder of a made transaction
+ or, if signed, as proof. Note that the "USER" and "TOWN" frames are
+ good to use in conjunction with this one. The frame begins, after the
+ frame ID, size and encoding fields, with a 'price payed' field. The
+ first three characters of this field contains the currency used for
+ the transaction, encoded according to ISO 4217 [ISO-4217] alphabetic
+ currency code. Concatenated to this is the actual price payed, as a
+ numerical string using "." as the decimal separator. Next is an 8
+ character date string (YYYYMMDD) followed by a string with the name
+ of the seller as the last field in the frame. There may only be one
+ "OWNE" frame in a tag.
+
+
+ Text encoding $xx
+ Price payed $00
+ Date of purch.
+ Seller
+
+
+4.25. Commercial frame
+
+ This frame enables several competing offers in the same tag by
+ bundling all needed information. That makes this frame rather complex
+ but it's an easier solution than if one tries to achieve the same
+ result with several frames. The frame begins, after the frame ID,
+ size and encoding fields, with a price string field. A price is
+ constructed by one three character currency code, encoded according
+ to ISO 4217 [ISO-4217] alphabetic currency code, followed by a
+ numerical value where "." is used as decimal seperator. In the price
+ string several prices may be concatenated, seperated by a "/"
+ character, but there may only be one currency of each type.
+
+ The price string is followed by an 8 character date string in the
+ format YYYYMMDD, describing for how long the price is valid. After
+ that is a contact URL, with which the user can contact the seller,
+ followed by a one byte 'received as' field. It describes how the
+ audio is delivered when bought according to the following list:
+
+ $00 Other
+ $01 Standard CD album with other songs
+ $02 Compressed audio on CD
+ $03 File over the Internet
+ $04 Stream over the Internet
+ $05 As note sheets
+ $06 As note sheets in a book with other sheets
+ $07 Music on other media
+ $08 Non-musical merchandise
+
+ Next follows a terminated string with the name of the seller followed
+ by a terminated string with a short description of the product. The
+ last thing is the ability to include a company logotype. The first of
+ them is the 'Picture MIME type' field containing information about
+ which picture format is used. In the event that the MIME media type
+ name is omitted, "image/" will be implied. Currently only "image/png"
+ and "image/jpeg" are allowed. This format string is followed by the
+ binary picture data. This two last fields may be omitted if no
+ picture is to attach.
+
+
+ Text encoding $xx
+ Price string $00
+ Valid until
+ Contact URL $00
+ Received as $xx
+ Name of seller $00 (00)
+ Description $00 (00)
+ Picture MIME type $00
+ Seller logo
+
+
+4.26. Encryption method registration
+
+ To identify with which method a frame has been encrypted the
+ encryption method must be registered in the tag with this frame. The
+ 'Owner identifier' is a null-terminated string with a URL [URL]
+ containing an email address, or a link to a location where an email
+ address can be found, that belongs to the organisation responsible
+ for this specific encryption method. Questions regarding the
+ encryption method should be sent to the indicated email address. The
+ 'Method symbol' contains a value that is associated with this method
+ throughout the whole tag. Values below $80 are reserved. The 'Method
+ symbol' may optionally be followed by encryption specific data. There
+ may be several "ENCR" frames in a tag but only one containing the
+ same symbol and only one containing the same owner identifier. The
+ method must be used somewhere in the tag. See section 3.3.1, flag j
+ for more information.
+
+
+ Owner identifier $00
+ Method symbol $xx
+ Encryption data
+
+
+4.27. Group identification registration
+
+ This frame enables grouping of otherwise unrelated frames. This can
+ be used when some frames are to be signed. To identify which frames
+ belongs to a set of frames a group identifier must be registered in
+ the tag with this frame. The 'Owner identifier' is a null-terminated
+ string with a URL [URL] containing an email address, or a link to a
+ location where an email address can be found, that belongs to the
+ organisation responsible for this grouping. Questions regarding the
+ grouping should be sent to the indicated email address. The 'Group
+ symbol' contains a value that associates the frame with this group
+ throughout the whole tag. Values below $80 are reserved. The 'Group
+ symbol' may optionally be followed by some group specific data, e.g.
+ a digital signature. There may be several "GRID" frames in a tag but
+ only one containing the same symbol and only one containing the same
+ owner identifier. The group symbol must be used somewhere in the tag.
+ See section 3.3.1, flag j for more information.
+
+
+ Owner identifier $00
+ Group symbol $xx
+ Group dependent data
+
+
+4.28. Private frame
+
+ This frame is used to contain information from a software producer
+ that its program uses and does not fit into the other frames. The
+ frame consists of an 'Owner identifier' string and the binary data.
+ The 'Owner identifier' is a null-terminated string with a URL [URL]
+ containing an email address, or a link to a location where an email
+ address can be found, that belongs to the organisation responsible
+ for the frame. Questions regarding the frame should be sent to the
+ indicated email address. The tag may contain more than one "PRIV"
+ frame but only with different contents. It is recommended to keep the
+ number of "PRIV" frames as low as possible.
+
+
+ Owner identifier $00
+ The private data
+
+
+5. The 'unsynchronisation scheme'
+
+ The only purpose of the 'unsynchronisation scheme' is to make the
+ ID3v2 tag as compatible as possible with existing software. There is
+ no use in 'unsynchronising' tags if the file is only to be processed
+ by new software. Unsynchronisation may only be made with MPEG 2 layer
+ I, II and III and MPEG 2.5 files.
+
+ Whenever a false synchronisation is found within the tag, one zeroed
+ byte is inserted after the first false synchronisation byte. The
+ format of a correct sync that should be altered by ID3 encoders is as
+ follows:
+
+ %11111111 111xxxxx
+
+ And should be replaced with:
+
+ %11111111 00000000 111xxxxx
+
+ This has the side effect that all $FF 00 combinations have to be
+ altered, so they won't be affected by the decoding process. Therefore
+ all the $FF 00 combinations have to be replaced with the $FF 00 00
+ combination during the unsynchronisation.
+
+ To indicate usage of the unsynchronisation, the first bit in 'ID3
+ flags' should be set. This bit should only be set if the tag
+ contains a, now corrected, false synchronisation. The bit should
+ only be clear if the tag does not contain any false synchronisations.
+
+ Do bear in mind, that if a compression scheme is used by the encoder,
+ the unsynchronisation scheme should be applied *afterwards*. When
+ decoding a compressed, 'unsynchronised' file, the 'unsynchronisation
+ scheme' should be parsed first, decompression afterwards.
+
+ If the last byte in the tag is $FF, and there is a need to eliminate
+ false synchronisations in the tag, at least one byte of padding
+ should be added.
+
+
+6. Copyright
+
+ Copyright (C) Martin Nilsson 1998. All Rights Reserved.
+
+ This document and translations of it may be copied and furnished to
+ others, and derivative works that comment on or otherwise explain it
+ or assist in its implementation may be prepared, copied, published
+ and distributed, in whole or in part, without restriction of any
+ kind, provided that a reference to this document is included on all
+ such copies and derivative works. However, this document itself may
+ not be modified in any way and reissued as the original document.
+
+ The limited permissions granted above are perpetual and will not be
+ revoked.
+
+ This document and the information contained herein is provided on an
+ "AS IS" basis and THE AUTHORS DISCLAIMS ALL WARRANTIES, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF
+ THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED
+ WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+
+
+7. References
+
+ [CDDB] Compact Disc Data Base
+
+ http://www.cddb.com
+
+ [ID3v2] Martin Nilsson, "ID3v2 informal standard".
+
+ http://www.id3lib.org/id3/id3v2-00.txt
+
+ [ISO-639-2] ISO/FDIS 639-2.
+ Codes for the representation of names of languages, Part 2: Alpha-3
+ code. Technical committee / subcommittee: TC 37 / SC 2
+
+ [ISO-4217] ISO 4217:1995.
+ Codes for the representation of currencies and funds.
+ Technical committee / subcommittee: TC 68
+
+ [ISO-8859-1] ISO/IEC DIS 8859-1.
+ 8-bit single-byte coded graphic character sets, Part 1: Latin
+ alphabet No. 1. Technical committee / subcommittee: JTC 1 / SC 2
+
+ [ISRC] ISO 3901:1986
+ International Standard Recording Code (ISRC).
+ Technical committee / subcommittee: TC 46 / SC 9
+
+ [JFIF] JPEG File Interchange Format, version 1.02
+
+ http://www.w3.org/Graphics/JPEG/jfif.txt">http://www.w3.org/Graphics/JPEG/jfif.txt
+
+ [MIME] Freed, N. and N. Borenstein, "Multipurpose Internet Mail
+ Extensions (MIME) Part One: Format of Internet Message Bodies",
+ RFC 2045, November 1996.
+
+ ftp://ftp.isi.edu/in-notes/rfc2045.txt">ftp://ftp.isi.edu/in-notes/rfc2045.txt
+
+ [MPEG] ISO/IEC 11172-3:1993.
+ Coding of moving pictures and associated audio for digital storage
+ media at up to about 1,5 Mbit/s, Part 3: Audio.
+ Technical committee / subcommittee: JTC 1 / SC 29
+ and
+ ISO/IEC 13818-3:1995
+ Generic coding of moving pictures and associated audio information,
+ Part 3: Audio.
+ Technical committee / subcommittee: JTC 1 / SC 29
+ and
+ ISO/IEC DIS 13818-3
+ Generic coding of moving pictures and associated audio information,
+ Part 3: Audio (Revision of ISO/IEC 13818-3:1995)
+
+
+ [PNG] Portable Network Graphics, version 1.0
+
+ http://www.w3.org/TR/REC-png-multi.html
+
+ [UNICODE] ISO/IEC 10646-1:1993.
+ Universal Multiple-Octet Coded Character Set (UCS), Part 1:
+ Architecture and Basic Multilingual Plane.
+ Technical committee / subcommittee: JTC 1 / SC 2
+
+ http://www.unicode.org/
+
+ [URL] T. Berners-Lee, L. Masinter & M. McCahill, "Uniform Resource
+ Locators (URL).", RFC 1738, December 1994.
+
+ ftp://ftp.isi.edu/in-notes/rfc1738.txt
+
+ [ZLIB] P. Deutsch, Aladdin Enterprises & J-L. Gailly, "ZLIB
+ Compressed
+ Data Format Specification version 3.3", RFC 1950, May 1996.
+
+ ftp://ftp.isi.edu/in-notes/rfc1950.txt
+
+
+8. Appendix
+
+
+A. Appendix A - Genre List from ID3v1
+
+ The following genres is defined in ID3v1
+
+ 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.AlternRock
+ 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
+ 60.Top 40
+ 61.Christian Rap
+ 62.Pop/Funk
+ 63.Jungle
+ 64.Native American
+ 65.Cabaret
+ 66.New Wave
+ 67.Psychadelic
+ 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
+
+ The following genres are Winamp extensions
+
+ 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.Acapella
+ 124.Euro-House
+ 125.Dance Hall
+
+
+9. Author's Address
+
+ Written by
+
+ Martin Nilsson
+ Rydsvägen 246 C. 30
+ S-584 34 Linköping
+ Sweden
+
+ Email: nilsson@id3.org
+
+
+ Edited by
+
+ Dirk Mahoney
+ 57 Pechey Street
+ Chermside Q
+ Australia 4032
+
+ Email: dirk@id3.org
+
+
+ Johan Sundström
+ Alsättersgatan 5 A. 34
+ S-584 35 Linköping
+ Sweden
+
+ Email: johan@id3.org
diff --git a/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/id3v2.4.0-frames.txt b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/id3v2.4.0-frames.txt
new file mode 100644
index 000000000..74a21bed3
--- /dev/null
+++ b/Frameworks/TagLib/taglib/taglib/mpeg/id3v2/id3v2.4.0-frames.txt
@@ -0,0 +1,1734 @@
+$Id$
+
+Informal standard M. Nilsson
+Document: id3v2.4.0-frames.txt 1st November 2000
+
+
+ ID3 tag version 2.4.0 - Native Frames
+
+Status of this document
+
+ This document is an informal standard and replaces the ID3v2.3.0
+ standard [ID3v2]. A formal standard will use another revision number
+ even if the content is identical to document. The contents in this
+ document may change for clarifications but never for added or altered
+ functionallity.
+
+ Distribution of this document is unlimited.
+
+
+Abstract
+
+ This document describes the frames natively supported by ID3v2.4.0,
+ which is a revised version of the ID3v2 informal standard [ID3v2.3.0]
+ version 2.3.0. The ID3v2 offers a flexible way of storing audio meta
+ information within audio file itself. The information may be
+ technical information, such as equalisation curves, as well as title,
+ performer, copyright etc.
+
+ ID3v2.4.0 is meant to be as close as possible to ID3v2.3.0 in order
+ to allow for implementations to be revised as easily as possible.
+
+
+1. Table of contents
+
+ 2. Conventions in this document
+ 3. Default flags
+ 4. Declared ID3v2 frames
+ 4.1. Unique file identifier
+ 4.2. Text information frames
+ 4.2.1. Identification frames
+ 4.2.2. Involved persons frames
+ 4.2.3. Derived and subjective properties frames
+ 4.2.4. Rights and license frames
+ 4.2.5. Other text frames
+ 4.2.6. User defined text information frame
+ 4.3. URL link frames
+ 4.3.1. URL link frames - details
+ 4.3.2. User defined URL link frame
+ 4.4. Music CD Identifier
+ 4.5. Event timing codes
+ 4.6. MPEG location lookup table
+ 4.7. Synced tempo codes
+ 4.8. Unsynchronised lyrics/text transcription
+ 4.9. Synchronised lyrics/text
+ 4.10. Comments
+ 4.11. Relative volume adjustment (2)
+ 4.12. Equalisation (2)
+ 4.13. Reverb
+ 4.14. Attached picture
+ 4.15. General encapsulated object
+ 4.16. Play counter
+ 4.17. Popularimeter
+ 4.18. Recommended buffer size
+ 4.19. Audio encryption
+ 4.20. Linked information
+ 4.21. Position synchronisation frame
+ 4.22. Terms of use
+ 4.23. Ownership frame
+ 4.24. Commercial frame
+ 4.25. Encryption method registration
+ 4.26. Group identification registration
+ 4.27. Private frame
+ 4.28. Signature frame
+ 4.29. Seek frame
+ 4.30. Audio seek point index
+ 5. Copyright
+ 6. References
+ 7. Appendix
+ A. Appendix A - Genre List from ID3v1
+ 8. Author's Address
+
+
+2. Conventions in this document
+
+ Text within "" is a text string exactly as it appears in a tag.
+ Numbers preceded with $ are hexadecimal and numbers preceded with %
+ are binary. $xx is used to indicate a byte with unknown content. %x
+ is used to indicate a bit with unknown content. The most significant
+ bit (MSB) of a byte is called 'bit 7' and the least significant bit
+ (LSB) is called 'bit 0'.
+
+ A tag is the whole tag described the ID3v2 main structure document
+ [ID3v2-strct]. A frame is a block of information in the tag. The tag
+ consists of a header, frames and optional padding. A field is a piece
+ of information; one value, a string etc. A numeric string is a string
+ that consists of the characters "0123456789" only.
+
+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
+ "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
+ document are to be interpreted as described in RFC 2119 [KEYWORDS].
+
+
+3. Default flags
+
+ The default settings for the frames described in this document can be
+ divided into the following classes. The flags may be set differently
+ if found more suitable by the software.
+
+ 1. Discarded if tag is altered, discarded if file is altered.
+
+ None.
+
+ 2. Discarded if tag is altered, preserved if file is altered.
+
+ None.
+
+ 3. Preserved if tag is altered, discarded if file is altered.
+
+ ASPI, AENC, ETCO, EQU2, MLLT, POSS, SEEK, SYLT, SYTC, RVA2, TENC,
+ TLEN
+
+ 4. Preserved if tag is altered, preserved if file is altered.
+
+ The rest of the frames.
+
+
+4. Declared ID3v2 frames
+
+ The following frames are declared in this draft.
+
+ 4.19 AENC Audio encryption
+ 4.14 APIC Attached picture
+ 4.30 ASPI Audio seek point index
+
+ 4.10 COMM Comments
+ 4.24 COMR Commercial frame
+
+ 4.25 ENCR Encryption method registration
+ 4.12 EQU2 Equalisation (2)
+ 4.5 ETCO Event timing codes
+
+ 4.15 GEOB General encapsulated object
+ 4.26 GRID Group identification registration
+
+ 4.20 LINK Linked information
+
+ 4.4 MCDI Music CD identifier
+ 4.6 MLLT MPEG location lookup table
+
+ 4.23 OWNE Ownership frame
+
+ 4.27 PRIV Private frame
+ 4.16 PCNT Play counter
+ 4.17 POPM Popularimeter
+ 4.21 POSS Position synchronisation frame
+
+ 4.18 RBUF Recommended buffer size
+ 4.11 RVA2 Relative volume adjustment (2)
+ 4.13 RVRB Reverb
+
+ 4.29 SEEK Seek frame
+ 4.28 SIGN Signature frame
+ 4.9 SYLT Synchronised lyric/text
+ 4.7 SYTC Synchronised tempo codes
+
+ 4.2.1 TALB Album/Movie/Show title
+ 4.2.3 TBPM BPM (beats per minute)
+ 4.2.2 TCOM Composer
+ 4.2.3 TCON Content type
+ 4.2.4 TCOP Copyright message
+ 4.2.5 TDEN Encoding time
+ 4.2.5 TDLY Playlist delay
+ 4.2.5 TDOR Original release time
+ 4.2.5 TDRC Recording time
+ 4.2.5 TDRL Release time
+ 4.2.5 TDTG Tagging time
+ 4.2.2 TENC Encoded by
+ 4.2.2 TEXT Lyricist/Text writer
+ 4.2.3 TFLT File type
+ 4.2.2 TIPL Involved people list
+ 4.2.1 TIT1 Content group description
+ 4.2.1 TIT2 Title/songname/content description
+ 4.2.1 TIT3 Subtitle/Description refinement
+ 4.2.3 TKEY Initial key
+ 4.2.3 TLAN Language(s)
+ 4.2.3 TLEN Length
+ 4.2.2 TMCL Musician credits list
+ 4.2.3 TMED Media type
+ 4.2.3 TMOO Mood
+ 4.2.1 TOAL Original album/movie/show title
+ 4.2.5 TOFN Original filename
+ 4.2.2 TOLY Original lyricist(s)/text writer(s)
+ 4.2.2 TOPE Original artist(s)/performer(s)
+ 4.2.4 TOWN File owner/licensee
+ 4.2.2 TPE1 Lead performer(s)/Soloist(s)
+ 4.2.2 TPE2 Band/orchestra/accompaniment
+ 4.2.2 TPE3 Conductor/performer refinement
+ 4.2.2 TPE4 Interpreted, remixed, or otherwise modified by
+ 4.2.1 TPOS Part of a set
+ 4.2.4 TPRO Produced notice
+ 4.2.4 TPUB Publisher
+ 4.2.1 TRCK Track number/Position in set
+ 4.2.4 TRSN Internet radio station name
+ 4.2.4 TRSO Internet radio station owner
+ 4.2.5 TSOA Album sort order
+ 4.2.5 TSOP Performer sort order
+ 4.2.5 TSOT Title sort order
+ 4.2.1 TSRC ISRC (international standard recording code)
+ 4.2.5 TSSE Software/Hardware and settings used for encoding
+ 4.2.1 TSST Set subtitle
+ 4.2.2 TXXX User defined text information frame
+
+ 4.1 UFID Unique file identifier
+ 4.22 USER Terms of use
+ 4.8 USLT Unsynchronised lyric/text transcription
+
+ 4.3.1 WCOM Commercial information
+ 4.3.1 WCOP Copyright/Legal information
+ 4.3.1 WOAF Official audio file webpage
+ 4.3.1 WOAR Official artist/performer webpage
+ 4.3.1 WOAS Official audio source webpage
+ 4.3.1 WORS Official Internet radio station homepage
+ 4.3.1 WPAY Payment
+ 4.3.1 WPUB Publishers official webpage
+ 4.3.2 WXXX User defined URL link frame
+
+
+4.1. Unique file identifier
+
+ This frame's purpose is to be able to identify the audio file in a
+ database, that may provide more information relevant to the content.
+ Since standardisation of such a database is beyond this document, all
+ UFID frames begin with an 'owner identifier' field. It is a null-
+ terminated string with a URL [URL] containing an email address, or a
+ link to a location where an email address can be found, that belongs
+ to the organisation responsible for this specific database
+ implementation. Questions regarding the database should be sent to
+ the indicated email address. The URL should not be used for the
+ actual database queries. The string
+ "http://www.id3.org/dummy/ufid.html" should be used for tests. The
+ 'Owner identifier' must be non-empty (more than just a termination).
+ The 'Owner identifier' is then followed by the actual identifier,
+ which may be up to 64 bytes. There may be more than one "UFID" frame
+ in a tag, but only one with the same 'Owner identifier'.
+
+
+ Owner identifier $00
+ Identifier
+
+
+4.2. Text information frames
+
+ The text information frames are often the most important frames,
+ containing information like artist, album and more. There may only be
+ one text information frame of its kind in an tag. All text
+ information frames supports multiple strings, stored as a null
+ separated list, where null is reperesented by the termination code
+ for the charater encoding. All text frame identifiers begin with "T".
+ Only text frame identifiers begin with "T", with the exception of the
+ "TXXX" frame. All the text information frames have the following
+ format:
+
+
+ Text encoding $xx
+ Information
+
+
+4.2.1. Identification frames
+
+ TIT1
+ The 'Content group description' frame is used if the sound belongs to
+ a larger category of sounds/music. For example, classical music is
+ often sorted in different musical sections (e.g. "Piano Concerto",
+ "Weather - Hurricane").
+
+ TIT2
+ The 'Title/Songname/Content description' frame is the actual name of
+ the piece (e.g. "Adagio", "Hurricane Donna").
+
+ TIT3
+ The 'Subtitle/Description refinement' frame is used for information
+ directly related to the contents title (e.g. "Op. 16" or "Performed
+ live at Wembley").
+
+ TALB
+ The 'Album/Movie/Show title' frame is intended for the title of the
+ recording (or source of sound) from which the audio in the file is
+ taken.
+
+ TOAL
+ The 'Original album/movie/show title' frame is intended for the title
+ of the original recording (or source of sound), if for example the
+ music in the file should be a cover of a previously released song.
+
+ TRCK
+ The 'Track number/Position in set' frame is a numeric string
+ containing the order number of the audio-file on its original
+ recording. This MAY be extended with a "/" character and a numeric
+ string containing the total number of tracks/elements on the original
+ recording. E.g. "4/9".
+
+ TPOS
+ The 'Part of a set' frame is a numeric string that describes which
+ part of a set the audio came from. This frame is used if the source
+ described in the "TALB" frame is divided into several mediums, e.g. a
+ double CD. The value MAY be extended with a "/" character and a
+ numeric string containing the total number of parts in the set. E.g.
+ "1/2".
+
+ TSST
+ The 'Set subtitle' frame is intended for the subtitle of the part of
+ a set this track belongs to.
+
+ TSRC
+ The 'ISRC' frame should contain the International Standard Recording
+ Code [ISRC] (12 characters).
+
+
+4.2.2. Involved persons frames
+
+ TPE1
+ The 'Lead artist/Lead performer/Soloist/Performing group' is
+ used for the main artist.
+
+ TPE2
+ The 'Band/Orchestra/Accompaniment' frame is used for additional
+ information about the performers in the recording.
+
+ TPE3
+ The 'Conductor' frame is used for the name of the conductor.
+
+ TPE4
+ The 'Interpreted, remixed, or otherwise modified by' frame contains
+ more information about the people behind a remix and similar
+ interpretations of another existing piece.
+
+ TOPE
+ The 'Original artist/performer' frame is intended for the performer
+ of the original recording, if for example the music in the file
+ should be a cover of a previously released song.
+
+ TEXT
+ The 'Lyricist/Text writer' frame is intended for the writer of the
+ text or lyrics in the recording.
+
+ TOLY
+ The 'Original lyricist/text writer' frame is intended for the
+ text writer of the original recording, if for example the music in
+ the file should be a cover of a previously released song.
+
+ TCOM
+ The 'Composer' frame is intended for the name of the composer.
+
+ TMCL
+ The 'Musician credits list' is intended as a mapping between
+ instruments and the musician that played it. Every odd field is an
+ instrument and every even is an artist or a comma delimited list of
+ artists.
+
+ TIPL
+ The 'Involved people list' is very similar to the musician credits
+ list, but maps between functions, like producer, and names.
+
+ TENC
+ The 'Encoded by' frame contains the name of the person or
+ organisation that encoded the audio file. This field may contain a
+ copyright message, if the audio file also is copyrighted by the
+ encoder.
+
+
+4.2.3. Derived and subjective properties frames
+
+ TBPM
+ The 'BPM' frame contains the number of beats per minute in the
+ main part of the audio. The BPM is an integer and represented as a
+ numerical string.
+
+ TLEN
+ The 'Length' frame contains the length of the audio file in
+ milliseconds, represented as a numeric string.
+
+ TKEY
+ The 'Initial key' frame contains the musical key in which the sound
+ starts. It is represented as a string with a maximum length of three
+ characters. The ground keys are represented with "A","B","C","D","E",
+ "F" and "G" and halfkeys represented with "b" and "#". Minor is
+ represented as "m", e.g. "Dbm" $00. Off key is represented with an
+ "o" only.
+
+ TLAN
+ The 'Language' frame should contain the languages of the text or
+ lyrics spoken or sung in the audio. The language is represented with
+ three characters according to ISO-639-2 [ISO-639-2]. If more than one
+ language is used in the text their language codes should follow
+ according to the amount of their usage, e.g. "eng" $00 "sve" $00.
+
+ TCON
+ The 'Content type', which ID3v1 was stored as a one byte numeric
+ value only, is now a string. You may use one or several of the ID3v1
+ types as numerical strings, or, since the category list would be
+ impossible to maintain with accurate and up to date categories,
+ define your own. Example: "21" $00 "Eurodisco" $00
+
+ You may also use any of the following keywords:
+
+ RX Remix
+ CR Cover
+
+ TFLT
+ The 'File type' frame indicates which type of audio this tag defines.
+ The following types and refinements are defined:
+
+ MIME MIME type follows
+ MPG MPEG Audio
+ /1 MPEG 1/2 layer I
+ /2 MPEG 1/2 layer II
+ /3 MPEG 1/2 layer III
+ /2.5 MPEG 2.5
+ /AAC Advanced audio compression
+ VQF Transform-domain Weighted Interleave Vector Quantisation
+ PCM Pulse Code Modulated audio
+
+ but other types may be used, but not for these types though. This is
+ used in a similar way to the predefined types in the "TMED" frame,
+ but without parentheses. If this frame is not present audio type is
+ assumed to be "MPG".
+
+ TMED
+ The 'Media type' frame describes from which media the sound
+ originated. This may be a text string or a reference to the
+ predefined media types found in the list below. Example:
+ "VID/PAL/VHS" $00.
+
+ DIG Other digital media
+ /A Analogue transfer from media
+
+ ANA Other analogue media
+ /WAC Wax cylinder
+ /8CA 8-track tape cassette
+
+ CD CD
+ /A Analogue transfer from media
+ /DD DDD
+ /AD ADD
+ /AA AAD
+
+ LD Laserdisc
+
+ TT Turntable records
+ /33 33.33 rpm
+ /45 45 rpm
+ /71 71.29 rpm
+ /76 76.59 rpm
+ /78 78.26 rpm
+ /80 80 rpm
+
+ MD MiniDisc
+ /A Analogue transfer from media
+
+ DAT DAT
+ /A Analogue transfer from media
+ /1 standard, 48 kHz/16 bits, linear
+ /2 mode 2, 32 kHz/16 bits, linear
+ /3 mode 3, 32 kHz/12 bits, non-linear, low speed
+ /4 mode 4, 32 kHz/12 bits, 4 channels
+ /5 mode 5, 44.1 kHz/16 bits, linear
+ /6 mode 6, 44.1 kHz/16 bits, 'wide track' play
+
+ DCC DCC
+ /A Analogue transfer from media
+
+ DVD DVD
+ /A Analogue transfer from media
+
+ TV Television
+ /PAL PAL
+ /NTSC NTSC
+ /SECAM SECAM
+
+ VID Video
+ /PAL PAL
+ /NTSC NTSC
+ /SECAM SECAM
+ /VHS VHS
+ /SVHS S-VHS
+ /BETA BETAMAX
+
+ RAD Radio
+ /FM FM
+ /AM AM
+ /LW LW
+ /MW MW
+
+ TEL Telephone
+ /I ISDN
+
+ MC MC (normal cassette)
+ /4 4.75 cm/s (normal speed for a two sided cassette)
+ /9 9.5 cm/s
+ /I Type I cassette (ferric/normal)
+ /II Type II cassette (chrome)
+ /III Type III cassette (ferric chrome)
+ /IV Type IV cassette (metal)
+
+ REE Reel
+ /9 9.5 cm/s
+ /19 19 cm/s
+ /38 38 cm/s
+ /76 76 cm/s
+ /I Type I cassette (ferric/normal)
+ /II Type II cassette (chrome)
+ /III Type III cassette (ferric chrome)
+ /IV Type IV cassette (metal)
+
+ TMOO
+ The 'Mood' frame is intended to reflect the mood of the audio with a
+ few keywords, e.g. "Romantic" or "Sad".
+
+
+4.2.4. Rights and license frames
+
+ TCOP
+ The 'Copyright message' frame, in which the string must begin with a
+ year and a space character (making five characters), is intended for
+ the copyright holder of the original sound, not the audio file
+ itself. The absence of this frame means only that the copyright
+ information is unavailable or has been removed, and must not be
+ interpreted to mean that the audio is public domain. Every time this
+ field is displayed the field must be preceded with "Copyright " (C) "
+ ", where (C) is one character showing a C in a circle.
+
+ TPRO
+ The 'Produced notice' frame, in which the string must begin with a
+ year and a space character (making five characters), is intended for
+ the production copyright holder of the original sound, not the audio
+ file itself. The absence of this frame means only that the production
+ copyright information is unavailable or has been removed, and must
+ not be interpreted to mean that the audio is public domain. Every
+ time this field is displayed the field must be preceded with
+ "Produced " (P) " ", where (P) is one character showing a P in a
+ circle.
+
+ TPUB
+ The 'Publisher' frame simply contains the name of the label or
+ publisher.
+
+ TOWN
+ The 'File owner/licensee' frame contains the name of the owner or
+ licensee of the file and it's contents.
+
+ TRSN
+ The 'Internet radio station name' frame contains the name of the
+ internet radio station from which the audio is streamed.
+
+ TRSO
+ The 'Internet radio station owner' frame contains the name of the
+ owner of the internet radio station from which the audio is
+ streamed.
+
+4.2.5. Other text frames
+
+ TOFN
+ The 'Original filename' frame contains the preferred filename for the
+ file, since some media doesn't allow the desired length of the
+ filename. The filename is case sensitive and includes its suffix.
+
+ TDLY
+ The 'Playlist delay' defines the numbers of milliseconds of silence
+ that should be inserted before this audio. The value zero indicates
+ that this is a part of a multifile audio track that should be played
+ continuously.
+
+ TDEN
+ The 'Encoding time' frame contains a timestamp describing when the
+ audio was encoded. Timestamp format is described in the ID3v2
+ structure document [ID3v2-strct].
+
+ TDOR
+ The 'Original release time' frame contains a timestamp describing
+ when the original recording of the audio was released. Timestamp
+ format is described in the ID3v2 structure document [ID3v2-strct].
+
+ TDRC
+ The 'Recording time' frame contains a timestamp describing when the
+ audio was recorded. Timestamp format is described in the ID3v2
+ structure document [ID3v2-strct].
+
+ TDRL
+ The 'Release time' frame contains a timestamp describing when the
+ audio was first released. Timestamp format is described in the ID3v2
+ structure document [ID3v2-strct].
+
+ TDTG
+ The 'Tagging time' frame contains a timestamp describing then the
+ audio was tagged. Timestamp format is described in the ID3v2
+ structure document [ID3v2-strct].
+
+ TSSE
+ The 'Software/Hardware and settings used for encoding' frame
+ includes the used audio encoder and its settings when the file was
+ encoded. Hardware refers to hardware encoders, not the computer on
+ which a program was run.
+
+ TSOA
+ The 'Album sort order' frame defines a string which should be used
+ instead of the album name (TALB) for sorting purposes. E.g. an album
+ named "A Soundtrack" might preferably be sorted as "Soundtrack".
+
+ TSOP
+ The 'Performer sort order' frame defines a string which should be
+ used instead of the performer (TPE2) for sorting purposes.
+
+ TSOT
+ The 'Title sort order' frame defines a string which should be used
+ instead of the title (TIT2) for sorting purposes.
+
+
+4.2.6. User defined text information frame
+
+ This frame is intended for one-string text information concerning the
+ audio file in a similar way to the other "T"-frames. The frame body
+ consists of a description of the string, represented as a terminated
+ string, followed by the actual string. There may be more than one
+ "TXXX" frame in each tag, but only one with the same description.
+
+
+ Text encoding $xx
+ Description $00 (00)
+ Value
+
+
+4.3. URL link frames
+
+ With these frames dynamic data such as webpages with touring
+ information, price information or plain ordinary news can be added to
+ the tag. There may only be one URL [URL] link frame of its kind in an
+ tag, except when stated otherwise in the frame description. If the
+ text string is followed by a string termination, all the following
+ information should be ignored and not be displayed. All URL link
+ frame identifiers begins with "W". Only URL link frame identifiers
+ begins with "W", except for "WXXX". All URL link frames have the
+ following format:
+
+
+ URL
+
+
+4.3.1. URL link frames - details
+
+ WCOM
+ The 'Commercial information' frame is a URL pointing at a webpage
+ with information such as where the album can be bought. There may be
+ more than one "WCOM" frame in a tag, but not with the same content.
+
+ WCOP
+ The 'Copyright/Legal information' frame is a URL pointing at a
+ webpage where the terms of use and ownership of the file is
+ described.
+
+ WOAF
+ The 'Official audio file webpage' frame is a URL pointing at a file
+ specific webpage.
+
+ WOAR
+ The 'Official artist/performer webpage' frame is a URL pointing at
+ the artists official webpage. There may be more than one "WOAR" frame
+ in a tag if the audio contains more than one performer, but not with
+ the same content.
+
+ WOAS
+ The 'Official audio source webpage' frame is a URL pointing at the
+ official webpage for the source of the audio file, e.g. a movie.
+
+ WORS
+ The 'Official Internet radio station homepage' contains a URL
+ pointing at the homepage of the internet radio station.
+
+ WPAY
+ The 'Payment' frame is a URL pointing at a webpage that will handle
+ the process of paying for this file.
+
+ WPUB
+ The 'Publishers official webpage' frame is a URL pointing at the
+ official webpage for the publisher.
+
+
+4.3.2. User defined URL link frame
+
+ This frame is intended for URL [URL] links concerning the audio file
+ in a similar way to the other "W"-frames. The frame body consists
+ of a description of the string, represented as a terminated string,
+ followed by the actual URL. The URL is always encoded with ISO-8859-1
+ [ISO-8859-1]. There may be more than one "WXXX" frame in each tag,
+ but only one with the same description.
+
+
+ Text encoding $xx
+ Description $00 (00)
+ URL
+
+
+4.4. Music CD identifier
+
+ This frame is intended for music that comes from a CD, so that the CD
+ can be identified in databases such as the CDDB [CDDB]. The frame
+ consists of a binary dump of the Table Of Contents, TOC, from the CD,
+ which is a header of 4 bytes and then 8 bytes/track on the CD plus 8
+ bytes for the 'lead out', making a maximum of 804 bytes. The offset
+ to the beginning of every track on the CD should be described with a
+ four bytes absolute CD-frame address per track, and not with absolute
+ time. When this frame is used the presence of a valid "TRCK" frame is
+ REQUIRED, even if the CD's only got one track. It is recommended that
+ this frame is always added to tags originating from CDs. There may
+ only be one "MCDI" frame in each tag.
+
+
+ CD TOC
+
+
+4.5. Event timing codes
+
+ This frame allows synchronisation with key events in the audio. The
+ header is:
+
+
+ Time stamp format $xx
+
+ Where time stamp format is:
+
+ $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit
+ $02 Absolute time, 32 bit sized, using milliseconds as unit
+
+ Absolute time means that every stamp contains the time from the
+ beginning of the 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. The type of event is as follows:
+
+ $00 padding (has no meaning)
+ $01 end of initial silence
+ $02 intro start
+ $03 main part start
+ $04 outro start
+ $05 outro end
+ $06 verse start
+ $07 refrain start
+ $08 interlude start
+ $09 theme start
+ $0A variation start
+ $0B key change
+ $0C time change
+ $0D momentary unwanted noise (Snap, Crackle & Pop)
+ $0E sustained noise
+ $0F sustained noise end
+ $10 intro end
+ $11 main part end
+ $12 verse end
+ $13 refrain end
+ $14 theme end
+ $15 profanity
+ $16 profanity end
+
+ $17-$DF reserved for future use
+
+ $E0-$EF not predefined synch 0-F
+
+ $F0-$FC reserved for future use
+
+ $FD audio end (start of silence)
+ $FE audio file ends
+ $FF one more byte of events follows (all the following bytes with
+ the value $FF have the same function)
+
+ Terminating the start events such as "intro start" is OPTIONAL. The
+ 'Not predefined synch's ($E0-EF) are for user events. You might want
+ to synchronise your music to something, like setting off an explosion
+ on-stage, activating a screensaver etc.
+
+ There may only be one "ETCO" frame in each tag.
+
+
+4.6. MPEG location lookup table
+
+ To increase performance and accuracy of jumps within a MPEG [MPEG]
+ audio file, frames with time codes in different locations in the file
+ might be useful. This ID3v2 frame includes references that the
+ software can use to calculate positions in the file. After the frame
+ header follows a descriptor of how much the 'frame counter' should be
+ increased for every reference. If this value is two then the first
+ reference points out the second frame, the 2nd reference the 4th
+ frame, the 3rd reference the 6th frame etc. In a similar way the
+ 'bytes between reference' and 'milliseconds between reference' points
+ out bytes and milliseconds respectively.
+
+ Each reference consists of two parts; a certain number of bits, as
+ defined in 'bits for bytes deviation', that describes the difference
+ between what is said in 'bytes between reference' and the reality and
+ a certain number of bits, as defined in 'bits for milliseconds
+ deviation', that describes the difference between what is said in
+ 'milliseconds between reference' and the reality. The number of bits
+ in every reference, i.e. 'bits for bytes deviation'+'bits for
+ milliseconds deviation', must be a multiple of four. There may only
+ be one "MLLT" frame in each tag.
+
+
+ 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....
+
+
+4.7. Synchronised tempo codes
+
+ For a more accurate description of the tempo of a musical piece, this
+ frame might be used. After the header follows one byte describing
+ which time stamp format should be used. Then follows one or more
+ tempo codes. Each tempo code consists of one tempo part and one time
+ part. The tempo is in BPM described with one or two bytes. If the
+ first byte has the value $FF, one more byte follows, which is added
+ to the first giving a range from 2 - 510 BPM, since $00 and $01 is
+ reserved. $00 is used to describe a beat-free time period, which is
+ not the same as a music-free time period. $01 is used to indicate one
+ single beat-stroke followed by a beat-free period.
+
+ The tempo descriptor is followed by a time stamp. Every time the
+ tempo in the music changes, a tempo descriptor may indicate this for
+ the player. All tempo descriptors MUST be sorted in chronological
+ order. The first beat-stroke in a time-period is at the same time as
+ the beat description occurs. There may only be one "SYTC" frame in
+ each tag.
+
+
+ Time stamp format $xx
+ Tempo data
+
+ Where time stamp format is:
+
+ $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit
+ $02 Absolute time, 32 bit sized, using milliseconds as unit
+
+ Absolute time means that every stamp contains the time from the
+ beginning of the file.
+
+
+4.8. Unsynchronised lyrics/text transcription
+
+ This frame contains the lyrics of the song or a text transcription of
+ other vocal activities. The head includes an encoding descriptor and
+ a content descriptor. The body consists of the actual text. The
+ 'Content descriptor' is a terminated string. If no descriptor is
+ entered, 'Content descriptor' is $00 (00) only. Newline characters
+ are allowed in the text. There may be more than one 'Unsynchronised
+ lyrics/text transcription' frame in each tag, but only one with the
+ same language and content descriptor.
+
+
+ Text encoding $xx
+ Language $xx xx xx
+ Content descriptor $00 (00)
+ Lyrics/text
+
+
+4.9. Synchronised lyrics/text
+
+ This is another way of incorporating the words, said or sung lyrics,
+ in the audio file as text, this time, however, in sync with the
+ audio. It might also be used to describing events e.g. occurring on a
+ stage or on the screen in sync with the audio. The header includes a
+ content descriptor, represented with as terminated text string. If no
+ descriptor is entered, 'Content descriptor' is $00 (00) only.
+
+
+ Text encoding $xx
+ Language $xx xx xx
+ Time stamp format $xx
+ Content type $xx
+ Content descriptor $00 (00)
+
+ Content type: $00 is other
+ $01 is lyrics
+ $02 is text transcription
+ $03 is movement/part name (e.g. "Adagio")
+ $04 is events (e.g. "Don Quijote enters the stage")
+ $05 is chord (e.g. "Bb F Fsus")
+ $06 is trivia/'pop up' information
+ $07 is URLs to webpages
+ $08 is URLs to images
+
+ Time stamp format:
+
+ $01 Absolute time, 32 bit sized, using MPEG [MPEG] frames as unit
+ $02 Absolute time, 32 bit sized, using milliseconds as unit
+
+ Absolute time means that every stamp contains the time from the
+ beginning of the file.
+
+ The text that follows the frame header differs from that of the
+ unsynchronised lyrics/text transcription in one major way. Each
+ syllable (or whatever size of text is considered to be convenient by
+ the encoder) is a null terminated string followed by a time stamp
+ denoting where in the sound file it belongs. Each sync thus has the
+ following structure:
+
+ Terminated text to be synced (typically a syllable)
+ Sync identifier (terminator to above string) $00 (00)
+ Time stamp $xx (xx ...)
+
+ The 'time stamp' is set to zero or the whole sync is omitted if
+ located directly at the beginning of the sound. All time stamps
+ should be sorted in chronological order. The sync can be considered
+ as a validator of the subsequent string.
+
+ Newline characters are allowed in all "SYLT" frames and MUST be used
+ after every entry (name, event etc.) in a frame with the content type
+ $03 - $04.
+
+ A few considerations regarding whitespace characters: Whitespace
+ separating words should mark the beginning of a new word, thus
+ occurring in front of the first syllable of a new word. This is also
+ valid for new line characters. A syllable followed by a comma should
+ not be broken apart with a sync (both the syllable and the comma
+ should be before the sync).
+
+ An example: The "USLT" passage
+
+ "Strangers in the night" $0A "Exchanging glances"
+
+ would be "SYLT" encoded as:
+
+ "Strang" $00 xx xx "ers" $00 xx xx " in" $00 xx xx " the" $00 xx xx
+ " night" $00 xx xx 0A "Ex" $00 xx xx "chang" $00 xx xx "ing" $00 xx
+ xx "glan" $00 xx xx "ces" $00 xx xx
+
+ There may be more than one "SYLT" frame in each tag, but only one
+ with the same language and content descriptor.
+
+
+4.10. Comments
+
+ This frame is intended for any kind of full text information that
+ does not fit in any other frame. It consists of a frame header
+ followed by encoding, language and content descriptors and is ended
+ with the actual comment as a text string. Newline characters are
+ allowed in the comment text string. There may be more than one
+ comment frame in each tag, but only one with the same language and
+ content descriptor.
+
+
+ Text encoding $xx
+ Language $xx xx xx
+ Short content descrip.