#AM_INIT_AUTOMAKE(taglib,1.0)
dnl don't remove the below
dnl AC_OUTPUT(taglib/taglib-config)
+
+AC_DEFUN([AC_HAVE_ZLIB],
+[
+ AC_DEFINE(HAVE_ZLIB, 1, [have zlib])
+ have_zlib=true
+])
+
+AC_DEFUN([AC_NO_ZLIB],
+[
+ AC_DEFINE(HAVE_ZLIB, 0, [have zlib])
+ have_zlib=false
+])
+
+AC_CHECK_HEADER(zlib.h, AC_HAVE_ZLIB, AC_NO_ZLIB)
+AM_CONDITIONAL(link_zlib, test x$have_zlib = xtrue)
-SUBDIRS = frames
+SUBDIRS = frames
INCLUDES = \
-I$(top_srcdir)/taglib \
-I$(top_srcdir)/taglib/toolkit \
libid3v2_la_SOURCES = \
id3v2framefactory.cpp id3v2synchdata.cpp id3v2tag.cpp \
id3v2header.cpp id3v2frame.cpp id3v2footer.cpp \
- id3v2extendedheader.cpp
+ id3v2extendedheader.cpp
taglib_include_HEADERS = \
id3v2extendedheader.h id3v2frame.h id3v2header.h \
id3v2synchdata.h id3v2footer.h id3v2framefactory.h id3v2tag.h
taglib_includedir = $(includedir)/taglib
-libid3v2_la_LIBADD = ./frames/libframes.la
+
+if link_zlib
+zlib = -lz
+endif
+
+libid3v2_la_LIBADD = ./frames/libframes.la $(zlib)
EXTRA_DIST = $(libid3v2_la_SOURCES) $(taglib_include_HEADERS) id3v2.4.0-frames.txt id3v2.4.0-structure.txt
* USA *
***************************************************************************/
+#include <config.h>
+
#include <bitset>
+#if HAVE_ZLIB
+#include <zlib.h>
+#endif
+
#include <tdebug.h>
#include "id3v2frame.h"
uint frameDataOffset = headerSize;
uint frameDataLength = size();
- if(d->header->dataLengthIndicator()) {
+ if(d->header->compression() || d->header->dataLengthIndicator()) {
frameDataLength = frameData.mid(headerSize, 4).toUInt();
frameDataOffset += 4;
}
- return frameData.mid(frameDataOffset, frameDataLength);
+#if HAVE_ZLIB
+ if(d->header->compression()) {
+ ByteVector data(frameDataLength);
+ uLongf uLongTmp = frameDataLength;
+ ::uncompress((Bytef *) data.data(),
+ (uLongf *) &uLongTmp,
+ (Bytef *) frameData.data() + frameDataOffset,
+ size());
+ return data;
+#else
+ return frameData.mid(frameDataOffset, frameDataLength);
+#endif
+ }
+ else
+ return frameData.mid(frameDataOffset, frameDataLength);
}
////////////////////////////////////////////////////////////////////////////////
case 1:
case 2:
{
- // ID3v2.2
+ // ID3v2.2
if(data.size() < 3) {
debug("You must at least specify a frame ID.");
* USA *
***************************************************************************/
+#include <config.h>
+
#include <tdebug.h>
#include "id3v2framefactory.h"
{
Frame::Header *header = new Frame::Header(data, version);
- // TagLib doesn't mess with encrypted or compressed frames, so just treat them
+ // TagLib doesn't mess with encrypted frames, so just treat them
// as unknown frames.
+#if HAVE_ZLIB == 0
if(header->compression()) {
- debug("Compressed frames are currently not supported.");
- return new UnknownFrame(data, header);
+ debug("Compressed frames are currently not supported.");
+ return new UnknownFrame(data, header);
}
+#endif
if(header->encryption()) {
- debug("Entrypted frames are currently not supported.");
- return new UnknownFrame(data, header);
+ debug("Encrypted frames are currently not supported.");
+ return new UnknownFrame(data, header);
}
TagLib::ByteVector frameID = header->frameID();
// characters. Also make sure that there is data in the frame.
if(!frameID.size() == (version < 3 ? 3 : 4) || header->frameSize() <= 0)
- return 0;
+ return 0;
for(ByteVector::ConstIterator it = frameID.begin(); it != frameID.end(); it++) {
if( (*it < 'A' || *it > 'Z') && (*it < '1' || *it > '9') ) {