diff -Nru taglib-1.8.1~git20121128.3fa295g/.gitignore taglib-1.8/.gitignore --- taglib-1.8.1~git20121128.3fa295g/.gitignore 1970-01-01 00:00:00.000000000 +0000 +++ taglib-1.8/.gitignore 2012-09-06 18:03:15.000000000 +0000 @@ -0,0 +1,44 @@ +cmake_install.cmake +cmake_uninstall.cmake +Makefile +CTestTestfile.cmake +CMakeFiles/ +*.so +*.so.* +*.dylib +*.vcproj +*.ncb +*.sln +*.suo +*.user +.* +*~ +/CMakeCache.txt +/Doxyfile +/config.h +/taglib.pc +/tests/test_runner +/tests/Testing +/taglib_config.h +/taglib-config +/bindings/c/taglib_c.pc +/bindings/c/Debug +/bindings/c/MinSizeRel +/bindings/c/Release +/bindings/c/tag_c.dir/Debug +/bindings/c/tag_c.dir/MinSizeRel +/bindings/c/tag_c.dir/Release +/examples/framelist +/examples/strip-id3v1 +/examples/tagreader +/examples/tagreader_c +/examples/tagwriter +/doc/html +/taglib/Debug +/taglib/MinSizeRel +/taglib/Release +/taglib/tag.dir/Debug +/taglib/tag.dir/MinSizeRel +/taglib/tag.dir/Release +/ALL_BUILD.dir +/ZERO_CHECK.dir diff -Nru taglib-1.8.1~git20121128.3fa295g/.travis.yml taglib-1.8/.travis.yml --- taglib-1.8.1~git20121128.3fa295g/.travis.yml 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/.travis.yml 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -language: cpp -compiler: - - gcc - - clang -install: sudo apt-get install libcppunit-dev zlib1g-dev -script: cmake -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON . && make && make check - diff -Nru taglib-1.8.1~git20121128.3fa295g/CMakeLists.txt taglib-1.8/CMakeLists.txt --- taglib-1.8.1~git20121128.3fa295g/CMakeLists.txt 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/CMakeLists.txt 2012-09-06 18:03:15.000000000 +0000 @@ -66,15 +66,8 @@ include(ConfigureChecks.cmake) -if(NOT WIN32) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib-config ) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/taglib-config DESTINATION ${BIN_INSTALL_DIR}) -endif() - -if(WIN32) - configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib-config.cmd.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib-config.cmd ) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/taglib-config.cmd DESTINATION ${BIN_INSTALL_DIR}) -endif() +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib-config ) +install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/taglib-config DESTINATION ${BIN_INSTALL_DIR}) if(NOT WIN32 AND NOT BUILD_FRAMEWORK) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib.pc ) diff -Nru taglib-1.8.1~git20121128.3fa295g/NEWS taglib-1.8/NEWS --- taglib-1.8.1~git20121128.3fa295g/NEWS 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/NEWS 2012-09-06 18:03:15.000000000 +0000 @@ -1,19 +1,5 @@ -TagLib 1.9 (In Development) -========================== - - * Added support for the Ogg Opus file format. - * Added support for INFO tags in WAV files. - * Changed FileStream to use Windows file API. - * Included taglib-config.cmd script for Windows. - * New ID3v1::Tag methods for working directly with genre numbers. - * New MPEG::File methods for checking which tags are saved in the file. - * Better parsing of corrupted FLAC files. - * Fixed saving of PropertyMap comments without description into ID3v2 tags. - * Fixed crash when parsing certain XM files. - * Fixed compilation of unit test with clang. - TagLib 1.8 (Sep 6, 2012) -======================== +============================== 1.8: diff -Nru taglib-1.8.1~git20121128.3fa295g/debian/changelog taglib-1.8/debian/changelog --- taglib-1.8.1~git20121128.3fa295g/debian/changelog 2012-12-20 12:19:08.000000000 +0000 +++ taglib-1.8/debian/changelog 2012-12-21 07:44:15.000000000 +0000 @@ -1,16 +1,4 @@ -taglib (1:1.8.1~git20121128.3fa295g-ppa2~quantal) quantal; urgency=medium - - * new git revision quantal. - - -- Semen Apukhtin (FANTOM) Thu, 20 Dec 2012 16:19:08 +0400 - -taglib (1.8-1~precise~ppa1) precise; urgency=low - - * Backported from raring. - - -- Andrey Pavlenko Thu, 29 Nov 2012 22:50:05 +0400 - -taglib (1.8-1) experimental; urgency=low +taglib (1.8-1~quantal1) quantal; urgency=medium * New upsteam release. (Closes: #687374) * Adapt multiarch.diff patch to upstream changes. @@ -26,459 +14,3 @@ -- Modestas Vainius Sun, 30 Sep 2012 02:27:46 +0300 -taglib (1.7.2-1) unstable; urgency=medium - - * New upstream release: - - fixed division by zero while parsing corrupted MP4 files (CVE-2012-2396); - - fixed compilation on Haiku. - * Update symbol files. - * Urgency=medium, security fix. - - -- Modestas Vainius Thu, 28 Jun 2012 01:18:37 +0300 - -taglib (1.7.1-3) unstable; urgency=low - - * libtag1-dev and libtagc0-dev (libtag1-dev reverse dependency) are not - Multi-Arch: same compatible, unmark them. (Closes: #670029) - - -- Modestas Vainius Sun, 29 Apr 2012 10:48:12 +0300 - -taglib (1.7.1-2) unstable; urgency=low - - * Replace build hook with dh_auto_configure override. This should be - compatible with building package via binary-arch target. Fixes FTBFSes. - * Hook doc/html/index.html to build-indep target. This is compat=9 - compatible. - * Do not attempt to build some binary packages uselessly. - * Fix patch to doc/html/index.html. It's in builddir-vanilla. - - -- Modestas Vainius Mon, 16 Apr 2012 22:22:26 +0300 - -taglib (1.7.1-1) unstable; urgency=high - - * New upstream release: - - fixes security vulnerabilities: CVE-2012-1107, CVE-2012-1108 - and CVE-2012-1584. (Closes: #662705) - * Bump Standards-Version to 3.9.3: no changes needed. - * Drop upstream_doxygen_out_of_source.diff, merged upstream. - * Drop backport_protection_against_broken_wma_files.diff, merged upstream. - * Update symbol file. - * Urgency=high due to security fixes. - - -- Modestas Vainius Sun, 15 Apr 2012 19:08:51 +0300 - -taglib (1.7-2) unstable; urgency=low - - * Backport some fixes from upstream repository: (Closes: #656226) - - fix segfault when parsing some ID3v2 tags (patch - backport_id3v2_null_pointer.diff); - - partial protection against broken WMA files (patch - backport_protection_against_broken_wma_files.diff). - * Add Multi-arch support. (Closes: #651019) Implementation is mostly based on - the patch from Steve Langasek. The only difference is bumping debhelper - build dependency to 9. - * Pass visibility options via DEB_{CFLAGS,CXXFLAGS}_MAINT_APPEND in order to - inherit default flags from dh/dpkg-buildflags. This needs dpkg-dev 1.16.1 - hence build depend on it. - * Enable parallel building. - * Update symbol file. - * Remove debian/libtag1-doc.lintian-overrides, no longer needed. - - -- Modestas Vainius Sun, 19 Feb 2012 21:47:28 +0200 - -taglib (1.7-1) unstable; urgency=low - - * New upstream release. - * Drop topgit support and remove README.source, no longer needed. - * Bump Standards-Version to 3.9.2: adjust Replaces/Breaks where needed. - * Simplify debian/rules a bit: use fewer make "functions". - * Do not care about shlibs anymore since there is a symbol file. - * Adapt rusxmms_taglib.diff to upstream changes (autotools removal). - * Clean trailing whitespace from the rusxmms_taglib.diff. - * Add header to the rusxmms_taglib.diff patch. - * Update the list of supported formats in the package descriptions. - (Closes: #613149) - * Update package synopsis'. - * Use new way to call doxygen: via `make docs`. - * Add upstream_doxygen_out_of_source.diff patch to support building - documentation out-of-the-source tree. - * Update symbol files. - * Remove no longer used lintian-overrides. - * Override jquery.js lintian warning, doxygen adds it. - * Update install files. - - -- Modestas Vainius Sat, 09 Apr 2011 19:32:40 +0300 - -taglib (1.6.3-1) unstable; urgency=low - - * New upstream release: - - fixes a problem with ID3v2 APIC frame parsing (Closes: #577990). - * Update symbol files for new release. - * Remove duplicate "Section" fields from debian/control. - * Bump libtag1c2a shlibs to 1.6.3. - - -- Modestas Vainius Mon, 17 May 2010 01:43:14 +0300 - -taglib (1.6.2-1) unstable; urgency=low - - * New upstream release. - * Remove DMUA field from debian/control. I'm a DD now. - * Git repository moved to my new DD account on alioth. Change Vcs fields in - debian/control accordingly. - * Update libtag1-vanilla symbol file, bump libtag1-{vanilla,rusxmms} shlibs. - * Override lintian "taglib source: outdated-autotools-helper-file". Package - does not use autotools anyway. - * Change maintainer email address to @debian.org one. - * Bump Standards-Version to 3.8.4: no changes needed. - - -- Modestas Vainius Fri, 09 Apr 2010 23:58:57 +0300 - -taglib (1.6.1-1) unstable; urgency=low - - * New upstream release. - * Remove all patches, merged upstream: - - general/add_missing_exports_fix.diff - - general/gcc_visibility_feature.diff - - general/link_interface_libraries_fix.diff - - general/taglib_c_pc_fix.diff - * Switch to dpkg-source v3 format: - - do not use quilt dh addon anymore. - * Update install files. - * Update libtag1-vanilla.symbols file: new symbols added. - * Use Conflicts rather than Breaks for libtag-extras0 (as lintian insists). - * Bump shlibs to 1.6.1 in debian/rules. - - -- Modestas Vainius Mon, 02 Nov 2009 01:48:01 +0200 - -taglib (1.6-3) unstable; urgency=low - - * Fix 'optional' tags in symbols file. - * Release to unstable. - - -- Modestas Vainius Mon, 21 Sep 2009 22:32:22 +0300 - -taglib (1.6-2) experimental; urgency=low - - * Build with ASF (-DWITH_ASF=ON) and MP4 (-DWITH_MP4=ON). Update symbols - file and libtag1c2a shlibs accordingly. - * This release breaks libtaglib-extras0. Add Breaks: to libtag1c2a and - libtag1-* packages. - - -- Modestas Vainius Thu, 17 Sep 2009 23:20:26 +0300 - -taglib (1.6-1) unstable; urgency=low - - * New upstream release. - * Bump Standards-Version to 3.8.3 (no changes needed). - * Drop general/recognize_oga_files_fix.diff patch, merged upstream. - * Refresh other patches. - * Refresh rusxmms patch. - * Update install files. - * Update symbols file. - * Bump shlibs of libtag1-* to 1.6. - - -- Modestas Vainius Tue, 15 Sep 2009 22:13:51 +0300 - -taglib (1.5-7) unstable; urgency=low - - * Fix Vcs-Browser URL. - * Convert symbol files to dpkg-dev 1.15.3 compat format: - - drop build dependency on pkg-kde-tools and remove its references from - debian/rules; - - add dpkg-dev (>= 1.15.3) to build depends; - - convert and rename debian/*.symbols.in to dpkg-dev 1.15.3 compatible - format. - * Use dh --with quilt rather than quilt make snippet: - - build depend on quilt (>= 0.46-7~); - - adjust debian/rules accordingly. - * Clean up topgit stuff. - * Get rid of the build branch: update debian/README.source. - * Make use of debhelper 7.3 cmake / build directory support: - - build depend on debhelper (>= 7.3); - - debian/rules rewritten to use dh_auto and otherwise simplified. - * Fix taglib_c.pc (patch general/taglib_c_pc_fix.diff) (Closes: #524696). - * Recognize .oga files as OGGs (patch general/recognize_oga_files_fix.diff) - (Closes: #525571). - * Bump Standards-Version to 3.8.2. No changes needed. - - -- Modestas Vainius Sat, 25 Jul 2009 04:09:33 +0300 - -taglib (1.5-6) unstable; urgency=low - - * Fix potential rusxmms patching breakage in case there were no regular - patches. - * Build depend on debhelper 7.2.7, drop a hack needed for previous dh and - make use of --remaining-packages option for dh_makeshlibs. - * Fix debian/watch file. - * Upload to unstable. - - -- Modestas Vainius Sat, 28 Mar 2009 16:01:43 +0200 - -taglib (1.5-5) experimental; urgency=low - - * Port buildsystem from cdbs to debhelper v7 (>= 7.0.50). cmake - support implemented via dh_overrides. - * Pass CMAKE_USE_RELATIVE_PATHS=ON to cmake. Hence build depend on - cmake 2.6.2. - * Strip debian/tmp from debian/*.install files. Not needed with dh v7. - * Add RusXMMS support (Closes: #384573): - - RusXMMS patch contributed by Ivan Borzenkov, thanks; - - add two libtag1 flavours: vanilla (libtag1-vanilla) and rusxmms - libtag1-rusxmms); - - new libtag1-* flavours replaces old libtag1c2a; - - libtag1c2a becomes a metapackage which depends on either of flavours - via alternate depends. Both libtag1-vanilla and libtag1-rusxmms export - themselves as libtag1c2a via shlibs/symbol files; - - rework buildsystem and build both flavours in their own build directories - (builddir-vanilla and builddir-rusxmms); - - employ some quilt on-the-fly patching hacks to patch and unpatch source - with rusxmms patch as needed; - - build depend on librcc-dev. RusXMMS needs it; - - add more lintian-overrides as the changes above triggered them. - * Get rid of old conflicts/replaces of the libtag1c2a package. - - -- Modestas Vainius Fri, 20 Mar 2009 01:36:31 +0200 - -taglib (1.5-4) unstable; urgency=low - - * Drop Adeodato Simó from Uploaders by his request. Thanks for your work! - * Build depend on pkg-kde-tools (>= 0.4) and switch libtag1c2a symbol file - handling to pkgkde-symbolshelper instead of custom implementation. This - should fix FTBFS on kfreebsd-amd64 (Closes: #494276). - * Migrate patch handling to topgit. As a result, patches were renamed: - - 01_gcc_visibility.diff -> general/gcc_visibility_feature.diff; - - 02_export_public_functions.diff -> general/add_missing_exports_fix.diff; - - 96_link_interface_libraries.diff -> - general/link_interface_libraries_fix.diff. - * Add README.source about topgit/quilt. - * Bump Standards-Version to 3.8.1: README.source added (see above). - * Add ${misc:Depends} for all packages. - * Capitalize API in the libtag1-doc package description. - * Add Vcs-* fields. - - -- Modestas Vainius Thu, 19 Mar 2009 18:05:40 +0200 - -taglib (1.5-3) unstable; urgency=high - - * Add 02_export_more_public_functions.diff patch to TAGLIB_EXPORT some - public functions of the id3v1 module (Closes: #485229). Urgency high - because this breaks other software in testing. - * Drop gcc4.2 symbols files, No longer needed as gcc 4.3 is now default on - all architectures. - - -- Modestas Vainius Mon, 09 Jun 2008 01:11:57 +0300 - -taglib (1.5-2) unstable; urgency=low - - * Write symbol files for g++ 4.2 and g++ 4.3 architectures. Also handle - symbol differences due to size_t mangling. Resolves numerous FTBFSes. - - -- Modestas Vainius Sun, 25 May 2008 22:47:35 +0300 - -taglib (1.5-1) unstable; urgency=low - - * New upstream release (Closes: #477507). - - * Set myself as maintainer (with maintainer's permission). - * Bump debhelper compat level to 5. - * Bump Standards-Version to 3.7.3. No changes needed. - * Remove VCS fields from debian/control for now. - * Add Homepage field. - * Build with cmake & cdbs: - - Adjust build depends. - - Clean up debian/rules. - - Remove libtool patch. - * Remove all other patches - this upstream release contains all fixes. - * Add myself to Uploaders and set DM-Upload-Allowed: yes. - * Convert libtag1-doc.install to libtag1-doc.docs. - * Add debian/rules target to install & rename bindings/README from the - source tree. Remove libtag1c2a.docs. - * taglib v1.5 dropped a few private tag classes which have never been - exposed via public headers. Ignore missing symbols from them: - - TagLib::CombinedTag - - TagLib::FLAC::Tag - - TagLib::MPEGTag - * Add 01_gcc_visibility.diff patch which adds GCC visibility - __attribute__ to TAGLIB_EXPORT and TAGLIB_C_EXPORT definitions. - * 01 patch allows to build with -fvisibility=hidden and - -fvisibility-inlines-hidden. Ignore symbols which where dropped due to - these flags. - * Add symbols files for libtag1c2a and libtagc0. Make two versions of - libtag1c2a.symbols file for 32bit and 64bit arches (based on i386 and - amd64 respectively). There are a few diffs in mangling. - level to -c0 because symbol tables differ insignificantly among arches. - * Add lintian overrides (libtagc0 package name mismatch with soname and - taglib-config man page). - - -- Modestas Vainius Sun, 25 May 2008 18:47:24 +0300 - -taglib (1.4-8.1) unstable; urgency=low - - * Non-maintainer upload. - * Update patches/fix_gcc4.3_ftbfs.diff to fix g++-4.3 FTBFS, thanks to - daniel schepler (Closes: 441604). - - -- Pierre Habouzit Sun, 16 Mar 2008 22:27:41 +0000 - -taglib (1.4-8) unstable; urgency=low - - * Backport patch from upstream svn to reopen files in read-only mode if - opening read-write fails even if access(2) said read-write was ok (this - happens on networked file systems). (Closes: #421893) - - -- Adeodato Simó Thu, 03 May 2007 14:23:30 +0200 - -taglib (1.4-7) unstable; urgency=low - - * Backport patch from upstream svn to fix some cases of miscalculation of - the length of a MP3 VBR file. (Closes: #398998) - - -- Adeodato Simó Fri, 20 Apr 2007 17:02:32 +0200 - -taglib (1.4-6) unstable; urgency=low - - * Add missing bit to the previous backported patch (r583305). - - * Revamp debian/copyright, updating FSF's address at the same time. - - * Move from ${Source-Version} to ${binary:Version}. - - -- Adeodato Simó Fri, 20 Apr 2007 14:30:28 +0200 - -taglib (1.4-5) unstable; urgency=low - - * Backport patch from upstream svn to fix #include that should be - #include "foo.h" instead. (Closes: #241815, #397752) - - * Add patch to fix FTBFS with gcc-4.3. (Closes: #417727) - - * Rename X-VCS-Bzr to VCS-Bzr in debian/control. - - * Use quilt.make. - - -- Adeodato Simó Thu, 19 Apr 2007 23:24:01 +0200 - -taglib (1.4-4) unstable; urgency=low - - * Rework debian/rules a bit, taking chance to change patch management to - quilt and use config.{sub,guess} from autotools-dev. - - * Add a X-VCS-Bzr header to the source package, pointing to the repository - where the packaging is kept. - - * Update Standards-Version to 3.7.2 (no changes needed). - - * Add debian/watch file. - - -- Adeodato Simó Fri, 9 Jun 2006 11:10:35 +0200 - -taglib (1.4-3) unstable; urgency=low - - * libstdc++ allocator transition: rename libtag1c2 to libtag1c2a. - (Closes: #339270) - - * Re-libtoolize, fixing FTBFS on GNU/k*BSD. (Closes: #337953) (Patch in - debian/patches/01_update-libtool.diff, plus a bit of touch magic in - debian/rules.) - - * Update FSF postal address in debian/copyright. - - * Again, update my e-mail address in debian/control, yada yada. - - -- Adeodato Simó Sat, 26 Nov 2005 04:57:44 +0100 - -taglib (1.4-2) unstable; urgency=low - - * Include /usr/lib/pkgconfig/taglib.pc in libtag1-dev. (Closes: #335255) - - * Update Standards-Version to 3.6.2 (no changes needed). - - * Update my e-mail address in debian/control. - - -- Adeodato Simó Mon, 07 Nov 2005 14:25:31 +0100 - -taglib (1.4-1) unstable; urgency=low - - * New upstream release packaged (closes: #323280, #325219), which fixes the - following bugs reported in the BTS: - - + does not leak in APE items. - (Closes: #317831) - + does not segfault when requesting the text of an empty APE item. - (Closes: #325721) - + does not segfault while parsing large ogg vorbis user comments. - (Closes: #312068) - - Changes in the Debian package: - - + bump shlibs. - + remove tdebug.h from libtag1-dev.install, since upstream does not - install it anymore. - - * Add myself as an uploader, with Christopher's permission. - - * Add zlib1g-dev to Build-Depends, to gain support for compressed frames. - - * Pass --disable-debug to ./configure in order to prevent debug messages on - stderr. (Closes: #309753) - - * Now that graphviz is in main, add it to Build-Depends-Indep together with - gsfonts-x11 in order to generate inheritance graphs in docs; the "Class - Hierarchy" page is also created now, which closes: #302889. Removed no - longer needed debian/patches/10_doxygen_have_dot_no.diff. - - * While we're at it, install taglib.png that the html docs reference. - - * Install bindings/README as README.bindings. - - * Acknowledge NMU. (Closes: #319512) - - -- Adeodato Simó Thu, 15 Sep 2005 02:42:18 +0200 - -taglib (1.3.1-1.1) unstable; urgency=medium - - * NMU for the C++ ABI transition (closes: #319512): - - + debian/control: - - rename libtag1 to libtag1c2, and make it conflict and replace libtag1. - - make libtag1-dev depend on libtag1c2 instead of libtag1. - - + debian/rules: - - adjust path for dh_shlibdeps -l option. - - + debian/libtag1.install: - - renamed to libtag1c2.install. - - * Left libtagc0 alone since it only exports C symbols. - - -- Adeodato Simó Sat, 23 Jul 2005 23:09:55 +0200 - -taglib (1.3.1-1) unstable; urgency=low - - * New upstream release. (Closes: #273029) - - -- Christopher L Cheney Mon, 8 Nov 2004 03:00:00 -0600 - -taglib (1.2-1) unstable; urgency=low - - * New upstream release. - - -- Christopher L Cheney Wed, 28 Jul 2004 15:00:00 -0500 - -taglib (1.1-1) unstable; urgency=low - - * New upstream release. - - -- Christopher L Cheney Tue, 13 Apr 2004 20:00:00 -0500 - -taglib (1.0-2) unstable; urgency=low - - * Make rules ignore doxygen failure due to dpkg idiocy. (Closes: #235478) - - -- Christopher L Cheney Wed, 10 Mar 2004 04:00:00 -0600 - -taglib (1.0-1) unstable; urgency=low - - * Initial release. - - -- Christopher L Cheney Thu, 19 Feb 2004 02:00:00 -0600 diff -Nru taglib-1.8.1~git20121128.3fa295g/debian/patches/series taglib-1.8/debian/patches/series --- taglib-1.8.1~git20121128.3fa295g/debian/patches/series 2012-12-20 12:19:08.000000000 +0000 +++ taglib-1.8/debian/patches/series 2012-09-29 22:14:13.000000000 +0000 @@ -1 +1 @@ -#multiarch.diff +multiarch.diff diff -Nru taglib-1.8.1~git20121128.3fa295g/debian/rusxmms-patches/rusxmms_series taglib-1.8/debian/rusxmms-patches/rusxmms_series --- taglib-1.8.1~git20121128.3fa295g/debian/rusxmms-patches/rusxmms_series 2012-12-20 12:19:08.000000000 +0000 +++ taglib-1.8/debian/rusxmms-patches/rusxmms_series 2010-05-13 21:52:24.000000000 +0000 @@ -1 +1 @@ -#rusxmms_taglib.diff +rusxmms_taglib.diff diff -Nru taglib-1.8.1~git20121128.3fa295g/examples/tagreader.cpp taglib-1.8/examples/tagreader.cpp --- taglib-1.8.1~git20121128.3fa295g/examples/tagreader.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/examples/tagreader.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -23,12 +23,10 @@ */ #include -#include #include #include #include -#include using namespace std; @@ -51,7 +49,7 @@ TagLib::Tag *tag = f.tag(); - cout << "-- TAG (basic) --" << endl; + cout << "-- TAG --" << endl; cout << "title - \"" << tag->title() << "\"" << endl; cout << "artist - \"" << tag->artist() << "\"" << endl; cout << "album - \"" << tag->album() << "\"" << endl; @@ -59,23 +57,6 @@ cout << "comment - \"" << tag->comment() << "\"" << endl; cout << "track - \"" << tag->track() << "\"" << endl; cout << "genre - \"" << tag->genre() << "\"" << endl; - - TagLib::PropertyMap tags = f.file()->properties(); - - unsigned int longest = 0; - for(TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end(); ++i) { - if (i->first.size() > longest) { - longest = i->first.size(); - } - } - - cout << "-- TAG (properties) --" << endl; - for(TagLib::PropertyMap::ConstIterator i = tags.begin(); i != tags.end(); ++i) { - for(TagLib::StringList::ConstIterator j = i->second.begin(); j != i->second.end(); ++j) { - cout << left << std::setw(longest) << i->first << " - " << '"' << *j << '"' << endl; - } - } - } if(!f.isNull() && f.audioProperties()) { diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/CMakeLists.txt taglib-1.8/taglib/CMakeLists.txt --- taglib-1.8.1~git20121128.3fa295g/taglib/CMakeLists.txt 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/CMakeLists.txt 2012-09-06 18:03:15.000000000 +0000 @@ -10,7 +10,6 @@ ${CMAKE_CURRENT_SOURCE_DIR}/mp4 ${CMAKE_CURRENT_SOURCE_DIR}/ogg/vorbis ${CMAKE_CURRENT_SOURCE_DIR}/ogg/speex - ${CMAKE_CURRENT_SOURCE_DIR}/ogg/opus ${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v2 ${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v2/frames ${CMAKE_CURRENT_SOURCE_DIR}/mpeg/id3v1 @@ -84,8 +83,6 @@ ogg/flac/oggflacfile.h ogg/speex/speexfile.h ogg/speex/speexproperties.h - ogg/opus/opusfile.h - ogg/opus/opusproperties.h flac/flacfile.h flac/flacpicture.h flac/flacproperties.h @@ -106,7 +103,6 @@ riff/aiff/aiffproperties.h riff/wav/wavfile.h riff/wav/wavproperties.h - riff/wav/infotag.h asf/asffile.h asf/asfproperties.h asf/asftag.h @@ -223,11 +219,6 @@ ogg/speex/speexproperties.cpp ) -set(opus_SRCS - ogg/opus/opusfile.cpp - ogg/opus/opusproperties.cpp -) - set(trueaudio_SRCS trueaudio/trueaudiofile.cpp trueaudio/trueaudioproperties.cpp @@ -253,7 +244,6 @@ set(wav_SRCS riff/wav/wavfile.cpp riff/wav/wavproperties.cpp - riff/wav/infotag.cpp ) set(mod_SRCS @@ -296,7 +286,7 @@ ${mpeg_SRCS} ${id3v1_SRCS} ${id3v2_SRCS} ${frames_SRCS} ${ogg_SRCS} ${vorbis_SRCS} ${oggflacs_SRCS} ${mpc_SRCS} ${ape_SRCS} ${toolkit_SRCS} ${flacs_SRCS} ${wavpack_SRCS} ${speex_SRCS} ${trueaudio_SRCS} ${riff_SRCS} ${aiff_SRCS} ${wav_SRCS} - ${asf_SRCS} ${mp4_SRCS} ${mod_SRCS} ${s3m_SRCS} ${it_SRCS} ${xm_SRCS} ${opus_SRCS} + ${asf_SRCS} ${mp4_SRCS} ${mod_SRCS} ${s3m_SRCS} ${it_SRCS} ${xm_SRCS} tag.cpp tagunion.cpp fileref.cpp diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/ape/apefile.cpp taglib-1.8/taglib/ape/apefile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/ape/apefile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/ape/apefile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -90,16 +90,14 @@ Properties::ReadStyle propertiesStyle) : TagLib::File(file) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } APE::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) : TagLib::File(stream) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } APE::File::~File() diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/ape/apefile.h taglib-1.8/taglib/ape/apefile.h --- taglib-1.8.1~git20121128.3fa295g/taglib/ape/apefile.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/ape/apefile.h 2012-09-06 18:03:15.000000000 +0000 @@ -132,7 +132,6 @@ * has no tag at all, APE will be created. */ PropertyMap setProperties(const PropertyMap &); - /*! * Returns the APE::Properties for this file. If no audio properties * were read then this will return a null pointer. diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/asf/asffile.cpp taglib-1.8/taglib/asf/asffile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/asf/asffile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/asf/asffile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -29,7 +29,6 @@ #include #include -#include #include #include "asffile.h" #include "asftag.h" @@ -373,16 +372,14 @@ : TagLib::File(file) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } ASF::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) : TagLib::File(stream) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } ASF::File::~File() @@ -404,21 +401,6 @@ return d->tag; } -PropertyMap ASF::File::properties() const -{ - return d->tag->properties(); -} - -void ASF::File::removeUnsupportedProperties(const StringList &properties) -{ - d->tag->removeUnsupportedProperties(properties); -} - -PropertyMap ASF::File::setProperties(const PropertyMap &properties) -{ - return d->tag->setProperties(properties); -} - ASF::Properties *ASF::File::audioProperties() const { return d->properties; diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/asf/asffile.h taglib-1.8/taglib/asf/asffile.h --- taglib-1.8.1~git20121128.3fa295g/taglib/asf/asffile.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/asf/asffile.h 2012-09-06 18:03:15.000000000 +0000 @@ -91,22 +91,6 @@ virtual Tag *tag() const; /*! - * Implements the unified property interface -- export function. - */ - PropertyMap properties() const; - - /*! - * Removes unsupported properties. Forwards to the actual Tag's - * removeUnsupportedProperties() function. - */ - void removeUnsupportedProperties(const StringList &properties); - - /*! - * Implements the unified property interface -- import function. - */ - PropertyMap setProperties(const PropertyMap &); - - /*! * Returns the ASF audio properties for this file. */ virtual Properties *audioProperties() const; diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/asf/asftag.cpp taglib-1.8/taglib/asf/asftag.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/asf/asftag.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/asf/asftag.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -27,7 +27,6 @@ #include #endif -#include #include "asftag.h" using namespace TagLib; @@ -197,162 +196,3 @@ d->attributeListMap.isEmpty(); } -static const char *keyTranslation[][2] = { - { "WM/AlbumTitle", "ALBUM" }, - { "WM/Composer", "COMPOSER" }, - { "WM/Writer", "WRITER" }, - { "WM/Conductor", "CONDUCTOR" }, - { "WM/ModifiedBy", "REMIXER" }, - { "WM/Year", "DATE" }, - { "WM/OriginalReleaseYear", "ORIGINALDATE" }, - { "WM/Producer", "PRODUCER" }, - { "WM/ContentGroupDescription", "GROUPING" }, - { "WM/SubTitle", "SUBTITLE" }, - { "WM/SetSubTitle", "DISCSUBTITLE" }, - { "WM/TrackNumber", "TRACKNUMBER" }, - { "WM/PartOfSet", "DISCNUMBER" }, - { "WM/Genre", "GENRE" }, - { "WM/BeatsPerMinute", "BPM" }, - { "WM/Mood", "MOOD" }, - { "WM/ISRC", "ISRC" }, - { "WM/Lyrics", "LYRICS" }, - { "WM/Media", "MEDIA" }, - { "WM/Publisher", "LABEL" }, - { "WM/CatalogNo", "CATALOGNUMBER" }, - { "WM/Barcode", "BARCODE" }, - { "WM/EncodedBy", "ENCODEDBY" }, - { "WM/AlbumSortOrder", "ALBUMSORT" }, - { "WM/AlbumArtistSortOrder", "ALBUMARTISTSORT" }, - { "WM/ArtistSortOrder", "ARTISTSORT" }, - { "WM/TitleSortOrder", "TITLESORT" }, - { "WM/Script", "SCRIPT" }, - { "WM/Language", "LANGUAGE" }, - { "MusicBrainz/Track Id", "MUSICBRAINZ_TRACKID" }, - { "MusicBrainz/Artist Id", "MUSICBRAINZ_ARTISTID" }, - { "MusicBrainz/Album Id", "MUSICBRAINZ_ALBUMID" }, - { "MusicBrainz/Album Artist Id", "MUSICBRAINZ_ALBUMARTISTID" }, - { "MusicBrainz/Release Group Id", "MUSICBRAINZ_RELEASEGROUPID" }, - { "MusicBrainz/Work Id", "MUSICBRAINZ_WORKID" }, - { "MusicIP/PUID", "MUSICIP_PUID" }, - { "Acoustid/Id", "ACOUSTID_ID" }, - { "Acoustid/Fingerprint", "ACOUSTID_FINGERPRINT" }, -}; - -PropertyMap ASF::Tag::properties() const -{ - static Map keyMap; - if(keyMap.isEmpty()) { - int numKeys = sizeof(keyTranslation) / sizeof(keyTranslation[0]); - for(int i = 0; i < numKeys; i++) { - keyMap[keyTranslation[i][0]] = keyTranslation[i][1]; - } - } - - PropertyMap props; - - if(!d->title.isEmpty()) { - props["TITLE"] = d->title; - } - if(!d->artist.isEmpty()) { - props["ARTIST"] = d->artist; - } - if(!d->copyright.isEmpty()) { - props["COPYRIGHT"] = d->copyright; - } - if(!d->comment.isEmpty()) { - props["COMMENT"] = d->comment; - } - - ASF::AttributeListMap::ConstIterator it = d->attributeListMap.begin(); - for(; it != d->attributeListMap.end(); ++it) { - if(keyMap.contains(it->first)) { - String key = keyMap[it->first]; - AttributeList::ConstIterator it2 = it->second.begin(); - for(; it2 != it->second.end(); ++it2) { - if(key == "TRACKNUMBER") { - if(it2->type() == ASF::Attribute::DWordType) - props.insert(key, String::number(it2->toUInt())); - else - props.insert(key, it2->toString()); - } - else { - props.insert(key, it2->toString()); - } - } - } - else { - props.unsupportedData().append(it->first); - } - } - return props; -} - -void ASF::Tag::removeUnsupportedProperties(const StringList &props) -{ - StringList::ConstIterator it = props.begin(); - for(; it != props.end(); ++it) - d->attributeListMap.erase(*it); -} - -PropertyMap ASF::Tag::setProperties(const PropertyMap &props) -{ - static Map reverseKeyMap; - if(reverseKeyMap.isEmpty()) { - int numKeys = sizeof(keyTranslation) / sizeof(keyTranslation[0]); - for(int i = 0; i < numKeys; i++) { - reverseKeyMap[keyTranslation[i][1]] = keyTranslation[i][0]; - } - } - - PropertyMap origProps = properties(); - PropertyMap::ConstIterator it = origProps.begin(); - for(; it != origProps.end(); ++it) { - if(!props.contains(it->first) || props[it->first].isEmpty()) { - if(it->first == "TITLE") { - d->title = String::null; - } - else if(it->first == "ARTIST") { - d->artist = String::null; - } - else if(it->first == "COMMENT") { - d->comment = String::null; - } - else if(it->first == "COPYRIGHT") { - d->copyright = String::null; - } - else { - d->attributeListMap.erase(reverseKeyMap[it->first]); - } - } - } - - PropertyMap ignoredProps; - it = props.begin(); - for(; it != props.end(); ++it) { - if(reverseKeyMap.contains(it->first)) { - String name = reverseKeyMap[it->first]; - removeItem(name); - StringList::ConstIterator it2 = it->second.begin(); - for(; it2 != it->second.end(); ++it2) { - addAttribute(name, *it2); - } - } - else if(it->first == "TITLE") { - d->title = it->second.toString(); - } - else if(it->first == "ARTIST") { - d->artist = it->second.toString(); - } - else if(it->first == "COMMENT") { - d->comment = it->second.toString(); - } - else if(it->first == "COPYRIGHT") { - d->copyright = it->second.toString(); - } - else { - ignoredProps.insert(it->first, it->second); - } - } - - return ignoredProps; -} diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/asf/asftag.h taglib-1.8/taglib/asf/asftag.h --- taglib-1.8.1~git20121128.3fa295g/taglib/asf/asftag.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/asf/asftag.h 2012-09-06 18:03:15.000000000 +0000 @@ -176,10 +176,6 @@ */ void addAttribute(const String &name, const Attribute &attribute); - PropertyMap properties() const; - void removeUnsupportedProperties(const StringList& properties); - PropertyMap setProperties(const PropertyMap &properties); - private: class TagPrivate; diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/fileref.cpp taglib-1.8/taglib/fileref.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/fileref.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/fileref.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -45,7 +45,6 @@ #include "mp4file.h" #include "wavpackfile.h" #include "speexfile.h" -#include "opusfile.h" #include "trueaudiofile.h" #include "aifffile.h" #include "wavfile.h" @@ -253,8 +252,6 @@ return new WavPack::File(fileName, readAudioProperties, audioPropertiesStyle); if(ext == "SPX") return new Ogg::Speex::File(fileName, readAudioProperties, audioPropertiesStyle); - if(ext == "OPUS") - return new Ogg::Opus::File(fileName, readAudioProperties, audioPropertiesStyle); if(ext == "TTA") return new TrueAudio::File(fileName, readAudioProperties, audioPropertiesStyle); if(ext == "M4A" || ext == "M4R" || ext == "M4B" || ext == "M4P" || ext == "MP4" || ext == "3G2") diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/flac/flacfile.cpp taglib-1.8/taglib/flac/flacfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/flac/flacfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/flac/flacfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -70,8 +70,7 @@ ~FilePrivate() { - uint size = blocks.size(); - for(uint i = 0; i < size; i++) { + for(uint i = 0; i < blocks.size(); i++) { delete blocks[i]; } delete properties; @@ -109,8 +108,7 @@ TagLib::File(file) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } FLAC::File::File(FileName file, ID3v2::FrameFactory *frameFactory, @@ -119,8 +117,7 @@ { d = new FilePrivate; d->ID3v2FrameFactory = frameFactory; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } FLAC::File::File(IOStream *stream, ID3v2::FrameFactory *frameFactory, @@ -129,8 +126,7 @@ { d = new FilePrivate; d->ID3v2FrameFactory = frameFactory; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } FLAC::File::~File() @@ -429,7 +425,7 @@ length = header.mid(1, 3).toUInt(); ByteVector data = readBlock(length); - if(data.size() != length || length == 0) { + if(data.size() != length) { debug("FLAC::File::scan() -- FLAC stream corrupted"); setValid(false); return; diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/it/itfile.cpp taglib-1.8/taglib/it/itfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/it/itfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/it/itfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -45,8 +45,7 @@ Mod::FileBase(file), d(new FilePrivate(propertiesStyle)) { - if(isOpen()) - read(readProperties); + read(readProperties); } IT::File::File(IOStream *stream, bool readProperties, @@ -54,8 +53,7 @@ Mod::FileBase(stream), d(new FilePrivate(propertiesStyle)) { - if(isOpen()) - read(readProperties); + read(readProperties); } IT::File::~File() diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mod/modfile.cpp taglib-1.8/taglib/mod/modfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/mod/modfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mod/modfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -45,8 +45,7 @@ Mod::FileBase(file), d(new FilePrivate(propertiesStyle)) { - if(isOpen()) - read(readProperties); + read(readProperties); } Mod::File::File(IOStream *stream, bool readProperties, @@ -54,8 +53,7 @@ Mod::FileBase(stream), d(new FilePrivate(propertiesStyle)) { - if(isOpen()) - read(readProperties); + read(readProperties); } Mod::File::~File() diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mp4/mp4coverart.h taglib-1.8/taglib/mp4/mp4coverart.h --- taglib-1.8.1~git20121128.3fa295g/taglib/mp4/mp4coverart.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mp4/mp4coverart.h 2012-09-06 18:03:15.000000000 +0000 @@ -42,11 +42,10 @@ * This describes the image type. */ enum Format { - JPEG = TypeJPEG, - PNG = TypePNG, - BMP = TypeBMP, - GIF = TypeGIF, - Unknown = TypeImplicit, + JPEG = TypeJPEG, + PNG = TypePNG, + BMP = TypeBMP, + GIF = TypeGIF }; CoverArt(Format format, const ByteVector &data); diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mp4/mp4file.cpp taglib-1.8/taglib/mp4/mp4file.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/mp4/mp4file.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mp4/mp4file.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -29,7 +29,6 @@ #include #include -#include #include "mp4atom.h" #include "mp4tag.h" #include "mp4file.h" @@ -68,16 +67,14 @@ : TagLib::File(file) { d = new FilePrivate; - if(isOpen()) - read(readProperties, audioPropertiesStyle); + read(readProperties, audioPropertiesStyle); } MP4::File::File(IOStream *stream, bool readProperties, AudioProperties::ReadStyle audioPropertiesStyle) : TagLib::File(stream) { d = new FilePrivate; - if(isOpen()) - read(readProperties, audioPropertiesStyle); + read(readProperties, audioPropertiesStyle); } MP4::File::~File() @@ -91,21 +88,6 @@ return d->tag; } -PropertyMap MP4::File::properties() const -{ - return d->tag->properties(); -} - -void MP4::File::removeUnsupportedProperties(const StringList &properties) -{ - d->tag->removeUnsupportedProperties(properties); -} - -PropertyMap MP4::File::setProperties(const PropertyMap &properties) -{ - return d->tag->setProperties(properties); -} - MP4::Properties * MP4::File::audioProperties() const { diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mp4/mp4file.h taglib-1.8/taglib/mp4/mp4file.h --- taglib-1.8.1~git20121128.3fa295g/taglib/mp4/mp4file.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mp4/mp4file.h 2012-09-06 18:03:15.000000000 +0000 @@ -89,22 +89,6 @@ Tag *tag() const; /*! - * Implements the unified property interface -- export function. - */ - PropertyMap properties() const; - - /*! - * Removes unsupported properties. Forwards to the actual Tag's - * removeUnsupportedProperties() function. - */ - void removeUnsupportedProperties(const StringList &properties); - - /*! - * Implements the unified property interface -- import function. - */ - PropertyMap setProperties(const PropertyMap &); - - /*! * Returns the MP4 audio properties for this file. */ Properties *audioProperties() const; diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mp4/mp4tag.cpp taglib-1.8/taglib/mp4/mp4tag.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/mp4/mp4tag.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mp4/mp4tag.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -29,7 +29,6 @@ #include #include -#include #include "mp4atom.h" #include "mp4tag.h" #include "id3v1genres.h" @@ -284,13 +283,10 @@ debug("MP4: Unexpected atom \"" + name + "\", expecting \"data\""); break; } - if(flags == TypeJPEG || flags == TypePNG || flags == TypeBMP || flags == TypeGIF || flags == TypeImplicit) { + if(flags == TypeJPEG || flags == TypePNG || flags == TypeBMP || flags == TypeGIF) { value.append(MP4::CoverArt(MP4::CoverArt::Format(flags), data.mid(pos + 16, length - 16))); } - else { - debug("MP4: Unknown covr format " + String::number(flags)); - } pos += length; } if(value.size() > 0) @@ -574,7 +570,7 @@ atom->offset += delta; } d->file->seek(atom->offset + 9); - ByteVector data = d->file->readBlock(atom->length - 9); + ByteVector data = d->file->readBlock(atom->offset - 9); unsigned int flags = (ByteVector(1, '\0') + data.mid(0, 3)).toUInt(); if(flags & 1) { long long o = data.mid(7, 8).toLongLong(); @@ -760,153 +756,3 @@ return d->items; } -static const char *keyTranslation[][2] = { - { "\251nam", "TITLE" }, - { "\251ART", "ARTIST" }, - { "\251alb", "ALBUM" }, - { "\251cmt", "COMMENT" }, - { "\251gen", "GENRE" }, - { "\251day", "DATE" }, - { "\251wrt", "COMPOSER" }, - { "\251grp", "GROUPING" }, - { "trkn", "TRACKNUMBER" }, - { "disk", "DISCNUMBER" }, - { "cpil", "COMPILATION" }, - { "tmpo", "BPM" }, - { "cprt", "COPYRIGHT" }, - { "\251lyr", "LYRICS" }, - { "\251too", "ENCODEDBY" }, - { "soal", "ALBUMSORT" }, - { "soaa", "ALBUMARTISTSORT" }, - { "soar", "ARTISTSORT" }, - { "sonm", "TITLESORT" }, - { "soco", "COMPOSERSORT" }, - { "sosn", "SHOWSORT" }, - { "----:com.apple.iTunes:MusicBrainz Track Id", "MUSICBRAINZ_TRACKID" }, - { "----:com.apple.iTunes:MusicBrainz Artist Id", "MUSICBRAINZ_ARTISTID" }, - { "----:com.apple.iTunes:MusicBrainz Album Id", "MUSICBRAINZ_ALBUMID" }, - { "----:com.apple.iTunes:MusicBrainz Album Artist Id", "MUSICBRAINZ_ALBUMARTISTID" }, - { "----:com.apple.iTunes:MusicBrainz Release Group Id", "MUSICBRAINZ_RELEASEGROUPID" }, - { "----:com.apple.iTunes:MusicBrainz Work Id", "MUSICBRAINZ_WORKID" }, - { "----:com.apple.iTunes:ASIN", "ASIN" }, - { "----:com.apple.iTunes:LABEL", "LABEL" }, - { "----:com.apple.iTunes:LYRICIST", "LYRICIST" }, - { "----:com.apple.iTunes:CONDUCTOR", "CONDUCTOR" }, - { "----:com.apple.iTunes:REMIXER", "REMIXER" }, - { "----:com.apple.iTunes:ENGINEER", "ENGINEER" }, - { "----:com.apple.iTunes:PRODUCER", "PRODUCER" }, - { "----:com.apple.iTunes:DJMIXER", "DJMIXER" }, - { "----:com.apple.iTunes:MIXER", "MIXER" }, - { "----:com.apple.iTunes:SUBTITLE", "SUBTITLE" }, - { "----:com.apple.iTunes:DISCSUBTITLE", "DISCSUBTITLE" }, - { "----:com.apple.iTunes:MOOD", "MOOD" }, - { "----:com.apple.iTunes:ISRC", "ISRC" }, - { "----:com.apple.iTunes:CATALOGNUMBER", "CATALOGNUMBER" }, - { "----:com.apple.iTunes:BARCODE", "BARCODE" }, - { "----:com.apple.iTunes:SCRIPT", "SCRIPT" }, - { "----:com.apple.iTunes:LANGUAGE", "LANGUAGE" }, - { "----:com.apple.iTunes:LICENSE", "LICENSE" }, - { "----:com.apple.iTunes:MEDIA", "MEDIA" }, -}; - -PropertyMap MP4::Tag::properties() const -{ - static Map keyMap; - if(keyMap.isEmpty()) { - int numKeys = sizeof(keyTranslation) / sizeof(keyTranslation[0]); - for(int i = 0; i < numKeys; i++) { - keyMap[keyTranslation[i][0]] = keyTranslation[i][1]; - } - } - - PropertyMap props; - MP4::ItemListMap::ConstIterator it = d->items.begin(); - for(; it != d->items.end(); ++it) { - if(keyMap.contains(it->first)) { - String key = keyMap[it->first]; - if(key == "TRACKNUMBER" || key == "DISCNUMBER") { - MP4::Item::IntPair ip = it->second.toIntPair(); - String value = String::number(ip.first); - if(ip.second) { - value += "/" + String::number(ip.second); - } - props[key] = value; - } - else if(key == "BPM") { - props[key] = String::number(it->second.toInt()); - } - else if(key == "COMPILATION") { - props[key] = String::number(it->second.toBool()); - } - else { - props[key] = it->second.toStringList(); - } - } - else { - props.unsupportedData().append(it->first); - } - } - return props; -} - -void MP4::Tag::removeUnsupportedProperties(const StringList &props) -{ - StringList::ConstIterator it = props.begin(); - for(; it != props.end(); ++it) - d->items.erase(*it); -} - -PropertyMap MP4::Tag::setProperties(const PropertyMap &props) -{ - static Map reverseKeyMap; - if(reverseKeyMap.isEmpty()) { - int numKeys = sizeof(keyTranslation) / sizeof(keyTranslation[0]); - for(int i = 0; i < numKeys; i++) { - reverseKeyMap[keyTranslation[i][1]] = keyTranslation[i][0]; - } - } - - PropertyMap origProps = properties(); - PropertyMap::ConstIterator it = origProps.begin(); - for(; it != origProps.end(); ++it) { - if(!props.contains(it->first) || props[it->first].isEmpty()) { - d->items.erase(reverseKeyMap[it->first]); - } - } - - PropertyMap ignoredProps; - it = props.begin(); - for(; it != props.end(); ++it) { - if(reverseKeyMap.contains(it->first)) { - String name = reverseKeyMap[it->first]; - if(it->first == "TRACKNUMBER" || it->first == "DISCNUMBER") { - int first = 0, second = 0; - StringList parts = StringList::split(it->second.front(), "/"); - if(parts.size() > 0) { - first = parts[0].toInt(); - if(parts.size() > 1) { - second = parts[1].toInt(); - } - d->items[name] = MP4::Item(first, second); - } - } - else if(it->first == "BPM") { - int value = it->second.front().toInt(); - d->items[name] = MP4::Item(value); - } - else if(it->first == "COMPILATION") { - bool value = it->second.front().toInt(); - d->items[name] = MP4::Item(value > 0); - } - else { - d->items[name] = it->second; - } - } - else { - ignoredProps.insert(it->first, it->second); - } - } - - return ignoredProps; -} - diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mp4/mp4tag.h taglib-1.8/taglib/mp4/mp4tag.h --- taglib-1.8.1~git20121128.3fa295g/taglib/mp4/mp4tag.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mp4/mp4tag.h 2012-09-06 18:03:15.000000000 +0000 @@ -67,10 +67,6 @@ ItemListMap &itemListMap(); - PropertyMap properties() const; - void removeUnsupportedProperties(const StringList& properties); - PropertyMap setProperties(const PropertyMap &properties); - private: AtomDataList parseData2(Atom *atom, TagLib::File *file, int expectedFlags = -1, bool freeForm = false); TagLib::ByteVectorList parseData(Atom *atom, TagLib::File *file, int expectedFlags = -1, bool freeForm = false); diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mpc/mpcfile.cpp taglib-1.8/taglib/mpc/mpcfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/mpc/mpcfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mpc/mpcfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -94,16 +94,14 @@ Properties::ReadStyle propertiesStyle) : TagLib::File(file) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } MPC::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) : TagLib::File(stream) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } MPC::File::~File() diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v1/id3v1tag.cpp taglib-1.8/taglib/mpeg/id3v1/id3v1tag.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v1/id3v1tag.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mpeg/id3v1/id3v1tag.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -182,26 +182,16 @@ d->genre = ID3v1::genreIndex(s); } -void ID3v1::Tag::setYear(TagLib::uint i) +void ID3v1::Tag::setYear(uint i) { d->year = i > 0 ? String::number(i) : String::null; } -void ID3v1::Tag::setTrack(TagLib::uint i) +void ID3v1::Tag::setTrack(uint i) { d->track = i < 256 ? i : 0; } -TagLib::uint ID3v1::Tag::genreNumber() const -{ - return d->genre; -} - -void ID3v1::Tag::setGenreNumber(TagLib::uint i) -{ - d->genre = i < 256 ? i : 255; -} - void ID3v1::Tag::setStringHandler(const StringHandler *handler) { if (handler) diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v1/id3v1tag.h taglib-1.8/taglib/mpeg/id3v1/id3v1tag.h --- taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v1/id3v1tag.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mpeg/id3v1/id3v1tag.h 2012-09-06 18:03:15.000000000 +0000 @@ -140,31 +140,16 @@ virtual String album() const; virtual String comment() const; virtual String genre() const; - virtual TagLib::uint year() const; - virtual TagLib::uint track() const; + virtual uint year() const; + virtual uint track() 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(TagLib::uint i); - virtual void setTrack(TagLib::uint i); - - /*! - * Returns the genre in number. - * - * /note Normally 255 indicates that this tag contains no genre. - */ - TagLib::uint genreNumber() const; - - /*! - * Sets the genre in number to \a i. - * - * /note Valid value is from 0 up to 255. Normally 255 indicates that - * this tag contains no genre. - */ - void setGenreNumber(TagLib::uint i); + virtual void setYear(uint i); + virtual void setTrack(uint i); /*! * Sets the string handler that decides how the ID3v1 data will be diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/frames/textidentificationframe.cpp taglib-1.8/taglib/mpeg/id3v2/frames/textidentificationframe.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/frames/textidentificationframe.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mpeg/id3v2/frames/textidentificationframe.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -381,12 +381,18 @@ PropertyMap UserTextIdentificationFrame::asProperties() const { + String tagName = description(); + PropertyMap map; - String tagName = txxxToKey(description()); - StringList v = fieldList(); - for(StringList::ConstIterator it = v.begin(); it != v.end(); ++it) - if(it != v.begin()) - map.insert(tagName, *it); + String key = tagName.upper(); + if(key.isNull()) // this frame's description is not a valid PropertyMap key -> add to unsupported list + map.unsupportedData().append(L"TXXX/" + description()); + else { + StringList v = fieldList(); + for(StringList::ConstIterator it = v.begin(); it != v.end(); ++it) + if(*it != description()) + map.insert(key, *it); + } return map; } diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp taglib-1.8/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -24,10 +24,8 @@ ***************************************************************************/ #include -#include #include -#include "id3v2tag.h" #include "uniquefileidentifierframe.h" using namespace TagLib; @@ -89,34 +87,6 @@ return String::null; } -PropertyMap UniqueFileIdentifierFrame::asProperties() const -{ - PropertyMap map; - if(d->owner == "http://musicbrainz.org") { - map.insert("MUSICBRAINZ_TRACKID", String(d->identifier)); - } - else { - map.unsupportedData().append(frameID() + String("/") + d->owner); - } - return map; -} - -UniqueFileIdentifierFrame *UniqueFileIdentifierFrame::findByOwner(const ID3v2::Tag *tag, const String &o) // static -{ - ID3v2::FrameList comments = tag->frameList("UFID"); - - for(ID3v2::FrameList::ConstIterator it = comments.begin(); - it != comments.end(); - ++it) - { - UniqueFileIdentifierFrame *frame = dynamic_cast(*it); - if(frame && frame->owner() == o) - return frame; - } - - return 0; -} - void UniqueFileIdentifierFrame::parseFields(const ByteVector &data) { if(data.size() < 1) { diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h taglib-1.8/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h --- taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mpeg/id3v2/frames/uniquefileidentifierframe.h 2012-09-06 18:03:15.000000000 +0000 @@ -94,16 +94,6 @@ virtual String toString() const; - PropertyMap asProperties() const; - - /*! - * UFID frames each have a unique owner. This searches for a UFID - * frame with the owner \a o and returns a pointer to it. - * - * \see owner() - */ - static UniqueFileIdentifierFrame *findByOwner(const Tag *tag, const String &o); - protected: virtual void parseFields(const ByteVector &data); virtual ByteVector renderFields() const; diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/id3v2frame.cpp taglib-1.8/taglib/mpeg/id3v2/id3v2frame.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/id3v2frame.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mpeg/id3v2/id3v2frame.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -44,7 +44,6 @@ #include "frames/urllinkframe.h" #include "frames/unsynchronizedlyricsframe.h" #include "frames/commentsframe.h" -#include "frames/uniquefileidentifierframe.h" #include "frames/unknownframe.h" using namespace TagLib; @@ -121,16 +120,12 @@ TextIdentificationFrame *frame = new TextIdentificationFrame(frameID, String::UTF8); frame->setText(values); return frame; - } else if((frameID[0] == 'W') && (values.size() == 1)){ // URL frame (not WXXX); support only one value + } else if(values.size() == 1){ // URL frame (not WXXX); support only one value UrlLinkFrame* frame = new UrlLinkFrame(frameID); frame->setUrl(values.front()); return frame; } } - if(key == "MUSICBRAINZ_TRACKID" && values.size() == 1) { - UniqueFileIdentifierFrame *frame = new UniqueFileIdentifierFrame("http://musicbrainz.org", values.front().data(String::UTF8)); - return frame; - } // now we check if it's one of the "special" cases: // -LYRICS: depending on the number of values, use USLT or TXXX (with description=LYRICS) if((key == "LYRICS" || key.startsWith(lyricsPrefix)) && values.size() == 1){ @@ -149,14 +144,12 @@ // -COMMENT: depending on the number of values, use COMM or TXXX (with description=COMMENT) if((key == "COMMENT" || key.startsWith(commentPrefix)) && values.size() == 1){ CommentsFrame *frame = new CommentsFrame(String::UTF8); - if (key != "COMMENT"){ - frame->setDescription(key.substr(commentPrefix.size())); - } + frame->setDescription(key == "COMMENT" ? key : key.substr(commentPrefix.size())); frame->setText(values.front()); return frame; } // if non of the above cases apply, we use a TXXX frame with the key as description - return new UserTextIdentificationFrame(keyToTXXX(key), values, String::UTF8); + return new UserTextIdentificationFrame(key, values, String::UTF8); } Frame::~Frame() @@ -355,7 +348,7 @@ { "TLAN", "LANGUAGE" }, { "TLEN", "LENGTH" }, //{ "TMCL", "MUSICIANCREDITS" }, handled separately - { "TMED", "MEDIA" }, + { "TMED", "MEDIATYPE" }, { "TMOO", "MOOD" }, { "TOAL", "ORIGINALALBUM" }, { "TOFN", "ORIGINALFILENAME" }, @@ -368,7 +361,7 @@ { "TPE4", "REMIXER" }, // could also be ARRANGER { "TPOS", "DISCNUMBER" }, { "TPRO", "PRODUCEDNOTICE" }, - { "TPUB", "LABEL" }, + { "TPUB", "PUBLISHER" }, { "TRCK", "TRACKNUMBER" }, { "TRSN", "RADIOSTATION" }, { "TRSO", "RADIOSTATIONOWNER" }, @@ -392,18 +385,6 @@ //{ "USLT", "LYRICS" }, handled specially }; -static const TagLib::uint txxxFrameTranslationSize = 7; -static const char *txxxFrameTranslation[][2] = { - { "MusicBrainz Album Id", "MUSICBRAINZ_ALBUMID" }, - { "MusicBrainz Artist Id", "MUSICBRAINZ_ARTISTID" }, - { "MusicBrainz Album Artist Id", "MUSICBRAINZ_ALBUMARTISTID" }, - { "MusicBrainz Release Group Id", "MUSICBRAINZ_RELEASEGROUPID" }, - { "MusicBrainz Work Id", "MUSICBRAINZ_WORKID" }, - { "Acoustid Id", "ACOUSTID_ID" }, - { "Acoustid Fingerprint", "ACOUSTID_FINGERPRINT" }, - { "MusicIP PUID", "MUSICIP_PUID" }, -}; - Map &idMap() { static Map m; @@ -413,18 +394,6 @@ return m; } -Map &txxxMap() -{ - static Map m; - if(m.isEmpty()) { - for(size_t i = 0; i < txxxFrameTranslationSize; ++i) { - String key = String(txxxFrameTranslation[i][0]).upper(); - m[key] = txxxFrameTranslation[i][1]; - } - } - return m; -} - // list of deprecated frames and their successors static const TagLib::uint deprecatedFramesSize = 4; static const char *deprecatedFrames[][2] = { @@ -464,26 +433,6 @@ return ByteVector::null; } -String Frame::txxxToKey(const String &description) -{ - Map &m = txxxMap(); - String d = description.upper(); - if(m.contains(d)) - return m[d]; - return d; -} - -String Frame::keyToTXXX(const String &s) -{ - static Map m; - if(m.isEmpty()) - for(size_t i = 0; i < txxxFrameTranslationSize; ++i) - m[txxxFrameTranslation[i][1]] = txxxFrameTranslation[i][0]; - if(m.contains(s.upper())) - return m[s]; - return s; -} - PropertyMap Frame::asProperties() const { if(dynamic_cast< const UnknownFrame *>(this)) { @@ -505,8 +454,6 @@ return dynamic_cast< const CommentsFrame* >(this)->asProperties(); else if(id == "USLT") return dynamic_cast< const UnsynchronizedLyricsFrame* >(this)->asProperties(); - else if(id == "UFID") - return dynamic_cast< const UniqueFileIdentifierFrame* >(this)->asProperties(); PropertyMap m; m.unsupportedData().append(id); return m; diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/id3v2frame.h taglib-1.8/taglib/mpeg/id3v2/id3v2frame.h --- taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/id3v2frame.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mpeg/id3v2/id3v2frame.h 2012-09-06 18:03:15.000000000 +0000 @@ -274,15 +274,6 @@ */ static String frameIDToKey(const ByteVector &); - /*! - * Returns an appropriate TXXX frame description for the given free-form tag key. - */ - static String keyToTXXX(const String &); - - /*! - * Returns a free-form tag name for the given ID3 frame description. - */ - static String txxxToKey(const String &); /*! * This helper function splits the PropertyMap \a original into three ProperytMaps diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/id3v2framefactory.cpp taglib-1.8/taglib/mpeg/id3v2/id3v2framefactory.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/id3v2framefactory.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mpeg/id3v2/id3v2framefactory.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -99,7 +99,7 @@ // A quick sanity check -- make sure that the frameID is 4 uppercase Latin1 // characters. Also make sure that there is data in the frame. - if(frameID.size() != (version < 3 ? 3 : 4) || + if(!frameID.size() == (version < 3 ? 3 : 4) || header->frameSize() <= uint(header->dataLengthIndicator() ? 4 : 0) || header->frameSize() > data.size()) { @@ -107,17 +107,6 @@ return 0; } -#ifndef NO_ITUNES_HACKS - if(version == 3 && frameID.size() == 4 && frameID[3] == '\0') { - // iTunes v2.3 tags store v2.2 frames - convert now - frameID = frameID.mid(0, 3); - header->setFrameID(frameID); - header->setVersion(2); - updateFrame(header); - header->setVersion(3); - } -#endif - for(ByteVector::ConstIterator it = frameID.begin(); it != frameID.end(); it++) { if( (*it < 'A' || *it > 'Z') && (*it < '0' || *it > '9') ) { delete header; diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/id3v2tag.cpp taglib-1.8/taglib/mpeg/id3v2/id3v2tag.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/id3v2/id3v2tag.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mpeg/id3v2/id3v2tag.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -379,12 +379,10 @@ for(FrameList::ConstIterator fit = l.begin(); fit != l.end(); fit++) if (dynamic_cast(*fit) != 0) removeFrame(*fit); - } - else if(it->size() == 4){ + } else if(it->size() == 4){ ByteVector id = it->data(String::Latin1); removeFrames(id); - } - else { + } else { ByteVector id = it->substr(0,4).data(String::Latin1); if(it->size() <= 5) continue; // invalid specification @@ -398,8 +396,6 @@ frame = CommentsFrame::findByDescription(this, description); else if(id == "USLT") frame = UnsynchronizedLyricsFrame::findByDescription(this, description); - else if(id == "UFID") - frame = UniqueFileIdentifierFrame::findByOwner(this, description); if(frame) removeFrame(frame); } diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/mpegfile.cpp taglib-1.8/taglib/mpeg/mpegfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/mpegfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mpeg/mpegfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -437,21 +437,6 @@ return previousFrameOffset(ID3v1Tag() ? d->ID3v1Location - 1 : length()); } -bool MPEG::File::hasID3v1Tag() const -{ - return d->hasID3v1; -} - -bool MPEG::File::hasID3v2Tag() const -{ - return d->hasID3v2; -} - -bool MPEG::File::hasAPETag() const -{ - return d->hasAPE; -} - //////////////////////////////////////////////////////////////////////////////// // private members //////////////////////////////////////////////////////////////////////////////// diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/mpegfile.h taglib-1.8/taglib/mpeg/mpegfile.h --- taglib-1.8.1~git20121128.3fa295g/taglib/mpeg/mpegfile.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/mpeg/mpegfile.h 2012-09-06 18:03:15.000000000 +0000 @@ -301,21 +301,6 @@ */ long lastFrameOffset(); - /*! - * Returns whether or not the file on disk contains ID3v1 tag. - */ - bool hasID3v1Tag() const; - - /*! - * Returns whether or not the file on disk contains ID3v2 tag. - */ - bool hasID3v2Tag() const; - - /*! - * Returns whether or not the file on disk contains APE tag. - */ - bool hasAPETag() const; - private: File(const File &); File &operator=(const File &); diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/ogg/flac/oggflacfile.cpp taglib-1.8/taglib/ogg/flac/oggflacfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/ogg/flac/oggflacfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/ogg/flac/oggflacfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -72,16 +72,14 @@ Properties::ReadStyle propertiesStyle) : Ogg::File(file) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } Ogg::FLAC::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) : Ogg::File(stream) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } Ogg::FLAC::File::~File() diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/ogg/opus/opusfile.cpp taglib-1.8/taglib/ogg/opus/opusfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/ogg/opus/opusfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/ogg/opus/opusfile.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ -/*************************************************************************** - copyright : (C) 2012 by Lukáš Lalinský - email : lalinsky@gmail.com - - copyright : (C) 2002 - 2008 by Scott Wheeler - email : wheeler@kde.org - (original Vorbis 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 "opusfile.h" - -using namespace TagLib; -using namespace TagLib::Ogg; - -class Opus::File::FilePrivate -{ -public: - FilePrivate() : - comment(0), - properties(0) {} - - ~FilePrivate() - { - delete comment; - delete properties; - } - - Ogg::XiphComment *comment; - Properties *properties; -}; - -//////////////////////////////////////////////////////////////////////////////// -// public members -//////////////////////////////////////////////////////////////////////////////// - -Opus::File::File(FileName file, bool readProperties, - Properties::ReadStyle propertiesStyle) : Ogg::File(file) -{ - d = new FilePrivate; - read(readProperties, propertiesStyle); -} - -Opus::File::File(IOStream *stream, bool readProperties, - Properties::ReadStyle propertiesStyle) : Ogg::File(stream) -{ - d = new FilePrivate; - read(readProperties, propertiesStyle); -} - -Opus::File::~File() -{ - delete d; -} - -Ogg::XiphComment *Opus::File::tag() const -{ - return d->comment; -} - -Opus::Properties *Opus::File::audioProperties() const -{ - return d->properties; -} - -bool Opus::File::save() -{ - if(!d->comment) - d->comment = new Ogg::XiphComment; - - setPacket(1, ByteVector("OpusTags", 8) + d->comment->render(false)); - - return Ogg::File::save(); -} - -//////////////////////////////////////////////////////////////////////////////// -// private members -//////////////////////////////////////////////////////////////////////////////// - -void Opus::File::read(bool readProperties, Properties::ReadStyle propertiesStyle) -{ - ByteVector opusHeaderData = packet(0); - - if(!opusHeaderData.startsWith("OpusHead")) { - setValid(false); - debug("Opus::File::read() -- invalid Opus identification header"); - return; - } - - ByteVector commentHeaderData = packet(1); - - if(!commentHeaderData.startsWith("OpusTags")) { - setValid(false); - debug("Opus::File::read() -- invalid Opus tags header"); - return; - } - - d->comment = new Ogg::XiphComment(commentHeaderData.mid(8)); - - if(readProperties) - d->properties = new Properties(this, propertiesStyle); -} diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/ogg/opus/opusfile.h taglib-1.8/taglib/ogg/opus/opusfile.h --- taglib-1.8.1~git20121128.3fa295g/taglib/ogg/opus/opusfile.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/ogg/opus/opusfile.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -/*************************************************************************** - copyright : (C) 2012 by Lukáš Lalinský - email : lalinsky@gmail.com - - copyright : (C) 2002 - 2008 by Scott Wheeler - email : wheeler@kde.org - (original Vorbis 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_OPUSFILE_H -#define TAGLIB_OPUSFILE_H - -#include "oggfile.h" -#include "xiphcomment.h" - -#include "opusproperties.h" - -namespace TagLib { - - namespace Ogg { - - //! A namespace containing classes for Opus metadata - - namespace Opus { - - //! An implementation of Ogg::File with Opus specific methods - - /*! - * This is the central class in the Ogg Opus metadata processing collection - * of classes. It's built upon Ogg::File which handles processing of the Ogg - * logical bitstream and breaking it down into pages which are handled by - * the codec implementations, in this case Opus specifically. - */ - - class TAGLIB_EXPORT File : public Ogg::File - { - public: - /*! - * Contructs a Opus 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); - - /*! - * Contructs a Opus 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 TagLib will *not* take ownership of the stream, the caller is - * responsible for deleting it after the File object. - */ - File(IOStream *stream, bool readProperties = true, - Properties::ReadStyle propertiesStyle = Properties::Average); - - /*! - * Destroys this instance of the File. - */ - virtual ~File(); - - /*! - * Returns the XiphComment for this file. XiphComment implements the tag - * interface, so this serves as the reimplementation of - * TagLib::File::tag(). - */ - virtual Ogg::XiphComment *tag() const; - - /*! - * Returns the Opus::Properties for this file. If no audio properties - * were read then this will return a null pointer. - */ - virtual Properties *audioProperties() const; - - virtual bool save(); - - private: - File(const File &); - File &operator=(const File &); - - void read(bool readProperties, Properties::ReadStyle propertiesStyle); - - class FilePrivate; - FilePrivate *d; - }; - } - } -} - -#endif diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/ogg/opus/opusproperties.cpp taglib-1.8/taglib/ogg/opus/opusproperties.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/ogg/opus/opusproperties.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/ogg/opus/opusproperties.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,161 +0,0 @@ -/*************************************************************************** - copyright : (C) 2012 by Lukáš Lalinský - email : lalinsky@gmail.com - - copyright : (C) 2002 - 2008 by Scott Wheeler - email : wheeler@kde.org - (original Vorbis 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 "opusproperties.h" -#include "opusfile.h" - -using namespace TagLib; -using namespace TagLib::Ogg; - -class Opus::Properties::PropertiesPrivate -{ -public: - PropertiesPrivate(File *f, ReadStyle s) : - file(f), - style(s), - length(0), - inputSampleRate(0), - channels(0), - opusVersion(0) {} - - File *file; - ReadStyle style; - int length; - int inputSampleRate; - int channels; - int opusVersion; -}; - -//////////////////////////////////////////////////////////////////////////////// -// public members -//////////////////////////////////////////////////////////////////////////////// - -Opus::Properties::Properties(File *file, ReadStyle style) : AudioProperties(style) -{ - d = new PropertiesPrivate(file, style); - read(); -} - -Opus::Properties::~Properties() -{ - delete d; -} - -int Opus::Properties::length() const -{ - return d->length; -} - -int Opus::Properties::bitrate() const -{ - return 0; -} - -int Opus::Properties::sampleRate() const -{ - // Opus can decode any stream at a sample rate of 8, 12, 16, 24, or 48 kHz, - // so there is no single sample rate. Let's assume it's the highest - // possible. - return 48000; -} - -int Opus::Properties::channels() const -{ - return d->channels; -} - -int Opus::Properties::inputSampleRate() const -{ - return d->inputSampleRate; -} - -int Opus::Properties::opusVersion() const -{ - return d->opusVersion; -} - -//////////////////////////////////////////////////////////////////////////////// -// private members -//////////////////////////////////////////////////////////////////////////////// - -void Opus::Properties::read() -{ - // Get the identification header from the Ogg implementation. - - // http://tools.ietf.org/html/draft-terriberry-oggopus-01#section-5.1 - - ByteVector data = d->file->packet(0); - - // *Magic Signature* - int pos = 8; - - // *Version* (8 bits, unsigned) - d->opusVersion = uchar(data.at(pos)); - pos += 1; - - // *Output Channel Count* 'C' (8 bits, unsigned) - d->channels = uchar(data.at(pos)); - pos += 1; - - // *Pre-skip* (16 bits, unsigned, little endian) - ushort preSkip = data.mid(pos, 2).toUShort(false); - pos += 2; - - // *Input Sample Rate* (32 bits, unsigned, little endian) - d->inputSampleRate = data.mid(pos, 4).toUInt(false); - pos += 4; - - // *Output Gain* (16 bits, signed, little endian) - pos += 2; - - // *Channel Mapping Family* (8 bits, unsigned) - pos += 1; - - const Ogg::PageHeader *first = d->file->firstPageHeader(); - const Ogg::PageHeader *last = d->file->lastPageHeader(); - - if(first && last) { - long long start = first->absoluteGranularPosition(); - long long end = last->absoluteGranularPosition(); - - if(start >= 0 && end >= 0) - d->length = (int) ((end - start - preSkip) / 48000); - else { - debug("Opus::Properties::read() -- The PCM values for the start or " - "end of this file was incorrect."); - } - } - else - debug("Opus::Properties::read() -- Could not find valid first and last Ogg pages."); -} diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/ogg/opus/opusproperties.h taglib-1.8/taglib/ogg/opus/opusproperties.h --- taglib-1.8.1~git20121128.3fa295g/taglib/ogg/opus/opusproperties.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/ogg/opus/opusproperties.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/*************************************************************************** - copyright : (C) 2012 by Lukáš Lalinský - email : lalinsky@gmail.com - - copyright : (C) 2002 - 2008 by Scott Wheeler - email : wheeler@kde.org - (original Vorbis 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_OPUSPROPERTIES_H -#define TAGLIB_OPUSPROPERTIES_H - -#include "audioproperties.h" - -namespace TagLib { - - namespace Ogg { - - namespace Opus { - - class File; - - //! An implementation of audio property reading for Ogg Opus - - /*! - * This reads the data from an Ogg Opus stream found in the AudioProperties - * API. - */ - - class TAGLIB_EXPORT Properties : public AudioProperties - { - public: - /*! - * Create an instance of Opus::Properties with the data read from the - * Opus::File \a file. - */ - Properties(File *file, ReadStyle style = Average); - - /*! - * Destroys this Opus::Properties instance. - */ - virtual ~Properties(); - - // Reimplementations. - - virtual int length() const; - virtual int bitrate() const; - virtual int sampleRate() const; - virtual int channels() const; - - /*! - * The Opus codec supports decoding at multiple sample rates, there is no - * single sample rate of the encoded stream. This returns the sample rate - * of the original audio stream. - */ - int inputSampleRate() const; - - /*! - * Returns the Opus version, currently "0" (as specified by the spec). - */ - int opusVersion() const; - - private: - Properties(const Properties &); - Properties &operator=(const Properties &); - - void read(); - - class PropertiesPrivate; - PropertiesPrivate *d; - }; - } - } -} - -#endif diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/ogg/speex/speexfile.cpp taglib-1.8/taglib/ogg/speex/speexfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/ogg/speex/speexfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/ogg/speex/speexfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -62,16 +62,14 @@ Properties::ReadStyle propertiesStyle) : Ogg::File(file) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } Speex::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) : Ogg::File(stream) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } Speex::File::~File() diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/ogg/vorbis/vorbisfile.cpp taglib-1.8/taglib/ogg/vorbis/vorbisfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/ogg/vorbis/vorbisfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/ogg/vorbis/vorbisfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -67,16 +67,14 @@ Properties::ReadStyle propertiesStyle) : Ogg::File(file) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } Vorbis::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) : Ogg::File(stream) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } Vorbis::File::~File() diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/riff/rifffile.cpp taglib-1.8/taglib/riff/rifffile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/riff/rifffile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/riff/rifffile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -138,44 +138,34 @@ return readBlock(d->chunks[i].size); } -void RIFF::File::setChunkData(uint i, const ByteVector &data) +void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data) { - // First we update the global size + if(d->chunks.size() == 0) { + debug("RIFF::File::setChunkData - No valid chunks found."); + return; + } - d->size += ((data.size() + 1) & ~1) - (d->chunks[i].size + d->chunks[i].padding); - insert(ByteVector::fromUInt(d->size, d->endianness == BigEndian), 4, 4); + for(uint i = 0; i < d->chunks.size(); i++) { + if(d->chunks[i].name == name) { - // Now update the specific chunk + // First we update the global size - writeChunk(chunkName(i), data, d->chunks[i].offset - 8, d->chunks[i].size + d->chunks[i].padding + 8); + d->size += ((data.size() + 1) & ~1) - (d->chunks[i].size + d->chunks[i].padding); + insert(ByteVector::fromUInt(d->size, d->endianness == BigEndian), 4, 4); - d->chunks[i].size = data.size(); - d->chunks[i].padding = (data.size() & 0x01) ? 1 : 0; + // Now update the specific chunk - // Now update the internal offsets + writeChunk(name, data, d->chunks[i].offset - 8, d->chunks[i].size + d->chunks[i].padding + 8); - for(i++; i < d->chunks.size(); i++) - d->chunks[i].offset = d->chunks[i-1].offset + 8 + d->chunks[i-1].size + d->chunks[i-1].padding; -} + d->chunks[i].size = data.size(); + d->chunks[i].padding = (data.size() & 0x01) ? 1 : 0; -void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data, bool alwaysCreate) -{ - if(d->chunks.size() == 0) { - debug("RIFF::File::setChunkData - No valid chunks found."); - return; - } + // Now update the internal offsets - if(alwaysCreate && name != "LIST") { - debug("RIFF::File::setChunkData - alwaysCreate should be used for only \"LIST\" chunks."); - return; - } + for(i++; i < d->chunks.size(); i++) + d->chunks[i].offset = d->chunks[i-1].offset + 8 + d->chunks[i-1].size + d->chunks[i-1].padding; - if(!alwaysCreate) { - for(uint i = 0; i < d->chunks.size(); i++) { - if(d->chunks[i].name == name) { - setChunkData(i, data); - return; - } + return; } } @@ -191,7 +181,7 @@ // Now add the chunk to the file - writeChunk(name, data, offset, std::max(0, length() - offset), (offset & 1) ? 1 : 0); + writeChunk(name, data, offset, std::max(ulong(0), length() - offset), (offset & 1) ? 1 : 0); // And update our internal structure @@ -209,28 +199,6 @@ d->chunks.push_back(chunk); } -void RIFF::File::removeChunk(uint i) -{ - if(i >= d->chunks.size()) - return; - - removeBlock(d->chunks[i].offset - 8, d->chunks[i].size + 8); - d->chunks.erase(d->chunks.begin() + i); -} - -void RIFF::File::removeChunk(const ByteVector &name) -{ - std::vector newChunks; - for(size_t i = 0; i < d->chunks.size(); ++i) { - if(d->chunks[i].name == name) - removeBlock(d->chunks[i].offset - 8, d->chunks[i].size + 8); - else - newChunks.push_back(d->chunks[i]); - } - - d->chunks.swap(newChunks); -} - //////////////////////////////////////////////////////////////////////////////// // private members //////////////////////////////////////////////////////////////////////////////// diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/riff/rifffile.h taglib-1.8/taglib/riff/rifffile.h --- taglib-1.8.1~git20121128.3fa295g/taglib/riff/rifffile.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/riff/rifffile.h 2012-09-06 18:03:15.000000000 +0000 @@ -96,38 +96,13 @@ ByteVector chunkData(uint i); /*! - * Sets the data for the the specified chunk to \a data. - * - * \warning This will update the file immediately. - */ - void setChunkData(uint i, const ByteVector &data); - - /*! * Sets the data for the chunk \a name to \a data. If a chunk with the * given name already exists it will be overwritten, otherwise it will be * created after the existing chunks. * - * \note If \a alwaysCreate is true, a new chunk is created regardless of - * existence of chunk \a name. It should be used for only "LIST" chunks. - * - * \warning This will update the file immediately. - */ - void setChunkData(const ByteVector &name, const ByteVector &data, bool alwaysCreate = false); - - /*! - * Removes the specified chunk. - * - * \warning This will update the file immediately. - */ - void removeChunk(uint i); - - /*! - * Removes the chunk \a name. - * * \warning This will update the file immediately. - * \warning This removes all the chunks with the given name. */ - void removeChunk(const ByteVector &name); + void setChunkData(const ByteVector &name, const ByteVector &data); private: File(const File &); diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/riff/wav/infotag.cpp taglib-1.8/taglib/riff/wav/infotag.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/riff/wav/infotag.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/riff/wav/infotag.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,258 +0,0 @@ -/*************************************************************************** - 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 "infotag.h" - -using namespace TagLib; -using namespace RIFF::Info; - -namespace { - static bool isValidChunkID(const ByteVector &name) - { - if(name.size() != 4) - return false; - - for(int i = 0; i < 4; i++) { - if(name[i] < 32 || name[i] > 127) - return false; - } - - return true; - } -} - -class RIFF::Info::Tag::TagPrivate -{ -public: - TagPrivate() - {} - - FieldListMap fieldListMap; - - static const StringHandler *stringHandler; -}; - -//////////////////////////////////////////////////////////////////////////////// -// StringHandler implementation -//////////////////////////////////////////////////////////////////////////////// - -StringHandler::StringHandler() -{ -} - -StringHandler::~StringHandler() -{ -} - -String RIFF::Info::StringHandler::parse(const ByteVector &data) const -{ - return String(data, String::UTF8); -} - -ByteVector RIFF::Info::StringHandler::render(const String &s) const -{ - return s.data(String::UTF8); -} - -//////////////////////////////////////////////////////////////////////////////// -// public members -//////////////////////////////////////////////////////////////////////////////// - -static const StringHandler defaultStringHandler; -const RIFF::Info::StringHandler *RIFF::Info::Tag::TagPrivate::stringHandler = &defaultStringHandler; - -RIFF::Info::Tag::Tag(const ByteVector &data) : TagLib::Tag() -{ - d = new TagPrivate; - parse(data); -} - -RIFF::Info::Tag::Tag() : TagLib::Tag() -{ - d = new TagPrivate; -} - -RIFF::Info::Tag::~Tag() -{ -} - -String RIFF::Info::Tag::title() const -{ - return fieldText("INAM"); -} - -String RIFF::Info::Tag::artist() const -{ - return fieldText("IART"); -} - -String RIFF::Info::Tag::album() const -{ - return fieldText("IPRD"); -} - -String RIFF::Info::Tag::comment() const -{ - return fieldText("ICMT"); -} - -String RIFF::Info::Tag::genre() const -{ - return fieldText("IGNR"); -} - -TagLib::uint RIFF::Info::Tag::year() const -{ - return fieldText("ICRD").substr(0, 4).toInt(); -} - -TagLib::uint RIFF::Info::Tag::track() const -{ - return fieldText("IPRT").toInt(); -} - -void RIFF::Info::Tag::setTitle(const String &s) -{ - setFieldText("INAM", s); -} - -void RIFF::Info::Tag::setArtist(const String &s) -{ - setFieldText("IART", s); -} - -void RIFF::Info::Tag::setAlbum(const String &s) -{ - setFieldText("IPRD", s); -} - -void RIFF::Info::Tag::setComment(const String &s) -{ - setFieldText("ICMT", s); -} - -void RIFF::Info::Tag::setGenre(const String &s) -{ - setFieldText("IGNR", s); -} - -void RIFF::Info::Tag::setYear(uint i) -{ - if(i != 0) - setFieldText("ICRD", String::number(i)); - else - d->fieldListMap.erase("ICRD"); -} - -void RIFF::Info::Tag::setTrack(uint i) -{ - if(i != 0) - setFieldText("IPRT", String::number(i)); - else - d->fieldListMap.erase("IPRT"); -} - -bool RIFF::Info::Tag::isEmpty() const -{ - return d->fieldListMap.isEmpty(); -} - -String RIFF::Info::Tag::fieldText(const ByteVector &id) const -{ - if(d->fieldListMap.contains(id)) - return String(d->fieldListMap[id]); - else - return String(); -} - -void RIFF::Info::Tag::setFieldText(const ByteVector &id, const String &s) -{ - // id must be four-byte long pure ascii string. - if(!isValidChunkID(id)) - return; - - if(!s.isEmpty()) - d->fieldListMap[id] = s; - else - removeField(id); -} - -void RIFF::Info::Tag::removeField(const ByteVector &id) -{ - if(d->fieldListMap.contains(id)) - d->fieldListMap.erase(id); -} - -ByteVector RIFF::Info::Tag::render() const -{ - ByteVector data("INFO"); - - FieldListMap::ConstIterator it = d->fieldListMap.begin(); - for(; it != d->fieldListMap.end(); ++it) { - ByteVector text = TagPrivate::stringHandler->render(it->second); - if(text.isEmpty()) - continue; - - data.append(it->first); - data.append(ByteVector::fromUInt(text.size() + 1, false)); - data.append(text); - - do { - data.append('\0'); - } while(data.size() & 1); - } - - if(data.size() == 4) - return ByteVector(); - else - return data; -} - -void RIFF::Info::Tag::setStringHandler(const StringHandler *handler) -{ - if(handler) - TagPrivate::stringHandler = handler; - else - TagPrivate::stringHandler = &defaultStringHandler; -} - -//////////////////////////////////////////////////////////////////////////////// -// protected members -//////////////////////////////////////////////////////////////////////////////// - -void RIFF::Info::Tag::parse(const ByteVector &data) -{ - uint p = 4; - while(p < data.size()) { - uint size = data.mid(p + 4, 4).toUInt(false); - d->fieldListMap[data.mid(p, 4)] = TagPrivate::stringHandler->parse(data.mid(p + 8, size)); - - p += ((size + 1) & ~1) + 8; - } -} - diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/riff/wav/infotag.h taglib-1.8/taglib/riff/wav/infotag.h --- taglib-1.8.1~git20121128.3fa295g/taglib/riff/wav/infotag.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/riff/wav/infotag.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,179 +0,0 @@ -/*************************************************************************** - 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_INFOTAG_H -#define TAGLIB_INFOTAG_H - -#include "tag.h" -#include "tmap.h" -#include "tstring.h" -#include "tstringlist.h" -#include "tbytevector.h" -#include "taglib_export.h" - -namespace TagLib { - - class File; - - //! A RIFF Info tag implementation. - namespace RIFF { - namespace Info { - - typedef Map FieldListMap; - - //! A abstraction for the string to data encoding in Info tags. - - /*! - * RIFF Info tag has no clear definitions about character encodings. - * In practice, local encoding of each system is largely used and UTF-8 is - * popular too. - * - * Here is an option to read and write tags in your preferrd encoding - * by subclassing this class, reimplementing parse() and render() and setting - * your reimplementation as the default with Info::Tag::setStringHandler(). - * - * \see ID3v1::Tag::setStringHandler() - */ - - class TAGLIB_EXPORT StringHandler - { - public: - StringHandler(); - ~StringHandler(); - - /*! - * Decode a string from \a data. The default implementation assumes that - * \a data is an UTF-8 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 UTF-8 string. - */ - virtual ByteVector render(const String &s) const; - }; - - //! The main class in the ID3v2 implementation - - /*! - * This is the main class in the INFO tag implementation. RIFF INFO tag is a - * metadata format found in WAV audio and AVI video files. Though it is a part - * of Microsoft/IBM's RIFF specification, the author could not find the official - * documents about it. So, this implementation is refering to unofficial documents - * online and some applications' behaviors especially Windows Explorer. - */ - class TAGLIB_EXPORT Tag : public TagLib::Tag - { - public: - /*! - * Constructs an empty Info tag. - */ - Tag(); - - /*! - * Constructs an Info tag read from \a data which is contents of "LIST" chunk. - */ - Tag(const ByteVector &data); - - virtual ~Tag(); - - // 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 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 bool isEmpty() const; - /* - * Gets the value of the field with the ID \a id. - */ - String fieldText(const ByteVector &id) const; - - /* - * Sets the value of the field with the ID \a id to \a s. - * If the field does not exist, it is created. - * If \s is empty, the field is removed. - * - * \note fieldId must be four-byte long pure ascii string. This function - * performs nothing if fieldId is invalid. - */ - void setFieldText(const ByteVector &id, const String &s); - - /* - * Removes the field with the ID \a id. - */ - void removeField(const ByteVector &id); - - /*! - * Render the tag back to binary data, suitable to be written to disk. - * - * \note Returns empty ByteVector is the tag contains no fields. - */ - ByteVector render() const; - - /*! - * Sets the string handler that decides how the text data will be - * converted to and from binary data. - * If the parameter \a handler is null, the previous handler is - * released and default UTF-8 handler is restored. - * - * \note The caller is responsible for deleting the previous handler - * as needed after it is released. - * - * \see StringHandler - */ - static void setStringHandler(const StringHandler *handler); - - protected: - /*! - * 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 -Nru taglib-1.8.1~git20121128.3fa295g/taglib/riff/wav/wavfile.cpp taglib-1.8/taglib/riff/wav/wavfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/riff/wav/wavfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/riff/wav/wavfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -23,42 +23,36 @@ * http://www.mozilla.org/MPL/ * ***************************************************************************/ -#include "tbytevector.h" -#include "tdebug.h" -#include "tstringlist.h" -#include "tpropertymap.h" +#include +#include +#include +#include +#include #include "wavfile.h" -#include "id3v2tag.h" -#include "infotag.h" -#include "tagunion.h" using namespace TagLib; -namespace -{ - enum { ID3v2Index = 0, InfoIndex = 1 }; -} - class RIFF::WAV::File::FilePrivate { public: FilePrivate() : properties(0), + tag(0), tagChunkID("ID3 ") { + } ~FilePrivate() { delete properties; + delete tag; } Properties *properties; - + ID3v2::Tag *tag; ByteVector tagChunkID; - - TagUnion tag; }; //////////////////////////////////////////////////////////////////////////////// @@ -88,29 +82,20 @@ ID3v2::Tag *RIFF::WAV::File::tag() const { - return ID3v2Tag(); -} - -ID3v2::Tag *RIFF::WAV::File::ID3v2Tag() const -{ - return d->tag.access(ID3v2Index, false); -} - -RIFF::Info::Tag *RIFF::WAV::File::InfoTag() const -{ - return d->tag.access(InfoIndex, false); + return d->tag; } PropertyMap RIFF::WAV::File::properties() const { - return d->tag.properties(); + return d->tag->properties(); } PropertyMap RIFF::WAV::File::setProperties(const PropertyMap &properties) { - return d->tag.setProperties(properties); + return d->tag->setProperties(properties); } + RIFF::WAV::Properties *RIFF::WAV::File::audioProperties() const { return d->properties; @@ -118,11 +103,6 @@ bool RIFF::WAV::File::save() { - return RIFF::WAV::File::save(AllTags); -} - -bool RIFF::WAV::File::save(TagTypes tags, bool stripOthers, int id3v2Version) -{ if(readOnly()) { debug("RIFF::WAV::File::save() -- File is read only."); return false; @@ -133,25 +113,7 @@ return false; } - if(stripOthers) - strip(static_cast(AllTags & ~tags)); - - ID3v2::Tag *id3v2tag = d->tag.access(ID3v2Index, false); - if(!id3v2tag->isEmpty()) { - if(tags & ID3v2) - setChunkData(d->tagChunkID, id3v2tag->render(id3v2Version)); - } - - Info::Tag *infotag = d->tag.access(InfoIndex, false); - if(!infotag->isEmpty()) { - if(tags & Info) { - int chunkId = findInfoTagChunk(); - if(chunkId != -1) - setChunkData(chunkId, infotag->render()); - else - setChunkData("LIST", infotag->render(), true); - } - } + setChunkData(d->tagChunkID, d->tag->render()); return true; } @@ -165,53 +127,19 @@ ByteVector formatData; uint streamLength = 0; for(uint i = 0; i < chunkCount(); i++) { - String name = chunkName(i); - if(name == "ID3 " || name == "id3 ") { + if(chunkName(i) == "ID3 " || chunkName(i) == "id3 ") { d->tagChunkID = chunkName(i); - d->tag.set(ID3v2Index, new ID3v2::Tag(this, chunkOffset(i))); + d->tag = new ID3v2::Tag(this, chunkOffset(i)); } - else if(name == "fmt " && readProperties) + else if(chunkName(i) == "fmt " && readProperties) formatData = chunkData(i); - else if(name == "data" && readProperties) + else if(chunkName(i) == "data" && readProperties) streamLength = chunkDataSize(i); - else if(name == "LIST") { - ByteVector data = chunkData(i); - ByteVector type = data.mid(0, 4); - - if(type == "INFO") - d->tag.set(InfoIndex, new RIFF::Info::Tag(data)); - } } - if (!d->tag[ID3v2Index]) - d->tag.set(ID3v2Index, new ID3v2::Tag); - - if (!d->tag[InfoIndex]) - d->tag.set(InfoIndex, new RIFF::Info::Tag); - if(!formatData.isEmpty()) d->properties = new Properties(formatData, streamLength, propertiesStyle); -} -void RIFF::WAV::File::strip(TagTypes tags) -{ - if(tags & ID3v2) - removeChunk(d->tagChunkID); - - if(tags & Info){ - TagLib::uint chunkId = findInfoTagChunk(); - if(chunkId != TagLib::uint(-1)) - removeChunk(chunkId); - } -} - -TagLib::uint RIFF::WAV::File::findInfoTagChunk() -{ - for(uint i = 0; i < chunkCount(); ++i) { - if(chunkName(i) == "LIST" && chunkData(i).mid(0, 4) == "INFO") { - return i; - } - } - - return TagLib::uint(-1); + if(!d->tag) + d->tag = new ID3v2::Tag; } diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/riff/wav/wavfile.h taglib-1.8/taglib/riff/wav/wavfile.h --- taglib-1.8.1~git20121128.3fa295g/taglib/riff/wav/wavfile.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/riff/wav/wavfile.h 2012-09-06 18:03:15.000000000 +0000 @@ -28,7 +28,6 @@ #include "rifffile.h" #include "id3v2tag.h" -#include "infotag.h" #include "wavproperties.h" namespace TagLib { @@ -58,17 +57,6 @@ class TAGLIB_EXPORT File : public TagLib::RIFF::File { public: - enum TagTypes { - //! Empty set. Matches no tag types. - NoTags = 0x0000, - //! Matches ID3v2 tags. - ID3v2 = 0x0001, - //! Matches Info tags. - Info = 0x0002, - //! Matches all tag types. - AllTags = 0xffff - }; - /*! * Contructs an WAV file from \a file. If \a readProperties is true the * file's audio properties will also be read using \a propertiesStyle. If @@ -94,22 +82,9 @@ virtual ~File(); /*! - * Returns the ID3v2 Tag for this file. - * - * \note This method does not return all the tags for this file for - * backward compatibility. Will be fixed in TagLib 2.0. - */ - ID3v2::Tag *tag() const; - - /*! - * Returns the ID3v2 Tag for this file. - */ - ID3v2::Tag *ID3v2Tag() const; - - /*! - * Returns the RIFF INFO Tag for this file. + * Returns the Tag for this file. */ - Info::Tag *InfoTag() const; + virtual ID3v2::Tag *tag() const; /*! * Implements the unified property interface -- export function. @@ -134,21 +109,12 @@ */ virtual bool save(); - bool save(TagTypes tags, bool stripOthers = true, int id3v2Version = 4); - private: File(const File &); File &operator=(const File &); void read(bool readProperties, Properties::ReadStyle propertiesStyle); - void strip(TagTypes tags); - - /*! - * Returns the index of the chunk that its name is "LIST" and list type is "INFO". - */ - uint findInfoTagChunk(); - class FilePrivate; FilePrivate *d; }; diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/s3m/s3mfile.cpp taglib-1.8/taglib/s3m/s3mfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/s3m/s3mfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/s3m/s3mfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -47,8 +47,7 @@ Mod::FileBase(file), d(new FilePrivate(propertiesStyle)) { - if(isOpen()) - read(readProperties); + read(readProperties); } S3M::File::File(IOStream *stream, bool readProperties, @@ -56,8 +55,7 @@ Mod::FileBase(stream), d(new FilePrivate(propertiesStyle)) { - if(isOpen()) - read(readProperties); + read(readProperties); } S3M::File::~File() diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/toolkit/taglib.h taglib-1.8/taglib/toolkit/taglib.h --- taglib-1.8.1~git20121128.3fa295g/taglib/toolkit/taglib.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/toolkit/taglib.h 2012-09-06 18:03:15.000000000 +0000 @@ -27,7 +27,7 @@ #define TAGLIB_H #define TAGLIB_MAJOR_VERSION 1 -#define TAGLIB_MINOR_VERSION 8 +#define TAGLIB_MINOR_VERSION 7 #define TAGLIB_PATCH_VERSION 0 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 1)) @@ -48,9 +48,7 @@ # include # define TAGLIB_ATOMIC_MAC #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) -# if !defined(NOMINMAX) -# define NOMINMAX -# endif +# define NOMINMAX # include # define TAGLIB_ATOMIC_WIN #elif defined (__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 401) \ @@ -145,7 +143,7 @@ * - A clean, high level, C++ API to handling audio meta data. * - Format specific APIs for advanced API users. * - ID3v1, ID3v2, APE, FLAC, Xiph, iTunes-style MP4 and WMA tag formats. - * - MP3, MPC, FLAC, MP4, ASF, AIFF, WAV, TrueAudio, WavPack, Ogg FLAC, Ogg Vorbis, Speex and Opus file formats. + * - MP3, MPC, FLAC, MP4, ASF, AIFF, WAV, TrueAudio, WavPack, Ogg FLAC, Ogg Vorbis and Speex file formats. * - Basic audio file properties such as length, sample rate, etc. * - Long term binary and source compatibility. * - Extensible design, notably the ability to add other formats or extend current formats as a library user. diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/toolkit/tfile.cpp taglib-1.8/taglib/toolkit/tfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/toolkit/tfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/toolkit/tfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -60,7 +60,6 @@ #include "mp4file.h" #include "wavpackfile.h" #include "speexfile.h" -#include "opusfile.h" #include "trueaudiofile.h" #include "aifffile.h" #include "wavfile.h" @@ -69,7 +68,6 @@ #include "s3mfile.h" #include "itfile.h" #include "xmfile.h" -#include "mp4file.h" using namespace TagLib; @@ -137,8 +135,6 @@ return dynamic_cast(this)->properties(); if(dynamic_cast(this)) return dynamic_cast(this)->properties(); - if(dynamic_cast(this)) - return dynamic_cast(this)->properties(); if(dynamic_cast(this)) return dynamic_cast(this)->properties(); if(dynamic_cast(this)) @@ -153,10 +149,12 @@ return dynamic_cast(this)->properties(); if(dynamic_cast(this)) return dynamic_cast(this)->properties(); - if(dynamic_cast(this)) - return dynamic_cast(this)->properties(); - if(dynamic_cast(this)) - return dynamic_cast(this)->properties(); + // no specialized implementation available -> use generic one + // - ASF: ugly format, largely undocumented, not worth implementing + // dict interface ... + // - MP4: taglib's MP4::Tag does not really support anything beyond + // the basic implementation, therefor we use just the default Tag + // interface return tag()->properties(); } @@ -176,8 +174,6 @@ dynamic_cast(this)->removeUnsupportedProperties(properties); else if(dynamic_cast(this)) dynamic_cast(this)->removeUnsupportedProperties(properties); - else if(dynamic_cast(this)) - dynamic_cast(this)->removeUnsupportedProperties(properties); else if(dynamic_cast(this)) dynamic_cast(this)->removeUnsupportedProperties(properties); else if(dynamic_cast(this)) @@ -192,10 +188,6 @@ dynamic_cast(this)->removeUnsupportedProperties(properties); else if(dynamic_cast(this)) dynamic_cast(this)->removeUnsupportedProperties(properties); - else if(dynamic_cast(this)) - dynamic_cast(this)->removeUnsupportedProperties(properties); - else if(dynamic_cast(this)) - dynamic_cast(this)->removeUnsupportedProperties(properties); else tag()->removeUnsupportedProperties(properties); } @@ -218,8 +210,6 @@ return dynamic_cast(this)->setProperties(properties); else if(dynamic_cast(this)) return dynamic_cast(this)->setProperties(properties); - else if(dynamic_cast(this)) - return dynamic_cast(this)->setProperties(properties); else if(dynamic_cast(this)) return dynamic_cast(this)->setProperties(properties); else if(dynamic_cast(this)) @@ -234,10 +224,6 @@ return dynamic_cast(this)->setProperties(properties); else if(dynamic_cast(this)) return dynamic_cast(this)->setProperties(properties); - else if(dynamic_cast(this)) - return dynamic_cast(this)->setProperties(properties); - else if(dynamic_cast(this)) - return dynamic_cast(this)->setProperties(properties); else return tag()->setProperties(properties); } diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/toolkit/tfilestream.cpp taglib-1.8/taglib/toolkit/tfilestream.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/toolkit/tfilestream.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/toolkit/tfilestream.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -35,69 +35,79 @@ # include # include # include +# define ftruncate _chsize #else # include #endif #include +#ifndef R_OK +# define R_OK 4 +#endif +#ifndef W_OK +# define W_OK 2 +#endif + using namespace TagLib; -namespace { #ifdef _WIN32 - // For Windows +typedef FileName FileNameHandle; - typedef FileName FileNameHandle; +#else - // Using native file handles instead of file descriptors for reducing the resource consumption. +struct FileNameHandle : public std::string +{ + FileNameHandle(FileName name) : std::string(name) {} + operator FileName () const { return c_str(); } +}; - const HANDLE InvalidFile = INVALID_HANDLE_VALUE; +#endif - HANDLE openFile(const FileName &path, bool readOnly) +namespace { + FILE *openFile(const FileName &path, bool readOnly) { - DWORD access = readOnly ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE); + // Calls a proper variation of fopen() depending on the compiling environment. - if(wcslen(path) > 0) - return CreateFileW(path, access, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - else - return CreateFileA(path, access, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); - } +#if defined(_WIN32) + +# if defined(_MSC_VER) && (_MSC_VER >= 1400) - size_t fread(void *ptr, size_t size, size_t nmemb, HANDLE stream) - { - DWORD readLen; - ReadFile(stream, ptr, size * nmemb, &readLen, NULL); + // Visual C++ 2005 or later. - return (readLen / size); - } + FILE *file; + errno_t err; - size_t fwrite(const void *ptr, size_t size, size_t nmemb, HANDLE stream) - { - DWORD writtenLen; - WriteFile(stream, ptr, size * nmemb, &writtenLen, NULL); + if(wcslen(path) > 0) + err = _wfopen_s(&file, path, readOnly ? L"rb" : L"rb+"); + else + err = fopen_s(&file, path, readOnly ? "rb" : "rb+"); + + if(err == 0) + return file; + else + return NULL; + +# else // defined(_MSC_VER) && (_MSC_VER >= 1400) - return writtenLen; - } + // Visual C++.NET 2003 or earlier. -#else + if(wcslen(path) > 0) + return _wfopen(path, readOnly ? L"rb" : L"rb+"); + else + return fopen(path, readOnly ? "rb" : "rb+"); - // For non-Windows +# endif // defined(_MSC_VER) && (_MSC_VER >= 1400) - FILE *const InvalidFile = 0; +#else // defined(_WIN32) - struct FileNameHandle : public std::string - { - FileNameHandle(FileName name) : std::string(name) {} - operator FileName () const { return c_str(); } - }; + // Non-Win32 - FILE *openFile(const FileName &path, bool readOnly) - { return fopen(path, readOnly ? "rb" : "rb+"); - } -#endif +#endif // defined(_WIN32) + } } class FileStream::FileStreamPrivate @@ -105,16 +115,8 @@ public: FileStreamPrivate(FileName fileName, bool openReadOnly); -#ifdef _WIN32 - - HANDLE file; - -#else - FILE *file; -#endif - FileNameHandle name; bool readOnly; @@ -123,7 +125,7 @@ }; FileStream::FileStreamPrivate::FileStreamPrivate(FileName fileName, bool openReadOnly) : - file(InvalidFile), + file(0), name(fileName), readOnly(true), size(0) @@ -133,12 +135,12 @@ if(!openReadOnly) file = openFile(name, false); - if(file != InvalidFile) + if(file) readOnly = false; else file = openFile(name, true); - if(file == InvalidFile) { + if(!file) { debug("Could not open file " + String((const char *) name)); } } @@ -154,18 +156,8 @@ FileStream::~FileStream() { -#ifdef _WIN32 - - if(d->file) - CloseHandle(d->file); - -#else - if(d->file) fclose(d->file); - -#endif - delete d; } @@ -356,67 +348,27 @@ return; } -#ifdef _WIN32 - - DWORD whence; - switch(p) { - case Beginning: - whence = FILE_BEGIN; - break; - case Current: - whence = FILE_CURRENT; - break; - case End: - whence = FILE_END; - break; - } - - SetFilePointer(d->file, offset, NULL, whence); - -#else - - int whence; switch(p) { case Beginning: - whence = SEEK_SET; + fseek(d->file, offset, SEEK_SET); break; case Current: - whence = SEEK_CUR; + fseek(d->file, offset, SEEK_CUR); break; case End: - whence = SEEK_END; + fseek(d->file, offset, SEEK_END); break; } - - fseek(d->file, offset, whence); - -#endif } void FileStream::clear() { -#ifdef _WIN32 - - // NOP - -#else - clearerr(d->file); - -#endif } long FileStream::tell() const { -#ifdef _WIN32 - - return (long)SetFilePointer(d->file, 0, NULL, FILE_CURRENT); - -#else - return ftell(d->file); - -#endif } long FileStream::length() @@ -446,20 +398,17 @@ void FileStream::truncate(long length) { -#ifdef _WIN32 - long currentPos = tell(); +#if defined(_MSC_VER) && (_MSC_VER >= 1400) // VC++2005 or later - seek(length); - SetEndOfFile(d->file); - - seek(currentPos); + ftruncate(_fileno(d->file), length); #else ftruncate(fileno(d->file), length); #endif + } TagLib::uint FileStream::bufferSize() diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/toolkit/tpropertymap.h taglib-1.8/taglib/toolkit/tpropertymap.h --- taglib-1.8.1~git20121128.3fa295g/taglib/toolkit/tpropertymap.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/toolkit/tpropertymap.h 2012-09-06 18:03:15.000000000 +0000 @@ -40,65 +40,6 @@ * Note that most metadata formats pose additional conditions on the tag keys. The * most popular ones (Vorbis, APE, ID3v2) should support all ASCII only words of * length between 2 and 16. - * - * This class can contain any tags, but here is a list of "well-known" tags that - * you might want to use: - * - * Basic tags: - * - * - TITLE - * - ALBUM - * - ARTIST - * - ALBUMARTIST - * - SUBTITLE - * - TRACKNUMBER - * - DISCNUMBER - * - DATE - * - ORIGINALDATE - * - GENRE - * - COMMENT - * - * Sort names: - * - * - TITLESORT - * - ALBUMSORT - * - ARTISTSORT - * - ALBUMARTISTSORT - * - * Credits: - * - * - COMPOSER - * - LYRICIST - * - CONDUCTOR - * - REMIXER - * - PERFORMER: - * - * Other tags: - * - * - ISRC - * - ASIN - * - BPM - * - COPYRIGHT - * - ENCODEDBY - * - MOOD - * - COMMENT - * - MEDIA - * - LABEL - * - CATALOGNUMBER - * - BARCODE - * - * MusicBrainz identifiers: - * - * - MUSICBRAINZ_TRACKID - * - MUSICBRAINZ_ALBUMID - * - MUSICBRAINZ_RELEASEGROUPID - * - MUSICBRAINZ_WORKID - * - MUSICBRAINZ_ARTISTID - * - MUSICBRAINZ_ALBUMARTISTID - * - ACOUSTID_ID - * - ACOUSTID_FINGERPRINT - * - MUSICIP_PUID - * */ class TAGLIB_EXPORT PropertyMap: public SimplePropertyMap diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/wavpack/wavpackfile.cpp taglib-1.8/taglib/wavpack/wavpackfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/wavpack/wavpackfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/wavpack/wavpackfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -86,16 +86,14 @@ Properties::ReadStyle propertiesStyle) : TagLib::File(file) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } WavPack::File::File(IOStream *stream, bool readProperties, Properties::ReadStyle propertiesStyle) : TagLib::File(stream) { d = new FilePrivate; - if(isOpen()) - read(readProperties, propertiesStyle); + read(readProperties, propertiesStyle); } WavPack::File::~File() diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib/xm/xmfile.cpp taglib-1.8/taglib/xm/xmfile.cpp --- taglib-1.8.1~git20121128.3fa295g/taglib/xm/xmfile.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib/xm/xmfile.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -359,8 +359,7 @@ Mod::FileBase(file), d(new FilePrivate(propertiesStyle)) { - if(isOpen()) - read(readProperties); + read(readProperties); } XM::File::File(IOStream *stream, bool readProperties, @@ -368,8 +367,7 @@ Mod::FileBase(stream), d(new FilePrivate(propertiesStyle)) { - if(isOpen()) - read(readProperties); + read(readProperties); } XM::File::~File() @@ -445,7 +443,7 @@ return false; uint len = std::min(22UL, instrumentHeaderSize - 4U); - if(i >= lines.size()) + if(i > lines.size()) writeString(String::null, len); else writeString(lines[i], len); diff -Nru taglib-1.8.1~git20121128.3fa295g/taglib-config.cmd.cmake taglib-1.8/taglib-config.cmd.cmake --- taglib-1.8.1~git20121128.3fa295g/taglib-config.cmd.cmake 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/taglib-config.cmd.cmake 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -@echo off -goto beginning - * - * It is what it is, you can do with it as you please. - * - * Just don't blame me if it teaches your computer to smoke! - * - * -Enjoy - * fh :)_~ - * -:beginning -if /i "%1#" == "--libs#" goto doit -if /i "%1#" == "--cflags#" goto doit -if /i "%1#" == "--version#" goto doit -if /i "%1#" == "--prefix#" goto doit - -echo "usage: %0 [OPTIONS]" -echo [--libs] -echo [--cflags] -echo [--version] -echo [--prefix] -goto theend - - * - * NOTE: Windows does not assume libraries are prefixed with 'lib'. - * NOTE: If '-llibtag' is the last element, it is easily appended in the users installation/makefile process - * to allow for static, shared or debug builds. - * It would be preferable if the top level CMakeLists.txt provided the library name during config. ?? -:doit -if /i "%1#" == "--libs#" echo -L${LIB_INSTALL_DIR} -llibtag -if /i "%1#" == "--cflags#" echo -I${INCLUDE_INSTALL_DIR}/taglib -if /i "%1#" == "--version#" echo ${TAGLIB_LIB_MAJOR_VERSION}.${TAGLIB_LIB_MINOR_VERSION}.${TAGLIB_LIB_PATCH_VERSION} -if /i "%1#" == "--prefix#" echo ${CMAKE_INSTALL_PREFIX} - -:theend - diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/CMakeLists.txt taglib-1.8/tests/CMakeLists.txt --- taglib-1.8.1~git20121128.3fa295g/tests/CMakeLists.txt 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/CMakeLists.txt 2012-09-06 18:03:15.000000000 +0000 @@ -16,8 +16,6 @@ ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg/vorbis ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg/flac - ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg/speex - ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/ogg/opus ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/flac ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/wavpack ${CMAKE_CURRENT_SOURCE_DIR}/../taglib/mod @@ -62,11 +60,8 @@ test_it.cpp test_xm.cpp test_mpc.cpp - test_opus.cpp ) -INCLUDE_DIRECTORIES(${CPPUNIT_INCLUDE_DIR}) - ADD_EXECUTABLE(test_runner ${test_runner_SRCS}) TARGET_LINK_LIBRARIES(test_runner tag ${CPPUNIT_LIBRARIES}) Binary files /tmp/tHlXtvpSWd/taglib-1.8.1~git20121128.3fa295g/tests/data/correctness_gain_silent_output.opus and /tmp/9zxSplICCG/taglib-1.8/tests/data/correctness_gain_silent_output.opus differ diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_apetag.cpp taglib-1.8/tests/test_apetag.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_apetag.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_apetag.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,3 +1,4 @@ +#include #include #include #include @@ -6,7 +7,6 @@ #include #include #include -#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_asf.cpp taglib-1.8/tests/test_asf.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_asf.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_asf.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,11 +1,10 @@ +#include #include #include #include #include #include -#include #include -#include #include "utils.h" using namespace std; @@ -14,7 +13,7 @@ class TestASF : public CppUnit::TestFixture { CPPUNIT_TEST_SUITE(TestASF); - CPPUNIT_TEST(testAudioProperties); + CPPUNIT_TEST(testProperties); CPPUNIT_TEST(testRead); CPPUNIT_TEST(testSaveMultipleValues); CPPUNIT_TEST(testSaveStream); @@ -23,12 +22,11 @@ CPPUNIT_TEST(testSaveLargeValue); CPPUNIT_TEST(testSavePicture); CPPUNIT_TEST(testSaveMultiplePictures); - CPPUNIT_TEST(testProperties); CPPUNIT_TEST_SUITE_END(); public: - void testAudioProperties() + void testProperties() { ASF::File f(TEST_FILE_PATH_C("silence-1.wma")); CPPUNIT_ASSERT_EQUAL(4, f.audioProperties()->length()); @@ -217,39 +215,6 @@ delete f; } - void testProperties() - { - ASF::File f(TEST_FILE_PATH_C("silence-1.wma")); - - PropertyMap tags = f.properties(); - - tags["TRACKNUMBER"] = StringList("2"); - tags["DISCNUMBER"] = StringList("3"); - tags["BPM"] = StringList("123"); - tags["ARTIST"] = StringList("Foo Bar"); - f.setProperties(tags); - - tags = f.properties(); - - CPPUNIT_ASSERT_EQUAL(String("Foo Bar"), f.tag()->artist()); - CPPUNIT_ASSERT_EQUAL(StringList("Foo Bar"), tags["ARTIST"]); - - CPPUNIT_ASSERT(f.tag()->attributeListMap().contains("WM/BeatsPerMinute")); - CPPUNIT_ASSERT_EQUAL(1u, f.tag()->attributeListMap()["WM/BeatsPerMinute"].size()); - CPPUNIT_ASSERT_EQUAL(String("123"), f.tag()->attributeListMap()["WM/BeatsPerMinute"].front().toString()); - CPPUNIT_ASSERT_EQUAL(StringList("123"), tags["BPM"]); - - CPPUNIT_ASSERT(f.tag()->attributeListMap().contains("WM/TrackNumber")); - CPPUNIT_ASSERT_EQUAL(1u, f.tag()->attributeListMap()["WM/TrackNumber"].size()); - CPPUNIT_ASSERT_EQUAL(String("2"), f.tag()->attributeListMap()["WM/TrackNumber"].front().toString()); - CPPUNIT_ASSERT_EQUAL(StringList("2"), tags["TRACKNUMBER"]); - - CPPUNIT_ASSERT(f.tag()->attributeListMap().contains("WM/PartOfSet")); - CPPUNIT_ASSERT_EQUAL(1u, f.tag()->attributeListMap()["WM/PartOfSet"].size()); - CPPUNIT_ASSERT_EQUAL(String("3"), f.tag()->attributeListMap()["WM/PartOfSet"].front().toString()); - CPPUNIT_ASSERT_EQUAL(StringList("3"), tags["DISCNUMBER"]); - } - }; CPPUNIT_TEST_SUITE_REGISTRATION(TestASF); diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_bytevector.cpp taglib-1.8/tests/test_bytevector.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_bytevector.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_bytevector.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -22,9 +22,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include -#include using namespace std; using namespace TagLib; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_bytevectorlist.cpp taglib-1.8/tests/test_bytevectorlist.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_bytevectorlist.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_bytevectorlist.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,6 +1,6 @@ +#include #include #include -#include using namespace std; using namespace TagLib; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_bytevectorstream.cpp taglib-1.8/tests/test_bytevectorstream.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_bytevectorstream.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_bytevectorstream.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,5 +1,5 @@ -#include #include +#include using namespace std; using namespace TagLib; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_fileref.cpp taglib-1.8/tests/test_fileref.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_fileref.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_fileref.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,10 +1,10 @@ +#include #include #include #include #include #include #include -#include #include "utils.h" #ifdef HAVE_CONFIG_H #include "config.h" @@ -29,7 +29,6 @@ CPPUNIT_TEST(testMP4_3); CPPUNIT_TEST(testTrueAudio); CPPUNIT_TEST(testAPE); - CPPUNIT_TEST(testWav); CPPUNIT_TEST_SUITE_END(); public: @@ -128,11 +127,6 @@ fileRefSave("no-tags", ".3g2"); } - void testWav() - { - fileRefSave("empty", ".wav"); - } - void testOGA_FLAC() { FileRef *f = new FileRef(TEST_FILE_PATH_C("empty_flac.oga")); @@ -149,7 +143,7 @@ void testAPE() { - fileRefSave("mac-399", ".ape"); + fileRefSave("mac-399.ape", ".ape"); } }; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_flac.cpp taglib-1.8/tests/test_flac.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_flac.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_flac.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,3 +1,4 @@ +#include #include #include #include @@ -6,7 +7,6 @@ #include #include #include -#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_flacpicture.cpp taglib-1.8/tests/test_flacpicture.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_flacpicture.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_flacpicture.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,3 +1,4 @@ +#include #include #include #include @@ -5,7 +6,6 @@ #include #include #include -#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_flacunknownmetadatablock.cpp taglib-1.8/tests/test_flacunknownmetadatablock.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_flacunknownmetadatablock.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_flacunknownmetadatablock.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,10 +1,10 @@ +#include #include #include #include #include #include #include -#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_id3v1.cpp taglib-1.8/tests/test_id3v1.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_id3v1.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_id3v1.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,7 +1,7 @@ +#include #include #include #include -#include using namespace std; using namespace TagLib; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_id3v2.cpp taglib-1.8/tests/test_id3v2.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_id3v2.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_id3v2.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,3 +1,4 @@ +#include #include #include // so evil :( @@ -17,7 +18,6 @@ #include #include #include -#include #include "utils.h" using namespace std; @@ -624,7 +624,7 @@ CPPUNIT_ASSERT_EQUAL(String("A COMMENT"), dict["COMMENT"].front()); CPPUNIT_ASSERT_EQUAL(1u, dict.unsupportedData().size()); - CPPUNIT_ASSERT_EQUAL(String("UFID/supermihi@web.de"), dict.unsupportedData().front()); + CPPUNIT_ASSERT_EQUAL(String("UFID"), dict.unsupportedData().front()); } void testPropertyInterface2() @@ -657,23 +657,11 @@ frame5->setText(tmclData); tag.addFrame(frame5); - ID3v2::UniqueFileIdentifierFrame *frame6 = new ID3v2::UniqueFileIdentifierFrame("http://musicbrainz.org", "152454b9-19ba-49f3-9fc9-8fc26545cf41"); - tag.addFrame(frame6); - - ID3v2::UniqueFileIdentifierFrame *frame7 = new ID3v2::UniqueFileIdentifierFrame("http://example.com", "123"); - tag.addFrame(frame7); - - ID3v2::UserTextIdentificationFrame *frame8 = new ID3v2::UserTextIdentificationFrame(); - frame8->setDescription("MusicBrainz Album Id"); - frame8->setText("95c454a5-d7e0-4d8f-9900-db04aca98ab3"); - tag.addFrame(frame8); - PropertyMap properties = tag.properties(); - CPPUNIT_ASSERT_EQUAL(3u, properties.unsupportedData().size()); + CPPUNIT_ASSERT_EQUAL(2u, properties.unsupportedData().size()); CPPUNIT_ASSERT(properties.unsupportedData().contains("TIPL")); CPPUNIT_ASSERT(properties.unsupportedData().contains("APIC")); - CPPUNIT_ASSERT(properties.unsupportedData().contains("UFID/http://example.com")); CPPUNIT_ASSERT(properties.contains("PERFORMER:VIOLIN")); CPPUNIT_ASSERT(properties.contains("PERFORMER:PIANO")); @@ -683,17 +671,9 @@ CPPUNIT_ASSERT(properties.contains("LYRICS")); CPPUNIT_ASSERT(properties.contains("LYRICS:TEST")); - CPPUNIT_ASSERT(properties.contains("MUSICBRAINZ_TRACKID")); - CPPUNIT_ASSERT_EQUAL(String("152454b9-19ba-49f3-9fc9-8fc26545cf41"), properties["MUSICBRAINZ_TRACKID"].front()); - - CPPUNIT_ASSERT(properties.contains("MUSICBRAINZ_ALBUMID")); - CPPUNIT_ASSERT_EQUAL(String("95c454a5-d7e0-4d8f-9900-db04aca98ab3"), properties["MUSICBRAINZ_ALBUMID"].front()); - tag.removeUnsupportedProperties(properties.unsupportedData()); CPPUNIT_ASSERT(tag.frameList("APIC").isEmpty()); CPPUNIT_ASSERT(tag.frameList("TIPL").isEmpty()); - CPPUNIT_ASSERT_EQUAL((ID3v2::UniqueFileIdentifierFrame *)0, ID3v2::UniqueFileIdentifierFrame::findByOwner(&tag, "http://example.com")); - CPPUNIT_ASSERT_EQUAL(frame6, ID3v2::UniqueFileIdentifierFrame::findByOwner(&tag, "http://musicbrainz.org")); } void testDeleteFrame() diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_info.cpp taglib-1.8/tests/test_info.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_info.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_info.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "utils.h" - -using namespace std; -using namespace TagLib; - -class TestInfoTag : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(TestInfoTag); - CPPUNIT_TEST(testTitle); - CPPUNIT_TEST(testNumericFields); - CPPUNIT_TEST_SUITE_END(); - -public: - void testTitle() - { - RIFF::Info::Tag tag; - - CPPUNIT_ASSERT_EQUAL(String(""), tag.title()); - tag.setTitle("Test title 1"); - CPPUNIT_ASSERT_EQUAL(String("Test title 1"), tag.title()); - } - - void testNumericFields() - { - RIFF::Info::Tag tag; - - CPPUNIT_ASSERT_EQUAL((uint)0, tag.track()); - tag.setTrack(1234); - CPPUNIT_ASSERT_EQUAL((uint)1234, tag.track()); - CPPUNIT_ASSERT_EQUAL(String("1234"), tag.fieldText("IPRT")); - - CPPUNIT_ASSERT_EQUAL((uint)0, tag.year()); - tag.setYear(1234); - CPPUNIT_ASSERT_EQUAL((uint)1234, tag.year()); - CPPUNIT_ASSERT_EQUAL(String("1234"), tag.fieldText("ICRD")); - } -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(TestInfoTag); diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_it.cpp taglib-1.8/tests/test_it.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_it.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_it.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -19,9 +19,9 @@ * MA 02110-1301 USA * ***************************************************************************/ +#include #include #include -#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_mod.cpp taglib-1.8/tests/test_mod.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_mod.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_mod.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -19,9 +19,9 @@ * MA 02110-1301 USA * ***************************************************************************/ +#include #include #include -#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_mp4.cpp taglib-1.8/tests/test_mp4.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_mp4.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_mp4.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,12 +1,11 @@ +#include #include #include #include #include #include -#include #include #include -#include #include "utils.h" using namespace std; @@ -26,7 +25,6 @@ CPPUNIT_TEST(testCovrRead); CPPUNIT_TEST(testCovrWrite); CPPUNIT_TEST(testCovrRead2); - CPPUNIT_TEST(testProperties); CPPUNIT_TEST_SUITE_END(); public: @@ -226,55 +224,6 @@ delete f; } - void testProperties() - { - MP4::File f(TEST_FILE_PATH_C("has-tags.m4a")); - - PropertyMap tags = f.properties(); - - CPPUNIT_ASSERT_EQUAL(StringList("Test Artist"), tags["ARTIST"]); - - tags["TRACKNUMBER"] = StringList("2/4"); - tags["DISCNUMBER"] = StringList("3/5"); - tags["BPM"] = StringList("123"); - tags["ARTIST"] = StringList("Foo Bar"); - tags["COMPILATION"] = StringList("1"); - f.setProperties(tags); - - tags = f.properties(); - - CPPUNIT_ASSERT(f.tag()->itemListMap().contains("trkn")); - CPPUNIT_ASSERT_EQUAL(2, f.tag()->itemListMap()["trkn"].toIntPair().first); - CPPUNIT_ASSERT_EQUAL(4, f.tag()->itemListMap()["trkn"].toIntPair().second); - CPPUNIT_ASSERT_EQUAL(StringList("2/4"), tags["TRACKNUMBER"]); - - CPPUNIT_ASSERT(f.tag()->itemListMap().contains("disk")); - CPPUNIT_ASSERT_EQUAL(3, f.tag()->itemListMap()["disk"].toIntPair().first); - CPPUNIT_ASSERT_EQUAL(5, f.tag()->itemListMap()["disk"].toIntPair().second); - CPPUNIT_ASSERT_EQUAL(StringList("3/5"), tags["DISCNUMBER"]); - - CPPUNIT_ASSERT(f.tag()->itemListMap().contains("tmpo")); - CPPUNIT_ASSERT_EQUAL(123, f.tag()->itemListMap()["tmpo"].toInt()); - CPPUNIT_ASSERT_EQUAL(StringList("123"), tags["BPM"]); - - CPPUNIT_ASSERT(f.tag()->itemListMap().contains("\251ART")); - CPPUNIT_ASSERT_EQUAL(StringList("Foo Bar"), f.tag()->itemListMap()["\251ART"].toStringList()); - CPPUNIT_ASSERT_EQUAL(StringList("Foo Bar"), tags["ARTIST"]); - - CPPUNIT_ASSERT(f.tag()->itemListMap().contains("cpil")); - CPPUNIT_ASSERT_EQUAL(true, f.tag()->itemListMap()["cpil"].toBool()); - CPPUNIT_ASSERT_EQUAL(StringList("1"), tags["COMPILATION"]); - - tags["COMPILATION"] = StringList("0"); - f.setProperties(tags); - - tags = f.properties(); - - CPPUNIT_ASSERT(f.tag()->itemListMap().contains("cpil")); - CPPUNIT_ASSERT_EQUAL(false, f.tag()->itemListMap()["cpil"].toBool()); - CPPUNIT_ASSERT_EQUAL(StringList("0"), tags["COMPILATION"]); - } - }; CPPUNIT_TEST_SUITE_REGISTRATION(TestMP4); diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_mp4coverart.cpp taglib-1.8/tests/test_mp4coverart.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_mp4coverart.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_mp4coverart.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,8 +1,8 @@ +#include #include #include #include #include -#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_mp4item.cpp taglib-1.8/tests/test_mp4item.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_mp4item.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_mp4item.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,9 +1,9 @@ +#include #include #include #include #include #include -#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_mpeg.cpp taglib-1.8/tests/test_mpeg.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_mpeg.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_mpeg.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,9 +1,8 @@ +#include #include #include -#include #include #include -#include #include "utils.h" using namespace std; @@ -33,12 +32,9 @@ String xxx = ByteVector(254, 'X'); MPEG::File f(newname.c_str()); - CPPUNIT_ASSERT_EQUAL(false, f.hasID3v2Tag()); - f.tag()->setTitle(xxx); f.tag()->setArtist("Artist A"); f.save(MPEG::File::AllTags, true, 4); - CPPUNIT_ASSERT_EQUAL(true, f.hasID3v2Tag()); MPEG::File f2(newname.c_str()); CPPUNIT_ASSERT_EQUAL(TagLib::uint(4), f2.ID3v2Tag()->header()->majorVersion()); @@ -70,12 +66,9 @@ String xxx = ByteVector(254, 'X'); MPEG::File f(newname.c_str()); - CPPUNIT_ASSERT_EQUAL(false, f.hasID3v2Tag()); - f.tag()->setTitle(xxx); f.tag()->setArtist("Artist A"); f.save(MPEG::File::AllTags, true, 3); - CPPUNIT_ASSERT_EQUAL(true, f.hasID3v2Tag()); MPEG::File f2(newname.c_str()); CPPUNIT_ASSERT_EQUAL(TagLib::uint(3), f2.ID3v2Tag()->header()->majorVersion()); diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_ogg.cpp taglib-1.8/tests/test_ogg.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_ogg.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_ogg.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,3 +1,4 @@ +#include #include #include #include @@ -7,7 +8,6 @@ #include #include #include -#include #include "utils.h" using namespace std; @@ -88,12 +88,12 @@ CPPUNIT_ASSERT_EQUAL(TagLib::uint(2), tags["UNUSUALTAG"].size()); CPPUNIT_ASSERT_EQUAL(String("usual value"), tags["UNUSUALTAG"][0]); CPPUNIT_ASSERT_EQUAL(String("another value"), tags["UNUSUALTAG"][1]); - CPPUNIT_ASSERT_EQUAL(String("öäüoΣø", String::UTF8), tags["UNICODETAG"][0]); + CPPUNIT_ASSERT_EQUAL(String(L"öäüoΣø"), tags["UNICODETAG"][0]); - tags["UNICODETAG"][0] = String("νεω ναλυε", String::UTF8); + tags["UNICODETAG"][0] = L"νεω ναλυε"; tags.erase("UNUSUALTAG"); f->tag()->setProperties(tags); - CPPUNIT_ASSERT_EQUAL(String("νεω ναλυε", String::UTF8), f->tag()->properties()["UNICODETAG"][0]); + CPPUNIT_ASSERT_EQUAL(String(L"νεω ναλυε"), f->tag()->properties()["UNICODETAG"][0]); CPPUNIT_ASSERT_EQUAL(false, f->tag()->properties().contains("UNUSUALTAG")); delete f; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_oggflac.cpp taglib-1.8/tests/test_oggflac.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_oggflac.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_oggflac.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,3 +1,4 @@ +#include #include #include #include @@ -5,7 +6,6 @@ #include #include #include -#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_opus.cpp taglib-1.8/tests/test_opus.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_opus.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_opus.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "utils.h" - -using namespace std; -using namespace TagLib; - -class TestOpus : public CppUnit::TestFixture -{ - CPPUNIT_TEST_SUITE(TestOpus); - CPPUNIT_TEST(testProperties); - CPPUNIT_TEST(testReadComments); - CPPUNIT_TEST(testWriteComments); - CPPUNIT_TEST_SUITE_END(); - -public: - - void testProperties() - { - Ogg::Opus::File f(TEST_FILE_PATH_C("correctness_gain_silent_output.opus")); - CPPUNIT_ASSERT_EQUAL(7, f.audioProperties()->length()); - CPPUNIT_ASSERT_EQUAL(0, f.audioProperties()->bitrate()); - CPPUNIT_ASSERT_EQUAL(1, f.audioProperties()->channels()); - CPPUNIT_ASSERT_EQUAL(48000, f.audioProperties()->sampleRate()); - CPPUNIT_ASSERT_EQUAL(48000, ((Ogg::Opus::Properties *)f.audioProperties())->inputSampleRate()); - } - - void testReadComments() - { - Ogg::Opus::File f(TEST_FILE_PATH_C("correctness_gain_silent_output.opus")); - CPPUNIT_ASSERT_EQUAL(StringList("Xiph.Org Opus testvectormaker"), f.tag()->fieldListMap()["ENCODER"]); - CPPUNIT_ASSERT(f.tag()->fieldListMap().contains("TESTDESCRIPTION")); - CPPUNIT_ASSERT(!f.tag()->fieldListMap().contains("ARTIST")); - CPPUNIT_ASSERT_EQUAL(String("libopus 0.9.11-66-g64c2dd7"), f.tag()->vendorID()); - } - - void testWriteComments() - { - ScopedFileCopy copy("correctness_gain_silent_output", ".opus"); - string filename = copy.fileName(); - - Ogg::Opus::File *f = new Ogg::Opus::File(filename.c_str()); - f->tag()->setArtist("Your Tester"); - f->save(); - delete f; - - f = new Ogg::Opus::File(filename.c_str()); - CPPUNIT_ASSERT_EQUAL(StringList("Xiph.Org Opus testvectormaker"), f->tag()->fieldListMap()["ENCODER"]); - CPPUNIT_ASSERT(f->tag()->fieldListMap().contains("TESTDESCRIPTION")); - CPPUNIT_ASSERT_EQUAL(StringList("Your Tester"), f->tag()->fieldListMap()["ARTIST"]); - CPPUNIT_ASSERT_EQUAL(String("libopus 0.9.11-66-g64c2dd7"), f->tag()->vendorID()); - delete f; - } - -}; - -CPPUNIT_TEST_SUITE_REGISTRATION(TestOpus); diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_riff.cpp taglib-1.8/tests/test_riff.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_riff.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_riff.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,9 +1,9 @@ +#include #include #include #include #include #include -#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_s3m.cpp taglib-1.8/tests/test_s3m.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_s3m.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_s3m.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -19,8 +19,8 @@ * MA 02110-1301 USA * ***************************************************************************/ -#include #include +#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_string.cpp taglib-1.8/tests/test_string.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_string.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_string.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -22,9 +22,9 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#include #include #include -#include using namespace std; using namespace TagLib; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_synchdata.cpp taglib-1.8/tests/test_synchdata.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_synchdata.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_synchdata.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -22,8 +22,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include #include +#include using namespace std; using namespace TagLib; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_xiphcomment.cpp taglib-1.8/tests/test_xiphcomment.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_xiphcomment.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_xiphcomment.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -1,9 +1,9 @@ +#include #include #include #include #include #include -#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/test_xm.cpp taglib-1.8/tests/test_xm.cpp --- taglib-1.8.1~git20121128.3fa295g/tests/test_xm.cpp 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/test_xm.cpp 2012-09-06 18:03:15.000000000 +0000 @@ -19,8 +19,8 @@ * MA 02110-1301 USA * ***************************************************************************/ -#include #include +#include #include "utils.h" using namespace std; diff -Nru taglib-1.8.1~git20121128.3fa295g/tests/utils.h taglib-1.8/tests/utils.h --- taglib-1.8.1~git20121128.3fa295g/tests/utils.h 2012-12-20 12:01:27.000000000 +0000 +++ taglib-1.8/tests/utils.h 2012-09-06 18:03:15.000000000 +0000 @@ -7,7 +7,6 @@ #include #include #include -#include #endif #include #include