mirror of
https://github.com/taglib/taglib.git
synced 2025-05-27 21:20:26 -04:00
Merge branch 'master' into merge-master-to-taglib2
# Conflicts: # AUTHORS # ConfigureChecks.cmake # taglib/asf/asfutils.h # taglib/mp4/mp4atom.cpp # taglib/mp4/mp4tag.h # taglib/mpeg/id3v2/frames/ownershipframe.cpp # taglib/mpeg/id3v2/frames/synchronizedlyricsframe.cpp # taglib/mpeg/id3v2/frames/tableofcontentsframe.cpp # taglib/mpeg/id3v2/id3v2frame.cpp # taglib/riff/rifffile.cpp # taglib/riff/rifffile.h # taglib/toolkit/taglib.h # taglib/toolkit/tbytevector.cpp # taglib/toolkit/tfilestream.cpp # taglib/toolkit/tstring.cpp # taglib/toolkit/tutils.h # taglib/xm/xmfile.cpp # tests/test_bytevector.cpp # tests/test_fileref.cpp # tests/test_id3v2.cpp # tests/test_riff.cpp # tests/test_string.cpp
This commit is contained in:
commit
d9df59306f
@ -8,12 +8,12 @@ root = true
|
||||
insert_final_newline = true
|
||||
|
||||
# 2 space indentation
|
||||
[*.{h,cpp,tcc,cmake}]
|
||||
[*.{h,cpp,tcc,cmake,yml}]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
|
||||
# Trim traling whitespaces
|
||||
[*.{h,cpp,tcc,cmake}]
|
||||
[*.{h,cpp,tcc,cmake,yml}]
|
||||
trim_trailing_whitespace = true
|
||||
|
||||
# UTF-8 without BOM
|
||||
|
18
.travis.yml
18
.travis.yml
@ -1,12 +1,28 @@
|
||||
language: cpp
|
||||
|
||||
sudo: false
|
||||
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- libcppunit-dev
|
||||
- libcppunit-dev
|
||||
- zlib1g-dev
|
||||
|
||||
matrix:
|
||||
exclude:
|
||||
- os: osx
|
||||
compiler: gcc
|
||||
|
||||
install:
|
||||
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install cppunit; fi
|
||||
|
||||
script: cmake -DBUILD_TESTS=ON -DBUILD_EXAMPLES=ON -DBUILD_BINDINGS=ON . && make && make check
|
||||
|
||||
|
4
AUTHORS
4
AUTHORS
@ -2,6 +2,8 @@ Scott Wheeler <wheeler@kde.org>
|
||||
Author, maintainer
|
||||
Lukas Lalinsky <lalinsky@gmail.com>
|
||||
Implementation of multiple new file formats, many bug fixes, maintainer
|
||||
Tsuda Kageyu <tsuda.kageyu@gmail.com>
|
||||
A lot of bug fixes and performance improvements, maintainer.
|
||||
Ismael Orenstein <orenstein@kde.org>
|
||||
Xing header implementation
|
||||
Allan Sandfeld Jensen <kde@carewolf.org>
|
||||
@ -10,8 +12,6 @@ Teemu Tervo <teemu.tervo@gmx.net>
|
||||
Numerous bug reports and fixes
|
||||
Mathias Panzenböck <grosser.meister.morti@gmx.net>
|
||||
Mod, S3M, IT and XM metadata implementations
|
||||
Tsuda Kageyu <tsuda.kageyu@gmail.com>
|
||||
A lot of fixes and improvements, i.e. memory copy reduction, large files support, etc.
|
||||
|
||||
Please send all patches and questions to taglib-devel@kde.org rather than to
|
||||
individual developers!
|
||||
|
@ -1,7 +1,7 @@
|
||||
project(taglib)
|
||||
|
||||
cmake_minimum_required(VERSION 2.8.0 FATAL_ERROR)
|
||||
|
||||
project(taglib)
|
||||
|
||||
if(NOT ${CMAKE_VERSION} VERSION_LESS 2.8.12)
|
||||
cmake_policy(SET CMP0022 OLD)
|
||||
endif()
|
||||
@ -12,6 +12,7 @@ if(DEFINED ENABLE_STATIC)
|
||||
message(FATAL_ERROR "This option is no longer available, use BUILD_SHARED_LIBS instead")
|
||||
endif()
|
||||
|
||||
option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
add_definitions(-DTAGLIB_STATIC)
|
||||
endif()
|
||||
@ -89,9 +90,9 @@ endif()
|
||||
# 2. If any interfaces have been added, removed, or changed since the last update, increment current, and set revision to 0.
|
||||
# 3. If any interfaces have been added since the last public release, then increment age.
|
||||
# 4. If any interfaces have been removed since the last public release, then set age to 0.
|
||||
set(TAGLIB_SOVERSION_CURRENT 17)
|
||||
set(TAGLIB_SOVERSION_CURRENT 18)
|
||||
set(TAGLIB_SOVERSION_REVISION 0)
|
||||
set(TAGLIB_SOVERSION_AGE 16)
|
||||
set(TAGLIB_SOVERSION_AGE 17)
|
||||
|
||||
math(EXPR TAGLIB_SOVERSION_MAJOR "${TAGLIB_SOVERSION_CURRENT} - ${TAGLIB_SOVERSION_AGE}")
|
||||
math(EXPR TAGLIB_SOVERSION_MINOR "${TAGLIB_SOVERSION_AGE}")
|
||||
|
@ -45,6 +45,13 @@ if(NOT WIN32)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Enable check_cxx_source_compiles() to work with Boost "header-only" libraries.
|
||||
|
||||
find_package(Boost)
|
||||
if(Boost_FOUND)
|
||||
set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${Boost_INCLUDE_DIRS}")
|
||||
endif()
|
||||
|
||||
# Determine which kind of atomic operations your compiler supports.
|
||||
|
||||
check_cxx_source_compiles("
|
||||
@ -58,15 +65,12 @@ check_cxx_source_compiles("
|
||||
" HAVE_STD_ATOMIC)
|
||||
|
||||
if(NOT HAVE_STD_ATOMIC)
|
||||
check_cxx_source_compiles("
|
||||
#include <boost/atomic.hpp>
|
||||
int main() {
|
||||
boost::atomic<unsigned int> x(1);
|
||||
x.fetch_add(1);
|
||||
x.fetch_sub(1);
|
||||
return 0;
|
||||
}
|
||||
" HAVE_BOOST_ATOMIC)
|
||||
find_package(Boost COMPONENTS atomic)
|
||||
if(Boost_ATOMIC_FOUND)
|
||||
set(HAVE_BOOST_ATOMIC 1)
|
||||
else()
|
||||
set(HAVE_BOOST_ATOMIC 0)
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_BOOST_ATOMIC)
|
||||
check_cxx_source_compiles("
|
||||
@ -255,6 +259,15 @@ if(NOT ZLIB_SOURCE)
|
||||
else()
|
||||
set(HAVE_ZLIB 0)
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_ZLIB)
|
||||
find_package(Boost COMPONENTS iostreams zlib)
|
||||
if(Boost_IOSTREAMS_FOUND AND Boost_ZLIB_FOUND)
|
||||
set(HAVE_BOOST_ZLIB 1)
|
||||
else()
|
||||
set(HAVE_BOOST_ZLIB 0)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# Determine whether CppUnit is installed.
|
||||
|
25
NEWS
25
NEWS
@ -1,8 +1,29 @@
|
||||
TagLib 1.11 (Jan 30, 2016)
|
||||
============================
|
||||
|
||||
* Added support for WinRT.
|
||||
|
||||
TagLib 1.11.1 (Oct 24, 2016)
|
||||
============================
|
||||
|
||||
* Fixed binary incompatible change in TagLib::String.
|
||||
* Fixed reading ID3v2 CTOC frames with a lot of entries.
|
||||
* Fixed seeking ByteVectorStream from the end.
|
||||
|
||||
TagLib 1.11 (Apr 29, 2016)
|
||||
==========================
|
||||
|
||||
1.11:
|
||||
|
||||
* Fixed reading APE items with long keys.
|
||||
* Fixed reading ID3v2 SYLT frames when description is empty.
|
||||
|
||||
1.11 BETA 2:
|
||||
|
||||
* Better handling of PCM WAV files with a 'fact' chunk.
|
||||
* Better handling of corrupted APE tags.
|
||||
* Efficient decoding of unsynchronized ID3v2 frames.
|
||||
* Fixed text encoding when saving certain frames in ID3v2.3 tags.
|
||||
* Fixed updating the size of RIFF files when removing chunks.
|
||||
* Several smaller bug fixes and performance improvements.
|
||||
|
||||
1.11 BETA:
|
||||
@ -34,7 +55,7 @@ TagLib 1.11 (Jan 30, 2016)
|
||||
* Fixed updating the comment field of Vorbis comments.
|
||||
* Fixed reading date and time in ID3v2.3 tags.
|
||||
* Marked ByteVector::null and ByteVector::isNull() deprecated.
|
||||
* Marked String::null and ByteVector::isNull() deprecated.
|
||||
* Marked String::null and String::isNull() deprecated.
|
||||
* Marked XiphComment::removeField() deprecated.
|
||||
* Marked Ogg::Page::getCopyWithNewPageSequenceNumber() deprecated. It returns null.
|
||||
* Marked custom integer types deprecated.
|
||||
|
@ -50,7 +50,7 @@ namespace
|
||||
bool unicodeStrings = true;
|
||||
bool stringManagementEnabled = true;
|
||||
|
||||
inline char *stringToCharArray(const String &s)
|
||||
char *stringToCharArray(const String &s)
|
||||
{
|
||||
const std::string str = s.to8Bit(unicodeStrings);
|
||||
|
||||
@ -65,7 +65,7 @@ namespace
|
||||
#endif
|
||||
}
|
||||
|
||||
inline String charArrayToString(const char *s)
|
||||
String charArrayToString(const char *s)
|
||||
{
|
||||
return String(s, unicodeStrings ? String::UTF8 : String::Latin1);
|
||||
}
|
||||
|
@ -124,7 +124,7 @@ TAGLIB_C_EXPORT TagLib_File *taglib_file_new_type(const char *filename, TagLib_F
|
||||
TAGLIB_C_EXPORT void taglib_file_free(TagLib_File *file);
|
||||
|
||||
/*!
|
||||
* Returns true if the file is open and readble and valid information for
|
||||
* Returns true if the file is open and readable and valid information for
|
||||
* the Tag and / or AudioProperties was found.
|
||||
*/
|
||||
|
||||
@ -137,7 +137,7 @@ TAGLIB_C_EXPORT BOOL taglib_file_is_valid(const TagLib_File *file);
|
||||
TAGLIB_C_EXPORT TagLib_Tag *taglib_file_tag(const TagLib_File *file);
|
||||
|
||||
/*!
|
||||
* Returns a pointer to the the audio properties associated with this file. This
|
||||
* Returns a pointer to the audio properties associated with this file. This
|
||||
* will be freed automatically when the file is freed.
|
||||
*/
|
||||
TAGLIB_C_EXPORT const TagLib_AudioProperties *taglib_file_audioproperties(const TagLib_File *file);
|
||||
|
@ -34,6 +34,7 @@
|
||||
|
||||
/* Defined if zlib is installed */
|
||||
#cmakedefine HAVE_ZLIB 1
|
||||
#cmakedefine HAVE_BOOST_ZLIB 1
|
||||
|
||||
/* Indicates whether debug messages are shown even in release mode */
|
||||
#cmakedefine TRACE_IN_RELEASE 1
|
||||
|
@ -35,6 +35,10 @@ elseif(HAVE_ZLIB_SOURCE)
|
||||
include_directories(${ZLIB_SOURCE})
|
||||
endif()
|
||||
|
||||
if(HAVE_BOOST_BYTESWAP OR HAVE_BOOST_ATOMIC OR HAVE_BOOST_ZLIB)
|
||||
include_directories(${Boost_INCLUDE_DIR})
|
||||
endif()
|
||||
|
||||
set(tag_HDRS
|
||||
tag.h
|
||||
fileref.h
|
||||
@ -337,6 +341,7 @@ set(toolkit_SRCS
|
||||
toolkit/tpropertymap.cpp
|
||||
toolkit/trefcounter.cpp
|
||||
toolkit/tdebuglistener.cpp
|
||||
toolkit/tzlib.cpp
|
||||
)
|
||||
|
||||
if(NOT WIN32)
|
||||
@ -376,6 +381,14 @@ if(ZLIB_FOUND)
|
||||
target_link_libraries(tag ${ZLIB_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(HAVE_BOOST_ATOMIC)
|
||||
target_link_libraries(tag ${Boost_ATOMIC_LIBRARY})
|
||||
endif()
|
||||
|
||||
if(HAVE_BOOST_ZLIB)
|
||||
target_link_libraries(tag ${Boost_IOSTREAMS_LIBRARY} ${Boost_ZLIB_LIBRARY})
|
||||
endif()
|
||||
|
||||
set_target_properties(tag PROPERTIES
|
||||
VERSION ${TAGLIB_SOVERSION_MAJOR}.${TAGLIB_SOVERSION_MINOR}.${TAGLIB_SOVERSION_PATCH}
|
||||
SOVERSION ${TAGLIB_SOVERSION_MAJOR}
|
||||
|
@ -126,7 +126,7 @@ unsigned int APE::AudioProperties::sampleFrames() const
|
||||
|
||||
namespace
|
||||
{
|
||||
inline int headerVersion(const ByteVector &header)
|
||||
int headerVersion(const ByteVector &header)
|
||||
{
|
||||
if(header.size() < 6 || !header.startsWith("MAC "))
|
||||
return -1;
|
||||
|
@ -48,11 +48,11 @@ using namespace APE;
|
||||
|
||||
namespace
|
||||
{
|
||||
inline bool isKeyValid(const char *key, size_t length)
|
||||
bool isKeyValid(const char *key, size_t length)
|
||||
{
|
||||
const char *invalidKeys[] = { "ID3", "TAG", "OGGS", "MP+", 0 };
|
||||
|
||||
if(length < 2 || length > 16)
|
||||
if(length < 2 || length > 255)
|
||||
return false;
|
||||
|
||||
// only allow printable ASCII including space (32..126)
|
||||
|
@ -34,65 +34,68 @@ namespace TagLib
|
||||
{
|
||||
namespace ASF
|
||||
{
|
||||
|
||||
inline unsigned short readWORD(File *file, bool *ok = 0)
|
||||
namespace
|
||||
{
|
||||
const ByteVector v = file->readBlock(2);
|
||||
if(v.size() != 2) {
|
||||
if(ok) *ok = false;
|
||||
return 0;
|
||||
}
|
||||
if(ok) *ok = true;
|
||||
return v.toUInt16LE(0);
|
||||
}
|
||||
|
||||
inline unsigned int readDWORD(File *file, bool *ok = 0)
|
||||
{
|
||||
const ByteVector v = file->readBlock(4);
|
||||
if(v.size() != 4) {
|
||||
if(ok) *ok = false;
|
||||
return 0;
|
||||
}
|
||||
if(ok) *ok = true;
|
||||
return v.toUInt32LE(0);
|
||||
}
|
||||
|
||||
inline long long readQWORD(File *file, bool *ok = 0)
|
||||
{
|
||||
const ByteVector v = file->readBlock(8);
|
||||
if(v.size() != 8) {
|
||||
if(ok) *ok = false;
|
||||
return 0;
|
||||
}
|
||||
if(ok) *ok = true;
|
||||
return v.toInt64LE(0);
|
||||
}
|
||||
|
||||
inline String readString(File *file, int length)
|
||||
{
|
||||
ByteVector data = file->readBlock(length);
|
||||
size_t size = data.size();
|
||||
while(size >= 2) {
|
||||
if(data[size - 1] != '\0' || data[size - 2] != '\0') {
|
||||
break;
|
||||
inline unsigned short readWORD(File *file, bool *ok = 0)
|
||||
{
|
||||
const ByteVector v = file->readBlock(2);
|
||||
if(v.size() != 2) {
|
||||
if(ok) *ok = false;
|
||||
return 0;
|
||||
}
|
||||
size -= 2;
|
||||
if(ok) *ok = true;
|
||||
return v.toUInt16LE(0);
|
||||
}
|
||||
if(size != data.size()) {
|
||||
data.resize(size);
|
||||
}
|
||||
return String(data, String::UTF16LE);
|
||||
}
|
||||
|
||||
inline ByteVector renderString(const String &str, bool includeLength = false)
|
||||
{
|
||||
ByteVector data = str.data(String::UTF16LE) + ByteVector::fromUInt16LE(0);
|
||||
if(includeLength) {
|
||||
data = ByteVector::fromUInt16LE(data.size()) + data;
|
||||
inline unsigned int readDWORD(File *file, bool *ok = 0)
|
||||
{
|
||||
const ByteVector v = file->readBlock(4);
|
||||
if(v.size() != 4) {
|
||||
if(ok) *ok = false;
|
||||
return 0;
|
||||
}
|
||||
if(ok) *ok = true;
|
||||
return v.toUInt32LE(0);
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
inline long long readQWORD(File *file, bool *ok = 0)
|
||||
{
|
||||
const ByteVector v = file->readBlock(8);
|
||||
if(v.size() != 8) {
|
||||
if(ok) *ok = false;
|
||||
return 0;
|
||||
}
|
||||
if(ok) *ok = true;
|
||||
return v.toInt64LE(0);
|
||||
}
|
||||
|
||||
inline String readString(File *file, int length)
|
||||
{
|
||||
ByteVector data = file->readBlock(length);
|
||||
unsigned int size = data.size();
|
||||
while (size >= 2) {
|
||||
if(data[size - 1] != '\0' || data[size - 2] != '\0') {
|
||||
break;
|
||||
}
|
||||
size -= 2;
|
||||
}
|
||||
if(size != data.size()) {
|
||||
data.resize(size);
|
||||
}
|
||||
return String(data, String::UTF16LE);
|
||||
}
|
||||
|
||||
inline ByteVector renderString(const String &str, bool includeLength = false)
|
||||
{
|
||||
ByteVector data = str.data(String::UTF16LE) + ByteVector::fromUInt16LE(0);
|
||||
if(includeLength) {
|
||||
data = ByteVector::fromUInt16LE(data.size()) + data;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,42 +63,42 @@ namespace
|
||||
// Templatized internal functions. T should be String or IOStream*.
|
||||
|
||||
template <typename T>
|
||||
inline FileName toFileName(T arg)
|
||||
FileName toFileName(T arg)
|
||||
{
|
||||
debug("FileRef::toFileName<T>(): This version should never be called.");
|
||||
return FileName(L"");
|
||||
}
|
||||
|
||||
template <>
|
||||
inline FileName toFileName<IOStream *>(IOStream *arg)
|
||||
FileName toFileName<IOStream *>(IOStream *arg)
|
||||
{
|
||||
return arg->name();
|
||||
}
|
||||
|
||||
template <>
|
||||
inline FileName toFileName<FileName>(FileName arg)
|
||||
FileName toFileName<FileName>(FileName arg)
|
||||
{
|
||||
return arg;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline File *resolveFileType(T arg, bool readProperties,
|
||||
AudioProperties::ReadStyle style)
|
||||
File *resolveFileType(T arg, bool readProperties,
|
||||
AudioProperties::ReadStyle style)
|
||||
{
|
||||
debug("FileRef::resolveFileType<T>(): This version should never be called.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline File *resolveFileType<IOStream *>(IOStream *arg, bool readProperties,
|
||||
AudioProperties::ReadStyle style)
|
||||
File *resolveFileType<IOStream *>(IOStream *arg, bool readProperties,
|
||||
AudioProperties::ReadStyle style)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <>
|
||||
inline File *resolveFileType<FileName>(FileName arg, bool readProperties,
|
||||
AudioProperties::ReadStyle style)
|
||||
File *resolveFileType<FileName>(FileName arg, bool readProperties,
|
||||
AudioProperties::ReadStyle style)
|
||||
{
|
||||
ResolverList::ConstIterator it = fileTypeResolvers.begin();
|
||||
for(; it != fileTypeResolvers.end(); ++it) {
|
||||
|
@ -129,13 +129,16 @@ namespace TagLib {
|
||||
audioPropertiesStyle = AudioProperties::Average);
|
||||
|
||||
/*!
|
||||
* Construct a FileRef from an opened \a IOStream. If \a readAudioProperties is true then
|
||||
* the audio properties will be read using \a audioPropertiesStyle. If
|
||||
* \a readAudioProperties is false then \a audioPropertiesStyle will be
|
||||
* Construct a FileRef from an opened \a IOStream. If \a readAudioProperties
|
||||
* is true then the audio properties will be read using \a audioPropertiesStyle.
|
||||
* If \a readAudioProperties is false then \a audioPropertiesStyle will be
|
||||
* ignored.
|
||||
*
|
||||
* Also see the note in the class documentation about why you may not want to
|
||||
* use this method in your application.
|
||||
*
|
||||
* \note TagLib will *not* take ownership of the stream, the caller is
|
||||
* responsible for deleting it after the File object.
|
||||
*/
|
||||
explicit FileRef(IOStream* stream,
|
||||
bool readAudioProperties = true,
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,10 +15,15 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 "tstringlist.h"
|
||||
#include "itfile.h"
|
||||
#include "tdebug.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,10 +15,15 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 "itproperties.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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_ITPROPERTIES_H
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,10 +15,15 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 "modfile.h"
|
||||
#include "tstringlist.h"
|
||||
#include "tdebug.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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_MODFILE_H
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,10 +15,15 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 "tdebug.h"
|
||||
#include "modfilebase.h"
|
||||
|
||||
@ -48,7 +53,7 @@ bool Mod::FileBase::readString(String &s, unsigned int size)
|
||||
if(index != ByteVector::npos()) {
|
||||
data.resize(index);
|
||||
}
|
||||
data.replace((char) 0xff, ' ');
|
||||
data.replace('\xff', ' ');
|
||||
|
||||
s = data;
|
||||
return true;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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_MODFILEBASE_H
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,10 +15,15 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 "modproperties.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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_MODPROPERTIES_H
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,10 +15,15 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 "modtag.h"
|
||||
#include "tstringlist.h"
|
||||
#include "tpropertymap.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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_MODTAG_H
|
||||
@ -50,39 +54,39 @@ namespace TagLib {
|
||||
* Returns the track name; if no track name is present in the tag
|
||||
* String::null will be returned.
|
||||
*/
|
||||
String title() const;
|
||||
virtual String title() const;
|
||||
|
||||
/*!
|
||||
* Not supported by module files. Therefore always returns String::null.
|
||||
*/
|
||||
String artist() const;
|
||||
virtual String artist() const;
|
||||
|
||||
/*!
|
||||
* Not supported by module files. Therefore always returns String::null.
|
||||
*/
|
||||
String album() const;
|
||||
virtual String album() const;
|
||||
|
||||
/*!
|
||||
* Returns the track comment derived from the instrument/sample/pattern
|
||||
* names; if no comment is present in the tag String::null will be
|
||||
* returned.
|
||||
*/
|
||||
String comment() const;
|
||||
virtual String comment() const;
|
||||
|
||||
/*!
|
||||
* Not supported by module files. Therefore always returns String::null.
|
||||
*/
|
||||
String genre() const;
|
||||
virtual String genre() const;
|
||||
|
||||
/*!
|
||||
* Not supported by module files. Therefore always returns 0.
|
||||
*/
|
||||
unsigned int year() const;
|
||||
virtual unsigned int year() const;
|
||||
|
||||
/*!
|
||||
* Not supported by module files. Therefore always returns 0.
|
||||
*/
|
||||
unsigned int track() const;
|
||||
virtual unsigned int track() const;
|
||||
|
||||
PictureMap pictures() const;
|
||||
|
||||
@ -103,17 +107,17 @@ namespace TagLib {
|
||||
* Mod 20 characters, S3M 27 characters, IT 25 characters and XM 20
|
||||
* characters.
|
||||
*/
|
||||
void setTitle(const String &title);
|
||||
virtual void setTitle(const String &title);
|
||||
|
||||
/*!
|
||||
* Not supported by module files and therefore ignored.
|
||||
*/
|
||||
void setArtist(const String &artist);
|
||||
virtual void setArtist(const String &artist);
|
||||
|
||||
/*!
|
||||
* Not supported by module files and therefore ignored.
|
||||
*/
|
||||
void setAlbum(const String &album);
|
||||
virtual void setAlbum(const String &album);
|
||||
|
||||
/*!
|
||||
* Sets the comment to \a comment. If \a comment is String::null then
|
||||
@ -132,22 +136,22 @@ namespace TagLib {
|
||||
* Mod 22 characters, S3M 27 characters, IT 25 characters and XM 22
|
||||
* characters.
|
||||
*/
|
||||
void setComment(const String &comment);
|
||||
virtual void setComment(const String &comment);
|
||||
|
||||
/*!
|
||||
* Not supported by module files and therefore ignored.
|
||||
*/
|
||||
void setGenre(const String &genre);
|
||||
virtual void setGenre(const String &genre);
|
||||
|
||||
/*!
|
||||
* Not supported by module files and therefore ignored.
|
||||
*/
|
||||
void setYear(unsigned int year);
|
||||
virtual void setYear(unsigned int year);
|
||||
|
||||
/*!
|
||||
* Not supported by module files and therefore ignored.
|
||||
*/
|
||||
void setTrack(unsigned int track);
|
||||
virtual void setTrack(unsigned int track);
|
||||
|
||||
void setPictures(const PictureMap &l);
|
||||
|
||||
|
@ -23,20 +23,17 @@
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <tdebug.h>
|
||||
#include <tstring.h>
|
||||
|
||||
#include "mp4atom.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
const char *MP4::Atom::containers[11] = {
|
||||
"moov", "udta", "mdia", "meta", "ilst",
|
||||
"stbl", "minf", "moof", "traf", "trak",
|
||||
"stsd"
|
||||
"moov", "udta", "mdia", "meta", "ilst",
|
||||
"stbl", "minf", "moof", "traf", "trak",
|
||||
"stsd"
|
||||
};
|
||||
|
||||
MP4::Atom::Atom(File *file)
|
||||
|
@ -34,7 +34,7 @@ using namespace TagLib;
|
||||
|
||||
namespace
|
||||
{
|
||||
inline bool checkValid(const MP4::AtomList &list)
|
||||
bool checkValid(const MP4::AtomList &list)
|
||||
{
|
||||
for(MP4::AtomList::ConstIterator it = list.begin(); it != list.end(); ++it) {
|
||||
|
||||
|
@ -50,26 +50,26 @@ namespace TagLib {
|
||||
public:
|
||||
Tag();
|
||||
Tag(TagLib::File *file, Atoms *atoms);
|
||||
~Tag();
|
||||
virtual ~Tag();
|
||||
bool save();
|
||||
|
||||
String title() const;
|
||||
String artist() const;
|
||||
String album() const;
|
||||
String comment() const;
|
||||
String genre() const;
|
||||
unsigned int year() const;
|
||||
unsigned int track() const;
|
||||
PictureMap pictures() const;
|
||||
virtual String title() const;
|
||||
virtual String artist() const;
|
||||
virtual String album() const;
|
||||
virtual String comment() const;
|
||||
virtual String genre() const;
|
||||
virtual unsigned int year() const;
|
||||
virtual unsigned int track() const;
|
||||
virtual PictureMap pictures() const;
|
||||
|
||||
void setTitle(const String &value);
|
||||
void setArtist(const String &value);
|
||||
void setAlbum(const String &value);
|
||||
void setComment(const String &value);
|
||||
void setGenre(const String &value);
|
||||
void setYear(unsigned int value);
|
||||
void setTrack(unsigned int value);
|
||||
void setPictures(const PictureMap &l);
|
||||
virtual void setTitle(const String &value);
|
||||
virtual void setArtist(const String &value);
|
||||
virtual void setAlbum(const String &value);
|
||||
virtual void setComment(const String &value);
|
||||
virtual void setGenre(const String &value);
|
||||
virtual void setYear(unsigned int value);
|
||||
virtual void setTrack(unsigned int value);
|
||||
virtual void setPictures(const PictureMap &l);
|
||||
|
||||
virtual bool isEmpty() const;
|
||||
|
||||
|
@ -198,7 +198,7 @@ String ChapterFrame::toString() const
|
||||
s += ", start offset: " + String::number(d->startOffset);
|
||||
|
||||
if(d->endOffset != 0xFFFFFFFF)
|
||||
s += ", start offset: " + String::number(d->endOffset);
|
||||
s += ", end offset: " + String::number(d->endOffset);
|
||||
|
||||
if(!d->embeddedFrameList.isEmpty()) {
|
||||
StringList frameIDs;
|
||||
|
@ -1,6 +1,7 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002 - 2008 by Scott Wheeler
|
||||
email : wheeler@kde.org
|
||||
|
||||
copyright : (C) 2006 by Aaron VonderHaar
|
||||
email : avh4@users.sourceforge.net
|
||||
***************************************************************************/
|
||||
@ -26,6 +27,7 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include <tdebug.h>
|
||||
#include <tstringlist.h>
|
||||
|
||||
#include "generalencapsulatedobjectframe.h"
|
||||
|
||||
@ -151,15 +153,21 @@ void GeneralEncapsulatedObjectFrame::parseFields(const ByteVector &data)
|
||||
|
||||
ByteVector GeneralEncapsulatedObjectFrame::renderFields() const
|
||||
{
|
||||
StringList sl;
|
||||
sl.append(d->fileName);
|
||||
sl.append(d->description);
|
||||
|
||||
const String::Type encoding = checkTextEncoding(sl, d->textEncoding);
|
||||
|
||||
ByteVector data;
|
||||
|
||||
data.append(char(d->textEncoding));
|
||||
data.append(char(encoding));
|
||||
data.append(d->mimeType.data(String::Latin1));
|
||||
data.append(textDelimiter(String::Latin1));
|
||||
data.append(d->fileName.data(d->textEncoding));
|
||||
data.append(textDelimiter(d->textEncoding));
|
||||
data.append(d->description.data(d->textEncoding));
|
||||
data.append(textDelimiter(d->textEncoding));
|
||||
data.append(d->fileName.data(encoding));
|
||||
data.append(textDelimiter(encoding));
|
||||
data.append(d->description.data(encoding));
|
||||
data.append(textDelimiter(encoding));
|
||||
data.append(d->data);
|
||||
|
||||
return data;
|
||||
|
@ -1,6 +1,7 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002 - 2008 by Scott Wheeler
|
||||
email : wheeler@kde.org
|
||||
|
||||
copyright : (C) 2006 by Aaron VonderHaar
|
||||
email : avh4@users.sourceforge.net
|
||||
***************************************************************************/
|
||||
|
@ -24,9 +24,10 @@
|
||||
***************************************************************************/
|
||||
|
||||
#include <tdebug.h>
|
||||
#include <tstringlist.h>
|
||||
#include <id3v2tag.h>
|
||||
|
||||
#include "ownershipframe.h"
|
||||
#include <id3v2tag.h>
|
||||
|
||||
using namespace TagLib;
|
||||
using namespace ID3v2;
|
||||
@ -113,24 +114,24 @@ void OwnershipFrame::setTextEncoding(String::Type encoding)
|
||||
void OwnershipFrame::parseFields(const ByteVector &data)
|
||||
{
|
||||
size_t pos = 0;
|
||||
|
||||
|
||||
// Get the text encoding
|
||||
d->textEncoding = String::Type(data[0]);
|
||||
pos += 1;
|
||||
|
||||
|
||||
// Read the price paid this is a null terminate string
|
||||
d->pricePaid = readStringField(data, String::Latin1, pos);
|
||||
|
||||
|
||||
// If we don't have at least 8 bytes left then don't parse the rest of the
|
||||
// data
|
||||
if(data.size() - pos < 8) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Read the date purchased YYYYMMDD
|
||||
d->datePurchased = String(data.mid(pos, 8));
|
||||
pos += 8;
|
||||
|
||||
|
||||
// Read the seller
|
||||
if(d->textEncoding == String::Latin1)
|
||||
d->seller = Tag::latin1StringHandler()->parse(data.mid(pos));
|
||||
@ -140,14 +141,19 @@ void OwnershipFrame::parseFields(const ByteVector &data)
|
||||
|
||||
ByteVector OwnershipFrame::renderFields() const
|
||||
{
|
||||
StringList sl;
|
||||
sl.append(d->seller);
|
||||
|
||||
const String::Type encoding = checkTextEncoding(sl, d->textEncoding);
|
||||
|
||||
ByteVector v;
|
||||
|
||||
v.append(char(d->textEncoding));
|
||||
|
||||
v.append(char(encoding));
|
||||
v.append(d->pricePaid.data(String::Latin1));
|
||||
v.append(textDelimiter(String::Latin1));
|
||||
v.append(d->datePurchased.data(String::Latin1));
|
||||
v.append(d->seller.data(d->textEncoding));
|
||||
|
||||
v.append(d->seller.data(encoding));
|
||||
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ void SynchronizedLyricsFrame::parseFields(const ByteVector &data)
|
||||
size_t pos = 6;
|
||||
|
||||
d->description = readStringField(data, d->textEncoding, pos);
|
||||
if(d->description.isEmpty())
|
||||
if(pos == 6)
|
||||
return;
|
||||
|
||||
/*
|
||||
|
@ -272,9 +272,9 @@ void TableOfContentsFrame::parseFields(const ByteVector &data)
|
||||
size_t pos = 0;
|
||||
size_t embPos = 0;
|
||||
d->elementID = readStringField(data, String::Latin1, pos).data(String::Latin1);
|
||||
d->isTopLevel = (data.at(pos) & 2) > 0;
|
||||
d->isOrdered = (data.at(pos++) & 1) > 0;
|
||||
unsigned int entryCount = data.at(pos++);
|
||||
d->isTopLevel = (data.at(pos) & 2) != 0;
|
||||
d->isOrdered = (data.at(pos++) & 1) != 0;
|
||||
unsigned int entryCount = static_cast<unsigned char>(data.at(pos++));
|
||||
for(unsigned int i = 0; i < entryCount; i++) {
|
||||
ByteVector childElementID = readStringField(data, String::Latin1, pos).data(String::Latin1);
|
||||
d->childElements.append(childElementID);
|
||||
|
@ -1,6 +1,7 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002 - 2008 by Scott Wheeler
|
||||
email : wheeler@kde.org
|
||||
|
||||
copyright : (C) 2006 by Urs Fleisch
|
||||
email : ufleisch@users.sourceforge.net
|
||||
***************************************************************************/
|
||||
@ -168,13 +169,19 @@ void UnsynchronizedLyricsFrame::parseFields(const ByteVector &data)
|
||||
|
||||
ByteVector UnsynchronizedLyricsFrame::renderFields() const
|
||||
{
|
||||
StringList sl;
|
||||
sl.append(d->description);
|
||||
sl.append(d->text);
|
||||
|
||||
const String::Type encoding = checkTextEncoding(sl, d->textEncoding);
|
||||
|
||||
ByteVector v;
|
||||
|
||||
v.append(char(d->textEncoding));
|
||||
v.append(char(encoding));
|
||||
v.append(d->language.size() == 3 ? d->language : "XXX");
|
||||
v.append(d->description.data(d->textEncoding));
|
||||
v.append(textDelimiter(d->textEncoding));
|
||||
v.append(d->text.data(d->textEncoding));
|
||||
v.append(d->description.data(encoding));
|
||||
v.append(textDelimiter(encoding));
|
||||
v.append(d->text.data(encoding));
|
||||
|
||||
return v;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002 - 2008 by Scott Wheeler
|
||||
email : wheeler@kde.org
|
||||
|
||||
copyright : (C) 2006 by Urs Fleisch
|
||||
email : ufleisch@users.sourceforge.net
|
||||
***************************************************************************/
|
||||
|
@ -1,6 +1,7 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002 - 2008 by Scott Wheeler
|
||||
email : wheeler@kde.org
|
||||
|
||||
copyright : (C) 2006 by Urs Fleisch
|
||||
email : ufleisch@users.sourceforge.net
|
||||
***************************************************************************/
|
||||
|
@ -23,22 +23,16 @@
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_ZLIB
|
||||
#include <zlib.h>
|
||||
#endif
|
||||
|
||||
#include <bitset>
|
||||
|
||||
#include <tdebug.h>
|
||||
#include <tstringlist.h>
|
||||
#include <tzlib.h>
|
||||
|
||||
#include "id3v2tag.h"
|
||||
#include "id3v2frame.h"
|
||||
#include "id3v2synchdata.h"
|
||||
|
||||
#include "tpropertymap.h"
|
||||
#include "frames/textidentificationframe.h"
|
||||
#include "frames/urllinkframe.h"
|
||||
@ -97,10 +91,10 @@ unsigned int Frame::headerSize(unsigned int version)
|
||||
|
||||
ByteVector Frame::textDelimiter(String::Type t)
|
||||
{
|
||||
ByteVector d = char(0);
|
||||
if(t == String::UTF16 || t == String::UTF16BE || t == String::UTF16LE)
|
||||
d.append(char(0));
|
||||
return d;
|
||||
return ByteVector(2, '\0');
|
||||
else
|
||||
return ByteVector(1, '\0');
|
||||
}
|
||||
|
||||
const String Frame::instrumentPrefix("PERFORMER:");
|
||||
@ -251,60 +245,21 @@ ByteVector Frame::fieldData(const ByteVector &frameData) const
|
||||
frameDataOffset += 4;
|
||||
}
|
||||
|
||||
#if HAVE_ZLIB
|
||||
if(d->header->compression() &&
|
||||
!d->header->encryption())
|
||||
{
|
||||
if(zlib::isAvailable() && d->header->compression() && !d->header->encryption()) {
|
||||
if(frameData.size() <= frameDataOffset) {
|
||||
debug("Compressed frame doesn't have enough data to decode");
|
||||
return ByteVector();
|
||||
}
|
||||
|
||||
z_stream stream = {};
|
||||
|
||||
if(inflateInit(&stream) != Z_OK)
|
||||
return ByteVector();
|
||||
|
||||
ByteVector inData = frameData;
|
||||
|
||||
stream.avail_in = static_cast<uInt>(inData.size() - frameDataOffset);
|
||||
stream.next_in = reinterpret_cast<Bytef *>(inData.data() + frameDataOffset);
|
||||
|
||||
static const size_t chunkSize = 1024;
|
||||
|
||||
ByteVector outData;
|
||||
ByteVector chunk(chunkSize);
|
||||
|
||||
do {
|
||||
stream.avail_out = static_cast<uInt>(chunk.size());
|
||||
stream.next_out = reinterpret_cast<Bytef *>(chunk.data());
|
||||
|
||||
int result = inflate(&stream, Z_NO_FLUSH);
|
||||
|
||||
if(result == Z_STREAM_ERROR ||
|
||||
result == Z_NEED_DICT ||
|
||||
result == Z_DATA_ERROR ||
|
||||
result == Z_MEM_ERROR)
|
||||
{
|
||||
if(result != Z_STREAM_ERROR)
|
||||
inflateEnd(&stream);
|
||||
debug("Error reading compressed stream");
|
||||
return ByteVector();
|
||||
}
|
||||
|
||||
outData.append(stream.avail_out == 0 ? chunk : chunk.mid(0, chunk.size() - stream.avail_out));
|
||||
} while(stream.avail_out == 0);
|
||||
|
||||
inflateEnd(&stream);
|
||||
|
||||
if(frameDataLength != outData.size())
|
||||
const ByteVector outData = zlib::decompress(frameData.mid(frameDataOffset));
|
||||
if(!outData.isEmpty() && frameDataLength != outData.size()) {
|
||||
debug("frameDataLength does not match the data length returned by zlib");
|
||||
}
|
||||
|
||||
return outData;
|
||||
}
|
||||
else
|
||||
#endif
|
||||
return frameData.mid(frameDataOffset, frameDataLength);
|
||||
|
||||
return frameData.mid(frameDataOffset, frameDataLength);
|
||||
}
|
||||
|
||||
String Frame::readStringField(const ByteVector &data, String::Type encoding, size_t &position)
|
||||
|
@ -23,11 +23,8 @@
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <tdebug.h>
|
||||
#include <tzlib.h>
|
||||
|
||||
#include "id3v2framefactory.h"
|
||||
#include "id3v2synchdata.h"
|
||||
@ -105,13 +102,14 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
FrameFactory FrameFactory::factory;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
FrameFactory *FrameFactory::instance()
|
||||
{
|
||||
static FrameFactory factory;
|
||||
return &factory;
|
||||
}
|
||||
|
||||
@ -162,12 +160,11 @@ Frame *FrameFactory::createFrame(const ByteVector &origData, const Header *tagHe
|
||||
// TagLib doesn't mess with encrypted frames, so just treat them
|
||||
// as unknown frames.
|
||||
|
||||
#if !defined(HAVE_ZLIB) || HAVE_ZLIB == 0
|
||||
if(header->compression()) {
|
||||
if(!zlib::isAvailable() && header->compression()) {
|
||||
debug("Compressed frames are currently not supported.");
|
||||
return new UnknownFrame(data, header);
|
||||
}
|
||||
#endif
|
||||
|
||||
if(header->encryption()) {
|
||||
debug("Encrypted frames are currently not supported.");
|
||||
return new UnknownFrame(data, header);
|
||||
@ -530,4 +527,3 @@ bool FrameFactory::updateFrame(Frame::Header *header) const
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,6 @@ namespace TagLib {
|
||||
{
|
||||
public:
|
||||
static FrameFactory *instance();
|
||||
|
||||
/*!
|
||||
* Create a frame based on \a data. \a tagHeader should be a valid
|
||||
* ID3v2::Header instance.
|
||||
@ -132,6 +131,8 @@ namespace TagLib {
|
||||
FrameFactory(const FrameFactory &);
|
||||
FrameFactory &operator=(const FrameFactory &);
|
||||
|
||||
static FrameFactory factory;
|
||||
|
||||
class FrameFactoryPrivate;
|
||||
FrameFactoryPrivate *d;
|
||||
};
|
||||
|
@ -74,11 +74,25 @@ ByteVector SynchData::fromUInt(unsigned int value)
|
||||
|
||||
ByteVector SynchData::decode(const ByteVector &data)
|
||||
{
|
||||
ByteVector result = data;
|
||||
// We have this optimized method instead of using ByteVector::replace(),
|
||||
// since it makes a great difference when decoding huge unsynchronized frames.
|
||||
|
||||
ByteVector pattern(2, char(0));
|
||||
pattern[0] = '\xFF';
|
||||
pattern[1] = '\x00';
|
||||
ByteVector result(data.size());
|
||||
|
||||
return result.replace(pattern, '\xFF');
|
||||
ByteVector::ConstIterator src = data.begin();
|
||||
ByteVector::Iterator dst = result.begin();
|
||||
|
||||
while(src < data.end() - 1) {
|
||||
*dst++ = *src++;
|
||||
|
||||
if(*(src - 1) == '\xff' && *src == '\x00')
|
||||
src++;
|
||||
}
|
||||
|
||||
if(src < data.end())
|
||||
*dst++ = *src++;
|
||||
|
||||
result.resize(static_cast<unsigned int>(dst - result.begin()));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -23,10 +23,6 @@
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <tfile.h>
|
||||
@ -650,7 +646,7 @@ ByteVector ID3v2::Tag::render() const
|
||||
|
||||
void ID3v2::Tag::downgradeFrames(FrameList *frames, FrameList *newFrames) const
|
||||
{
|
||||
#ifdef NO_ITUNES_HACKS
|
||||
#ifdef NO_ITUNES_HACKS
|
||||
const char *unsupportedFrames[] = {
|
||||
"ASPI", "EQU2", "RVA2", "SEEK", "SIGN", "TDRL", "TDTG",
|
||||
"TMOO", "TPRO", "TSOA", "TSOT", "TSST", "TSOP", 0
|
||||
|
@ -34,25 +34,27 @@ namespace TagLib
|
||||
{
|
||||
namespace MPEG
|
||||
{
|
||||
|
||||
/*!
|
||||
* MPEG frames can be recognized by the bit pattern 11111111 111, so the
|
||||
* first byte is easy to check for, however checking to see if the second byte
|
||||
* starts with \e 111 is a bit more tricky, hence these functions.
|
||||
*/
|
||||
|
||||
inline bool firstSyncByte(unsigned char byte)
|
||||
namespace
|
||||
{
|
||||
return (byte == 0xFF);
|
||||
|
||||
/*!
|
||||
* MPEG frames can be recognized by the bit pattern 11111111 111, so the
|
||||
* first byte is easy to check for, however checking to see if the second byte
|
||||
* starts with \e 111 is a bit more tricky, hence these functions.
|
||||
*/
|
||||
inline bool firstSyncByte(unsigned char byte)
|
||||
{
|
||||
return (byte == 0xFF);
|
||||
}
|
||||
|
||||
inline bool secondSynchByte(unsigned char byte)
|
||||
{
|
||||
// 0xFF is possible in theory, but it's very unlikely be a header.
|
||||
|
||||
return (byte != 0xFF && ((byte & 0xE0) == 0xE0));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inline bool secondSynchByte(unsigned char byte)
|
||||
{
|
||||
// 0xFF is possible in theory, but it's very unlikely be a header.
|
||||
|
||||
return (byte != 0xFF && ((byte & 0xE0) == 0xE0));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ using namespace TagLib;
|
||||
namespace
|
||||
{
|
||||
// Returns the first packet index of the right next page to the given one.
|
||||
inline unsigned int nextPacketIndex(const Ogg::Page *page)
|
||||
unsigned int nextPacketIndex(const Ogg::Page *page)
|
||||
{
|
||||
if(page->header()->lastPacketCompleted())
|
||||
return page->firstPacketIndex() + page->packetCount();
|
||||
@ -262,12 +262,13 @@ void Ogg::File::writePacket(unsigned int i, const ByteVector &packet)
|
||||
// TODO: This pagination method isn't accurate for what's being done here.
|
||||
// This should account for real possibilities like non-aligned packets and such.
|
||||
|
||||
const List<Page *> pages = Page::paginate(packets,
|
||||
Page::SinglePagePerGroup,
|
||||
firstPage->header()->streamSerialNumber(),
|
||||
firstPage->pageSequenceNumber(),
|
||||
firstPage->header()->firstPacketContinued(),
|
||||
lastPage->header()->lastPacketCompleted());
|
||||
List<Page *> pages = Page::paginate(packets,
|
||||
Page::SinglePagePerGroup,
|
||||
firstPage->header()->streamSerialNumber(),
|
||||
firstPage->pageSequenceNumber(),
|
||||
firstPage->header()->firstPacketContinued(),
|
||||
lastPage->header()->lastPacketCompleted());
|
||||
pages.setAutoDelete(true);
|
||||
|
||||
// Write the pages.
|
||||
|
||||
|
@ -67,11 +67,14 @@ class RIFF::File::FilePrivate
|
||||
public:
|
||||
FilePrivate(ByteOrder endianness) :
|
||||
endianness(endianness),
|
||||
size(0) {}
|
||||
size(0),
|
||||
sizeOffset(0) {}
|
||||
|
||||
const ByteOrder endianness;
|
||||
|
||||
unsigned int size;
|
||||
long long sizeOffset;
|
||||
|
||||
std::vector<Chunk> chunks;
|
||||
};
|
||||
|
||||
@ -116,31 +119,50 @@ size_t RIFF::File::chunkCount() const
|
||||
|
||||
unsigned int RIFF::File::chunkDataSize(unsigned int i) const
|
||||
{
|
||||
if(i >= d->chunks.size()) {
|
||||
debug("RIFF::File::chunkPadding() - Index out of range. Returning 0.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return d->chunks[i].size;
|
||||
}
|
||||
|
||||
long long RIFF::File::chunkOffset(unsigned int i) const
|
||||
{
|
||||
if(i >= d->chunks.size()) {
|
||||
debug("RIFF::File::chunkPadding() - Index out of range. Returning 0.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return d->chunks[i].offset;
|
||||
}
|
||||
|
||||
unsigned int RIFF::File::chunkPadding(unsigned int i) const
|
||||
{
|
||||
if(i >= d->chunks.size()) {
|
||||
debug("RIFF::File::chunkPadding() - Index out of range. Returning 0.");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return d->chunks[i].padding;
|
||||
}
|
||||
|
||||
ByteVector RIFF::File::chunkName(unsigned int i) const
|
||||
{
|
||||
if(i >= chunkCount())
|
||||
if(i >= d->chunks.size()) {
|
||||
debug("RIFF::File::chunkName() - Index out of range. Returning an empty vector.");
|
||||
return ByteVector();
|
||||
}
|
||||
|
||||
return d->chunks[i].name;
|
||||
}
|
||||
|
||||
ByteVector RIFF::File::chunkData(unsigned int i)
|
||||
{
|
||||
if(i >= chunkCount())
|
||||
if(i >= d->chunks.size()) {
|
||||
debug("RIFF::File::chunkData() - Index out of range. Returning an empty vector.");
|
||||
return ByteVector();
|
||||
}
|
||||
|
||||
seek(d->chunks[i].offset);
|
||||
return readBlock(d->chunks[i].size);
|
||||
@ -148,22 +170,33 @@ ByteVector RIFF::File::chunkData(unsigned int i)
|
||||
|
||||
void RIFF::File::setChunkData(unsigned int i, const ByteVector &data)
|
||||
{
|
||||
// First we update the global size
|
||||
|
||||
d->size += ((data.size() + 1) & ~1) - (d->chunks[i].size + d->chunks[i].padding);
|
||||
insert(fromUInt32(d->size, d->endianness), 4, 4);
|
||||
if(i >= d->chunks.size()) {
|
||||
debug("RIFF::File::setChunkData() - Index out of range.");
|
||||
return;
|
||||
}
|
||||
|
||||
// Now update the specific chunk
|
||||
|
||||
writeChunk(chunkName(i), data, d->chunks[i].offset - 8, d->chunks[i].size + d->chunks[i].padding + 8);
|
||||
std::vector<Chunk>::iterator it = d->chunks.begin();
|
||||
std::advance(it, i);
|
||||
|
||||
d->chunks[i].size = static_cast<unsigned int>(data.size());
|
||||
d->chunks[i].padding = (data.size() & 0x01) ? 1 : 0;
|
||||
const long long originalSize = static_cast<long long>(it->size) + it->padding;
|
||||
|
||||
writeChunk(it->name, data, it->offset - 8, it->size + it->padding + 8);
|
||||
|
||||
it->size = data.size();
|
||||
it->padding = data.size() % 2;
|
||||
|
||||
const long long diff = static_cast<long long>(it->size) + it->padding - originalSize;
|
||||
|
||||
// Now update the internal offsets
|
||||
|
||||
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;
|
||||
for(++it; it != d->chunks.end(); ++it)
|
||||
it->offset += diff;
|
||||
|
||||
// Update the global size.
|
||||
|
||||
updateGlobalSize();
|
||||
}
|
||||
|
||||
void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data)
|
||||
@ -194,45 +227,49 @@ void RIFF::File::setChunkData(const ByteVector &name, const ByteVector &data, bo
|
||||
|
||||
// Couldn't find an existing chunk, so let's create a new one.
|
||||
|
||||
long long offset = d->chunks.back().offset + d->chunks.back().size;
|
||||
// Adjust the padding of the last chunk to place the new chunk at even position.
|
||||
|
||||
// First we update the global size
|
||||
Chunk &last = d->chunks.back();
|
||||
|
||||
d->size += static_cast<unsigned int>((offset & 1) + data.size() + 8);
|
||||
if(d->endianness == BigEndian)
|
||||
insert(ByteVector::fromUInt32BE(d->size), 4, 4);
|
||||
else
|
||||
insert(ByteVector::fromUInt32LE(d->size), 4, 4);
|
||||
long long offset = last.offset + last.size + last.padding;
|
||||
if(offset & 1) {
|
||||
if(last.padding == 1) {
|
||||
last.padding = 0; // This should not happen unless the file is corrupted.
|
||||
offset--;
|
||||
removeBlock(offset, 1);
|
||||
}
|
||||
else {
|
||||
insert(ByteVector("\0", 1), offset, 0);
|
||||
last.padding = 1;
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
// Now add the chunk to the file
|
||||
// Now add the chunk to the file.
|
||||
|
||||
writeChunk(
|
||||
name,
|
||||
data,
|
||||
offset,
|
||||
static_cast<size_t>(std::max(0LL, length() - offset)),
|
||||
static_cast<unsigned int>(offset & 1));
|
||||
writeChunk(name, data, offset, 0);
|
||||
|
||||
// And update our internal structure
|
||||
|
||||
if(offset & 1) {
|
||||
d->chunks.back().padding = 1;
|
||||
offset++;
|
||||
}
|
||||
|
||||
Chunk chunk;
|
||||
chunk.name = name;
|
||||
chunk.size = static_cast<unsigned int>(data.size());
|
||||
chunk.size = data.size();
|
||||
chunk.offset = offset + 8;
|
||||
chunk.padding = static_cast<char>(data.size() & 1);
|
||||
chunk.padding = data.size() % 2;
|
||||
|
||||
d->chunks.push_back(chunk);
|
||||
|
||||
// Update the global size.
|
||||
|
||||
updateGlobalSize();
|
||||
}
|
||||
|
||||
void RIFF::File::removeChunk(unsigned int i)
|
||||
{
|
||||
if(i >= d->chunks.size())
|
||||
if(i >= d->chunks.size()) {
|
||||
debug("RIFF::File::removeChunk() - Index out of range.");
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<Chunk>::iterator it = d->chunks.begin();
|
||||
std::advance(it, i);
|
||||
@ -243,6 +280,10 @@ void RIFF::File::removeChunk(unsigned int i)
|
||||
|
||||
for(; it != d->chunks.end(); ++it)
|
||||
it->offset -= removeSize;
|
||||
|
||||
// Update the global size.
|
||||
|
||||
updateGlobalSize();
|
||||
}
|
||||
|
||||
void RIFF::File::removeChunk(const ByteVector &name)
|
||||
@ -259,15 +300,20 @@ void RIFF::File::removeChunk(const ByteVector &name)
|
||||
|
||||
void RIFF::File::read()
|
||||
{
|
||||
const long long baseOffset = tell();
|
||||
long long offset = tell();
|
||||
|
||||
seek(baseOffset + 4);
|
||||
offset += 4;
|
||||
d->sizeOffset = offset;
|
||||
|
||||
seek(offset);
|
||||
d->size = toUInt32(readBlock(4), 0, d->endianness);
|
||||
|
||||
seek(baseOffset + 12);
|
||||
offset += 8;
|
||||
|
||||
// + 8: chunk header at least, fix for additional junk bytes
|
||||
while(tell() + 8 <= length()) {
|
||||
while(offset + 8 <= length()) {
|
||||
|
||||
seek(offset);
|
||||
const ByteVector chunkName = readBlock(4);
|
||||
const unsigned int chunkSize = toUInt32(readBlock(4), 0, d->endianness);
|
||||
|
||||
@ -277,30 +323,28 @@ void RIFF::File::read()
|
||||
break;
|
||||
}
|
||||
|
||||
if(tell() + chunkSize > length()) {
|
||||
if(offset + 8 + chunkSize > length()) {
|
||||
debug("RIFF::File::read() -- Chunk '" + chunkName + "' has invalid size (larger than the file size)");
|
||||
setValid(false);
|
||||
break;
|
||||
}
|
||||
|
||||
Chunk chunk;
|
||||
chunk.name = chunkName;
|
||||
chunk.size = chunkSize;
|
||||
chunk.offset = tell();
|
||||
|
||||
seek(chunk.size, Current);
|
||||
|
||||
// check padding
|
||||
chunk.name = chunkName;
|
||||
chunk.size = chunkSize;
|
||||
chunk.offset = offset + 8;
|
||||
chunk.padding = 0;
|
||||
long long uPosNotPadded = tell();
|
||||
if(uPosNotPadded & 1) {
|
||||
ByteVector iByte = readBlock(1);
|
||||
if((iByte.size() != 1) || (iByte[0] != 0)) {
|
||||
// not well formed, re-seek
|
||||
seek(uPosNotPadded, Beginning);
|
||||
}
|
||||
else {
|
||||
|
||||
offset = chunk.offset + chunk.size;
|
||||
|
||||
// Check padding
|
||||
|
||||
if(offset & 1) {
|
||||
seek(offset);
|
||||
const ByteVector iByte = readBlock(1);
|
||||
if(iByte.size() == 1 && iByte[0] == '\0') {
|
||||
chunk.padding = 1;
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -309,20 +353,26 @@ void RIFF::File::read()
|
||||
}
|
||||
|
||||
void RIFF::File::writeChunk(const ByteVector &name, const ByteVector &data,
|
||||
long long offset, size_t replace,
|
||||
unsigned int leadingPadding)
|
||||
long long offset, size_t replace)
|
||||
{
|
||||
ByteVector combined;
|
||||
if(leadingPadding) {
|
||||
combined.append(ByteVector(leadingPadding, '\x00'));
|
||||
}
|
||||
|
||||
combined.append(name);
|
||||
combined.append(fromUInt32(data.size(), d->endianness));
|
||||
combined.append(data);
|
||||
|
||||
if((data.size() & 0x01) != 0) {
|
||||
combined.append('\x00');
|
||||
}
|
||||
if(data.size() & 1)
|
||||
combined.resize(combined.size() + 1, '\0');
|
||||
|
||||
insert(combined, offset, replace);
|
||||
}
|
||||
|
||||
void RIFF::File::updateGlobalSize()
|
||||
{
|
||||
const Chunk first = d->chunks.front();
|
||||
const Chunk last = d->chunks.back();
|
||||
d->size = static_cast<unsigned int>(last.offset + last.size + last.padding - first.offset + 12);
|
||||
|
||||
const ByteVector data = fromUInt32(d->size, d->endianness);
|
||||
insert(data, d->sizeOffset, 4);
|
||||
}
|
||||
|
@ -142,8 +142,12 @@ namespace TagLib {
|
||||
|
||||
void read();
|
||||
void writeChunk(const ByteVector &name, const ByteVector &data,
|
||||
long long offset, size_t replace = 0,
|
||||
unsigned int leadingPadding = 0);
|
||||
long long offset, size_t replace = 0);
|
||||
|
||||
/*!
|
||||
* Update the global RIFF size based on the current internal structure.
|
||||
*/
|
||||
void updateGlobalSize();
|
||||
|
||||
class FilePrivate;
|
||||
FilePrivate *d;
|
||||
|
@ -34,18 +34,23 @@ namespace TagLib
|
||||
{
|
||||
namespace RIFF
|
||||
{
|
||||
inline bool isValidChunkName(const ByteVector &name)
|
||||
namespace
|
||||
{
|
||||
if(name.size() != 4)
|
||||
return false;
|
||||
|
||||
for(ByteVector::ConstIterator it = name.begin(); it != name.end(); ++it) {
|
||||
const int c = static_cast<unsigned char>(*it);
|
||||
if(c < 32 || 127 < c)
|
||||
inline bool isValidChunkName(const ByteVector &name)
|
||||
{
|
||||
if(name.size() != 4)
|
||||
return false;
|
||||
|
||||
for(ByteVector::ConstIterator it = name.begin(); it != name.end(); ++it) {
|
||||
const int c = static_cast<unsigned char>(*it);
|
||||
if(c < 32 || 127 < c)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,10 +15,15 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 "s3mfile.h"
|
||||
#include "tstringlist.h"
|
||||
#include "tdebug.h"
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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_S3MFILE_H
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,10 +15,15 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 "s3mproperties.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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_S3MPROPERTIES_H
|
||||
|
@ -28,7 +28,7 @@
|
||||
|
||||
#define TAGLIB_MAJOR_VERSION 1
|
||||
#define TAGLIB_MINOR_VERSION 11
|
||||
#define TAGLIB_PATCH_VERSION 0
|
||||
#define TAGLIB_PATCH_VERSION 1
|
||||
|
||||
#if (defined(_MSC_VER) && _MSC_VER >= 1600)
|
||||
#define TAGLIB_CONSTRUCT_BITSET(x) static_cast<unsigned long long>(x)
|
||||
@ -53,7 +53,9 @@ namespace TagLib
|
||||
LittleEndian,
|
||||
BigEndian
|
||||
};
|
||||
|
||||
class String;
|
||||
|
||||
namespace Version
|
||||
{
|
||||
/*!
|
||||
|
@ -23,10 +23,6 @@
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <limits>
|
||||
@ -35,10 +31,10 @@
|
||||
#include <cstring>
|
||||
#include <cstddef>
|
||||
|
||||
#include "tstring.h"
|
||||
#include "tdebug.h"
|
||||
#include "tsmartptr.h"
|
||||
#include "tutils.h"
|
||||
#include <tstring.h>
|
||||
#include <tdebug.h>
|
||||
#include <tsmartptr.h>
|
||||
#include <tutils.h>
|
||||
|
||||
#include "tbytevector.h"
|
||||
|
||||
@ -472,18 +468,34 @@ bool ByteVector::endsWith(const ByteVector &pattern) const
|
||||
return containsAt(pattern, size() - pattern.size());
|
||||
}
|
||||
|
||||
ByteVector &ByteVector::replace(char oldByte, char newByte)
|
||||
{
|
||||
detach();
|
||||
|
||||
for(ByteVector::Iterator it = begin(); it != end(); ++it) {
|
||||
if(*it == oldByte)
|
||||
*it = newByte;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
ByteVector &ByteVector::replace(const ByteVector &pattern, const ByteVector &with)
|
||||
{
|
||||
// TODO: This takes O(n!) time in the worst case. Rewrite it to run in O(n) time.
|
||||
|
||||
if(pattern.size() == 0 || pattern.size() > size())
|
||||
return *this;
|
||||
|
||||
if(pattern.size() == 1 && with.size() == 1)
|
||||
return replace(pattern[0], with[0]);
|
||||
|
||||
const size_t withSize = with.size();
|
||||
const size_t patternSize = pattern.size();
|
||||
const ptrdiff_t diff = withSize - patternSize;
|
||||
|
||||
size_t offset = 0;
|
||||
while (true)
|
||||
{
|
||||
while (true) {
|
||||
offset = find(pattern, offset);
|
||||
if(offset == npos())
|
||||
break;
|
||||
@ -535,12 +547,16 @@ size_t ByteVector::endsWithPartialMatch(const ByteVector &pattern) const
|
||||
|
||||
ByteVector &ByteVector::append(const ByteVector &v)
|
||||
{
|
||||
if(v.d->length != 0) {
|
||||
detach();
|
||||
size_t originalSize = size();
|
||||
resize(originalSize + v.size());
|
||||
::memcpy(data() + originalSize, v.data(), v.size());
|
||||
}
|
||||
if(v.isEmpty())
|
||||
return *this;
|
||||
|
||||
detach();
|
||||
|
||||
const size_t originalSize = size();
|
||||
const size_t appendSize = v.size();
|
||||
|
||||
resize(originalSize + appendSize);
|
||||
::memcpy(data() + originalSize, v.data(), appendSize);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -178,6 +178,12 @@ namespace TagLib {
|
||||
*/
|
||||
bool endsWith(const ByteVector &pattern) const;
|
||||
|
||||
/*!
|
||||
* Replaces \a oldByte with \a newByte and returns a reference to the
|
||||
* ByteVector after the operation. This \e does modify the vector.
|
||||
*/
|
||||
ByteVector &replace(char oldByte, char newByte);
|
||||
|
||||
/*!
|
||||
* Replaces \a pattern with \a with and returns a reference to the ByteVector
|
||||
* after the operation. This \e does modify the vector.
|
||||
|
@ -144,7 +144,7 @@ void ByteVectorStream::seek(long long offset, Position p)
|
||||
d->position += offset;
|
||||
break;
|
||||
case End:
|
||||
d->position = length() - offset;
|
||||
d->position = length() + offset; // offset is expected to be negative
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -27,6 +27,8 @@
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#if !defined(NDEBUG) || defined(TRACE_IN_RELEASE)
|
||||
|
||||
#include "tdebug.h"
|
||||
#include "tstring.h"
|
||||
#include "tutils.h"
|
||||
@ -42,17 +44,11 @@ namespace TagLib
|
||||
|
||||
void debug(const String &s)
|
||||
{
|
||||
#if !defined(NDEBUG) || defined(TRACE_IN_RELEASE)
|
||||
|
||||
debugListener->printMessage("TagLib: " + s + "\n");
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void debugData(const ByteVector &v)
|
||||
{
|
||||
#if !defined(NDEBUG) || defined(TRACE_IN_RELEASE)
|
||||
|
||||
for(size_t i = 0; i < v.size(); ++i)
|
||||
{
|
||||
std::string bits = std::bitset<8>(v[i]).to_string();
|
||||
@ -62,7 +58,7 @@ namespace TagLib
|
||||
|
||||
debugListener->printMessage(msg);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -32,10 +32,11 @@ namespace TagLib {
|
||||
class ByteVector;
|
||||
|
||||
#ifndef DO_NOT_DOCUMENT
|
||||
#if !defined(NDEBUG) || defined(TRACE_IN_RELEASE)
|
||||
|
||||
/*!
|
||||
* A simple function that outputs the debug messages to the listener.
|
||||
* The default listener redirects the messages to \a stderr when NDEBUG is
|
||||
* A simple function that outputs the debug messages to the listener.
|
||||
* The default listener redirects the messages to \a stderr when NDEBUG is
|
||||
* not defined.
|
||||
*
|
||||
* \warning Do not use this outside of TagLib, it could lead to undefined
|
||||
@ -45,7 +46,7 @@ namespace TagLib {
|
||||
* \internal
|
||||
*/
|
||||
void debug(const String &s);
|
||||
|
||||
|
||||
/*!
|
||||
* For debugging binary data.
|
||||
*
|
||||
@ -56,6 +57,13 @@ namespace TagLib {
|
||||
* \internal
|
||||
*/
|
||||
void debugData(const ByteVector &v);
|
||||
|
||||
#else
|
||||
|
||||
#define debug(x) ((void)0)
|
||||
#define debugData(x) ((void)0)
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -52,24 +52,28 @@ namespace
|
||||
|
||||
const FileHandle InvalidFileHandle = INVALID_HANDLE_VALUE;
|
||||
|
||||
inline FileHandle openFile(const FileName &path, bool readOnly)
|
||||
FileHandle openFile(const FileName &path, bool readOnly)
|
||||
{
|
||||
const DWORD access = readOnly ? GENERIC_READ : (GENERIC_READ | GENERIC_WRITE);
|
||||
|
||||
#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)
|
||||
return CreateFile2(path.toString().toCWString(), access, FILE_SHARE_READ, OPEN_EXISTING, NULL);
|
||||
#else
|
||||
if(!path.wstr().empty())
|
||||
return CreateFileW(path.wstr().c_str(), access, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
else if(!path.str().empty())
|
||||
return CreateFileA(path.str().c_str(), access, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL);
|
||||
else
|
||||
return InvalidFileHandle;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline void closeFile(FileHandle file)
|
||||
void closeFile(FileHandle file)
|
||||
{
|
||||
CloseHandle(file);
|
||||
}
|
||||
|
||||
inline size_t readFile(FileHandle file, ByteVector &buffer)
|
||||
size_t readFile(FileHandle file, ByteVector &buffer)
|
||||
{
|
||||
DWORD length;
|
||||
if(ReadFile(file, buffer.data(), static_cast<DWORD>(buffer.size()), &length, NULL))
|
||||
@ -78,7 +82,7 @@ namespace
|
||||
return 0;
|
||||
}
|
||||
|
||||
inline size_t writeFile(FileHandle file, const ByteVector &buffer)
|
||||
size_t writeFile(FileHandle file, const ByteVector &buffer)
|
||||
{
|
||||
DWORD length;
|
||||
if(WriteFile(file, buffer.data(), static_cast<DWORD>(buffer.size()), &length, NULL))
|
||||
@ -99,22 +103,22 @@ namespace
|
||||
|
||||
const FileHandle InvalidFileHandle = 0;
|
||||
|
||||
inline FileHandle openFile(const FileName &path, bool readOnly)
|
||||
FileHandle openFile(const FileName &path, bool readOnly)
|
||||
{
|
||||
return fopen(path, readOnly ? "rb" : "rb+");
|
||||
}
|
||||
|
||||
inline void closeFile(FileHandle file)
|
||||
void closeFile(FileHandle file)
|
||||
{
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
inline size_t readFile(FileHandle file, ByteVector &buffer)
|
||||
size_t readFile(FileHandle file, ByteVector &buffer)
|
||||
{
|
||||
return fread(buffer.data(), sizeof(char), buffer.size(), file);
|
||||
}
|
||||
|
||||
inline size_t writeFile(FileHandle file, const ByteVector &buffer)
|
||||
size_t writeFile(FileHandle file, const ByteVector &buffer)
|
||||
{
|
||||
return fwrite(buffer.data(), sizeof(char), buffer.size(), file);
|
||||
}
|
||||
@ -446,13 +450,16 @@ long long FileStream::length()
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
LARGE_INTEGER fileSize;
|
||||
fileSize.QuadPart = 0;
|
||||
|
||||
SetLastError(NO_ERROR);
|
||||
fileSize.LowPart = GetFileSize(d->file, reinterpret_cast<LPDWORD>(&fileSize.HighPart));
|
||||
#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0602)
|
||||
LARGE_INTEGER fileSize;
|
||||
GetFileSizeEx(d->file, &fileSize);
|
||||
#else
|
||||
ULARGE_INTEGER fileSize;
|
||||
fileSize.LowPart = GetFileSize(d->file, &fileSize.HighPart);
|
||||
#endif
|
||||
if(GetLastError() == NO_ERROR) {
|
||||
return fileSize.QuadPart;
|
||||
return static_cast<long long>(fileSize.QuadPart);
|
||||
}
|
||||
else {
|
||||
debug("FileStream::length() -- Failed to get the file size.");
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,10 +15,15 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 "tpropertymap.h"
|
||||
using namespace TagLib;
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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_PROPERTYMAP_H_
|
||||
|
@ -25,16 +25,6 @@
|
||||
|
||||
// This class assumes that std::basic_string<T> has a contiguous and null-terminated buffer.
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <tstring.h>
|
||||
#include <tdebug.h>
|
||||
#include <tstringlist.h>
|
||||
#include <tsmartptr.h>
|
||||
#include <tutils.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cwchar>
|
||||
@ -47,12 +37,18 @@
|
||||
# include "unicode.h"
|
||||
#endif
|
||||
|
||||
#include <tdebug.h>
|
||||
#include <tstringlist.h>
|
||||
#include <tsmartptr.h>
|
||||
#include <tutils.h>
|
||||
|
||||
#include "tstring.h"
|
||||
|
||||
namespace
|
||||
{
|
||||
using namespace TagLib;
|
||||
|
||||
inline size_t UTF16toUTF8(
|
||||
const wchar_t *src, size_t srcLength, char *dst, size_t dstLength)
|
||||
size_t UTF16toUTF8(const wchar_t *src, size_t srcLength, char *dst, size_t dstLength)
|
||||
{
|
||||
size_t len = 0;
|
||||
|
||||
@ -85,8 +81,7 @@ namespace
|
||||
return len;
|
||||
}
|
||||
|
||||
inline size_t UTF8toUTF16(
|
||||
const char *src, size_t srcLength, wchar_t *dst, size_t dstLength)
|
||||
size_t UTF8toUTF16(const char *src, size_t srcLength, wchar_t *dst, size_t dstLength)
|
||||
{
|
||||
size_t len = 0;
|
||||
|
||||
@ -120,7 +115,7 @@ namespace
|
||||
}
|
||||
|
||||
// Returns the native format of std::wstring.
|
||||
inline String::Type wcharByteOrder()
|
||||
String::Type wcharByteOrder()
|
||||
{
|
||||
if(Utils::systemByteOrder() == LittleEndian)
|
||||
return String::UTF16LE;
|
||||
@ -130,7 +125,7 @@ namespace
|
||||
|
||||
// Converts a Latin-1 string into UTF-16(without BOM/CPU byte order)
|
||||
// and copies it to the internal buffer.
|
||||
inline void copyFromLatin1(std::wstring &data, const char *s, size_t length)
|
||||
void copyFromLatin1(std::wstring &data, const char *s, size_t length)
|
||||
{
|
||||
data.resize(length);
|
||||
|
||||
@ -140,7 +135,7 @@ namespace
|
||||
|
||||
// Converts a UTF-8 string into UTF-16(without BOM/CPU byte order)
|
||||
// and copies it to the internal buffer.
|
||||
inline void copyFromUTF8(std::wstring &data, const char *s, size_t length)
|
||||
void copyFromUTF8(std::wstring &data, const char *s, size_t length)
|
||||
{
|
||||
data.resize(length);
|
||||
|
||||
@ -152,7 +147,7 @@ namespace
|
||||
|
||||
// Converts a UTF-16 (with BOM), UTF-16LE or UTF16-BE string into
|
||||
// UTF-16(without BOM/CPU byte order) and copies it to the internal buffer.
|
||||
inline void copyFromUTF16(std::wstring &data, const wchar_t *s, size_t length, String::Type t)
|
||||
void copyFromUTF16(std::wstring &data, const wchar_t *s, size_t length, String::Type t)
|
||||
{
|
||||
bool swap;
|
||||
if(t == String::UTF16) {
|
||||
@ -186,7 +181,7 @@ namespace
|
||||
|
||||
// Converts a UTF-16 (with BOM), UTF-16LE or UTF16-BE string into
|
||||
// UTF-16(without BOM/CPU byte order) and copies it to the internal buffer.
|
||||
inline void copyFromUTF16(std::wstring &data, const char *s, size_t length, String::Type t)
|
||||
void copyFromUTF16(std::wstring &data, const char *s, size_t length, String::Type t)
|
||||
{
|
||||
bool swap;
|
||||
if(t == String::UTF16) {
|
||||
|
@ -55,224 +55,226 @@ namespace TagLib
|
||||
{
|
||||
namespace Utils
|
||||
{
|
||||
|
||||
/*!
|
||||
* Reverses the order of bytes in an 16-bit integer.
|
||||
*/
|
||||
inline unsigned short byteSwap(unsigned short x)
|
||||
namespace
|
||||
{
|
||||
|
||||
/*!
|
||||
* Reverses the order of bytes in an 16-bit integer.
|
||||
*/
|
||||
inline unsigned short byteSwap(unsigned short x)
|
||||
{
|
||||
#if defined(HAVE_BOOST_BYTESWAP)
|
||||
|
||||
return boost::endian::endian_reverse(static_cast<uint16_t>(x));
|
||||
return boost::endian::endian_reverse(static_cast<uint16_t>(x));
|
||||
|
||||
#elif defined(HAVE_GCC_BYTESWAP)
|
||||
|
||||
return __builtin_bswap16(x);
|
||||
return __builtin_bswap16(x);
|
||||
|
||||
#elif defined(HAVE_MSC_BYTESWAP)
|
||||
|
||||
return _byteswap_ushort(x);
|
||||
return _byteswap_ushort(x);
|
||||
|
||||
#elif defined(HAVE_GLIBC_BYTESWAP)
|
||||
|
||||
return __bswap_16(x);
|
||||
return __bswap_16(x);
|
||||
|
||||
#elif defined(HAVE_MAC_BYTESWAP)
|
||||
|
||||
return OSSwapInt16(x);
|
||||
return OSSwapInt16(x);
|
||||
|
||||
#elif defined(HAVE_OPENBSD_BYTESWAP)
|
||||
|
||||
return swap16(x);
|
||||
return swap16(x);
|
||||
|
||||
#else
|
||||
|
||||
return ((x >> 8) & 0xff) | ((x & 0xff) << 8);
|
||||
return ((x >> 8) & 0xff) | ((x & 0xff) << 8);
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Reverses the order of bytes in an 32-bit integer.
|
||||
*/
|
||||
inline unsigned int byteSwap(unsigned int x)
|
||||
{
|
||||
/*!
|
||||
* Reverses the order of bytes in an 32-bit integer.
|
||||
*/
|
||||
inline unsigned int byteSwap(unsigned int x)
|
||||
{
|
||||
#if defined(HAVE_BOOST_BYTESWAP)
|
||||
|
||||
return boost::endian::endian_reverse(static_cast<uint32_t>(x));
|
||||
return boost::endian::endian_reverse(static_cast<uint32_t>(x));
|
||||
|
||||
#elif defined(HAVE_GCC_BYTESWAP)
|
||||
|
||||
return __builtin_bswap32(x);
|
||||
return __builtin_bswap32(x);
|
||||
|
||||
#elif defined(HAVE_MSC_BYTESWAP)
|
||||
|
||||
return _byteswap_ulong(x);
|
||||
return _byteswap_ulong(x);
|
||||
|
||||
#elif defined(HAVE_GLIBC_BYTESWAP)
|
||||
|
||||
return __bswap_32(x);
|
||||
return __bswap_32(x);
|
||||
|
||||
#elif defined(HAVE_MAC_BYTESWAP)
|
||||
|
||||
return OSSwapInt32(x);
|
||||
return OSSwapInt32(x);
|
||||
|
||||
#elif defined(HAVE_OPENBSD_BYTESWAP)
|
||||
|
||||
return swap32(x);
|
||||
return swap32(x);
|
||||
|
||||
#else
|
||||
|
||||
return ((x & 0xff000000u) >> 24)
|
||||
| ((x & 0x00ff0000u) >> 8)
|
||||
| ((x & 0x0000ff00u) << 8)
|
||||
| ((x & 0x000000ffu) << 24);
|
||||
return ((x & 0xff000000u) >> 24)
|
||||
| ((x & 0x00ff0000u) >> 8)
|
||||
| ((x & 0x0000ff00u) << 8)
|
||||
| ((x & 0x000000ffu) << 24);
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Reverses the order of bytes in an 64-bit integer.
|
||||
*/
|
||||
inline unsigned long long byteSwap(unsigned long long x)
|
||||
{
|
||||
/*!
|
||||
* Reverses the order of bytes in an 64-bit integer.
|
||||
*/
|
||||
inline unsigned long long byteSwap(unsigned long long x)
|
||||
{
|
||||
#if defined(HAVE_BOOST_BYTESWAP)
|
||||
|
||||
return boost::endian::endian_reverse(static_cast<uint64_t>(x));
|
||||
return boost::endian::endian_reverse(static_cast<uint64_t>(x));
|
||||
|
||||
#elif defined(HAVE_GCC_BYTESWAP)
|
||||
|
||||
return __builtin_bswap64(x);
|
||||
return __builtin_bswap64(x);
|
||||
|
||||
#elif defined(HAVE_MSC_BYTESWAP)
|
||||
|
||||
return _byteswap_uint64(x);
|
||||
return _byteswap_uint64(x);
|
||||
|
||||
#elif defined(HAVE_GLIBC_BYTESWAP)
|
||||
|
||||
return __bswap_64(x);
|
||||
return __bswap_64(x);
|
||||
|
||||
#elif defined(HAVE_MAC_BYTESWAP)
|
||||
|
||||
return OSSwapInt64(x);
|
||||
return OSSwapInt64(x);
|
||||
|
||||
#elif defined(HAVE_OPENBSD_BYTESWAP)
|
||||
|
||||
return swap64(x);
|
||||
return swap64(x);
|
||||
|
||||
#else
|
||||
|
||||
return ((x & 0xff00000000000000ull) >> 56)
|
||||
| ((x & 0x00ff000000000000ull) >> 40)
|
||||
| ((x & 0x0000ff0000000000ull) >> 24)
|
||||
| ((x & 0x000000ff00000000ull) >> 8)
|
||||
| ((x & 0x00000000ff000000ull) << 8)
|
||||
| ((x & 0x0000000000ff0000ull) << 24)
|
||||
| ((x & 0x000000000000ff00ull) << 40)
|
||||
| ((x & 0x00000000000000ffull) << 56);
|
||||
return ((x & 0xff00000000000000ull) >> 56)
|
||||
| ((x & 0x00ff000000000000ull) >> 40)
|
||||
| ((x & 0x0000ff0000000000ull) >> 24)
|
||||
| ((x & 0x000000ff00000000ull) >> 8)
|
||||
| ((x & 0x00000000ff000000ull) << 8)
|
||||
| ((x & 0x0000000000ff0000ull) << 24)
|
||||
| ((x & 0x000000000000ff00ull) << 40)
|
||||
| ((x & 0x00000000000000ffull) << 56);
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns a formatted string just like standard sprintf(), but makes use of
|
||||
* safer functions such as snprintf() if available.
|
||||
*/
|
||||
inline String formatString(const char *format, ...)
|
||||
{
|
||||
// Sufficient buffer size for the current internal uses.
|
||||
// Consider changing this value when you use this function.
|
||||
/*!
|
||||
* Returns a formatted string just like standard sprintf(), but makes use of
|
||||
* safer functions such as snprintf() if available.
|
||||
*/
|
||||
inline String formatString(const char *format, ...)
|
||||
{
|
||||
// Sufficient buffer size for the current internal uses.
|
||||
// Consider changing this value when you use this function.
|
||||
|
||||
static const size_t BufferSize = 128;
|
||||
static const size_t BufferSize = 128;
|
||||
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
|
||||
char buf[BufferSize];
|
||||
int length;
|
||||
char buf[BufferSize];
|
||||
int length;
|
||||
|
||||
#if defined(HAVE_VSNPRINTF)
|
||||
|
||||
length = vsnprintf(buf, BufferSize, format, args);
|
||||
length = vsnprintf(buf, BufferSize, format, args);
|
||||
|
||||
#elif defined(HAVE_VSPRINTF_S)
|
||||
|
||||
length = vsprintf_s(buf, format, args);
|
||||
length = vsprintf_s(buf, format, args);
|
||||
|
||||
#else
|
||||
|
||||
// The last resort. May cause a buffer overflow.
|
||||
// The last resort. May cause a buffer overflow.
|
||||
|
||||
length = vsprintf(buf, format, args);
|
||||
if(length >= BufferSize) {
|
||||
debug("Utils::formatString() - Buffer overflow! Returning an empty string.");
|
||||
length = -1;
|
||||
}
|
||||
length = vsprintf(buf, format, args);
|
||||
if(length >= BufferSize) {
|
||||
debug("Utils::formatString() - Buffer overflow! Returning an empty string.");
|
||||
length = -1;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
va_end(args);
|
||||
|
||||
if(length > 0)
|
||||
return String(buf);
|
||||
else
|
||||
return String();
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns whether the two strings s1 and s2 are equal, ignoring the case of
|
||||
* the characters.
|
||||
*
|
||||
* We took the trouble to define this one here, since there are some
|
||||
* incompatible variations of case insensitive strcmp().
|
||||
*/
|
||||
inline bool equalsIgnoreCase(const char *s1, const char *s2)
|
||||
{
|
||||
while(*s1 != '\0' && *s2 != '\0' && ::tolower(*s1) == ::tolower(*s2)) {
|
||||
s1++;
|
||||
s2++;
|
||||
if(length > 0)
|
||||
return String(buf);
|
||||
else
|
||||
return String();
|
||||
}
|
||||
|
||||
return (*s1 == '\0' && *s2 == '\0');
|
||||
/*!
|
||||
* Returns whether the two strings s1 and s2 are equal, ignoring the case of
|
||||
* the characters.
|
||||
*
|
||||
* We took the trouble to define this one here, since there are some
|
||||
* incompatible variations of case insensitive strcmp().
|
||||
*/
|
||||
inline bool equalsIgnoreCase(const char *s1, const char *s2)
|
||||
{
|
||||
while(*s1 != '\0' && *s2 != '\0' && ::tolower(*s1) == ::tolower(*s2)) {
|
||||
s1++;
|
||||
s2++;
|
||||
}
|
||||
|
||||
return (*s1 == '\0' && *s2 == '\0');
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns the integer byte order of the system.
|
||||
*/
|
||||
inline ByteOrder systemByteOrder()
|
||||
{
|
||||
union {
|
||||
int i;
|
||||
char c;
|
||||
} u;
|
||||
|
||||
u.i = 1;
|
||||
if(u.c == 1)
|
||||
return LittleEndian;
|
||||
else
|
||||
return BigEndian;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns the IEEE754 byte order of the system.
|
||||
*/
|
||||
inline ByteOrder floatByteOrder()
|
||||
{
|
||||
union {
|
||||
double d;
|
||||
char c;
|
||||
} u;
|
||||
|
||||
// 1.0 is stored in memory like 0x3FF0000000000000 in canonical form.
|
||||
// So the first byte is zero if little endian.
|
||||
|
||||
u.d = 1.0;
|
||||
if(u.c == 0)
|
||||
return LittleEndian;
|
||||
else
|
||||
return BigEndian;
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns the integer byte order of the system.
|
||||
*/
|
||||
inline ByteOrder systemByteOrder()
|
||||
{
|
||||
union {
|
||||
int i;
|
||||
char c;
|
||||
} u;
|
||||
|
||||
u.i = 1;
|
||||
if(u.c == 1)
|
||||
return LittleEndian;
|
||||
else
|
||||
return BigEndian;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Returns the IEEE754 byte order of the system.
|
||||
*/
|
||||
inline ByteOrder floatByteOrder()
|
||||
{
|
||||
union {
|
||||
double d;
|
||||
char c;
|
||||
} u;
|
||||
|
||||
// 1.0 is stored in memory like 0x3FF0000000000000 in canonical form.
|
||||
// So the first byte is zero if little endian.
|
||||
|
||||
u.d = 1.0;
|
||||
if(u.c == 0)
|
||||
return LittleEndian;
|
||||
else
|
||||
return BigEndian;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
142
taglib/toolkit/tzlib.cpp
Normal file
142
taglib/toolkit/tzlib.cpp
Normal file
@ -0,0 +1,142 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2016 by Tsuda Kageyu
|
||||
email : tsuda.kageyu@gmail.com
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 2.1 as published by the Free Software Foundation. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this library; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
|
||||
* 02110-1301 USA *
|
||||
* *
|
||||
* Alternatively, this file is available under the Mozilla Public *
|
||||
* License Version 1.1. You may obtain a copy of the License at *
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_ZLIB)
|
||||
# include <zlib.h>
|
||||
#elif defined(HAVE_BOOST_ZLIB)
|
||||
# include <boost/iostreams/filtering_streambuf.hpp>
|
||||
# include <boost/iostreams/filter/zlib.hpp>
|
||||
#endif
|
||||
|
||||
#include <tstring.h>
|
||||
#include <tdebug.h>
|
||||
|
||||
#include "tzlib.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
bool zlib::isAvailable()
|
||||
{
|
||||
#if defined(HAVE_ZLIB) || defined(HAVE_BOOST_ZLIB)
|
||||
|
||||
return true;
|
||||
|
||||
#else
|
||||
|
||||
return false;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
ByteVector zlib::decompress(const ByteVector &data)
|
||||
{
|
||||
#if defined(HAVE_ZLIB)
|
||||
|
||||
z_stream stream = {};
|
||||
|
||||
if(inflateInit(&stream) != Z_OK) {
|
||||
debug("zlib::decompress() - Failed to initizlize zlib.");
|
||||
return ByteVector();
|
||||
}
|
||||
|
||||
ByteVector inData = data;
|
||||
|
||||
stream.avail_in = static_cast<uInt>(inData.size());
|
||||
stream.next_in = reinterpret_cast<Bytef *>(inData.data());
|
||||
|
||||
const unsigned int chunkSize = 1024;
|
||||
|
||||
ByteVector outData;
|
||||
|
||||
do {
|
||||
const size_t offset = outData.size();
|
||||
outData.resize(outData.size() + chunkSize);
|
||||
|
||||
stream.avail_out = static_cast<uInt>(chunkSize);
|
||||
stream.next_out = reinterpret_cast<Bytef *>(outData.data() + offset);
|
||||
|
||||
const int result = inflate(&stream, Z_NO_FLUSH);
|
||||
|
||||
if(result == Z_STREAM_ERROR ||
|
||||
result == Z_NEED_DICT ||
|
||||
result == Z_DATA_ERROR ||
|
||||
result == Z_MEM_ERROR)
|
||||
{
|
||||
if(result != Z_STREAM_ERROR)
|
||||
inflateEnd(&stream);
|
||||
|
||||
debug("zlib::decompress() - Error reading compressed stream.");
|
||||
return ByteVector();
|
||||
}
|
||||
|
||||
outData.resize(outData.size() - stream.avail_out);
|
||||
} while(stream.avail_out == 0);
|
||||
|
||||
inflateEnd(&stream);
|
||||
|
||||
return outData;
|
||||
|
||||
#elif defined(HAVE_BOOST_ZLIB)
|
||||
|
||||
using namespace boost::iostreams;
|
||||
|
||||
struct : public sink
|
||||
{
|
||||
ByteVector data;
|
||||
|
||||
typedef char char_type;
|
||||
typedef sink_tag category;
|
||||
|
||||
std::streamsize write(char const* s, std::streamsize n)
|
||||
{
|
||||
const unsigned int originalSize = data.size();
|
||||
|
||||
data.resize(static_cast<unsigned int>(originalSize + n));
|
||||
::memcpy(data.data() + originalSize, s, static_cast<size_t>(n));
|
||||
|
||||
return n;
|
||||
}
|
||||
} sink;
|
||||
|
||||
try {
|
||||
zlib_decompressor().write(sink, data.data(), data.size());
|
||||
}
|
||||
catch(const zlib_error &) {
|
||||
debug("zlib::decompress() - Error reading compressed stream.");
|
||||
return ByteVector();
|
||||
}
|
||||
|
||||
return sink.data;
|
||||
|
||||
#else
|
||||
|
||||
return ByteVector();
|
||||
|
||||
#endif
|
||||
}
|
54
taglib/toolkit/tzlib.h
Normal file
54
taglib/toolkit/tzlib.h
Normal file
@ -0,0 +1,54 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2016 by Tsuda Kageyu
|
||||
email : tsuda.kageyu@gmail.com
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 2.1 as published by the Free Software Foundation. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this library; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
|
||||
* 02110-1301 USA *
|
||||
* *
|
||||
* Alternatively, this file is available under the Mozilla Public *
|
||||
* License Version 1.1. You may obtain a copy of the License at *
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef TAGLIB_TZLIB_H
|
||||
#define TAGLIB_TZLIB_H
|
||||
|
||||
#include <tbytevector.h>
|
||||
|
||||
// THIS FILE IS NOT A PART OF THE TAGLIB API
|
||||
|
||||
#ifndef DO_NOT_DOCUMENT // tell Doxygen not to document this header
|
||||
|
||||
namespace TagLib {
|
||||
|
||||
namespace zlib {
|
||||
|
||||
/*!
|
||||
* Returns whether or not zlib is installed and ready to use.
|
||||
*/
|
||||
bool isAvailable();
|
||||
|
||||
/*!
|
||||
* Decompress \a data by zlib.
|
||||
*/
|
||||
ByteVector decompress(const ByteVector &data);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 "tstringlist.h"
|
||||
@ -129,11 +133,11 @@ namespace
|
||||
{
|
||||
ByteVector data = file.readBlock(std::min(m_size, limit));
|
||||
size_t count = data.size();
|
||||
const size_t index = data.find((char) 0);
|
||||
if(index != ByteVector::npos()) {
|
||||
int index = data.find((char) 0);
|
||||
if(index > -1) {
|
||||
data.resize(index);
|
||||
}
|
||||
data.replace((char) 0xff, ' ');
|
||||
data.replace('\xff', ' ');
|
||||
value = data;
|
||||
return static_cast<unsigned int>(count);
|
||||
}
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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_XMFILE_H
|
||||
|
@ -1,11 +1,11 @@
|
||||
/***************************************************************************
|
||||
copyright :(C) 2011 by Mathias Panzenböck
|
||||
copyright : (C) 2011 by Mathias Panzenböck
|
||||
email : grosser.meister.morti@gmx.net
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,10 +15,15 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 "xmproperties.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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_XMPROPERTIES_H
|
||||
|
Binary file not shown.
BIN
tests/data/toc_many_children.mp3
Normal file
BIN
tests/data/toc_many_children.mp3
Normal file
Binary file not shown.
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2007 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <fstream>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2009 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2010 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <apetag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2010 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2008 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
|
@ -1,28 +1,30 @@
|
||||
/* Copyright (C) 2003 Scott Wheeler <wheeler@kde.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/***************************************************************************
|
||||
copyright : (C) 2007 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
#include <cstring>
|
||||
/***************************************************************************
|
||||
* 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/ *
|
||||
***************************************************************************/
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <cmath>
|
||||
#include <tbytevector.h>
|
||||
#include <tbytevectorlist.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
@ -36,47 +38,35 @@ class TestByteVector : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testByteVector);
|
||||
CPPUNIT_TEST(testFind1);
|
||||
CPPUNIT_TEST(testFind2);
|
||||
CPPUNIT_TEST(testFind3);
|
||||
CPPUNIT_TEST(testRfind1);
|
||||
CPPUNIT_TEST(testRfind2);
|
||||
CPPUNIT_TEST(testRfind3);
|
||||
CPPUNIT_TEST(testToHex);
|
||||
CPPUNIT_TEST(testNumericCoversion);
|
||||
CPPUNIT_TEST(testIntegerConversion);
|
||||
CPPUNIT_TEST(testFloatingPointConversion);
|
||||
CPPUNIT_TEST(testReplace);
|
||||
CPPUNIT_TEST(testIterator);
|
||||
CPPUNIT_TEST(testResize);
|
||||
CPPUNIT_TEST(testAppend);
|
||||
CPPUNIT_TEST(testAppend1);
|
||||
CPPUNIT_TEST(testAppend2);
|
||||
CPPUNIT_TEST(testBase64);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
|
||||
void testByteVector()
|
||||
{
|
||||
ByteVector v("foobar");
|
||||
|
||||
CPPUNIT_ASSERT(v.find("ob") == 2);
|
||||
CPPUNIT_ASSERT(v.find('b') == 3);
|
||||
|
||||
ByteVector a1("foo");
|
||||
a1.append("bar");
|
||||
CPPUNIT_ASSERT(a1 == "foobar");
|
||||
|
||||
ByteVector a2("foo");
|
||||
a2.append("b");
|
||||
CPPUNIT_ASSERT(a2 == "foob");
|
||||
|
||||
ByteVector a3;
|
||||
a3.append("b");
|
||||
CPPUNIT_ASSERT(a3 == "b");
|
||||
|
||||
ByteVector s1("foo");
|
||||
CPPUNIT_ASSERT(ByteVectorList::split(s1, " ").size() == 1);
|
||||
|
||||
ByteVector s2("f");
|
||||
CPPUNIT_ASSERT(ByteVectorList::split(s2, " ").size() == 1);
|
||||
|
||||
CPPUNIT_ASSERT(ByteVector().size() == 0);
|
||||
CPPUNIT_ASSERT(ByteVector("asdf").clear().size() == 0);
|
||||
CPPUNIT_ASSERT(ByteVector("asdf").clear() == ByteVector());
|
||||
CPPUNIT_ASSERT(ByteVector().isEmpty());
|
||||
CPPUNIT_ASSERT_EQUAL(0U, ByteVector().size());
|
||||
CPPUNIT_ASSERT(ByteVector("asdf").clear().isEmpty());
|
||||
CPPUNIT_ASSERT_EQUAL(0U, ByteVector("asdf").clear().size());
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector(), ByteVector("asdf").clear());
|
||||
|
||||
ByteVector i("blah blah");
|
||||
ByteVector j("blah");
|
||||
@ -116,6 +106,20 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector::npos(), ByteVector("\x01\x02", 2).find("\x01\x03"));
|
||||
}
|
||||
|
||||
void testFind3()
|
||||
{
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)4, ByteVector("....SggO."). find('S'));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)4, ByteVector("....SggO."). find('S', 0));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)4, ByteVector("....SggO."). find('S', 1));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)4, ByteVector("....SggO."). find('S', 2));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)4, ByteVector("....SggO."). find('S', 3));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)4, ByteVector("....SggO."). find('S', 4));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector::npos(), ByteVector("....SggO."). find('S', 5));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector::npos(), ByteVector("....SggO."). find('S', 6));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector::npos(), ByteVector("....SggO."). find('S', 7));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector::npos(), ByteVector("....SggO."). find('S', 8));
|
||||
}
|
||||
|
||||
void testRfind1()
|
||||
{
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, ByteVector(".OggS....").rfind("OggS", 0));
|
||||
@ -152,6 +156,20 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)10, r4.rfind("OggS", 12));
|
||||
}
|
||||
|
||||
void testRfind3()
|
||||
{
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, ByteVector(".OggS....").rfind('O', 0));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, ByteVector(".OggS....").rfind('O', 1));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, ByteVector(".OggS....").rfind('O', 2));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, ByteVector(".OggS....").rfind('O', 3));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, ByteVector(".OggS....").rfind('O', 4));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, ByteVector(".OggS....").rfind('O', 5));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, ByteVector(".OggS....").rfind('O', 6));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, ByteVector(".OggS....").rfind('O', 7));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, ByteVector(".OggS....").rfind('O', 8));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, ByteVector(".OggS....").rfind('O'));
|
||||
}
|
||||
|
||||
void testToHex()
|
||||
{
|
||||
ByteVector v("\xf0\xe1\xd2\xc3\xb4\xa5\x96\x87\x78\x69\x5a\x4b\x3c\x2d\x1e\x0f", 16);
|
||||
@ -159,77 +177,71 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("f0e1d2c3b4a5968778695a4b3c2d1e0f"), v.toHex());
|
||||
}
|
||||
|
||||
void testNumericCoversion()
|
||||
void testIntegerConversion()
|
||||
{
|
||||
// n = { 0x00, 0x88, 0x11, 0x99, ..., 0x77, 0xFF }
|
||||
ByteVector n(16, 0);
|
||||
for(size_t i = 0; i < 8; ++i) {
|
||||
n[i * 2 ] = static_cast<unsigned char>(0x11 * i);
|
||||
n[i * 2 + 1] = static_cast<unsigned char>(0x11 * (i + 8));
|
||||
}
|
||||
const ByteVector data("\x00\xff\x01\xff\x00\xff\x01\xff\x00\xff\x01\xff\x00\xff", 14);
|
||||
|
||||
CPPUNIT_ASSERT(n.toUInt16LE(1) == 4488);
|
||||
CPPUNIT_ASSERT(n.toUInt16BE(2) == 4505);
|
||||
CPPUNIT_ASSERT(n.toUInt24LE(3) == 11149977);
|
||||
CPPUNIT_ASSERT(n.toUInt24BE(4) == 2271795);
|
||||
CPPUNIT_ASSERT(n.toUInt32LE(5) == 1153119146);
|
||||
CPPUNIT_ASSERT(n.toUInt32BE(6) == 867910860);
|
||||
CPPUNIT_ASSERT(n.toInt16LE(3) == 8857);
|
||||
CPPUNIT_ASSERT(n.toInt16BE(7) == -17596);
|
||||
CPPUNIT_ASSERT(n.toInt16LE(10) == -8875);
|
||||
CPPUNIT_ASSERT(n.toInt16BE(14) == 30719);
|
||||
CPPUNIT_ASSERT(n.toInt64LE(5) == 7412174897536512938ll);
|
||||
CPPUNIT_ASSERT(n.toInt64BE(3) == -7412174897536512939ll);
|
||||
CPPUNIT_ASSERT(n.toInt64LE(6) == -1268082884489200845ll);
|
||||
CPPUNIT_ASSERT(n.toInt64BE(4) == 2497865822736504285ll);
|
||||
CPPUNIT_ASSERT_EQUAL((short)0x00ff, data.toInt16BE(0));
|
||||
CPPUNIT_ASSERT_EQUAL((short)0xff00, data.toInt16LE(0));
|
||||
CPPUNIT_ASSERT_EQUAL((short)0xff01, data.toInt16BE(5));
|
||||
CPPUNIT_ASSERT_EQUAL((short)0x01ff, data.toInt16LE(5));
|
||||
CPPUNIT_ASSERT_EQUAL((short)0xff, data.toInt16BE(13));
|
||||
CPPUNIT_ASSERT_EQUAL((short)0xff, data.toInt16LE(13));
|
||||
|
||||
CPPUNIT_ASSERT(ByteVector::fromUInt16LE(n.toInt16LE(5)) == n.mid(5, 2));
|
||||
CPPUNIT_ASSERT(ByteVector::fromUInt16BE(n.toInt16BE(9)) == n.mid(9, 2));
|
||||
CPPUNIT_ASSERT(ByteVector::fromUInt32LE(n.toUInt32LE(4)) == n.mid(4, 4));
|
||||
CPPUNIT_ASSERT(ByteVector::fromUInt32BE(n.toUInt32BE(7)) == n.mid(7, 4));
|
||||
CPPUNIT_ASSERT(ByteVector::fromUInt64LE(n.toInt64LE(1)) == n.mid(1, 8));
|
||||
CPPUNIT_ASSERT(ByteVector::fromUInt64BE(n.toInt64BE(6)) == n.mid(6, 8));
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned short)0x00ff, data.toUInt16BE(0));
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned short)0xff00, data.toUInt16LE(0));
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned short)0xff01, data.toUInt16BE(5));
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned short)0x01ff, data.toUInt16LE(5));
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned short)0xff, data.toUInt16BE(13));
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned short)0xff, data.toUInt16LE(13));
|
||||
|
||||
CPPUNIT_ASSERT(ByteVector::fromUInt16LE(4386) == ByteVector::fromUInt16BE(8721));
|
||||
CPPUNIT_ASSERT(ByteVector::fromUInt32LE(287454020) == ByteVector::fromUInt32BE(1144201745));
|
||||
CPPUNIT_ASSERT(ByteVector::fromUInt64LE(1234605615291183940ll) == ByteVector::fromUInt64BE(4914309075945333265ll));
|
||||
CPPUNIT_ASSERT_EQUAL(0x00ff01ffU, data.toUInt32BE(0));
|
||||
CPPUNIT_ASSERT_EQUAL(0xff01ff00U, data.toUInt32LE(0));
|
||||
CPPUNIT_ASSERT_EQUAL(0xff01ff00U, data.toUInt32BE(5));
|
||||
CPPUNIT_ASSERT_EQUAL(0x00ff01ffU, data.toUInt32LE(5));
|
||||
CPPUNIT_ASSERT_EQUAL(0x00ffU, data.toUInt32BE(12));
|
||||
CPPUNIT_ASSERT_EQUAL(0xff00U, data.toUInt32LE(12));
|
||||
|
||||
const unsigned char PI32LE[] = { 0x00, 0xdb, 0x0f, 0x49, 0x40 };
|
||||
const unsigned char PI32BE[] = { 0x00, 0x40, 0x49, 0x0f, 0xdb };
|
||||
const unsigned char PI64LE[] = { 0x00, 0x18, 0x2d, 0x44, 0x54, 0xfb, 0x21, 0x09, 0x40 };
|
||||
const unsigned char PI64BE[] = { 0x00, 0x40, 0x09, 0x21, 0xfb, 0x54, 0x44, 0x2d, 0x18 };
|
||||
const unsigned char PI80LE[] = { 0x00, 0x00, 0xc0, 0x68, 0x21, 0xa2, 0xda, 0x0f, 0xc9, 0x00, 0x40 };
|
||||
const unsigned char PI80BE[] = { 0x00, 0x40, 0x00, 0xc9, 0x0f, 0xda, 0xa2, 0x21, 0x68, 0xc0, 0x00 };
|
||||
CPPUNIT_ASSERT_EQUAL(0x00ff01U, data.toUInt24BE(0));
|
||||
CPPUNIT_ASSERT_EQUAL(0x01ff00U, data.toUInt24LE(0));
|
||||
CPPUNIT_ASSERT_EQUAL(0xff01ffU, data.toUInt24BE(5));
|
||||
CPPUNIT_ASSERT_EQUAL(0xff01ffU, data.toUInt24LE(5));
|
||||
CPPUNIT_ASSERT_EQUAL(0x00ffU, data.toUInt24BE(12));
|
||||
CPPUNIT_ASSERT_EQUAL(0xff00U, data.toUInt24LE(12));
|
||||
|
||||
ByteVector pi32le(reinterpret_cast<const char*>(PI32LE), 5);
|
||||
CPPUNIT_ASSERT_EQUAL(31415, static_cast<int>(pi32le.toFloat32LE(1) * 10000));
|
||||
CPPUNIT_ASSERT_EQUAL((long long)0x00ff01ff00ff01ffULL, data.toInt64BE(0));
|
||||
CPPUNIT_ASSERT_EQUAL((long long)0xff01ff00ff01ff00ULL, data.toInt64LE(0));
|
||||
CPPUNIT_ASSERT_EQUAL((long long)0xff01ff00ff01ff00ULL, data.toInt64BE(5));
|
||||
CPPUNIT_ASSERT_EQUAL((long long)0x00ff01ff00ff01ffULL, data.toInt64LE(5));
|
||||
CPPUNIT_ASSERT_EQUAL((long long)0x00ffU, data.toInt64BE(12));
|
||||
CPPUNIT_ASSERT_EQUAL((long long)0xff00U, data.toInt64LE(12));
|
||||
}
|
||||
|
||||
ByteVector pi32be(reinterpret_cast<const char*>(PI32BE), 5);
|
||||
CPPUNIT_ASSERT_EQUAL(31415, static_cast<int>(pi32be.toFloat32BE(1) * 10000));
|
||||
void testFloatingPointConversion()
|
||||
{
|
||||
const double Tolerance = 1.0e-7;
|
||||
|
||||
ByteVector pi64le(reinterpret_cast<const char*>(PI64LE), 9);
|
||||
CPPUNIT_ASSERT_EQUAL(31415, static_cast<int>(pi64le.toFloat64LE(1) * 10000));
|
||||
const ByteVector pi32le("\xdb\x0f\x49\x40", 4);
|
||||
CPPUNIT_ASSERT(std::abs(pi32le.toFloat32LE(0) - M_PI) < Tolerance);
|
||||
CPPUNIT_ASSERT_EQUAL(pi32le, ByteVector::fromFloat32LE(pi32le.toFloat32LE(0)));
|
||||
|
||||
ByteVector pi64be(reinterpret_cast<const char*>(PI64BE), 9);
|
||||
CPPUNIT_ASSERT_EQUAL(31415, static_cast<int>(pi64be.toFloat64BE(1) * 10000));
|
||||
const ByteVector pi32be("\x40\x49\x0f\xdb", 4);
|
||||
CPPUNIT_ASSERT(std::abs(pi32be.toFloat32BE(0) - M_PI) < Tolerance);
|
||||
CPPUNIT_ASSERT_EQUAL(pi32be, ByteVector::fromFloat32BE(pi32be.toFloat32BE(0)));
|
||||
|
||||
ByteVector pi80le(reinterpret_cast<const char*>(PI80LE), 11);
|
||||
CPPUNIT_ASSERT_EQUAL(31415, static_cast<int>(pi80le.toFloat80LE(1) * 10000));
|
||||
const ByteVector pi64le("\x18\x2d\x44\x54\xfb\x21\x09\x40", 8);
|
||||
CPPUNIT_ASSERT(std::abs(pi64le.toFloat64LE(0) - M_PI) < Tolerance);
|
||||
CPPUNIT_ASSERT_EQUAL(pi64le, ByteVector::fromFloat64LE(pi64le.toFloat64LE(0)));
|
||||
|
||||
ByteVector pi80be(reinterpret_cast<const char*>(PI80BE), 11);
|
||||
CPPUNIT_ASSERT_EQUAL(31415, static_cast<int>(pi80be.toFloat80BE(1) * 10000));
|
||||
const ByteVector pi64be("\x40\x09\x21\xfb\x54\x44\x2d\x18", 8);
|
||||
CPPUNIT_ASSERT(std::abs(pi64be.toFloat64BE(0) - M_PI) < Tolerance);
|
||||
CPPUNIT_ASSERT_EQUAL(pi64be, ByteVector::fromFloat64BE(pi64be.toFloat64BE(0)));
|
||||
|
||||
ByteVector pi32le2 = ByteVector::fromFloat32LE(pi32le.toFloat32LE(1));
|
||||
CPPUNIT_ASSERT(memcmp(pi32le.data() + 1, pi32le2.data(), 4) == 0);
|
||||
const ByteVector pi80le("\x00\xc0\x68\x21\xa2\xda\x0f\xc9\x00\x40", 10);
|
||||
CPPUNIT_ASSERT(std::abs(pi80le.toFloat80LE(0) - M_PI) < Tolerance);
|
||||
|
||||
ByteVector pi32be2 = ByteVector::fromFloat32BE(pi32be.toFloat32BE(1));
|
||||
CPPUNIT_ASSERT(memcmp(pi32be.data() + 1, pi32be2.data(), 4) == 0);
|
||||
|
||||
ByteVector pi64le2 = ByteVector::fromFloat64LE(pi64le.toFloat64LE(1));
|
||||
CPPUNIT_ASSERT(memcmp(pi64le.data() + 1, pi64le2.data(), 8) == 0);
|
||||
|
||||
ByteVector pi64be2 = ByteVector::fromFloat64BE(pi64be.toFloat64BE(1));
|
||||
CPPUNIT_ASSERT(memcmp(pi64be.data() + 1, pi64be2.data(), 8) == 0);
|
||||
const ByteVector pi80be("\x40\x00\xc9\x0f\xda\xa2\x21\x68\xc0\x00", 10);
|
||||
CPPUNIT_ASSERT(std::abs(pi80be.toFloat80BE(0) - M_PI) < Tolerance);
|
||||
}
|
||||
|
||||
void testReplace()
|
||||
@ -253,31 +265,50 @@ public:
|
||||
ByteVector a("abcdabf");
|
||||
a.replace(ByteVector("a"), ByteVector("x"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("xbcdxbf"), a);
|
||||
a.replace(ByteVector("x"), ByteVector("a"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("abcdabf"), a);
|
||||
}
|
||||
{
|
||||
ByteVector a("abcdabf");
|
||||
a.replace('a', 'x');
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("xbcdxbf"), a);
|
||||
a.replace('x', 'a');
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("abcdabf"), a);
|
||||
}
|
||||
{
|
||||
ByteVector a("abcdabf");
|
||||
a.replace(ByteVector("ab"), ByteVector("xy"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("xycdxyf"), a);
|
||||
a.replace(ByteVector("xy"), ByteVector("ab"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("abcdabf"), a);
|
||||
}
|
||||
{
|
||||
ByteVector a("abcdabf");
|
||||
a.replace(ByteVector("a"), ByteVector("<a>"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("<a>bcd<a>bf"), a);
|
||||
a.replace(ByteVector("<a>"), ByteVector("a"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("abcdabf"), a);
|
||||
}
|
||||
{
|
||||
ByteVector a("abcdabf");
|
||||
a.replace(ByteVector("ab"), ByteVector("x"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("xcdxf"), a);
|
||||
a.replace(ByteVector("b"), ByteVector("<b>"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("a<b>cda<b>f"), a);
|
||||
a.replace(ByteVector("<b>"), ByteVector("b"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("abcdabf"), a);
|
||||
}
|
||||
{
|
||||
ByteVector a("abcdabf");
|
||||
a.replace(ByteVector("ab"), ByteVector());
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("cdf"), a);
|
||||
ByteVector a("abcdabc");
|
||||
a.replace(ByteVector("c"), ByteVector("<c>"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("ab<c>dab<c>"), a);
|
||||
a.replace(ByteVector("<c>"), ByteVector("c"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("abcdabc"), a);
|
||||
}
|
||||
{
|
||||
ByteVector a("abcdabf");
|
||||
a.replace(ByteVector("bf"), ByteVector("x"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("abcdax"), a);
|
||||
ByteVector a("abcdaba");
|
||||
a.replace(ByteVector("a"), ByteVector("<a>"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("<a>bcd<a>b<a>"), a);
|
||||
a.replace(ByteVector("<a>"), ByteVector("a"));
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("abcdaba"), a);
|
||||
}
|
||||
}
|
||||
|
||||
@ -372,18 +403,49 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector::npos(), c.find('C'));
|
||||
}
|
||||
|
||||
void testAppend()
|
||||
void testAppend1()
|
||||
{
|
||||
ByteVector v1("taglib");
|
||||
ByteVector v2 = v1;
|
||||
ByteVector v1("foo");
|
||||
v1.append("bar");
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("foobar"), v1);
|
||||
|
||||
v1.append("ABC");
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("taglibABC"), v1);
|
||||
v1.append('1');
|
||||
v1.append('2');
|
||||
v1.append('3');
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("taglibABC123"), v1);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("taglib"), v2);
|
||||
ByteVector v2("foo");
|
||||
v2.append("b");
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("foob"), v2);
|
||||
|
||||
ByteVector v3;
|
||||
v3.append("b");
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("b"), v3);
|
||||
|
||||
ByteVector v4("foo");
|
||||
v4.append(v1);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("foofoobar"), v4);
|
||||
|
||||
ByteVector v5("foo");
|
||||
v5.append('b');
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("foob"), v5);
|
||||
|
||||
ByteVector v6;
|
||||
v6.append('b');
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("b"), v6);
|
||||
|
||||
ByteVector v7("taglib");
|
||||
ByteVector v8 = v7;
|
||||
|
||||
v7.append("ABC");
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("taglibABC"), v7);
|
||||
v7.append('1');
|
||||
v7.append('2');
|
||||
v7.append('3');
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("taglibABC123"), v7);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("taglib"), v8);
|
||||
}
|
||||
|
||||
void testAppend2()
|
||||
{
|
||||
ByteVector a("1234");
|
||||
a.append(a);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("12341234"), a);
|
||||
}
|
||||
|
||||
void testBase64()
|
||||
@ -411,7 +473,7 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(e3, s3.toBase64());
|
||||
|
||||
// Decode
|
||||
CPPUNIT_ASSERT_EQUAL(sempty, eempty.toBase64());
|
||||
CPPUNIT_ASSERT_EQUAL(sempty, ByteVector::fromBase64(eempty));
|
||||
CPPUNIT_ASSERT_EQUAL(s0, ByteVector::fromBase64(e0));
|
||||
CPPUNIT_ASSERT_EQUAL(s1, ByteVector::fromBase64(e1));
|
||||
CPPUNIT_ASSERT_EQUAL(s2, ByteVector::fromBase64(e2));
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2009 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <tbytevector.h>
|
||||
#include <tbytevectorlist.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2011 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <tbytevectorstream.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
||||
@ -13,6 +38,7 @@ class TestByteVectorStream : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testReadBlock);
|
||||
CPPUNIT_TEST(testRemoveBlock);
|
||||
CPPUNIT_TEST(testInsert);
|
||||
CPPUNIT_TEST(testSeekEnd);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -87,6 +113,19 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("yyx123foa"), *stream.data());
|
||||
}
|
||||
|
||||
void testSeekEnd()
|
||||
{
|
||||
ByteVector v("abcdefghijklmnopqrstuvwxyz");
|
||||
ByteVectorStream stream(v);
|
||||
CPPUNIT_ASSERT_EQUAL(26LL, stream.length());
|
||||
|
||||
stream.seek(-4, IOStream::End);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("w"), stream.readBlock(1));
|
||||
|
||||
stream.seek(-25, IOStream::End);
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("b"), stream.readBlock(1));
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestByteVectorStream);
|
||||
|
@ -1,11 +1,11 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2014 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
copyright : (C) 2015 by Tsuda Kageyu
|
||||
email : tsuda.kageyu@gmail.com
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 <tfile.h>
|
||||
@ -41,6 +45,7 @@ class TestFile : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testFindInSmallFile);
|
||||
CPPUNIT_TEST(testRFindInSmallFile);
|
||||
CPPUNIT_TEST(testSeek);
|
||||
CPPUNIT_TEST(testTruncate);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -125,6 +130,24 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(4428LL, f.tell());
|
||||
}
|
||||
|
||||
void testTruncate()
|
||||
{
|
||||
ScopedFileCopy copy("empty", ".ogg");
|
||||
std::string name = copy.fileName();
|
||||
|
||||
{
|
||||
PlainFile f(name.c_str());
|
||||
CPPUNIT_ASSERT_EQUAL(4328LL, f.length());
|
||||
|
||||
f.truncate(2000);
|
||||
CPPUNIT_ASSERT_EQUAL(2000LL, f.length());
|
||||
}
|
||||
{
|
||||
PlainFile f(name.c_str());
|
||||
CPPUNIT_ASSERT_EQUAL(2000LL, f.length());
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestFile);
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2007 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
@ -5,6 +30,15 @@
|
||||
#include <oggflacfile.h>
|
||||
#include <vorbisfile.h>
|
||||
#include <mpegfile.h>
|
||||
#include <mpcfile.h>
|
||||
#include <asffile.h>
|
||||
#include <speexfile.h>
|
||||
#include <flacfile.h>
|
||||
#include <trueaudiofile.h>
|
||||
#include <mp4file.h>
|
||||
#include <wavfile.h>
|
||||
#include <apefile.h>
|
||||
#include <aifffile.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include "utils.h"
|
||||
#include <tfilestream.h>
|
||||
@ -42,14 +76,15 @@ class TestFileRef : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testTrueAudio);
|
||||
CPPUNIT_TEST(testAPE);
|
||||
CPPUNIT_TEST(testWav);
|
||||
CPPUNIT_TEST(testAIFF);
|
||||
CPPUNIT_TEST(testAIFC);
|
||||
CPPUNIT_TEST(testAIFF_1);
|
||||
CPPUNIT_TEST(testAIFF_2);
|
||||
CPPUNIT_TEST(testUnsupported);
|
||||
CPPUNIT_TEST(testFileResolver);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
|
||||
template <typename T>
|
||||
void fileRefSave(const string &filename, const string &ext)
|
||||
{
|
||||
ScopedFileCopy copy(filename, ext);
|
||||
@ -57,6 +92,7 @@ public:
|
||||
|
||||
{
|
||||
FileRef f(newname.c_str());
|
||||
CPPUNIT_ASSERT(dynamic_cast<T*>(f.file()));
|
||||
CPPUNIT_ASSERT(!f.isNull());
|
||||
f.tag()->setArtist("test artist");
|
||||
f.tag()->setTitle("test title");
|
||||
@ -96,6 +132,7 @@ public:
|
||||
{
|
||||
FileStream fs(newname.c_str());
|
||||
FileRef f(&fs);
|
||||
CPPUNIT_ASSERT(dynamic_cast<T*>(f.file()));
|
||||
CPPUNIT_ASSERT(!f.isNull());
|
||||
CPPUNIT_ASSERT_EQUAL(f.tag()->artist(), String("ttest artist"));
|
||||
CPPUNIT_ASSERT_EQUAL(f.tag()->title(), String("ytest title"));
|
||||
@ -108,91 +145,87 @@ public:
|
||||
|
||||
void testMusepack()
|
||||
{
|
||||
fileRefSave("click", ".mpc");
|
||||
fileRefSave<MPC::File>("click", ".mpc");
|
||||
}
|
||||
|
||||
void testASF()
|
||||
{
|
||||
fileRefSave("silence-1", ".wma");
|
||||
fileRefSave<ASF::File>("silence-1", ".wma");
|
||||
}
|
||||
|
||||
void testVorbis()
|
||||
{
|
||||
fileRefSave("empty", ".ogg");
|
||||
fileRefSave<Ogg::Vorbis::File>("empty", ".ogg");
|
||||
}
|
||||
|
||||
void testSpeex()
|
||||
{
|
||||
fileRefSave("empty", ".spx");
|
||||
fileRefSave<Ogg::Speex::File>("empty", ".spx");
|
||||
}
|
||||
|
||||
void testFLAC()
|
||||
{
|
||||
fileRefSave("no-tags", ".flac");
|
||||
fileRefSave<FLAC::File>("no-tags", ".flac");
|
||||
}
|
||||
|
||||
void testMP3()
|
||||
{
|
||||
fileRefSave("xing", ".mp3");
|
||||
fileRefSave<MPEG::File>("xing", ".mp3");
|
||||
}
|
||||
|
||||
void testTrueAudio()
|
||||
{
|
||||
fileRefSave("empty", ".tta");
|
||||
fileRefSave<TrueAudio::File>("empty", ".tta");
|
||||
}
|
||||
|
||||
void testMP4_1()
|
||||
{
|
||||
fileRefSave("has-tags", ".m4a");
|
||||
fileRefSave<MP4::File>("has-tags", ".m4a");
|
||||
}
|
||||
|
||||
void testMP4_2()
|
||||
{
|
||||
fileRefSave("no-tags", ".m4a");
|
||||
fileRefSave<MP4::File>("no-tags", ".m4a");
|
||||
}
|
||||
|
||||
void testMP4_3()
|
||||
{
|
||||
fileRefSave("no-tags", ".3g2");
|
||||
fileRefSave<MP4::File>("no-tags", ".3g2");
|
||||
}
|
||||
|
||||
void testMP4_4()
|
||||
{
|
||||
fileRefSave("blank_video", ".m4v");
|
||||
fileRefSave<MP4::File>("blank_video", ".m4v");
|
||||
}
|
||||
|
||||
void testWav()
|
||||
{
|
||||
fileRefSave("empty", ".wav");
|
||||
}
|
||||
|
||||
void testAIFF()
|
||||
{
|
||||
fileRefSave("empty", ".aiff");
|
||||
}
|
||||
|
||||
void testAIFC()
|
||||
{
|
||||
fileRefSave("alaw", ".aifc");
|
||||
fileRefSave<RIFF::WAV::File>("empty", ".wav");
|
||||
}
|
||||
|
||||
void testOGA_FLAC()
|
||||
{
|
||||
FileRef f(TEST_FILE_PATH_C("empty_flac.oga"));
|
||||
CPPUNIT_ASSERT(dynamic_cast<Ogg::Vorbis::File *>(f.file()) == NULL);
|
||||
CPPUNIT_ASSERT(dynamic_cast<Ogg::FLAC::File *>(f.file()) != NULL);
|
||||
fileRefSave<Ogg::FLAC::File>("empty_flac", ".oga");
|
||||
}
|
||||
|
||||
void testOGA_Vorbis()
|
||||
{
|
||||
FileRef f(TEST_FILE_PATH_C("empty_vorbis.oga"));
|
||||
CPPUNIT_ASSERT(dynamic_cast<Ogg::Vorbis::File *>(f.file()) != NULL);
|
||||
CPPUNIT_ASSERT(dynamic_cast<Ogg::FLAC::File *>(f.file()) == NULL);
|
||||
fileRefSave<Ogg::Vorbis::File>("empty_vorbis", ".oga");
|
||||
}
|
||||
|
||||
void testAPE()
|
||||
{
|
||||
fileRefSave("mac-399", ".ape");
|
||||
fileRefSave<APE::File>("mac-399", ".ape");
|
||||
}
|
||||
|
||||
void testAIFF_1()
|
||||
{
|
||||
fileRefSave<RIFF::AIFF::File>("empty", ".aiff");
|
||||
}
|
||||
|
||||
void testAIFF_2()
|
||||
{
|
||||
fileRefSave<RIFF::AIFF::File>("alaw", ".aifc");
|
||||
}
|
||||
|
||||
void testUnsupported()
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2009 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2010 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2012 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2007 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tstring.h>
|
||||
|
@ -1,6 +1,27 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
/***************************************************************************
|
||||
copyright : (C) 2007 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
@ -23,6 +44,7 @@
|
||||
#include <tableofcontentsframe.h>
|
||||
#include <tdebug.h>
|
||||
#include <tpropertymap.h>
|
||||
#include <tzlib.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
#include "utils.h"
|
||||
|
||||
@ -47,7 +69,8 @@ class TestID3v2 : public CppUnit::TestFixture
|
||||
{
|
||||
CPPUNIT_TEST_SUITE(TestID3v2);
|
||||
CPPUNIT_TEST(testUnsynchDecode);
|
||||
CPPUNIT_TEST(testDowngradeUTF8ForID3v23);
|
||||
CPPUNIT_TEST(testDowngradeUTF8ForID3v23_1);
|
||||
CPPUNIT_TEST(testDowngradeUTF8ForID3v23_2);
|
||||
CPPUNIT_TEST(testUTF16BEDelimiter);
|
||||
CPPUNIT_TEST(testUTF16Delimiter);
|
||||
CPPUNIT_TEST(testReadStringField);
|
||||
@ -73,6 +96,7 @@ class TestID3v2 : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testParseOwnershipFrame);
|
||||
CPPUNIT_TEST(testRenderOwnershipFrame);
|
||||
CPPUNIT_TEST(testParseSynchronizedLyricsFrame);
|
||||
CPPUNIT_TEST(testParseSynchronizedLyricsFrameWithEmptyDescritpion);
|
||||
CPPUNIT_TEST(testRenderSynchronizedLyricsFrame);
|
||||
CPPUNIT_TEST(testParseEventTimingCodesFrame);
|
||||
CPPUNIT_TEST(testRenderEventTimingCodesFrame);
|
||||
@ -96,6 +120,7 @@ class TestID3v2 : public CppUnit::TestFixture
|
||||
CPPUNIT_TEST(testShrinkPadding);
|
||||
CPPUNIT_TEST(testEmptyFrame);
|
||||
CPPUNIT_TEST(testDuplicateTags);
|
||||
CPPUNIT_TEST(testParseTOCFrameWithManyChildren);
|
||||
CPPUNIT_TEST_SUITE_END();
|
||||
|
||||
public:
|
||||
@ -107,7 +132,7 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(String("My babe just cares for me"), f.tag()->title());
|
||||
}
|
||||
|
||||
void testDowngradeUTF8ForID3v23()
|
||||
void testDowngradeUTF8ForID3v23_1()
|
||||
{
|
||||
ScopedFileCopy copy("xing", ".mp3");
|
||||
string newname = copy.fileName();
|
||||
@ -131,6 +156,27 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL(String::UTF16, f2.textEncoding());
|
||||
}
|
||||
|
||||
void testDowngradeUTF8ForID3v23_2()
|
||||
{
|
||||
ScopedFileCopy copy("xing", ".mp3");
|
||||
|
||||
ID3v2::UnsynchronizedLyricsFrame *f
|
||||
= new ID3v2::UnsynchronizedLyricsFrame(String::UTF8);
|
||||
f->setText("Foo");
|
||||
|
||||
MPEG::File file(copy.fileName().c_str());
|
||||
file.ID3v2Tag(true)->addFrame(f);
|
||||
file.save(MPEG::File::ID3v2, true, 3);
|
||||
CPPUNIT_ASSERT(file.hasID3v2Tag());
|
||||
|
||||
ByteVector data = f->render();
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned int)(4+4+2+1+3+2+2+6+2), data.size());
|
||||
|
||||
ID3v2::UnsynchronizedLyricsFrame f2(data);
|
||||
CPPUNIT_ASSERT_EQUAL(String("Foo"), f2.text());
|
||||
CPPUNIT_ASSERT_EQUAL(String::UTF16, f2.textEncoding());
|
||||
}
|
||||
|
||||
void testUTF16BEDelimiter()
|
||||
{
|
||||
ID3v2::TextIdentificationFrame f(ByteVector("TPE1"), String::UTF16BE);
|
||||
@ -208,7 +254,7 @@ public:
|
||||
ID3v2::Header header;
|
||||
header.setMajorVersion(2);
|
||||
ID3v2::AttachedPictureFrame *frame =
|
||||
static_cast<TagLib::ID3v2::AttachedPictureFrame*>(factory->createFrame(data, &header));
|
||||
dynamic_cast<TagLib::ID3v2::AttachedPictureFrame*>(factory->createFrame(data, &header));
|
||||
|
||||
CPPUNIT_ASSERT(frame);
|
||||
CPPUNIT_ASSERT_EQUAL(String("image/jpeg"), frame->mimeType());
|
||||
@ -230,8 +276,8 @@ public:
|
||||
"\x00", 14);
|
||||
ID3v2::Header header;
|
||||
header.setMajorVersion(2);
|
||||
ID3v2::AttachedPictureFrame *frame =
|
||||
static_cast<TagLib::ID3v2::AttachedPictureFrame*>(factory->createFrame(data, &header));
|
||||
ID3v2::UnknownFrame *frame =
|
||||
dynamic_cast<TagLib::ID3v2::UnknownFrame*>(factory->createFrame(data, &header));
|
||||
|
||||
CPPUNIT_ASSERT(frame);
|
||||
|
||||
@ -489,6 +535,35 @@ public:
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned int)4567, stl[1].time);
|
||||
}
|
||||
|
||||
void testParseSynchronizedLyricsFrameWithEmptyDescritpion()
|
||||
{
|
||||
ID3v2::SynchronizedLyricsFrame f(
|
||||
ByteVector("SYLT" // Frame ID
|
||||
"\x00\x00\x00\x21" // Frame size
|
||||
"\x00\x00" // Frame flags
|
||||
"\x00" // Text encoding
|
||||
"eng" // Language
|
||||
"\x02" // Time stamp format
|
||||
"\x01" // Content type
|
||||
"\x00" // Content descriptor
|
||||
"Example\x00" // 1st text
|
||||
"\x00\x00\x04\xd2" // 1st time stamp
|
||||
"Lyrics\x00" // 2nd text
|
||||
"\x00\x00\x11\xd7", 40)); // 2nd time stamp
|
||||
CPPUNIT_ASSERT_EQUAL(String::Latin1, f.textEncoding());
|
||||
CPPUNIT_ASSERT_EQUAL(ByteVector("eng", 3), f.language());
|
||||
CPPUNIT_ASSERT_EQUAL(ID3v2::SynchronizedLyricsFrame::AbsoluteMilliseconds,
|
||||
f.timestampFormat());
|
||||
CPPUNIT_ASSERT_EQUAL(ID3v2::SynchronizedLyricsFrame::Lyrics, f.type());
|
||||
CPPUNIT_ASSERT(f.description().isEmpty());
|
||||
ID3v2::SynchronizedLyricsFrame::SynchedTextList stl = f.synchedText();
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned int)2, stl.size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("Example"), stl[0].text);
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned int)1234, stl[0].time);
|
||||
CPPUNIT_ASSERT_EQUAL(String("Lyrics"), stl[1].text);
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned int)4567, stl[1].time);
|
||||
}
|
||||
|
||||
void testRenderSynchronizedLyricsFrame()
|
||||
{
|
||||
ID3v2::SynchronizedLyricsFrame f;
|
||||
@ -597,8 +672,8 @@ public:
|
||||
ID3v2::Header header;
|
||||
header.setMajorVersion(3);
|
||||
ID3v2::TextIdentificationFrame *frame =
|
||||
static_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, &header));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, frame->fieldList().size());
|
||||
dynamic_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, &header));
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned int)1, frame->fieldList().size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("Death Metal"), frame->fieldList()[0]);
|
||||
|
||||
ID3v2::Tag tag;
|
||||
@ -618,8 +693,8 @@ public:
|
||||
ID3v2::Header header;
|
||||
header.setMajorVersion(3);
|
||||
ID3v2::TextIdentificationFrame *frame =
|
||||
static_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, &header));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)2, frame->fieldList().size());
|
||||
dynamic_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, &header));
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned int)2, frame->fieldList().size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("4"), frame->fieldList()[0]);
|
||||
CPPUNIT_ASSERT_EQUAL(String("Eurodisco"), frame->fieldList()[1]);
|
||||
|
||||
@ -638,8 +713,8 @@ public:
|
||||
"14\0Eurodisco", 23); // Text
|
||||
ID3v2::Header header;
|
||||
ID3v2::TextIdentificationFrame *frame =
|
||||
static_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, &header));
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)2, frame->fieldList().size());
|
||||
dynamic_cast<TagLib::ID3v2::TextIdentificationFrame*>(factory->createFrame(data, &header));
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned int)2, frame->fieldList().size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("14"), frame->fieldList()[0]);
|
||||
CPPUNIT_ASSERT_EQUAL(String("Eurodisco"), frame->fieldList()[1]);
|
||||
|
||||
@ -694,11 +769,11 @@ public:
|
||||
}
|
||||
{
|
||||
MPEG::File bar(newname.c_str());
|
||||
tf = static_cast<ID3v2::TextIdentificationFrame *>(bar.ID3v2Tag()->frameList("TDOR").front());
|
||||
tf = dynamic_cast<ID3v2::TextIdentificationFrame *>(bar.ID3v2Tag()->frameList("TDOR").front());
|
||||
CPPUNIT_ASSERT(tf);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, tf->fieldList().size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("2011"), tf->fieldList().front());
|
||||
tf = static_cast<ID3v2::TextIdentificationFrame *>(bar.ID3v2Tag()->frameList("TDRC").front());
|
||||
tf = dynamic_cast<ID3v2::TextIdentificationFrame *>(bar.ID3v2Tag()->frameList("TDRC").front());
|
||||
CPPUNIT_ASSERT(tf);
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)1, tf->fieldList().size());
|
||||
CPPUNIT_ASSERT_EQUAL(String("2012-04-17T12:01"), tf->fieldList().front());
|
||||
@ -731,26 +806,23 @@ public:
|
||||
MPEG::File f(TEST_FILE_PATH_C("compressed_id3_frame.mp3"), false);
|
||||
CPPUNIT_ASSERT(f.ID3v2Tag()->frameListMap().contains("APIC"));
|
||||
|
||||
#ifdef HAVE_ZLIB
|
||||
if(zlib::isAvailable()) {
|
||||
ID3v2::AttachedPictureFrame *frame
|
||||
= dynamic_cast<TagLib::ID3v2::AttachedPictureFrame*>(f.ID3v2Tag()->frameListMap()["APIC"].front());
|
||||
CPPUNIT_ASSERT(frame);
|
||||
CPPUNIT_ASSERT_EQUAL(String("image/bmp"), frame->mimeType());
|
||||
CPPUNIT_ASSERT_EQUAL(ID3v2::AttachedPictureFrame::Other, frame->type());
|
||||
CPPUNIT_ASSERT_EQUAL(String(""), frame->description());
|
||||
CPPUNIT_ASSERT_EQUAL((unsigned int)86414, frame->picture().size());
|
||||
}
|
||||
else {
|
||||
// Skip the test if ZLIB is not installed.
|
||||
// The message "Compressed frames are currently not supported." will be displayed.
|
||||
|
||||
ID3v2::AttachedPictureFrame *frame
|
||||
= dynamic_cast<TagLib::ID3v2::AttachedPictureFrame*>(f.ID3v2Tag()->frameListMap()["APIC"].front());
|
||||
CPPUNIT_ASSERT(frame);
|
||||
CPPUNIT_ASSERT_EQUAL(String("image/bmp"), frame->mimeType());
|
||||
CPPUNIT_ASSERT_EQUAL(ID3v2::AttachedPictureFrame::Other, frame->type());
|
||||
CPPUNIT_ASSERT_EQUAL(String(""), frame->description());
|
||||
CPPUNIT_ASSERT_EQUAL((size_t)86414, frame->picture().size());
|
||||
|
||||
#else
|
||||
|
||||
// Skip the test if ZLIB is not installed.
|
||||
// The message "Compressed frames are currently not supported." will be displayed.
|
||||
|
||||
ID3v2::UnknownFrame *frame
|
||||
= dynamic_cast<TagLib::ID3v2::UnknownFrame*>(f.ID3v2Tag()->frameListMap()["APIC"].front());
|
||||
CPPUNIT_ASSERT(frame);
|
||||
|
||||
#endif
|
||||
ID3v2::UnknownFrame *frame
|
||||
= dynamic_cast<TagLib::ID3v2::UnknownFrame*>(f.ID3v2Tag()->frameListMap()["APIC"].front());
|
||||
CPPUNIT_ASSERT(frame);
|
||||
}
|
||||
}
|
||||
|
||||
void testW000()
|
||||
@ -1157,6 +1229,12 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void testParseTOCFrameWithManyChildren()
|
||||
{
|
||||
MPEG::File f(TEST_FILE_PATH_C("toc_many_children.mp3"));
|
||||
CPPUNIT_ASSERT(f.isValid());
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
CPPUNIT_TEST_SUITE_REGISTRATION(TestID3v2);
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2012 by Tsuda Kageyu
|
||||
email : tsuda.kageyu@gmail.com
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 2.1 as published by the Free Software Foundation. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this library; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA *
|
||||
* 02110-1301 USA *
|
||||
* *
|
||||
* Alternatively, this file is available under the Mozilla Public *
|
||||
* License Version 1.1. You may obtain a copy of the License at *
|
||||
* http://www.mozilla.org/MPL/ *
|
||||
***************************************************************************/
|
||||
|
||||
#include <string>
|
||||
#include <stdio.h>
|
||||
#include <infotag.h>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 <itfile.h>
|
||||
|
@ -1,26 +1,27 @@
|
||||
/* Copyright (C) 2003 Scott Wheeler <wheeler@kde.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
/***************************************************************************
|
||||
copyright : (C) 2007 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <tlist.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2007 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <tstring.h>
|
||||
#include <tmap.h>
|
||||
#include <cppunit/extensions/HelperMacros.h>
|
||||
|
@ -5,7 +5,7 @@
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 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 *
|
||||
@ -15,8 +15,12 @@
|
||||
* *
|
||||
* 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 *
|
||||
* 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 <modfile.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2008 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2009 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2009 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2012 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <apetag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2007 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tstring.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2009 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2009 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2012 by Lukas Lalinsky
|
||||
email : lukas@oxygene.sk
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <string>
|
||||
#include <stdio.h>
|
||||
#include <tag.h>
|
||||
|
@ -1,3 +1,28 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2012 by Michael Helmling
|
||||
email : helmling@mathematik.uni-kl.de
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 <tpropertymap.h>
|
||||
#include <tag.h>
|
||||
#include <id3v1tag.h>
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user