Merge remote branch 'taglib/master' into abstract-io

This commit is contained in:
Lukáš Lalinský 2011-05-28 22:04:07 +02:00
commit 088dbfa832
28 changed files with 150 additions and 80 deletions

19
.gitignore vendored
View File

@ -4,6 +4,11 @@ CMakeFiles/
*.so
*.so.*
*.dylib
*.vcproj
*.ncb
*.sln
*.suo
*.user
/CMakeCache.txt
/Doxyfile
/config.h
@ -12,9 +17,23 @@ CMakeFiles/
/taglib_config.h
/taglib-config
/bindings/c/taglib_c.pc
/bindings/c/Debug
/bindings/c/MinSizeRel
/bindings/c/Release
/bindings/c/tag_c.dir/Debug
/bindings/c/tag_c.dir/MinSizeRel
/bindings/c/tag_c.dir/Release
/examples/framelist
/examples/strip-id3v1
/examples/tagreader
/examples/tagreader_c
/examples/tagwriter
/doc/html
/taglib/Debug
/taglib/MinSizeRel
/taglib/Release
/taglib/tag.dir/Debug
/taglib/tag.dir/MinSizeRel
/taglib/tag.dir/Release
/ALL_BUILD.dir
/ZERO_CHECK.dir

View File

@ -3,6 +3,12 @@ project(taglib)
cmake_minimum_required(VERSION 2.6.0 FATAL_ERROR)
option(ENABLE_STATIC "Make static version of libtag" OFF)
if(ENABLE_STATIC)
add_definitions(-DTAGLIB_STATIC)
set(BUILD_SHARED_LIBS OFF)
else()
set(BUILD_SHARED_LIBS ON)
endif()
option(BUILD_TESTS "Build the test suite" OFF)
option(BUILD_EXAMPLES "Build the examples" OFF)
@ -21,6 +27,11 @@ set(BIN_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/bin" CACHE PATH "The subdirectory to
set(LIB_INSTALL_DIR "${EXEC_INSTALL_PREFIX}/lib${LIB_SUFFIX}" CACHE PATH "The subdirectory relative to the install prefix where libraries will be installed (default is /lib${LIB_SUFFIX})" FORCE)
set(INCLUDE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/include" CACHE PATH "The subdirectory to the header prefix" FORCE)
if(APPLE)
option(BUILD_FRAMEWORK "Build an OS X framework" OFF)
set(FRAMEWORK_INSTALL_DIR "/Library/Frameworks" CACHE STRING "Directory to install frameworks to.")
endif()
if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
@ -49,7 +60,7 @@ include(ConfigureChecks.cmake)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib-config.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib-config )
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/taglib-config DESTINATION ${BIN_INSTALL_DIR})
if(NOT WIN32)
if(NOT WIN32 AND NOT BUILD_FRAMEWORK)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib.pc )
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
endif()
@ -65,7 +76,6 @@ if(WITH_MP4)
endif()
configure_file(taglib/taglib_config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib_config.h)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib_config.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)
add_subdirectory(taglib)
add_subdirectory(bindings)

View File

@ -14,6 +14,10 @@ support for MP4 and WMA using the following options:
cmake -DWITH_MP4=ON -DWITH_ASF=ON [...]
In order to build the included examples, use the BUILD_EXAMPLES option:
cmake -DBUILD_EXAMPLES=ON [...]
If you want to run the test suite to make sure TagLib works properly on your
system, you need to have cppunit installed. The test suite has a custom target
in the build system, so you can run the tests using make:

View File

@ -16,16 +16,15 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/../../taglib/trueaudio
)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib_c.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc)
set(tag_c_HDRS tag_c.h)
if(ENABLE_STATIC)
add_library(tag_c STATIC tag_c.cpp)
set_target_properties(tag_c PROPERTIES COMPILE_DEFINITIONS TAGLIB_STATIC)
else()
add_library(tag_c SHARED tag_c.cpp)
endif()
add_library(tag_c tag_c.cpp ${tag_c_HDRS})
target_link_libraries(tag_c tag)
set_target_properties(tag_c PROPERTIES PUBLIC_HEADER "${tag_c_HDRS}")
if(BUILD_FRAMEWORK)
set_target_properties(tag_c PROPERTIES FRAMEWORK TRUE)
endif()
# On Solaris we need to explicitly add the C++ standard and runtime
# libraries to the libs used by the C bindings, because those C bindings
@ -55,11 +54,15 @@ set_target_properties(tag_c PROPERTIES
INSTALL_NAME_DIR ${LIB_INSTALL_DIR}
)
install(TARGETS tag_c
FRAMEWORK DESTINATION ${FRAMEWORK_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
PUBLIC_HEADER DESTINATION ${INCLUDE_INSTALL_DIR}/taglib
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
install(FILES tag_c.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)
if(NOT WIN32 AND NOT BUILD_FRAMEWORK)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/taglib_c.pc.cmake ${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/taglib_c.pc DESTINATION ${LIB_INSTALL_DIR}/pkgconfig)
endif()

View File

@ -25,17 +25,95 @@ if(ZLIB_FOUND)
include_directories(${ZLIB_INCLUDE_DIR})
endif()
add_subdirectory(toolkit)
add_subdirectory(asf)
add_subdirectory(mpeg)
add_subdirectory(ogg)
add_subdirectory(flac)
add_subdirectory(ape)
add_subdirectory(mpc)
add_subdirectory(mp4)
add_subdirectory(wavpack)
add_subdirectory(trueaudio)
add_subdirectory(riff)
set(tag_HDRS
tag.h
fileref.h
audioproperties.h
taglib_export.h
${CMAKE_BINARY_DIR}/taglib_config.h
toolkit/taglib.h
toolkit/tstring.h
toolkit/tlist.h
toolkit/tlist.tcc
toolkit/tstringlist.h
toolkit/tbytevector.h
toolkit/tbytevectorlist.h
toolkit/tfile.h
toolkit/tmap.h
toolkit/tmap.tcc
mpeg/mpegfile.h
mpeg/mpegproperties.h
mpeg/mpegheader.h
mpeg/xingheader.h
mpeg/id3v1/id3v1tag.h
mpeg/id3v1/id3v1genres.h
mpeg/id3v2/id3v2extendedheader.h
mpeg/id3v2/id3v2frame.h
mpeg/id3v2/id3v2header.h
mpeg/id3v2/id3v2synchdata.h
mpeg/id3v2/id3v2footer.h
mpeg/id3v2/id3v2framefactory.h
mpeg/id3v2/id3v2tag.h
mpeg/id3v2/frames/attachedpictureframe.h
mpeg/id3v2/frames/commentsframe.h
mpeg/id3v2/frames/generalencapsulatedobjectframe.h
mpeg/id3v2/frames/popularimeterframe.h
mpeg/id3v2/frames/privateframe.h
mpeg/id3v2/frames/relativevolumeframe.h
mpeg/id3v2/frames/textidentificationframe.h
mpeg/id3v2/frames/uniquefileidentifierframe.h
mpeg/id3v2/frames/unknownframe.h
mpeg/id3v2/frames/unsynchronizedlyricsframe.h
mpeg/id3v2/frames/urllinkframe.h
ogg/oggfile.h
ogg/oggpage.h
ogg/oggpageheader.h
ogg/xiphcomment.h
ogg/vorbis/vorbisfile.h
ogg/vorbis/vorbisproperties.h
ogg/flac/oggflacfile.h
ogg/speex/speexfile.h
ogg/speex/speexproperties.h
flac/flacfile.h
flac/flacpicture.h
flac/flacproperties.h
flac/flacmetadatablock.h
ape/apefile.h
ape/apeproperties.h
ape/apetag.h
ape/apefooter.h
ape/apeitem.h
mpc/mpcfile.h
mpc/mpcproperties.h
wavpack/wavpackfile.h
wavpack/wavpackproperties.h
trueaudio/trueaudiofile.h
trueaudio/trueaudioproperties.h
riff/rifffile.h
riff/aiff/aifffile.h
riff/aiff/aiffproperties.h
riff/wav/wavfile.h
riff/wav/wavproperties.h
)
if(WITH_ASF)
set(tag_HDRS ${tag_HDRS}
asf/asffile.h
asf/asfproperties.h
asf/asftag.h
asf/asfattribute.h
asf/asfpicture.h
)
endif()
if(WITH_MP4)
set(tag_HDRS ${tag_HDRS}
mp4/mp4file.h
mp4/mp4atom.h
mp4/mp4tag.h
mp4/mp4item.h
mp4/mp4properties.h
mp4/mp4coverart.h
)
endif()
set(mpeg_SRCS
mpeg/mpegfile.cpp
@ -185,12 +263,7 @@ if(WITH_MP4)
set(tag_LIB_SRCS ${tag_LIB_SRCS} ${mp4_SRCS})
endif()
if(ENABLE_STATIC)
add_library(tag STATIC ${tag_LIB_SRCS})
set_target_properties(tag PROPERTIES COMPILE_DEFINITIONS TAGLIB_STATIC)
else()
add_library(tag SHARED ${tag_LIB_SRCS})
endif()
add_library(tag ${tag_LIB_SRCS} ${tag_HDRS})
if(ZLIB_FOUND)
target_link_libraries(tag ${ZLIB_LIBRARIES})
@ -202,13 +275,17 @@ set_target_properties(tag PROPERTIES
INSTALL_NAME_DIR ${LIB_INSTALL_DIR}
DEFINE_SYMBOL MAKE_TAGLIB_LIB
LINK_INTERFACE_LIBRARIES ""
PUBLIC_HEADER "${tag_HDRS}"
)
if(BUILD_FRAMEWORK)
set_target_properties(tag PROPERTIES FRAMEWORK TRUE)
endif()
install(TARGETS tag
FRAMEWORK DESTINATION ${FRAMEWORK_INSTALL_DIR}
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
PUBLIC_HEADER DESTINATION ${INCLUDE_INSTALL_DIR}/taglib
)
install(FILES tag.h fileref.h audioproperties.h taglib_export.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1 +0,0 @@
INSTALL( FILES apefile.h apeproperties.h apetag.h apefooter.h apeitem.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1 +0,0 @@
INSTALL( FILES asffile.h asfproperties.h asftag.h asfattribute.h asfpicture.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1 +0,0 @@
INSTALL( FILES flacfile.h flacpicture.h flacproperties.h flacmetadatablock.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib )

View File

@ -170,10 +170,12 @@ bool FLAC::File::save()
MetadataBlock *block = d->blocks[i];
if(block->code() == MetadataBlock::VorbisComment) {
// Set the new Vorbis Comment block
delete block;
block = new UnknownMetadataBlock(MetadataBlock::VorbisComment, d->xiphCommentData);
foundVorbisCommentBlock = true;
}
if(block->code() == MetadataBlock::Padding) {
delete block;
continue;
}
newBlocks.append(block);
@ -199,7 +201,7 @@ bool FLAC::File::save()
// Adjust the padding block(s)
long originalLength = d->streamStart - d->flacStart;
int paddingLength = originalLength - data.size() - 4;
int paddingLength = originalLength - data.size() - 4;
if (paddingLength < 0) {
paddingLength = MinPaddingLength;
}

View File

@ -1 +0,0 @@
INSTALL( FILES mp4file.h mp4atom.h mp4tag.h mp4item.h mp4properties.h mp4coverart.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1 +0,0 @@
INSTALL( FILES mpcfile.h mpcproperties.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1,4 +0,0 @@
ADD_SUBDIRECTORY( id3v1 )
ADD_SUBDIRECTORY( id3v2 )
INSTALL(FILES mpegfile.h mpegproperties.h mpegheader.h xingheader.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib )

View File

@ -1 +0,0 @@
INSTALL( FILES id3v1tag.h id3v1genres.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -207,7 +207,7 @@ ID3v1::GenreMap ID3v1::genreMap()
String ID3v1::genre(int i)
{
if(i >= 0 && i < genresSize)
return genres[i];
return genres[i] + String::null; // always make a copy
return String::null;
}

View File

@ -1,4 +0,0 @@
ADD_SUBDIRECTORY( frames )
INSTALL(FILES id3v2extendedheader.h id3v2frame.h id3v2header.h id3v2synchdata.h id3v2footer.h id3v2framefactory.h id3v2tag.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1,13 +0,0 @@
INSTALL(FILES
attachedpictureframe.h
commentsframe.h
generalencapsulatedobjectframe.h
popularimeterframe.h
privateframe.h
relativevolumeframe.h
textidentificationframe.h
uniquefileidentifierframe.h
unknownframe.h
unsynchronizedlyricsframe.h
urllinkframe.h
DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1,6 +0,0 @@
ADD_SUBDIRECTORY( vorbis )
ADD_SUBDIRECTORY( speex )
ADD_SUBDIRECTORY( flac )
INSTALL( FILES oggfile.h oggpage.h oggpageheader.h xiphcomment.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib )

View File

@ -1,2 +0,0 @@
INSTALL( FILES oggflacfile.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1 +0,0 @@
INSTALL( FILES speexfile.h speexproperties.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1 +0,0 @@
INSTALL( FILES vorbisfile.h vorbisproperties.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1,4 +0,0 @@
ADD_SUBDIRECTORY( aiff )
ADD_SUBDIRECTORY( wav )
INSTALL( FILES rifffile.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1 +0,0 @@
INSTALL( FILES aifffile.h aiffproperties.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1 +0,0 @@
INSTALL( FILES wavfile.h wavproperties.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1 +0,0 @@
INSTALL( FILES taglib.h tstring.h tlist.h tlist.tcc tstringlist.h tbytevector.h tbytevectorlist.h tfile.h tmap.h tmap.tcc DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -100,8 +100,8 @@ namespace TagLib {
RefCounter() : refCount(1) {}
#ifdef TAGLIB_ATOMIC_MAC
void ref() { OSAtomicIncrement32Barrier(&refCount); }
bool deref() { return ! OSAtomicDecrement32Barrier(&refCount); }
void ref() { OSAtomicIncrement32Barrier(const_cast<int32_t*>(&refCount)); }
bool deref() { return ! OSAtomicDecrement32Barrier(const_cast<int32_t*>(&refCount)); }
int32_t count() { return refCount; }
private:
volatile int32_t refCount;

View File

@ -323,3 +323,4 @@ void File::setValid(bool valid)
{
d->valid = valid;
}

View File

@ -1 +0,0 @@
INSTALL( FILES trueaudiofile.h trueaudioproperties.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)

View File

@ -1 +0,0 @@
INSTALL( FILES wavpackfile.h wavpackproperties.h DESTINATION ${INCLUDE_INSTALL_DIR}/taglib)