TagLib supports MP4 metadata since version 1.6 (2009). The custom parser code caused problems because there was a mismatch between the definition of TagLib::Tag and TagLib::MP4::Tag, and the implementation of the custom TagLib::MP4::Tag. This requires TagLib 1.11 and above. Resolves: TDE/tdemultimedia#82 Signed-off-by: mio <stigma@disroot.org>pull/66/head
parent
956d90f8cb
commit
460320e577
@ -1,33 +0,0 @@
|
||||
#################################################
|
||||
#
|
||||
# (C) 2010-2011 Serghei Amelian
|
||||
# serghei (DOT) amelian (AT) gmail.com
|
||||
#
|
||||
# Improvements and feedback are welcome
|
||||
#
|
||||
# This file is released under GPL >= 2
|
||||
#
|
||||
#################################################
|
||||
|
||||
include_directories(
|
||||
${CMAKE_BINARY_DIR}
|
||||
${TDE_INCLUDE_DIR}
|
||||
${TQT_INCLUDE_DIRS}
|
||||
${TAGLIB_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
||||
##### tagm4a (static) ###########################
|
||||
|
||||
tde_add_library( common-tagmp4 STATIC_PIC
|
||||
SOURCES
|
||||
taglib_mp4filetyperesolver.cpp mp4file.cpp mp4itunestag.cpp mp4isobox.cpp
|
||||
mp4isofullbox.cpp mp4skipbox.cpp mp4moovbox.cpp mp4mvhdbox.cpp
|
||||
mp4ilstbox.cpp boxfactory.cpp mp4fourcc.cpp mp4udtabox.cpp mp4metabox.cpp
|
||||
mp4tagsproxy.cpp mp4mdiabox.cpp mp4minfbox.cpp mp4audioproperties.cpp
|
||||
mp4hdlrbox.cpp mp4stblbox.cpp mp4audiosampleentry.cpp mp4stsdbox.cpp
|
||||
mp4sampleentry.cpp mp4trakbox.cpp mp4propsproxy.cpp itunesnambox.cpp
|
||||
itunesartbox.cpp itunesalbbox.cpp itunescvrbox.cpp itunesgenbox.cpp
|
||||
itunestrknbox.cpp itunesdaybox.cpp itunescmtbox.cpp itunesgrpbox.cpp
|
||||
ituneswrtbox.cpp itunesdiskbox.cpp itunestmpobox.cpp itunesdatabox.cpp
|
||||
)
|
@ -1,84 +0,0 @@
|
||||
SUBDIRS =
|
||||
METASOURCES = AUTO
|
||||
INCLUDES = $(all_includes) $(TAGLIB_CFLAGS)
|
||||
|
||||
libtagm4a_la_LDFLAGS = $(all_libraries)
|
||||
noinst_LTLIBRARIES = libtagm4a.la
|
||||
|
||||
libtagm4a_la_SOURCES = \
|
||||
taglib_mp4filetyperesolver.cpp \
|
||||
mp4file.cpp \
|
||||
mp4itunestag.cpp \
|
||||
mp4isobox.cpp \
|
||||
mp4isofullbox.cpp \
|
||||
mp4skipbox.cpp \
|
||||
mp4moovbox.cpp \
|
||||
mp4mvhdbox.cpp \
|
||||
mp4ilstbox.cpp \
|
||||
boxfactory.cpp \
|
||||
mp4fourcc.cpp \
|
||||
mp4udtabox.cpp \
|
||||
mp4metabox.cpp \
|
||||
mp4tagsproxy.cpp \
|
||||
mp4mdiabox.cpp \
|
||||
mp4minfbox.cpp \
|
||||
mp4audioproperties.cpp \
|
||||
mp4hdlrbox.cpp \
|
||||
mp4stblbox.cpp \
|
||||
mp4audiosampleentry.cpp \
|
||||
mp4stsdbox.cpp \
|
||||
mp4sampleentry.cpp \
|
||||
mp4trakbox.cpp \
|
||||
mp4propsproxy.cpp \
|
||||
itunesnambox.cpp \
|
||||
itunesartbox.cpp \
|
||||
itunesalbbox.cpp \
|
||||
itunescvrbox.cpp \
|
||||
itunesgenbox.cpp \
|
||||
itunestrknbox.cpp \
|
||||
itunesdaybox.cpp \
|
||||
itunescmtbox.cpp \
|
||||
itunesgrpbox.cpp \
|
||||
ituneswrtbox.cpp \
|
||||
itunesdiskbox.cpp \
|
||||
itunestmpobox.cpp \
|
||||
itunesdatabox.cpp
|
||||
|
||||
noinst_HEADERS = \
|
||||
taglib_mp4filetyperesolver.h \
|
||||
mp4file.h \
|
||||
mp4itunestag.h \
|
||||
mp4isobox.h \
|
||||
mp4isofullbox.h \
|
||||
mp4skipbox.h \
|
||||
mp4moovbox.h \
|
||||
mp4mvhdbox.h \
|
||||
mp4ilstbox.h \
|
||||
boxfactory.h \
|
||||
mp4fourcc.h \
|
||||
mp4udtabox.h \
|
||||
mp4metabox.h \
|
||||
mp4tagsproxy.h \
|
||||
mp4audioproperties.h \
|
||||
mp4hdlrbox.h \
|
||||
mp4propsproxy.h \
|
||||
mp4mdiabox.h \
|
||||
mp4stsdbox.h \
|
||||
mp4trakbox.h \
|
||||
mp4stblbox.h \
|
||||
mp4audiosampleentry.h \
|
||||
mp4minfbox.h \
|
||||
mp4sampleentry.h \
|
||||
itunesnambox.h \
|
||||
itunesartbox.h \
|
||||
itunesalbbox.h \
|
||||
itunesgenbox.h \
|
||||
itunestrknbox.h \
|
||||
itunesdaybox.h \
|
||||
itunescmtbox.h \
|
||||
itunescvrbox.h \
|
||||
itunesgrpbox.h \
|
||||
ituneswrtbox.h \
|
||||
itunesdiskbox.h \
|
||||
itunestmpobox.h \
|
||||
itunesdatabox.h
|
@ -1,150 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "tstring.h"
|
||||
#include "boxfactory.h"
|
||||
#include "mp4skipbox.h"
|
||||
#include "mp4moovbox.h"
|
||||
#include "mp4mvhdbox.h"
|
||||
#include "mp4trakbox.h"
|
||||
#include "mp4mdiabox.h"
|
||||
#include "mp4minfbox.h"
|
||||
#include "mp4stblbox.h"
|
||||
#include "mp4stsdbox.h"
|
||||
#include "mp4hdlrbox.h"
|
||||
#include "mp4udtabox.h"
|
||||
#include "mp4metabox.h"
|
||||
#include "mp4ilstbox.h"
|
||||
#include "itunesnambox.h"
|
||||
#include "itunesartbox.h"
|
||||
#include "itunesalbbox.h"
|
||||
#include "itunesgenbox.h"
|
||||
#include "itunesdaybox.h"
|
||||
#include "itunestrknbox.h"
|
||||
#include "itunescmtbox.h"
|
||||
#include "itunesgrpbox.h"
|
||||
#include "ituneswrtbox.h"
|
||||
#include "itunesdiskbox.h"
|
||||
#include "itunestmpobox.h"
|
||||
#include "itunescvrbox.h"
|
||||
#include "itunesdatabox.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
MP4::BoxFactory::BoxFactory()
|
||||
{
|
||||
}
|
||||
|
||||
MP4::BoxFactory::~BoxFactory()
|
||||
{
|
||||
}
|
||||
|
||||
//! factory function
|
||||
MP4::Mp4IsoBox* MP4::BoxFactory::createInstance( TagLib::File* anyfile, MP4::Fourcc fourcc, uint size, long offset ) const
|
||||
{
|
||||
MP4::File * file = dynamic_cast<MP4::File *>(anyfile);
|
||||
if(!file)
|
||||
return 0;
|
||||
|
||||
//std::cout << "creating box for: " << fourcc.toString() << std::endl;
|
||||
|
||||
switch( fourcc )
|
||||
{
|
||||
case 0x6d6f6f76: // 'moov'
|
||||
return new MP4::Mp4MoovBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x6d766864: // 'mvhd'
|
||||
return new MP4::Mp4MvhdBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x7472616b: // 'trak'
|
||||
return new MP4::Mp4TrakBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x6d646961: // 'mdia'
|
||||
return new MP4::Mp4MdiaBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x6d696e66: // 'minf'
|
||||
return new MP4::Mp4MinfBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x7374626c: // 'stbl'
|
||||
return new MP4::Mp4StblBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x73747364: // 'stsd'
|
||||
return new MP4::Mp4StsdBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x68646c72: // 'hdlr'
|
||||
return new MP4::Mp4HdlrBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x75647461: // 'udta'
|
||||
return new MP4::Mp4UdtaBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x6d657461: // 'meta'
|
||||
return new MP4::Mp4MetaBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x696c7374: // 'ilst'
|
||||
return new MP4::Mp4IlstBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0xa96e616d: // '_nam'
|
||||
return new MP4::ITunesNamBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0xa9415254: // '_ART'
|
||||
return new MP4::ITunesArtBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0xa9616c62: // '_alb'
|
||||
return new MP4::ITunesAlbBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0xa967656e: // '_gen'
|
||||
return new MP4::ITunesGenBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x676e7265: // 'gnre'
|
||||
return new MP4::ITunesGenBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0xa9646179: // '_day'
|
||||
return new MP4::ITunesDayBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x74726b6e: // 'trkn'
|
||||
return new MP4::ITunesTrknBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0xa9636d74: // '_cmt'
|
||||
return new MP4::ITunesCmtBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0xa9677270: // '_grp'
|
||||
return new MP4::ITunesGrpBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0xa9777274: // '_wrt'
|
||||
return new MP4::ITunesWrtBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x6469736b: // 'disk'
|
||||
return new MP4::ITunesDiskBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x746d706f: // 'tmpo'
|
||||
return new MP4::ITunesTmpoBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x636f7672: // 'covr'
|
||||
return new MP4::ITunesCvrBox( file, fourcc, size, offset );
|
||||
break;
|
||||
case 0x64616461: // 'data'
|
||||
return new MP4::ITunesDataBox( file, fourcc, size, offset );
|
||||
break;
|
||||
default:
|
||||
return new MP4::Mp4SkipBox( file, fourcc, size, offset );
|
||||
}
|
||||
}
|
@ -1,45 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef BOXFACTORY_H
|
||||
#define BOXFACTORY_H
|
||||
|
||||
#include "taglib.h"
|
||||
#include "mp4isobox.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class BoxFactory
|
||||
{
|
||||
public:
|
||||
BoxFactory();
|
||||
~BoxFactory();
|
||||
|
||||
//! factory function
|
||||
Mp4IsoBox* createInstance( TagLib::File* anyfile, MP4::Fourcc fourcc, uint size, long offset ) const;
|
||||
}; // class BoxFactory
|
||||
|
||||
} // namepace MP4
|
||||
} // namepace TagLib
|
||||
|
||||
#endif // BOXFACTORY_H
|
@ -1,89 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "itunesalbbox.h"
|
||||
#include "itunesdatabox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "tfile.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesAlbBox::ITunesAlbBoxPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* dataBox;
|
||||
};
|
||||
|
||||
MP4::ITunesAlbBox::ITunesAlbBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesAlbBox::ITunesAlbBoxPrivate();
|
||||
d->dataBox = 0;
|
||||
}
|
||||
|
||||
MP4::ITunesAlbBox::~ITunesAlbBox()
|
||||
{
|
||||
if( d->dataBox != 0 )
|
||||
delete d->dataBox;
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesAlbBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
// parse data box
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
if(mp4file->readSizeAndType( size, fourcc ) == true)
|
||||
{
|
||||
// check for type - must be 'data'
|
||||
if( fourcc != MP4::Fourcc("data") )
|
||||
{
|
||||
std::cerr << "bad atom in itunes tag - skipping it." << std::endl;
|
||||
// jump over data tag
|
||||
mp4file->seek( size-8, TagLib::File::Current );
|
||||
return;
|
||||
}
|
||||
d->dataBox = new ITunesDataBox( mp4file, fourcc, size, mp4file->tell() );
|
||||
d->dataBox->parsebox();
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading unsuccessful - serious error!
|
||||
std::cerr << "Error in parsing ITunesAlbBox - serious Error in taglib!" << std::endl;
|
||||
return;
|
||||
}
|
||||
// register data box
|
||||
mp4file->tagProxy()->registerBox( Mp4TagsProxy::album, d->dataBox );
|
||||
|
||||
#if 0
|
||||
// get data pointer - just for debugging...
|
||||
TagLib::String dataString( d->dataBox->data() );
|
||||
std::cout << "Content of album box: " << dataString << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESALBBOX_H
|
||||
#define ITUNESALBBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesAlbBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
ITunesAlbBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesAlbBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesAlbBoxPrivate;
|
||||
ITunesAlbBoxPrivate* d;
|
||||
}; // class ITunesAlbBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESALBBOX_H
|
@ -1,89 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "itunesartbox.h"
|
||||
#include "itunesdatabox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "tfile.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesArtBox::ITunesArtBoxPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* dataBox;
|
||||
};
|
||||
|
||||
MP4::ITunesArtBox::ITunesArtBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesArtBox::ITunesArtBoxPrivate();
|
||||
d->dataBox = 0;
|
||||
}
|
||||
|
||||
MP4::ITunesArtBox::~ITunesArtBox()
|
||||
{
|
||||
if( d->dataBox != 0 )
|
||||
delete d->dataBox;
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesArtBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
// parse data box
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
if(mp4file->readSizeAndType( size, fourcc ) == true)
|
||||
{
|
||||
// check for type - must be 'data'
|
||||
if( fourcc != MP4::Fourcc("data") )
|
||||
{
|
||||
std::cerr << "bad atom in itunes tag - skipping it." << std::endl;
|
||||
// jump over data tag
|
||||
mp4file->seek( size-8, TagLib::File::Current );
|
||||
return;
|
||||
}
|
||||
d->dataBox = new ITunesDataBox( mp4file, fourcc, size, mp4file->tell() );
|
||||
d->dataBox->parsebox();
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading unsuccessful - serious error!
|
||||
std::cerr << "Error in parsing ITunesArtBox - serious Error in taglib!" << std::endl;
|
||||
return;
|
||||
}
|
||||
// register data box
|
||||
mp4file->tagProxy()->registerBox( Mp4TagsProxy::artist, d->dataBox );
|
||||
|
||||
#if 0
|
||||
// get data pointer - just for debugging...
|
||||
TagLib::String dataString( d->dataBox->data() );
|
||||
std::cout << "Content of artist box: " << dataString << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESARTBOX_H
|
||||
#define ITUNESARTBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesArtBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
ITunesArtBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesArtBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesArtBoxPrivate;
|
||||
ITunesArtBoxPrivate* d;
|
||||
}; // class ITunesArtBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESARTBOX_H
|
@ -1,89 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "itunescmtbox.h"
|
||||
#include "itunesdatabox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "tfile.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesCmtBox::ITunesCmtBoxPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* dataBox;
|
||||
};
|
||||
|
||||
MP4::ITunesCmtBox::ITunesCmtBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesCmtBox::ITunesCmtBoxPrivate();
|
||||
d->dataBox = 0;
|
||||
}
|
||||
|
||||
MP4::ITunesCmtBox::~ITunesCmtBox()
|
||||
{
|
||||
if( d->dataBox != 0 )
|
||||
delete d->dataBox;
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesCmtBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
// parse data box
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
if(mp4file->readSizeAndType( size, fourcc ) == true)
|
||||
{
|
||||
// check for type - must be 'data'
|
||||
if( fourcc != MP4::Fourcc("data") )
|
||||
{
|
||||
std::cerr << "bad atom in itunes tag - skipping it." << std::endl;
|
||||
// jump over data tag
|
||||
mp4file->seek( size-8, TagLib::File::Current );
|
||||
return;
|
||||
}
|
||||
d->dataBox = new ITunesDataBox( mp4file, fourcc, size, mp4file->tell() );
|
||||
d->dataBox->parsebox();
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading unsuccessful - serious error!
|
||||
std::cerr << "Error in parsing ITunesCmtBox - serious Error in taglib!" << std::endl;
|
||||
return;
|
||||
}
|
||||
// register data box
|
||||
mp4file->tagProxy()->registerBox( Mp4TagsProxy::comment, d->dataBox );
|
||||
|
||||
#if 0
|
||||
// get data pointer - just for debugging...
|
||||
TagLib::String dataString( d->dataBox->data() );
|
||||
std::cout << "Content of title box: " << dataString << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESCMTBOX_H
|
||||
#define ITUNESCMTBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesCmtBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
ITunesCmtBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesCmtBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesCmtBoxPrivate;
|
||||
ITunesCmtBoxPrivate* d;
|
||||
}; // class ITunesCmtBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESCMTBOX_H
|
@ -1,89 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "itunescvrbox.h"
|
||||
#include "itunesdatabox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "tfile.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesCvrBox::ITunesCvrBoxPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* dataBox;
|
||||
};
|
||||
|
||||
MP4::ITunesCvrBox::ITunesCvrBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesCvrBox::ITunesCvrBoxPrivate();
|
||||
d->dataBox = 0;
|
||||
}
|
||||
|
||||
MP4::ITunesCvrBox::~ITunesCvrBox()
|
||||
{
|
||||
if( d->dataBox != 0 )
|
||||
delete d->dataBox;
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesCvrBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
// parse data box
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
if(mp4file->readSizeAndType( size, fourcc ) == true)
|
||||
{
|
||||
// check for type - must be 'data'
|
||||
if( fourcc != MP4::Fourcc("data") )
|
||||
{
|
||||
std::cerr << "bad atom in itunes tag - skipping it." << std::endl;
|
||||
// jump over data tag
|
||||
mp4file->seek( size-8, TagLib::File::Current );
|
||||
return;
|
||||
}
|
||||
d->dataBox = new ITunesDataBox( mp4file, fourcc, size, mp4file->tell() );
|
||||
d->dataBox->parsebox();
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading unsuccessful - serious error!
|
||||
std::cerr << "Error in parsing ITunesCvrBox - serious Error in taglib!" << std::endl;
|
||||
return;
|
||||
}
|
||||
// register data box
|
||||
mp4file->tagProxy()->registerBox( Mp4TagsProxy::cover, d->dataBox );
|
||||
|
||||
#if 0
|
||||
// get data pointer - just for debugging...
|
||||
TagLib::String dataString( d->dataBox->data() );
|
||||
std::cout << "Content of album box: " << dataString << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESCVRBOX_H
|
||||
#define ITUNESCVRBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesCvrBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
ITunesCvrBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesCvrBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesCvrBoxPrivate;
|
||||
ITunesCvrBoxPrivate* d;
|
||||
}; // class ITunesCvrBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESCVRBOX_H
|
@ -1,63 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "itunesdatabox.h"
|
||||
#include "tbytevector.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "tfile.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesDataBox::ITunesDataBoxPrivate
|
||||
{
|
||||
public:
|
||||
ByteVector data;
|
||||
};
|
||||
|
||||
MP4::ITunesDataBox::ITunesDataBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoFullBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesDataBox::ITunesDataBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox::~ITunesDataBox()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
ByteVector MP4::ITunesDataBox::data() const
|
||||
{
|
||||
return d->data;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesDataBox::parse()
|
||||
{
|
||||
// skip first 4 byte - don't know what they are supposed to be for - simply 4 zeros
|
||||
file()->seek( 4, TagLib::File::Current );
|
||||
// read contents - remaining size is box_size-12-4 (12:fullbox header, 4:starting zeros of data box)
|
||||
#if 0
|
||||
std::cout << " reading data box with data length: " << size()-16 << std::endl;
|
||||
#endif
|
||||
d->data = file()->readBlock( size()-12-4 );
|
||||
}
|
||||
|
@ -1,53 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESDATABOX_H
|
||||
#define ITUNESDATABOX_H
|
||||
|
||||
#include "mp4isofullbox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesDataBox: public Mp4IsoFullBox
|
||||
{
|
||||
public:
|
||||
ITunesDataBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesDataBox();
|
||||
|
||||
//! get the internal data, which can be txt or binary data as well
|
||||
ByteVector data() const;
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesDataBoxPrivate;
|
||||
ITunesDataBoxPrivate* d;
|
||||
}; // class ITunesDataBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESDATABOX_H
|
@ -1,89 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "itunesdaybox.h"
|
||||
#include "itunesdatabox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "tfile.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesDayBox::ITunesDayBoxPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* dataBox;
|
||||
};
|
||||
|
||||
MP4::ITunesDayBox::ITunesDayBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesDayBox::ITunesDayBoxPrivate();
|
||||
d->dataBox = 0;
|
||||
}
|
||||
|
||||
MP4::ITunesDayBox::~ITunesDayBox()
|
||||
{
|
||||
if( d->dataBox != 0 )
|
||||
delete d->dataBox;
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesDayBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
// parse data box
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
if(mp4file->readSizeAndType( size, fourcc ) == true)
|
||||
{
|
||||
// check for type - must be 'data'
|
||||
if( fourcc != MP4::Fourcc("data") )
|
||||
{
|
||||
std::cerr << "bad atom in itunes tag - skipping it." << std::endl;
|
||||
// jump over data tag
|
||||
mp4file->seek( size-8, TagLib::File::Current );
|
||||
return;
|
||||
}
|
||||
d->dataBox = new ITunesDataBox( mp4file, fourcc, size, mp4file->tell() );
|
||||
d->dataBox->parsebox();
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading unsuccessful - serious error!
|
||||
std::cerr << "Error in parsing ITunesDayBox - serious Error in taglib!" << std::endl;
|
||||
return;
|
||||
}
|
||||
// register data box
|
||||
mp4file->tagProxy()->registerBox( Mp4TagsProxy::year, d->dataBox );
|
||||
|
||||
#if 0
|
||||
// get data pointer - just for debugging...
|
||||
TagLib::String dataString( d->dataBox->data() );
|
||||
std::cout << "Content of day box: " << dataString.substr(0,4) << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESDAYBOX_H
|
||||
#define ITUNESDAYBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesDayBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
ITunesDayBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesDayBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesDayBoxPrivate;
|
||||
ITunesDayBoxPrivate* d;
|
||||
}; // class ITunesDayBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESDAYBOX_H
|
@ -1,93 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "itunesdiskbox.h"
|
||||
#include "itunesdatabox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "tfile.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesDiskBox::ITunesDiskBoxPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* dataBox;
|
||||
};
|
||||
|
||||
MP4::ITunesDiskBox::ITunesDiskBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesDiskBox::ITunesDiskBoxPrivate();
|
||||
d->dataBox = 0;
|
||||
}
|
||||
|
||||
MP4::ITunesDiskBox::~ITunesDiskBox()
|
||||
{
|
||||
if( d->dataBox != 0 )
|
||||
delete d->dataBox;
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesDiskBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
// parse data box
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
if(mp4file->readSizeAndType( size, fourcc ) == true)
|
||||
{
|
||||
// check for type - must be 'data'
|
||||
if( fourcc != MP4::Fourcc("data") )
|
||||
{
|
||||
std::cerr << "bad atom in itunes tag - skipping it." << std::endl;
|
||||
// jump over data tag
|
||||
mp4file->seek( size-8, TagLib::File::Current );
|
||||
return;
|
||||
}
|
||||
d->dataBox = new ITunesDataBox( mp4file, fourcc, size, mp4file->tell() );
|
||||
d->dataBox->parsebox();
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading unsuccessful - serious error!
|
||||
std::cerr << "Error in parsing ITunesDiskBox - serious Error in taglib!" << std::endl;
|
||||
return;
|
||||
}
|
||||
// register data box
|
||||
mp4file->tagProxy()->registerBox( Mp4TagsProxy::disk, d->dataBox );
|
||||
|
||||
#if 0
|
||||
// get data pointer - just for debugging...
|
||||
TagLib::ByteVector trknData = d->dataBox->data();
|
||||
TagLib::String trknumber = TagLib::String::number( static_cast<int>( static_cast<unsigned char>(trknData[0]) << 24 |
|
||||
static_cast<unsigned char>(trknData[1]) << 16 |
|
||||
static_cast<unsigned char>(trknData[2]) << 8 |
|
||||
static_cast<unsigned char>(trknData[3]) ) );
|
||||
std::cout << "Content of tracknumber box: " << trknumber << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESDISKBOX_H
|
||||
#define ITUNESDISKBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesDiskBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
ITunesDiskBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesDiskBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesDiskBoxPrivate;
|
||||
ITunesDiskBoxPrivate* d;
|
||||
}; // class ITunesDiskBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESDISKBOX_H
|
@ -1,89 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "itunesgenbox.h"
|
||||
#include "itunesdatabox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "tfile.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesGenBox::ITunesGenBoxPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* dataBox;
|
||||
};
|
||||
|
||||
MP4::ITunesGenBox::ITunesGenBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesGenBox::ITunesGenBoxPrivate();
|
||||
d->dataBox = 0;
|
||||
}
|
||||
|
||||
MP4::ITunesGenBox::~ITunesGenBox()
|
||||
{
|
||||
if( d->dataBox != 0 )
|
||||
delete d->dataBox;
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesGenBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
// parse data box
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
if(mp4file->readSizeAndType( size, fourcc ) == true)
|
||||
{
|
||||
// check for type - must be 'data'
|
||||
if( fourcc != MP4::Fourcc("data") )
|
||||
{
|
||||
std::cerr << "bad atom in itunes tag - skipping it." << std::endl;
|
||||
// jump over data tag
|
||||
mp4file->seek( size-8, TagLib::File::Current );
|
||||
return;
|
||||
}
|
||||
d->dataBox = new ITunesDataBox( mp4file, fourcc, size, mp4file->tell() );
|
||||
d->dataBox->parsebox();
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading unsuccessful - serious error!
|
||||
std::cerr << "Error in parsing ITunesGenBox - serious Error in taglib!" << std::endl;
|
||||
return;
|
||||
}
|
||||
// register data box
|
||||
mp4file->tagProxy()->registerBox( Mp4TagsProxy::genre, d->dataBox );
|
||||
|
||||
#if 0
|
||||
// get data pointer - just for debugging...
|
||||
TagLib::String dataString( d->dataBox->data() );
|
||||
std::cout << "Content of genre box: " << dataString << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESGENBOX_H
|
||||
#define ITUNESGENBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesGenBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
ITunesGenBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesGenBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesGenBoxPrivate;
|
||||
ITunesGenBoxPrivate* d;
|
||||
}; // class ITunesGenBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESGENBOX_H
|
@ -1,89 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "itunesgrpbox.h"
|
||||
#include "itunesdatabox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "tfile.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesGrpBox::ITunesGrpBoxPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* dataBox;
|
||||
};
|
||||
|
||||
MP4::ITunesGrpBox::ITunesGrpBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesGrpBox::ITunesGrpBoxPrivate();
|
||||
d->dataBox = 0;
|
||||
}
|
||||
|
||||
MP4::ITunesGrpBox::~ITunesGrpBox()
|
||||
{
|
||||
if( d->dataBox != 0 )
|
||||
delete d->dataBox;
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesGrpBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
// parse data box
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
if(mp4file->readSizeAndType( size, fourcc ) == true)
|
||||
{
|
||||
// check for type - must be 'data'
|
||||
if( fourcc != MP4::Fourcc("data") )
|
||||
{
|
||||
std::cerr << "bad atom in itunes tag - skipping it." << std::endl;
|
||||
// jump over data tag
|
||||
mp4file->seek( size-8, TagLib::File::Current );
|
||||
return;
|
||||
}
|
||||
d->dataBox = new ITunesDataBox( mp4file, fourcc, size, mp4file->tell() );
|
||||
d->dataBox->parsebox();
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading unsuccessful - serious error!
|
||||
std::cerr << "Error in parsing ITunesGrpBox - serious Error in taglib!" << std::endl;
|
||||
return;
|
||||
}
|
||||
// register data box
|
||||
mp4file->tagProxy()->registerBox( Mp4TagsProxy::grouping, d->dataBox );
|
||||
|
||||
#if 0
|
||||
// get data pointer - just for debugging...
|
||||
TagLib::String dataString( d->dataBox->data() );
|
||||
std::cout << "Content of title box: " << dataString << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESGRPBOX_H
|
||||
#define ITUNESGRPBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesGrpBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
ITunesGrpBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesGrpBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesGrpBoxPrivate;
|
||||
ITunesGrpBoxPrivate* d;
|
||||
}; // class ITunesGrpBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESGRPBOX_H
|
@ -1,89 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "itunesnambox.h"
|
||||
#include "itunesdatabox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "tfile.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesNamBox::ITunesNamBoxPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* dataBox;
|
||||
};
|
||||
|
||||
MP4::ITunesNamBox::ITunesNamBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesNamBox::ITunesNamBoxPrivate();
|
||||
d->dataBox = 0;
|
||||
}
|
||||
|
||||
MP4::ITunesNamBox::~ITunesNamBox()
|
||||
{
|
||||
if( d->dataBox != 0 )
|
||||
delete d->dataBox;
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesNamBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
// parse data box
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
if(mp4file->readSizeAndType( size, fourcc ) == true)
|
||||
{
|
||||
// check for type - must be 'data'
|
||||
if( fourcc != MP4::Fourcc("data") )
|
||||
{
|
||||
std::cerr << "bad atom in itunes tag - skipping it." << std::endl;
|
||||
// jump over data tag
|
||||
mp4file->seek( size-8, TagLib::File::Current );
|
||||
return;
|
||||
}
|
||||
d->dataBox = new ITunesDataBox( mp4file, fourcc, size, mp4file->tell() );
|
||||
d->dataBox->parsebox();
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading unsuccessful - serious error!
|
||||
std::cerr << "Error in parsing ITunesNamBox - serious Error in taglib!" << std::endl;
|
||||
return;
|
||||
}
|
||||
// register data box
|
||||
mp4file->tagProxy()->registerBox( Mp4TagsProxy::title, d->dataBox );
|
||||
|
||||
#if 0
|
||||
// get data pointer - just for debugging...
|
||||
TagLib::String dataString( d->dataBox->data() );
|
||||
std::cout << "Content of title box: " << dataString << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESNAMBOX_H
|
||||
#define ITUNESNAMBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesNamBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
ITunesNamBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesNamBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesNamBoxPrivate;
|
||||
ITunesNamBoxPrivate* d;
|
||||
}; // class ITunesNamBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESNAMBOX_H
|
@ -1,93 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "itunestmpobox.h"
|
||||
#include "itunesdatabox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "tfile.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesTmpoBox::ITunesTmpoBoxPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* dataBox;
|
||||
};
|
||||
|
||||
MP4::ITunesTmpoBox::ITunesTmpoBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesTmpoBox::ITunesTmpoBoxPrivate();
|
||||
d->dataBox = 0;
|
||||
}
|
||||
|
||||
MP4::ITunesTmpoBox::~ITunesTmpoBox()
|
||||
{
|
||||
if( d->dataBox != 0 )
|
||||
delete d->dataBox;
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesTmpoBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
// parse data box
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
if(mp4file->readSizeAndType( size, fourcc ) == true)
|
||||
{
|
||||
// check for type - must be 'data'
|
||||
if( fourcc != MP4::Fourcc("data") )
|
||||
{
|
||||
std::cerr << "bad atom in itunes tag - skipping it." << std::endl;
|
||||
// jump over data tag
|
||||
mp4file->seek( size-8, TagLib::File::Current );
|
||||
return;
|
||||
}
|
||||
d->dataBox = new ITunesDataBox( mp4file, fourcc, size, mp4file->tell() );
|
||||
d->dataBox->parsebox();
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading unsuccessful - serious error!
|
||||
std::cerr << "Error in parsing ITunesTmpoBox - serious Error in taglib!" << std::endl;
|
||||
return;
|
||||
}
|
||||
// register data box
|
||||
mp4file->tagProxy()->registerBox( Mp4TagsProxy::bpm, d->dataBox );
|
||||
|
||||
#if 0
|
||||
// get data pointer - just for debugging...
|
||||
TagLib::ByteVector trknData = d->dataBox->data();
|
||||
TagLib::String trknumber = TagLib::String::number( static_cast<int>( static_cast<unsigned char>(trknData[0]) << 24 |
|
||||
static_cast<unsigned char>(trknData[1]) << 16 |
|
||||
static_cast<unsigned char>(trknData[2]) << 8 |
|
||||
static_cast<unsigned char>(trknData[3]) ) );
|
||||
std::cout << "Content of tracknumber box: " << trknumber << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESTMPOBOX_H
|
||||
#define ITUNESTMPOBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesTmpoBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
ITunesTmpoBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesTmpoBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesTmpoBoxPrivate;
|
||||
ITunesTmpoBoxPrivate* d;
|
||||
}; // class ITunesTmpoBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESTMPOBOX_H
|
@ -1,93 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "itunestrknbox.h"
|
||||
#include "itunesdatabox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "tfile.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesTrknBox::ITunesTrknBoxPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* dataBox;
|
||||
};
|
||||
|
||||
MP4::ITunesTrknBox::ITunesTrknBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesTrknBox::ITunesTrknBoxPrivate();
|
||||
d->dataBox = 0;
|
||||
}
|
||||
|
||||
MP4::ITunesTrknBox::~ITunesTrknBox()
|
||||
{
|
||||
if( d->dataBox != 0 )
|
||||
delete d->dataBox;
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesTrknBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
// parse data box
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
if(mp4file->readSizeAndType( size, fourcc ) == true)
|
||||
{
|
||||
// check for type - must be 'data'
|
||||
if( fourcc != MP4::Fourcc("data") )
|
||||
{
|
||||
std::cerr << "bad atom in itunes tag - skipping it." << std::endl;
|
||||
// jump over data tag
|
||||
mp4file->seek( size-8, TagLib::File::Current );
|
||||
return;
|
||||
}
|
||||
d->dataBox = new ITunesDataBox( mp4file, fourcc, size, mp4file->tell() );
|
||||
d->dataBox->parsebox();
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading unsuccessful - serious error!
|
||||
std::cerr << "Error in parsing ITunesTrknBox - serious Error in taglib!" << std::endl;
|
||||
return;
|
||||
}
|
||||
// register data box
|
||||
mp4file->tagProxy()->registerBox( Mp4TagsProxy::trackno, d->dataBox );
|
||||
|
||||
#if 0
|
||||
// get data pointer - just for debugging...
|
||||
TagLib::ByteVector trknData = d->dataBox->data();
|
||||
TagLib::String trknumber = TagLib::String::number( static_cast<int>( static_cast<unsigned char>(trknData[0]) << 24 |
|
||||
static_cast<unsigned char>(trknData[1]) << 16 |
|
||||
static_cast<unsigned char>(trknData[2]) << 8 |
|
||||
static_cast<unsigned char>(trknData[3]) ) );
|
||||
std::cout << "Content of tracknumber box: " << trknumber << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESTRKNBOX_H
|
||||
#define ITUNESTRKNBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesTrknBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
ITunesTrknBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesTrknBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesTrknBoxPrivate;
|
||||
ITunesTrknBoxPrivate* d;
|
||||
}; // class ITunesTrknBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESTRKNBOX_H
|
@ -1,89 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "ituneswrtbox.h"
|
||||
#include "itunesdatabox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "tfile.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::ITunesWrtBox::ITunesWrtBoxPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* dataBox;
|
||||
};
|
||||
|
||||
MP4::ITunesWrtBox::ITunesWrtBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::ITunesWrtBox::ITunesWrtBoxPrivate();
|
||||
d->dataBox = 0;
|
||||
}
|
||||
|
||||
MP4::ITunesWrtBox::~ITunesWrtBox()
|
||||
{
|
||||
if( d->dataBox != 0 )
|
||||
delete d->dataBox;
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::ITunesWrtBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
// parse data box
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
if(mp4file->readSizeAndType( size, fourcc ) == true)
|
||||
{
|
||||
// check for type - must be 'data'
|
||||
if( fourcc != MP4::Fourcc("data") )
|
||||
{
|
||||
std::cerr << "bad atom in itunes tag - skipping it." << std::endl;
|
||||
// jump over data tag
|
||||
mp4file->seek( size-8, TagLib::File::Current );
|
||||
return;
|
||||
}
|
||||
d->dataBox = new ITunesDataBox( mp4file, fourcc, size, mp4file->tell() );
|
||||
d->dataBox->parsebox();
|
||||
}
|
||||
else
|
||||
{
|
||||
// reading unsuccessful - serious error!
|
||||
std::cerr << "Error in parsing ITunesWrtBox - serious Error in taglib!" << std::endl;
|
||||
return;
|
||||
}
|
||||
// register data box
|
||||
mp4file->tagProxy()->registerBox( Mp4TagsProxy::composer, d->dataBox );
|
||||
|
||||
#if 0
|
||||
// get data pointer - just for debugging...
|
||||
TagLib::String dataString( d->dataBox->data() );
|
||||
std::cout << "Content of title box: " << dataString << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef ITUNESWRTBOX_H
|
||||
#define ITUNESWRTBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class ITunesWrtBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
ITunesWrtBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~ITunesWrtBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class ITunesWrtBoxPrivate;
|
||||
ITunesWrtBoxPrivate* d;
|
||||
}; // class ITunesWrtBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // ITUNESWRTBOX_H
|
@ -1,75 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mp4audioproperties.h"
|
||||
#include "mp4propsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::AudioProperties::AudioPropertiesPrivate
|
||||
{
|
||||
public:
|
||||
MP4::Mp4PropsProxy* propsproxy;
|
||||
}; // AudioPropertiesPrivate
|
||||
|
||||
MP4::AudioProperties::AudioProperties():TagLib::AudioProperties(TagLib::AudioProperties::Average)
|
||||
{
|
||||
d = new MP4::AudioProperties::AudioPropertiesPrivate();
|
||||
}
|
||||
|
||||
MP4::AudioProperties::~AudioProperties()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MP4::AudioProperties::setProxy( Mp4PropsProxy* proxy )
|
||||
{
|
||||
d->propsproxy = proxy;
|
||||
}
|
||||
|
||||
int MP4::AudioProperties::length() const
|
||||
{
|
||||
if( d->propsproxy == 0 )
|
||||
return 0;
|
||||
return d->propsproxy->seconds();
|
||||
}
|
||||
|
||||
int MP4::AudioProperties::bitrate() const
|
||||
{
|
||||
if( d->propsproxy == 0 )
|
||||
return 0;
|
||||
return d->propsproxy->bitRate()/1000;
|
||||
}
|
||||
|
||||
int MP4::AudioProperties::sampleRate() const
|
||||
{
|
||||
if( d->propsproxy == 0 )
|
||||
return 0;
|
||||
return d->propsproxy->sampleRate();
|
||||
}
|
||||
|
||||
int MP4::AudioProperties::channels() const
|
||||
{
|
||||
if( d->propsproxy == 0 )
|
||||
return 0;
|
||||
return d->propsproxy->channels();
|
||||
}
|
||||
|
@ -1,73 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4AUDIOPROPERTIES_H
|
||||
#define MP4AUDIOPROPERTIES_H MP4AUDIOPROPERTIES_H
|
||||
|
||||
#include "audioproperties.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4PropsProxy;
|
||||
|
||||
class AudioProperties : public TagLib::AudioProperties
|
||||
{
|
||||
public:
|
||||
//! constructor
|
||||
AudioProperties();
|
||||
//! destructor
|
||||
~AudioProperties();
|
||||
|
||||
//! function to set the proxy
|
||||
void setProxy( Mp4PropsProxy* proxy );
|
||||
|
||||
/*!
|
||||
* Returns the length of the file in seconds.
|
||||
*/
|
||||
int length() const;
|
||||
|
||||
/*!
|
||||
* Returns the most appropriate bit rate for the file in kb/s. For constant
|
||||
* bitrate formats this is simply the bitrate of the file. For variable
|
||||
* bitrate formats this is either the average or nominal bitrate.
|
||||
*/
|
||||
int bitrate() const;
|
||||
|
||||
/*!
|
||||
* Returns the sample rate in Hz.
|
||||
*/
|
||||
int sampleRate() const;
|
||||
|
||||
/*!
|
||||
* Returns the number of audio channels.
|
||||
*/
|
||||
int channels() const;
|
||||
|
||||
private:
|
||||
class AudioPropertiesPrivate;
|
||||
AudioPropertiesPrivate* d;
|
||||
};
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4AUDIOPROPERTIES_H
|
@ -1,146 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <iostream>
|
||||
#include "mp4audiosampleentry.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
#include "mp4propsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4AudioSampleEntry::Mp4AudioSampleEntryPrivate
|
||||
{
|
||||
public:
|
||||
uint channelcount;
|
||||
uint samplerate;
|
||||
uint bitrate;
|
||||
};
|
||||
|
||||
MP4::Mp4AudioSampleEntry::Mp4AudioSampleEntry( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4SampleEntry(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::Mp4AudioSampleEntry::Mp4AudioSampleEntryPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4AudioSampleEntry::~Mp4AudioSampleEntry()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
uint MP4::Mp4AudioSampleEntry::channels() const
|
||||
{
|
||||
return d->channelcount;
|
||||
}
|
||||
|
||||
uint MP4::Mp4AudioSampleEntry::samplerate() const
|
||||
{
|
||||
return d->samplerate;
|
||||
}
|
||||
|
||||
uint MP4::Mp4AudioSampleEntry::bitrate() const
|
||||
{
|
||||
return d->bitrate;
|
||||
}
|
||||
|
||||
void MP4::Mp4AudioSampleEntry::parseEntry()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = dynamic_cast<TagLib::MP4::File*>(file());
|
||||
if(!mp4file)
|
||||
return;
|
||||
|
||||
// read 8 reserved bytes
|
||||
mp4file->seek( 8, TagLib::File::Current );
|
||||
// read channelcount
|
||||
if(!mp4file->readShort( d->channelcount ))
|
||||
return;
|
||||
// seek over samplesize, pre_defined and reserved
|
||||
mp4file->seek( 6, TagLib::File::Current );
|
||||
// read samplerate
|
||||
if(!mp4file->readInt( d->samplerate ))
|
||||
return;
|
||||
|
||||
// register box at proxy
|
||||
mp4file->propProxy()->registerAudioSampleEntry( this );
|
||||
|
||||
|
||||
//std::cout << "fourcc of audio sample entry: " << fourcc().toString() << std::endl;
|
||||
// check for both mp4a (plain files) and drms (encrypted files)
|
||||
if( (fourcc() == MP4::Fourcc("mp4a")) ||
|
||||
(fourcc() == MP4::Fourcc("drms")) )
|
||||
{
|
||||
TagLib::MP4::Fourcc fourcc;
|
||||
uint esds_size;
|
||||
|
||||
if (!mp4file->readSizeAndType( esds_size, fourcc ))
|
||||
return;
|
||||
|
||||
// read esds' main parts
|
||||
if( size()-48 > 0 )
|
||||
ByteVector flags_version = mp4file->readBlock(4);
|
||||
else
|
||||
return;
|
||||
|
||||
ByteVector EsDescrTag = mp4file->readBlock(1);
|
||||
// first 4 bytes contain full box specifics (version & flags)
|
||||
// upcoming byte must be ESDescrTag (0x03)
|
||||
if( EsDescrTag[0] == 0x03 )
|
||||
{
|
||||
uint descr_len = mp4file->readSystemsLen();
|
||||
uint EsId;
|
||||
if( !mp4file->readShort( EsId ) )
|
||||
return;
|
||||
ByteVector priority = mp4file->readBlock(1);
|
||||
if( descr_len < 20 )
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint EsId;
|
||||
if( !mp4file->readShort( EsId ) )
|
||||
return;
|
||||
}
|
||||
// read decoder configuration tag (0x04)
|
||||
ByteVector DecCfgTag = mp4file->readBlock(1);
|
||||
if( DecCfgTag[0] != 0x04 )
|
||||
return;
|
||||
// read decoder configuration length
|
||||
// uint deccfg_len = mp4file->readSystemsLen();
|
||||
// read object type Id
|
||||
ByteVector objId = mp4file->readBlock(1);
|
||||
// read stream type id
|
||||
ByteVector strId = mp4file->readBlock(1);
|
||||
// read buffer Size DB
|
||||
ByteVector bufferSizeDB = mp4file->readBlock(3);
|
||||
// read max bitrate
|
||||
uint max_bitrate;
|
||||
if( !mp4file->readInt( max_bitrate ) )
|
||||
return;
|
||||
// read average bitrate
|
||||
if( !mp4file->readInt( d->bitrate ) )
|
||||
return;
|
||||
// skip the rest
|
||||
mp4file->seek( offset()+size()-8, File::Beginning );
|
||||
}
|
||||
else
|
||||
mp4file->seek( size()-36, File::Current );
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4AUDIOSAMPLEENTRY_H
|
||||
#define MP4AUDIOSAMPLEENTRY_H
|
||||
|
||||
#include "mp4sampleentry.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4AudioSampleEntry: public Mp4SampleEntry
|
||||
{
|
||||
public:
|
||||
Mp4AudioSampleEntry( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4AudioSampleEntry();
|
||||
|
||||
//! function to get the number of channels
|
||||
uint channels() const;
|
||||
//! function to get the sample rate
|
||||
uint samplerate() const;
|
||||
//! function to get the average bitrate of the audio stream
|
||||
uint bitrate() const;
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
void parseEntry();
|
||||
|
||||
protected:
|
||||
class Mp4AudioSampleEntryPrivate;
|
||||
Mp4AudioSampleEntryPrivate* d;
|
||||
}; // class Mp4AudioSampleEntry
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4AUDIOSAMPLEENTRY_H
|
@ -1,377 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <tbytevector.h>
|
||||
#include <tstring.h>
|
||||
#include "tlist.h"
|
||||
|
||||
#include "mp4itunestag.h"
|
||||
#include "mp4file.h"
|
||||
#include "boxfactory.h"
|
||||
#include "mp4tagsproxy.h"
|
||||
#include "mp4propsproxy.h"
|
||||
#include "mp4audioproperties.h"
|
||||
#include "itunesdatabox.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::File::FilePrivate
|
||||
{
|
||||
public:
|
||||
//! list for all boxes of the mp4 file
|
||||
TagLib::List<MP4::Mp4IsoBox*> boxes;
|
||||
//! the box factory - will create all boxes by tag and size
|
||||
MP4::BoxFactory boxfactory;
|
||||
//! proxy for the tags is filled after parsing
|
||||
MP4::Mp4TagsProxy tagsProxy;
|
||||
//! proxy for audio properties
|
||||
MP4::Mp4PropsProxy propsProxy;
|
||||
//! the tag returned by tag() function
|
||||
MP4::Tag mp4tag;
|
||||
//! container for the audio properties returned by properties() function
|
||||
MP4::AudioProperties mp4audioproperties;
|
||||
//! is set to valid after successfully parsing
|
||||
bool isValid;
|
||||
};
|
||||
|
||||
//! function to fill the tags with converted proxy data, which has been parsed out of the file previously
|
||||
static void fillTagFromProxy( MP4::Mp4TagsProxy& proxy, MP4::Tag& mp4tag );
|
||||
|
||||
MP4::File::File(const char *file, bool , AudioProperties::ReadStyle )
|
||||
:TagLib::File( file )
|
||||
{
|
||||
// create member container
|
||||
d = new MP4::File::FilePrivate();
|
||||
|
||||
|
||||
d->isValid = false;
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
while( readSizeAndType( size, fourcc ) == true )
|
||||
{
|
||||
// create the appropriate subclass and parse it
|
||||
MP4::Mp4IsoBox* curbox = d->boxfactory.createInstance( this, fourcc, size, tell() );
|
||||
curbox->parsebox();
|
||||
d->boxes.append( curbox );
|
||||
}
|
||||
|
||||
for( TagLib::List<MP4::Mp4IsoBox*>::Iterator iter = d->boxes.begin();
|
||||
iter != d->boxes.end();
|
||||
iter++ )
|
||||
{
|
||||
if( (*iter)->fourcc() == MP4::Fourcc("moov") )
|
||||
{
|
||||
d->isValid = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//if( d->isValid )
|
||||
//debug( "file is valid" );
|
||||
//else
|
||||
//debug( "file is NOT valid" );
|
||||
|
||||
// fill tags from proxy data
|
||||
fillTagFromProxy( d->tagsProxy, d->mp4tag );
|
||||
}
|
||||
|
||||
MP4::File::~File()
|
||||
{
|
||||
TagLib::List<Mp4IsoBox*>::Iterator delIter;
|
||||
for( delIter = d->boxes.begin();
|
||||
delIter != d->boxes.end();
|
||||
delIter++ )
|
||||
{
|
||||
delete *delIter;
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
Tag *MP4::File::tag() const
|
||||
{
|
||||
return &d->mp4tag;
|
||||
}
|
||||
|
||||
AudioProperties * MP4::File::audioProperties() const
|
||||
{
|
||||
d->mp4audioproperties.setProxy( &d->propsProxy );
|
||||
return &d->mp4audioproperties;
|
||||
}
|
||||
|
||||
bool MP4::File::save()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void MP4::File::remove()
|
||||
{
|
||||
}
|
||||
|
||||
uint MP4::File::readSystemsLen()
|
||||
{
|
||||
uint length = 0;
|
||||
uint nbytes = 0;
|
||||
ByteVector input;
|
||||
uchar tmp_input;
|
||||
|
||||
do
|
||||
{
|
||||
input = readBlock(1);
|
||||
tmp_input = static_cast<uchar>(input[0]);
|
||||
nbytes++;
|
||||
length = (length<<7) | (tmp_input&0x7F);
|
||||
} while( (tmp_input&0x80) && (nbytes<4) );
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
bool MP4::File::readSizeAndType( uint& size, MP4::Fourcc& fourcc )
|
||||
{
|
||||
// read the two blocks from file
|
||||
ByteVector readsize = readBlock(4);
|
||||
ByteVector readtype = readBlock(4);
|
||||
|
||||
if( (readsize.size() != 4) || (readtype.size() != 4) )
|
||||
return false;
|
||||
|
||||
// set size
|
||||
size = static_cast<unsigned char>(readsize[0]) << 24 |
|
||||
static_cast<unsigned char>(readsize[1]) << 16 |
|
||||
static_cast<unsigned char>(readsize[2]) << 8 |
|
||||
static_cast<unsigned char>(readsize[3]);
|
||||
|
||||
// type and size seem to be part of the stored size
|
||||
if( size < 8 )
|
||||
return false;
|
||||
|
||||
// set fourcc
|
||||
fourcc = readtype.data();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MP4::File::readInt( uint& toRead )
|
||||
{
|
||||
ByteVector readbuffer = readBlock(4);
|
||||
if( readbuffer.size() != 4 )
|
||||
return false;
|
||||
|
||||
toRead = static_cast<unsigned char>(readbuffer[0]) << 24 |
|
||||
static_cast<unsigned char>(readbuffer[1]) << 16 |
|
||||
static_cast<unsigned char>(readbuffer[2]) << 8 |
|
||||
static_cast<unsigned char>(readbuffer[3]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MP4::File::readShort( uint& toRead )
|
||||
{
|
||||
ByteVector readbuffer = readBlock(2);
|
||||
if( readbuffer.size() != 2 )
|
||||
return false;
|
||||
|
||||
toRead = static_cast<unsigned char>(readbuffer[0]) << 8 |
|
||||
static_cast<unsigned char>(readbuffer[1]);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MP4::File::readLongLong( TagLib::ulonglong& toRead )
|
||||
{
|
||||
ByteVector readbuffer = readBlock(8);
|
||||
if( readbuffer.size() != 8 )
|
||||
return false;
|
||||
|
||||
toRead = static_cast<ulonglong>(static_cast<unsigned char>(readbuffer[0])) << 56 |
|
||||
static_cast<ulonglong>(static_cast<unsigned char>(readbuffer[1])) << 48 |
|
||||
static_cast<ulonglong>(static_cast<unsigned char>(readbuffer[2])) << 40 |
|
||||
static_cast<ulonglong>(static_cast<unsigned char>(readbuffer[3])) << 32 |
|
||||
static_cast<ulonglong>(static_cast<unsigned char>(readbuffer[4])) << 24 |
|
||||
static_cast<ulonglong>(static_cast<unsigned char>(readbuffer[5])) << 16 |
|
||||
static_cast<ulonglong>(static_cast<unsigned char>(readbuffer[6])) << 8 |
|
||||
static_cast<ulonglong>(static_cast<unsigned char>(readbuffer[7]));
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MP4::File::readFourcc( TagLib::MP4::Fourcc& fourcc )
|
||||
{
|
||||
ByteVector readtype = readBlock(4);
|
||||
|
||||
if( readtype.size() != 4)
|
||||
return false;
|
||||
|
||||
// set fourcc
|
||||
fourcc = readtype.data();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
MP4::Mp4TagsProxy* MP4::File::tagProxy() const
|
||||
{
|
||||
return &d->tagsProxy;
|
||||
}
|
||||
|
||||
MP4::Mp4PropsProxy* MP4::File::propProxy() const
|
||||
{
|
||||
return &d->propsProxy;
|
||||
}
|
||||
|
||||
void fillTagFromProxy( MP4::Mp4TagsProxy& proxy, MP4::Tag& mp4tag )
|
||||
{
|
||||
// tmp buffer for each tag
|
||||
MP4::ITunesDataBox* databox;
|
||||
|
||||
databox = proxy.titleData();
|
||||
if( databox != 0 )
|
||||
{
|
||||
// convert data to string
|
||||
TagLib::String datastring( databox->data(), String::UTF8 );
|
||||
// check if string was set
|
||||
if( !datastring.isEmpty() )
|
||||
mp4tag.setTitle( datastring );
|
||||
}
|
||||
|
||||
databox = proxy.artistData();
|
||||
if( databox != 0 )
|
||||
{
|
||||
// convert data to string
|
||||
TagLib::String datastring( databox->data(), String::UTF8 );
|
||||
// check if string was set
|
||||
if( !datastring.isEmpty() )
|
||||
mp4tag.setArtist( datastring );
|
||||
}
|
||||
|
||||
databox = proxy.albumData();
|
||||
if( databox != 0 )
|
||||
{
|
||||
// convert data to string
|
||||
TagLib::String datastring( databox->data(), String::UTF8 );
|
||||
// check if string was set
|
||||
if( !datastring.isEmpty() )
|
||||
mp4tag.setAlbum( datastring );
|
||||
}
|
||||
|
||||
databox = proxy.genreData();
|
||||
if( databox != 0 )
|
||||
{
|
||||
// convert data to string
|
||||
TagLib::String datastring( databox->data(), String::UTF8 );
|
||||
// check if string was set
|
||||
if( !datastring.isEmpty() )
|
||||
mp4tag.setGenre( datastring );
|
||||
}
|
||||
|
||||
databox = proxy.yearData();
|
||||
if( databox != 0 )
|
||||
{
|
||||
// convert data to string
|
||||
TagLib::String datastring( databox->data(), String::UTF8 );
|
||||
// check if string was set
|
||||
if( !datastring.isEmpty() )
|
||||
mp4tag.setYear( datastring.toInt() );
|
||||
}
|
||||
|
||||
databox = proxy.trknData();
|
||||
if( databox != 0 )
|
||||
{
|
||||
// convert data to uint
|
||||
TagLib::ByteVector datavec = databox->data();
|
||||
if( datavec.size() >= 4 )
|
||||
{
|
||||
uint trackno = static_cast<uint>( static_cast<unsigned char>(datavec[0]) << 24 |
|
||||
static_cast<unsigned char>(datavec[1]) << 16 |
|
||||
static_cast<unsigned char>(datavec[2]) << 8 |
|
||||
static_cast<unsigned char>(datavec[3]) );
|
||||
mp4tag.setTrack( trackno );
|
||||
}
|
||||
else
|
||||
mp4tag.setTrack( 0 );
|
||||
}
|
||||
|
||||
databox = proxy.commentData();
|
||||
if( databox != 0 )
|
||||
{
|
||||
// convert data to string
|
||||
TagLib::String datastring( databox->data(), String::UTF8 );
|
||||
// check if string was set
|
||||
if( !datastring.isEmpty() )
|
||||
mp4tag.setComment( datastring );
|
||||
}
|
||||
|
||||
databox = proxy.groupingData();
|
||||
if( databox != 0 )
|
||||
{
|
||||
// convert data to string
|
||||
TagLib::String datastring( databox->data(), String::UTF8 );
|
||||
// check if string was set
|
||||
if( !datastring.isEmpty() )
|
||||
mp4tag.setGrouping( datastring );
|
||||
}
|
||||
|
||||
databox = proxy.composerData();
|
||||
if( databox != 0 )
|
||||
{
|
||||
// convert data to string
|
||||
TagLib::String datastring( databox->data(), String::UTF8 );
|
||||
// check if string was set
|
||||
if( !datastring.isEmpty() )
|
||||
mp4tag.setComposer( datastring );
|
||||
}
|
||||
|
||||
databox = proxy.diskData();
|
||||
if( databox != 0 )
|
||||
{
|
||||
// convert data to uint
|
||||
TagLib::ByteVector datavec = databox->data();
|
||||
if( datavec.size() >= 4 )
|
||||
{
|
||||
uint discno = static_cast<uint>( static_cast<unsigned char>(datavec[0]) << 24 |
|
||||
static_cast<unsigned char>(datavec[1]) << 16 |
|
||||
static_cast<unsigned char>(datavec[2]) << 8 |
|
||||
static_cast<unsigned char>(datavec[3]) );
|
||||
mp4tag.setDisk( discno );
|
||||
}
|
||||
else
|
||||
mp4tag.setDisk( 0 );
|
||||
}
|
||||
|
||||
databox = proxy.bpmData();
|
||||
if( databox != 0 )
|
||||
{
|
||||
// convert data to uint
|
||||
TagLib::ByteVector datavec = databox->data();
|
||||
|
||||
if( datavec.size() >= 2 )
|
||||
{
|
||||
uint bpm = static_cast<uint>( static_cast<unsigned char>(datavec[0]) << 8 |
|
||||
static_cast<unsigned char>(datavec[1]) );
|
||||
mp4tag.setBpm( bpm );
|
||||
}
|
||||
else
|
||||
mp4tag.setBpm( 0 );
|
||||
}
|
||||
|
||||
databox = proxy.coverData();
|
||||
if( databox != 0 )
|
||||
{
|
||||
// get byte vector
|
||||
mp4tag.setCover( databox->data() );
|
||||
}
|
||||
}
|
@ -1,169 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef TAGLIB_MP4FILE_H
|
||||
#define TAGLIB_MP4FILE_H
|
||||
|
||||
#include <tfile.h>
|
||||
#include <audioproperties.h>
|
||||
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib {
|
||||
|
||||
typedef unsigned long long ulonglong;
|
||||
|
||||
class Tag;
|
||||
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4TagsProxy;
|
||||
class Mp4PropsProxy;
|
||||
|
||||
//! An implementation of TagLib::File with mp4 itunes specific methods
|
||||
|
||||
/*!
|
||||
* This implements and provides an interface for mp4 itunes files to the
|
||||
* TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing
|
||||
* the abstract TagLib::File API as well as providing some additional
|
||||
* information specific to mp4 itunes files. (TODO)
|
||||
*/
|
||||
|
||||
class File : public TagLib::File
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* Contructs an mp4 itunes file from \a file. If \a readProperties is true the
|
||||
* file's audio properties will also be read using \a propertiesStyle. If
|
||||
* false, \a propertiesStyle is ignored.
|
||||
*/
|
||||
File(const char *file, bool readProperties = true,
|
||||
AudioProperties::ReadStyle propertiesStyle = AudioProperties::Average);
|
||||
|
||||
/*!
|
||||
* Destroys this instance of the File.
|
||||
*/
|
||||
virtual ~File();
|
||||
|
||||
/*!
|
||||
* Returns the Tag for this file. This will be an APE tag, an ID3v1 tag
|
||||
* or a combination of the two.
|
||||
*/
|
||||
virtual TagLib::Tag *tag() const;
|
||||
|
||||
/*!
|
||||
* Returns the mp4 itunes::Properties for this file. If no audio properties
|
||||
* were read then this will return a null pointer.
|
||||
*/
|
||||
virtual AudioProperties *audioProperties() const;
|
||||
|
||||
/*!
|
||||
* Saves the file.
|
||||
*/
|
||||
virtual bool save();
|
||||
|
||||
/*!
|
||||
* This will remove all tags.
|
||||
*
|
||||
* \note This will also invalidate pointers to the tags
|
||||
* as their memory will be freed.
|
||||
* \note In order to make the removal permanent save() still needs to be called
|
||||
*/
|
||||
void remove();
|
||||
|
||||
/*!
|
||||
* Helper function for parsing the MP4 file - reads the size and type of the next box.
|
||||
* Returns true if read succeeded - not at EOF
|
||||
*/
|
||||
bool readSizeAndType( uint& size, MP4::Fourcc& fourcc );
|
||||
|
||||
/*!
|
||||
* Helper function to read the length of an descriptor in systems manner
|
||||
*/
|
||||
uint readSystemsLen();
|
||||
|
||||
/*!
|
||||
* Helper function for reading an unsigned int out of the file (big endian method)
|
||||
*/
|
||||
bool readInt( uint& toRead );
|
||||
|
||||
/*!
|
||||
* Helper function for reading an unsigned short out of the file (big endian method)
|
||||
*/
|
||||
bool readShort( uint& toRead );
|
||||
|
||||
/*!
|
||||
* Helper function for reading an unsigned long long (64bit) out of the file (big endian method)
|
||||
*/
|
||||
bool readLongLong( TagLib::ulonglong& toRead );
|
||||
|
||||
/*!
|
||||
* Helper function to read a fourcc code
|
||||
*/
|
||||
bool readFourcc( TagLib::MP4::Fourcc& fourcc );
|
||||
|
||||
/*!
|
||||
* Function to get the tags proxy for registration of the tags boxes.
|
||||
* The proxy provides direct access to the data boxes of the certain tags - normally
|
||||
* covered by several levels of subboxes
|
||||
*/
|
||||
Mp4TagsProxy* tagProxy() const;
|
||||
|
||||
/*!
|
||||
* Function to get the properties proxy for registration of the properties boxes.
|
||||
* The proxy provides direct access to the needed boxes describing audio properties.
|
||||
*/
|
||||
Mp4PropsProxy* propProxy() const;
|
||||
|
||||
private:
|
||||
File(const File &);
|
||||
File &operator=(const File &);
|
||||
|
||||
class FilePrivate;
|
||||
FilePrivate *d;
|
||||
};
|
||||
|
||||
} // namespace MP4
|
||||
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // TAGLIB_MP4FILE_H
|
@ -1,84 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
MP4::Fourcc::Fourcc()
|
||||
{
|
||||
m_fourcc = 0U;
|
||||
}
|
||||
|
||||
MP4::Fourcc::Fourcc( TagLib::String fourcc )
|
||||
{
|
||||
m_fourcc = 0U;
|
||||
|
||||
if( fourcc.size() >= 4 )
|
||||
m_fourcc = static_cast<unsigned char>(fourcc[0]) << 24 |
|
||||
static_cast<unsigned char>(fourcc[1]) << 16 |
|
||||
static_cast<unsigned char>(fourcc[2]) << 8 |
|
||||
static_cast<unsigned char>(fourcc[3]);
|
||||
}
|
||||
|
||||
MP4::Fourcc::~Fourcc()
|
||||
{}
|
||||
|
||||
TagLib::String MP4::Fourcc::toString() const
|
||||
{
|
||||
TagLib::String fourcc;
|
||||
fourcc.append(static_cast<char>(m_fourcc >> 24 & 0xFF));
|
||||
fourcc.append(static_cast<char>(m_fourcc >> 16 & 0xFF));
|
||||
fourcc.append(static_cast<char>(m_fourcc >> 8 & 0xFF));
|
||||
fourcc.append(static_cast<char>(m_fourcc & 0xFF));
|
||||
|
||||
return fourcc;
|
||||
}
|
||||
|
||||
MP4::Fourcc::operator unsigned int() const
|
||||
{
|
||||
return m_fourcc;
|
||||
}
|
||||
|
||||
bool MP4::Fourcc::operator == (unsigned int fourccB ) const
|
||||
{
|
||||
return (m_fourcc==fourccB);
|
||||
}
|
||||
|
||||
bool MP4::Fourcc::operator != (unsigned int fourccB ) const
|
||||
{
|
||||
return (m_fourcc!=fourccB);
|
||||
}
|
||||
|
||||
MP4::Fourcc& MP4::Fourcc::operator = (unsigned int fourcc )
|
||||
{
|
||||
m_fourcc = fourcc;
|
||||
return *this;
|
||||
}
|
||||
|
||||
MP4::Fourcc& MP4::Fourcc::operator = (char fourcc[4])
|
||||
{
|
||||
m_fourcc = static_cast<unsigned char>(fourcc[0]) << 24 |
|
||||
static_cast<unsigned char>(fourcc[1]) << 16 |
|
||||
static_cast<unsigned char>(fourcc[2]) << 8 |
|
||||
static_cast<unsigned char>(fourcc[3]);
|
||||
return *this;
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4FOURCC_H
|
||||
#define MP4FOURCC_H
|
||||
|
||||
#include "tstring.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
/*! union for easy fourcc / type handling */
|
||||
class Fourcc
|
||||
{
|
||||
public:
|
||||
//! std constructor
|
||||
Fourcc();
|
||||
//! string constructor
|
||||
Fourcc(TagLib::String fourcc);
|
||||
|
||||
//! destructor
|
||||
~Fourcc();
|
||||
|
||||
//! function to get a string version of the fourcc
|
||||
TagLib::String toString() const;
|
||||
//! cast operator to unsigned int
|
||||
operator unsigned int() const;
|
||||
//! comparison operator
|
||||
bool operator == (unsigned int fourccB ) const;
|
||||
//! comparison operator
|
||||
bool operator != (unsigned int fourccB ) const;
|
||||
//! assigment operator for unsigned int
|
||||
Fourcc& operator = (unsigned int fourcc );
|
||||
//! assigment operator for character string
|
||||
Fourcc& operator = (char fourcc[4]);
|
||||
|
||||
private:
|
||||
uint m_fourcc; /*!< integer code of the fourcc */
|
||||
};
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4FOURCC_H
|
@ -1,75 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <deque>
|
||||
#include <iostream>
|
||||
#include "mp4hdlrbox.h"
|
||||
#include "boxfactory.h"
|
||||
#include "mp4file.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4HdlrBox::Mp4HdlrBoxPrivate
|
||||
{
|
||||
public:
|
||||
uint pre_defined;
|
||||
MP4::Fourcc handler_type;
|
||||
TagLib::String hdlr_string;
|
||||
}; // class Mp4HdlrBoxPrivate
|
||||
|
||||
MP4::Mp4HdlrBox::Mp4HdlrBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
: Mp4IsoFullBox( file, fourcc, size, offset )
|
||||
{
|
||||
d = new MP4::Mp4HdlrBox::Mp4HdlrBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4HdlrBox::~Mp4HdlrBox()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
MP4::Fourcc MP4::Mp4HdlrBox::hdlr_type() const
|
||||
{
|
||||
return d->handler_type;
|
||||
}
|
||||
|
||||
TagLib::String MP4::Mp4HdlrBox::hdlr_string() const
|
||||
{
|
||||
return d->hdlr_string;
|
||||
}
|
||||
|
||||
void MP4::Mp4HdlrBox::parse()
|
||||
{
|
||||
uint totalread = 12+20;
|
||||
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
if( mp4file->readInt( d->pre_defined ) == false )
|
||||
return;
|
||||
if( mp4file->readFourcc( d->handler_type ) == false )
|
||||
return;
|
||||
|
||||
// read reserved into trash
|
||||
mp4file->seek( 3*4, TagLib::File::Current );
|
||||
|
||||
// check if there are bytes remaining - used for hdlr string
|
||||
if( size() - totalread != 0 )
|
||||
d->hdlr_string = mp4file->readBlock( size()-totalread );
|
||||
}
|
@ -1,53 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4HDLRBOX_H
|
||||
#define MP4HDLRBOX_H
|
||||
|
||||
#include "mp4isofullbox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4HdlrBox: public Mp4IsoFullBox
|
||||
{
|
||||
public:
|
||||
Mp4HdlrBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4HdlrBox();
|
||||
|
||||
//! parse hdlr contents
|
||||
void parse();
|
||||
//! get the handler type
|
||||
MP4::Fourcc hdlr_type() const;
|
||||
//! get the hdlr string
|
||||
TagLib::String hdlr_string() const;
|
||||
|
||||
private:
|
||||
class Mp4HdlrBoxPrivate;
|
||||
Mp4HdlrBoxPrivate* d;
|
||||
}; // Mp4HdlrBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4HDLRBOX_H
|
@ -1,97 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "tlist.h"
|
||||
#include <iostream>
|
||||
#include "mp4ilstbox.h"
|
||||
#include "boxfactory.h"
|
||||
#include "mp4file.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4IlstBox::Mp4IlstBoxPrivate
|
||||
{
|
||||
public:
|
||||
//! container for all boxes in ilst box
|
||||
TagLib::List<Mp4IsoBox*> ilstBoxes;
|
||||
//! a box factory for creating the appropriate boxes
|
||||
MP4::BoxFactory boxfactory;
|
||||
}; // class Mp4IlstBoxPrivate
|
||||
|
||||
MP4::Mp4IlstBox::Mp4IlstBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
: Mp4IsoBox( file, fourcc, size, offset )
|
||||
{
|
||||
d = new MP4::Mp4IlstBox::Mp4IlstBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4IlstBox::~Mp4IlstBox()
|
||||
{
|
||||
TagLib::List<Mp4IsoBox*>::Iterator delIter;
|
||||
for( delIter = d->ilstBoxes.begin();
|
||||
delIter != d->ilstBoxes.end();
|
||||
delIter++ )
|
||||
{
|
||||
delete *delIter;
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MP4::Mp4IlstBox::parse()
|
||||
{
|
||||
#if 0
|
||||
std::cout << " parsing ilst box" << std::endl;
|
||||
#endif
|
||||
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
uint totalsize = 8;
|
||||
// parse all contained boxes
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
#if 0
|
||||
std::cout << " ";
|
||||
#endif
|
||||
while( (mp4file->readSizeAndType( size, fourcc ) == true) )
|
||||
{
|
||||
totalsize += size;
|
||||
|
||||
// check for errors
|
||||
if( totalsize > MP4::Mp4IsoBox::size() )
|
||||
{
|
||||
std::cerr << "Error in mp4 file " << mp4file->name() << " ilst box contains bad box with name: " << fourcc.toString() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// create the appropriate subclass and parse it
|
||||
MP4::Mp4IsoBox* curbox = d->boxfactory.createInstance( mp4file, fourcc, size, mp4file->tell() );
|
||||
curbox->parsebox();
|
||||
d->ilstBoxes.append( curbox );
|
||||
|
||||
// check for end of ilst box
|
||||
if( totalsize == MP4::Mp4IsoBox::size() )
|
||||
break;
|
||||
|
||||
#if 0
|
||||
std::cout << " ";
|
||||
#endif
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4ILSTBOX_H
|
||||
#define MP4ILSTBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4IlstBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
Mp4IlstBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4IlstBox();
|
||||
|
||||
//! parse ilst contents
|
||||
void parse();
|
||||
|
||||
private:
|
||||
class Mp4IlstBoxPrivate;
|
||||
Mp4IlstBoxPrivate* d;
|
||||
}; // Mp4IlstBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4ILSTBOX_H
|
@ -1,76 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "tfile.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4IsoBox::Mp4IsoBoxPrivate
|
||||
{
|
||||
public:
|
||||
MP4::Fourcc fourcc;
|
||||
uint size;
|
||||
long offset;
|
||||
TagLib::File* file;
|
||||
};
|
||||
|
||||
MP4::Mp4IsoBox::Mp4IsoBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
{
|
||||
d = new MP4::Mp4IsoBox::Mp4IsoBoxPrivate();
|
||||
d->file = file;
|
||||
d->fourcc = fourcc;
|
||||
d->size = size;
|
||||
d->offset = offset;
|
||||
}
|
||||
|
||||
MP4::Mp4IsoBox::~Mp4IsoBox()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MP4::Mp4IsoBox::parsebox()
|
||||
{
|
||||
// seek to offset
|
||||
file()->seek( offset(), File::Beginning );
|
||||
// simply call parse method of sub class
|
||||
parse();
|
||||
}
|
||||
|
||||
MP4::Fourcc MP4::Mp4IsoBox::fourcc() const
|
||||
{
|
||||
return d->fourcc;
|
||||
}
|
||||
|
||||
uint MP4::Mp4IsoBox::size() const
|
||||
{
|
||||
return d->size;
|
||||
}
|
||||
|
||||
long MP4::Mp4IsoBox::offset() const
|
||||
{
|
||||
return d->offset;
|
||||
}
|
||||
|
||||
TagLib::File* MP4::Mp4IsoBox::file() const
|
||||
{
|
||||
return d->file;
|
||||
}
|
@ -1,67 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4ISOBOX_H
|
||||
#define MP4ISOBOX_H
|
||||
|
||||
#include "taglib.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
class File;
|
||||
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
//! constructor for base class
|
||||
Mp4IsoBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
//! destructor - simply freeing private ptr
|
||||
virtual ~Mp4IsoBox();
|
||||
|
||||
//! function to get the fourcc code
|
||||
MP4::Fourcc fourcc() const;
|
||||
//! function to get the size of tha atom/box
|
||||
uint size() const;
|
||||
//! function to get the offset of the atom in the mp4 file
|
||||
long offset() const;
|
||||
|
||||
//! parse wrapper to get common interface for both box and fullbox
|
||||
virtual void parsebox();
|
||||
//! pure virtual function for all subclasses to implement
|
||||
virtual void parse() = 0;
|
||||
|
||||
protected:
|
||||
//! function to get the file pointer
|
||||
TagLib::File* file() const;
|
||||
|
||||
protected:
|
||||
class Mp4IsoBoxPrivate;
|
||||
Mp4IsoBoxPrivate* d;
|
||||
};
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4ISOBOX_H
|
||||
|
@ -1,67 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mp4isofullbox.h"
|
||||
#include "tfile.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4IsoFullBox::Mp4IsoFullBoxPrivate
|
||||
{
|
||||
public:
|
||||
uchar version;
|
||||
uint flags;
|
||||
}; // Mp4IsoFullBoxPrivate
|
||||
|
||||
|
||||
MP4::Mp4IsoFullBox::Mp4IsoFullBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
: Mp4IsoBox( file, fourcc, size, offset )
|
||||
{
|
||||
d = new MP4::Mp4IsoFullBox::Mp4IsoFullBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4IsoFullBox::~Mp4IsoFullBox()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MP4::Mp4IsoFullBox::parsebox()
|
||||
{
|
||||
// seek to offset
|
||||
Mp4IsoBox::file()->seek(Mp4IsoBox::offset(), File::Beginning );
|
||||
// parse version and flags
|
||||
ByteVector version_flags = Mp4IsoBox::file()->readBlock(4);
|
||||
d->version = version_flags[0];
|
||||
d->flags = version_flags[1] << 16 || version_flags[2] << 8 || version_flags[3];
|
||||
// call parse method of subclass
|
||||
parse();
|
||||
}
|
||||
|
||||
uchar MP4::Mp4IsoFullBox::version()
|
||||
{
|
||||
return d->version;
|
||||
}
|
||||
|
||||
uint MP4::Mp4IsoFullBox::flags()
|
||||
{
|
||||
return d->flags;
|
||||
}
|
||||
|
@ -1,57 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4ISOFULLBOX_H
|
||||
#define MP4ISOFULLBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4IsoFullBox : public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
//! constructor for full box
|
||||
Mp4IsoFullBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
//! destructor for mp4 iso full box
|
||||
virtual ~Mp4IsoFullBox();
|
||||
|
||||
//! function to get the version of box
|
||||
uchar version();
|
||||
//! function to get the flag map
|
||||
uint flags();
|
||||
|
||||
//! parse wrapper to get common interface for both box and fullbox
|
||||
virtual void parsebox();
|
||||
|
||||
protected:
|
||||
class Mp4IsoFullBoxPrivate;
|
||||
Mp4IsoFullBoxPrivate* d;
|
||||
};
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4ISOFULLBOX_H
|
||||
|
@ -1,197 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mp4itunestag.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Tag::TagPrivate
|
||||
{
|
||||
public:
|
||||
MP4::File* mp4file;
|
||||
TagLib::String title;
|
||||
TagLib::String artist;
|
||||
TagLib::String album;
|
||||
TagLib::String genre;
|
||||
uint year;
|
||||
uint track;
|
||||
TagLib::String comment;
|
||||
TagLib::String grouping;
|
||||
TagLib::String composer;
|
||||
uint disk;
|
||||
uint bpm;
|
||||
bool isEmpty;
|
||||
TagLib::ByteVector cover;
|
||||
};
|
||||
|
||||
|
||||
MP4::Tag::Tag( )
|
||||
{
|
||||
d = new TagPrivate();
|
||||
d->year = 0;
|
||||
d->track = 0;
|
||||
d->disk = 0;
|
||||
d->bpm = 0;
|
||||
d->isEmpty = true;
|
||||
}
|
||||
|
||||
MP4::Tag::~Tag()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
String MP4::Tag::title() const
|
||||
{
|
||||
return d->title;
|
||||
}
|
||||
|
||||
String MP4::Tag::artist() const
|
||||
{
|
||||
return d->artist;
|
||||
}
|
||||
|
||||
String MP4::Tag::album() const
|
||||
{
|
||||
return d->album;
|
||||
}
|
||||
|
||||
String MP4::Tag::comment() const
|
||||
{
|
||||
return d->comment;
|
||||
}
|
||||
|
||||
String MP4::Tag::genre() const
|
||||
{
|
||||
return d->genre;
|
||||
}
|
||||
|
||||
uint MP4::Tag::year() const
|
||||
{
|
||||
return d->year;
|
||||
}
|
||||
|
||||
uint MP4::Tag::track() const
|
||||
{
|
||||
return d->track;
|
||||
}
|
||||
|
||||
String MP4::Tag::grouping() const
|
||||
{
|
||||
return d->grouping;
|
||||
}
|
||||
|
||||
String MP4::Tag::composer() const
|
||||
{
|
||||
return d->composer;
|
||||
}
|
||||
|
||||
uint MP4::Tag::disk() const
|
||||
{
|
||||
return d->disk;
|
||||
}
|
||||
|
||||
uint MP4::Tag::bpm() const
|
||||
{
|
||||
return d->bpm;
|
||||
}
|
||||
|
||||
TagLib::ByteVector MP4::Tag::cover() const
|
||||
{
|
||||
return d->cover;
|
||||
}
|
||||
|
||||
void MP4::Tag::setTitle(const String &s)
|
||||
{
|
||||
d->title = s;
|
||||
d->isEmpty = false;
|
||||
}
|
||||
|
||||
void MP4::Tag::setArtist(const String &s)
|
||||
{
|
||||
d->artist = s;
|
||||
d->isEmpty = false;
|
||||
}
|
||||
|
||||
void MP4::Tag::setAlbum(const String &s)
|
||||
{
|
||||
d->album = s;
|
||||
d->isEmpty = false;
|
||||
}
|
||||
|
||||
void MP4::Tag::setComment(const String &s)
|
||||
{
|
||||
d->comment = s;
|
||||
d->isEmpty = false;
|
||||
}
|
||||
|
||||
void MP4::Tag::setGenre(const String &s)
|
||||
{
|
||||
d->genre = s;
|
||||
d->isEmpty = false;
|
||||
}
|
||||
|
||||
void MP4::Tag::setYear(const uint i)
|
||||
{
|
||||
d->year = i;
|
||||
d->isEmpty = false;
|
||||
}
|
||||
|
||||
void MP4::Tag::setTrack(const uint i)
|
||||
{
|
||||
d->track = i;
|
||||
d->isEmpty = false;
|
||||
}
|
||||
|
||||
void MP4::Tag::setGrouping(const String &s)
|
||||
{
|
||||
d->grouping = s;
|
||||
d->isEmpty = false;
|
||||
}
|
||||
|
||||
void MP4::Tag::setComposer(const String &s)
|
||||
{
|
||||
d->composer = s;
|
||||
d->isEmpty = false;
|
||||
}
|
||||
|
||||
void MP4::Tag::setDisk(const uint i)
|
||||
{
|
||||
d->disk = i;
|
||||
d->isEmpty = false;
|
||||
}
|
||||
|
||||
void MP4::Tag::setBpm(const uint i)
|
||||
{
|
||||
d->bpm = i;
|
||||
d->isEmpty = false;
|
||||
}
|
||||
|
||||
void MP4::Tag::setCover(const TagLib::ByteVector& c)
|
||||
{
|
||||
d->cover = c;
|
||||
d->isEmpty = false;
|
||||
}
|
||||
|
||||
bool MP4::Tag::isEmpty() const
|
||||
{
|
||||
return d->isEmpty;
|
||||
}
|
||||
|
@ -1,95 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4ITUNESTAG_H
|
||||
#define MP4ITUNESTAG_H
|
||||
|
||||
#include "taglib.h"
|
||||
#include "tstring.h"
|
||||
#include "tag.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class File;
|
||||
|
||||
class Tag : public TagLib::Tag
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* Constructs an empty MP4 iTunes tag.
|
||||
*/
|
||||
Tag( );
|
||||
|
||||
/*!
|
||||
* Destroys this Tag instance.
|
||||
*/
|
||||
virtual ~Tag();
|
||||
|
||||
// Reimplementations.
|
||||
|
||||
virtual String title() const;
|
||||
virtual String artist() const;
|
||||
virtual String album() const;
|
||||
virtual String comment() const;
|
||||
virtual String genre() const;
|
||||
virtual uint year() const;
|
||||
virtual uint track() const;
|
||||
|
||||
virtual void setTitle(const String &s);
|
||||
virtual void setArtist(const String &s);
|
||||
virtual void setAlbum(const String &s);
|
||||
virtual void setComment(const String &s);
|
||||
virtual void setGenre(const String &s);
|
||||
virtual void setYear(const uint i);
|
||||
virtual void setTrack(const uint i);
|
||||
|
||||
// MP4 specific fields
|
||||
|
||||
String grouping() const;
|
||||
String composer() const;
|
||||
uint disk() const;
|
||||
uint bpm() const;
|
||||
ByteVector cover() const;
|
||||
int compilation() const { return -1; }
|
||||
|
||||
void setGrouping(const String &s);
|
||||
void setComposer(const String &s);
|
||||
void setDisk(const uint i);
|
||||
void setBpm(const uint i);
|
||||
void setCover( const ByteVector& cover );
|
||||
void setCompilation( bool /*isCompilation*/ ) {}
|
||||
|
||||
virtual bool isEmpty() const;
|
||||
|
||||
private:
|
||||
Tag(const Tag &);
|
||||
Tag &operator=(const Tag &);
|
||||
|
||||
class TagPrivate;
|
||||
TagPrivate *d;
|
||||
};
|
||||
} // namespace MP4
|
||||
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4ITUNESTAG_H
|
@ -1,111 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "tlist.h"
|
||||
#include <iostream>
|
||||
#include "mp4mdiabox.h"
|
||||
#include "mp4hdlrbox.h"
|
||||
#include "mp4minfbox.h"
|
||||
#include "boxfactory.h"
|
||||
#include "mp4file.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4MdiaBox::Mp4MdiaBoxPrivate
|
||||
{
|
||||
public:
|
||||
//! container for all boxes in mdia box
|
||||
TagLib::List<Mp4IsoBox*> mdiaBoxes;
|
||||
//! a box factory for creating the appropriate boxes
|
||||
MP4::BoxFactory boxfactory;
|
||||
}; // class Mp4MdiaBoxPrivate
|
||||
|
||||
MP4::Mp4MdiaBox::Mp4MdiaBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
: Mp4IsoBox( file, fourcc, size, offset )
|
||||
{
|
||||
d = new MP4::Mp4MdiaBox::Mp4MdiaBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4MdiaBox::~Mp4MdiaBox()
|
||||
{
|
||||
TagLib::List<Mp4IsoBox*>::Iterator delIter;
|
||||
for( delIter = d->mdiaBoxes.begin();
|
||||
delIter != d->mdiaBoxes.end();
|
||||
delIter++ )
|
||||
{
|
||||
delete *delIter;
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MP4::Mp4MdiaBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
uint totalsize = 8;
|
||||
// parse all contained boxes
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
// stores the current handler type
|
||||
TagLib::MP4::Fourcc hdlrtype;
|
||||
|
||||
while( (mp4file->readSizeAndType( size, fourcc ) == true) )
|
||||
{
|
||||
totalsize += size;
|
||||
|
||||
// check for errors
|
||||
if( totalsize > MP4::Mp4IsoBox::size() )
|
||||
{
|
||||
std::cerr << "Error in mp4 file " << mp4file->name() << " mdia box contains bad box with name: " << fourcc.toString() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// create the appropriate subclass and parse it
|
||||
MP4::Mp4IsoBox* curbox = d->boxfactory.createInstance( mp4file, fourcc, size, mp4file->tell() );
|
||||
if( static_cast<uint>( fourcc ) == 0x6d696e66 /*"minf"*/ )
|
||||
{
|
||||
// cast to minf
|
||||
Mp4MinfBox* minfbox = dynamic_cast<Mp4MinfBox*>( curbox );
|
||||
if(!minfbox)
|
||||
return;
|
||||
// set handler type
|
||||
minfbox->setHandlerType( hdlrtype );
|
||||
}
|
||||
|
||||
curbox->parsebox();
|
||||
d->mdiaBoxes.append( curbox );
|
||||
|
||||
if(static_cast<uint>( fourcc ) == 0x68646c72 /*"hdlr"*/ )
|
||||
{
|
||||
// cast to hdlr box
|
||||
Mp4HdlrBox* hdlrbox = dynamic_cast<Mp4HdlrBox*>( curbox );
|
||||
if(!hdlrbox)
|
||||
return;
|
||||
// get handler type
|
||||
hdlrtype = hdlrbox->hdlr_type();
|
||||
}
|
||||
// check for end of mdia box
|
||||
if( totalsize == MP4::Mp4IsoBox::size() )
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4MDIABOX_H
|
||||
#define MP4MDIABOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4MdiaBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
Mp4MdiaBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4MdiaBox();
|
||||
|
||||
//! parse mdia contents
|
||||
void parse();
|
||||
|
||||
private:
|
||||
class Mp4MdiaBoxPrivate;
|
||||
Mp4MdiaBoxPrivate* d;
|
||||
}; // Mp4MdiaBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4MDIABOX_H
|
@ -1,86 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <tlist.h>
|
||||
#include <iostream>
|
||||
#include "mp4metabox.h"
|
||||
#include "boxfactory.h"
|
||||
#include "mp4file.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4MetaBox::Mp4MetaBoxPrivate
|
||||
{
|
||||
public:
|
||||
//! container for all boxes in meta box
|
||||
TagLib::List<Mp4IsoBox*> metaBoxes;
|
||||
//! a box factory for creating the appropriate boxes
|
||||
MP4::BoxFactory boxfactory;
|
||||
}; // class Mp4MetaBoxPrivate
|
||||
|
||||
MP4::Mp4MetaBox::Mp4MetaBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
: Mp4IsoFullBox( file, fourcc, size, offset )
|
||||
{
|
||||
d = new MP4::Mp4MetaBox::Mp4MetaBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4MetaBox::~Mp4MetaBox()
|
||||
{
|
||||
TagLib::List<Mp4IsoBox*>::Iterator delIter;
|
||||
for( delIter = d->metaBoxes.begin();
|
||||
delIter != d->metaBoxes.end();
|
||||
delIter++ )
|
||||
{
|
||||
delete *delIter;
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MP4::Mp4MetaBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
uint totalsize = 12; // initial size of box
|
||||
// parse all contained boxes
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
while( (mp4file->readSizeAndType( size, fourcc ) == true) )
|
||||
{
|
||||
totalsize += size;
|
||||
|
||||
// check for errors
|
||||
if( totalsize > MP4::Mp4IsoBox::size() )
|
||||
{
|
||||
std::cerr << "Error in mp4 file " << mp4file->name() << " meta box contains bad box with name: " << fourcc.toString() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// create the appropriate subclass and parse it
|
||||
MP4::Mp4IsoBox* curbox = d->boxfactory.createInstance( mp4file, fourcc, size, mp4file->tell() );
|
||||
curbox->parsebox();
|
||||
d->metaBoxes.append( curbox );
|
||||
|
||||
// check for end of meta box
|
||||
if( totalsize == MP4::Mp4IsoBox::size() )
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4METABOX_H
|
||||
#define MP4METABOX_H
|
||||
|
||||
#include "mp4isofullbox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4MetaBox: public Mp4IsoFullBox
|
||||
{
|
||||
public:
|
||||
Mp4MetaBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4MetaBox();
|
||||
|
||||
//! parse meta contents
|
||||
void parse();
|
||||
|
||||
private:
|
||||
class Mp4MetaBoxPrivate;
|
||||
Mp4MetaBoxPrivate* d;
|
||||
}; // Mp4MetaBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4METABOX_H
|
@ -1,104 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "tlist.h"
|
||||
#include <iostream>
|
||||
#include "mp4minfbox.h"
|
||||
#include "mp4stblbox.h"
|
||||
#include "boxfactory.h"
|
||||
#include "mp4file.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4MinfBox::Mp4MinfBoxPrivate
|
||||
{
|
||||
public:
|
||||
//! container for all boxes in minf box
|
||||
TagLib::List<Mp4IsoBox*> minfBoxes;
|
||||
//! a box factory for creating the appropriate boxes
|
||||
MP4::BoxFactory boxfactory;
|
||||
//! stores the handler type of the current trak
|
||||
MP4::Fourcc handler_type;
|
||||
}; // class Mp4MinfBoxPrivate
|
||||
|
||||
MP4::Mp4MinfBox::Mp4MinfBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
: Mp4IsoBox( file, fourcc, size, offset )
|
||||
{
|
||||
d = new MP4::Mp4MinfBox::Mp4MinfBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4MinfBox::~Mp4MinfBox()
|
||||
{
|
||||
TagLib::List<Mp4IsoBox*>::Iterator delIter;
|
||||
for( delIter = d->minfBoxes.begin();
|
||||
delIter != d->minfBoxes.end();
|
||||
delIter++ )
|
||||
{
|
||||
delete *delIter;
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MP4::Mp4MinfBox::setHandlerType( MP4::Fourcc fourcc )
|
||||
{
|
||||
d->handler_type = fourcc;
|
||||
}
|
||||
|
||||
void MP4::Mp4MinfBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
uint totalsize = 8;
|
||||
// parse all contained boxes
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
while( (mp4file->readSizeAndType( size, fourcc ) == true) )
|
||||
{
|
||||
totalsize += size;
|
||||
|
||||
// check for errors
|
||||
if( totalsize > MP4::Mp4IsoBox::size() )
|
||||
{
|
||||
std::cerr << "Error in mp4 file " << mp4file->name() << " minf box contains bad box with name: " << fourcc.toString() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// create the appropriate subclass and parse it
|
||||
MP4::Mp4IsoBox* curbox = d->boxfactory.createInstance( mp4file, fourcc, size, mp4file->tell() );
|
||||
if(static_cast<uint>( fourcc ) == 0x7374626c /*stbl*/ )
|
||||
{
|
||||
// cast to hdlr box
|
||||
Mp4StblBox* stblbox = dynamic_cast<Mp4StblBox*>( curbox );
|
||||
if(!stblbox)
|
||||
return;
|
||||
// set handler type
|
||||
stblbox->setHandlerType( d->handler_type );
|
||||
}
|
||||
|
||||
curbox->parsebox();
|
||||
d->minfBoxes.append( curbox );
|
||||
|
||||
// check for end of minf box
|
||||
if( totalsize == MP4::Mp4IsoBox::size() )
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4MINFBOX_H
|
||||
#define MP4MINFBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4MinfBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
Mp4MinfBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4MinfBox();
|
||||
|
||||
//! parse minf contents
|
||||
void parse();
|
||||
//! set the handler type - needed for stsd
|
||||
void setHandlerType( MP4::Fourcc fourcc );
|
||||
|
||||
private:
|
||||
class Mp4MinfBoxPrivate;
|
||||
Mp4MinfBoxPrivate* d;
|
||||
}; // Mp4MinfBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4MINFBOX_H
|
@ -1,86 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "tlist.h"
|
||||
#include <iostream>
|
||||
#include "mp4moovbox.h"
|
||||
#include "boxfactory.h"
|
||||
#include "mp4file.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4MoovBox::Mp4MoovBoxPrivate
|
||||
{
|
||||
public:
|
||||
//! container for all boxes in moov box
|
||||
TagLib::List<Mp4IsoBox*> moovBoxes;
|
||||
//! a box factory for creating the appropriate boxes
|
||||
MP4::BoxFactory boxfactory;
|
||||
}; // class Mp4MoovBoxPrivate
|
||||
|
||||
MP4::Mp4MoovBox::Mp4MoovBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
: Mp4IsoBox( file, fourcc, size, offset )
|
||||
{
|
||||
d = new MP4::Mp4MoovBox::Mp4MoovBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4MoovBox::~Mp4MoovBox()
|
||||
{
|
||||
TagLib::List<Mp4IsoBox*>::Iterator delIter;
|
||||
for( delIter = d->moovBoxes.begin();
|
||||
delIter != d->moovBoxes.end();
|
||||
delIter++ )
|
||||
{
|
||||
delete *delIter;
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MP4::Mp4MoovBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
uint totalsize = 8;
|
||||
// parse all contained boxes
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
while( (mp4file->readSizeAndType( size, fourcc ) == true) )
|
||||
{
|
||||
totalsize += size;
|
||||
|
||||
// check for errors
|
||||
if( totalsize > MP4::Mp4IsoBox::size() )
|
||||
{
|
||||
std::cerr << "Error in mp4 file " << mp4file->name() << " moov box contains bad box with name: " << fourcc.toString() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// create the appropriate subclass and parse it
|
||||
MP4::Mp4IsoBox* curbox = d->boxfactory.createInstance( mp4file, fourcc, size, mp4file->tell() );
|
||||
curbox->parsebox();
|
||||
d->moovBoxes.append( curbox );
|
||||
|
||||
// check for end of moov box
|
||||
if( totalsize == MP4::Mp4IsoBox::size() )
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4MOOVBOX_H
|
||||
#define MP4MOOVBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4MoovBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
Mp4MoovBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4MoovBox();
|
||||
|
||||
//! parse moov contents
|
||||
void parse();
|
||||
|
||||
private:
|
||||
class Mp4MoovBoxPrivate;
|
||||
Mp4MoovBoxPrivate* d;
|
||||
}; // Mp4MoovBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4MOOVBOX_H
|
@ -1,140 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <deque>
|
||||
#include <iostream>
|
||||
#include "mp4mvhdbox.h"
|
||||
#include "boxfactory.h"
|
||||
#include "mp4file.h"
|
||||
#include "mp4propsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4MvhdBox::Mp4MvhdBoxPrivate
|
||||
{
|
||||
public:
|
||||
//! creation time of the file
|
||||
TagLib::ulonglong creationTime;
|
||||
//! modification time of the file - since midnight, Jan. 1, 1904, UTC-time
|
||||
TagLib::ulonglong modificationTime;
|
||||
//! timescale for the file - referred by all time specifications in this box
|
||||
uint timescale;
|
||||
//! duration of presentation
|
||||
TagLib::ulonglong duration;
|
||||
//! playout speed
|
||||
uint rate;
|
||||
//! volume for entire presentation
|
||||
uint volume;
|
||||
//! track ID for an additional track (next new track)
|
||||
uint nextTrackID;
|
||||
}; // class Mp4MvhdBoxPrivate
|
||||
|
||||
MP4::Mp4MvhdBox::Mp4MvhdBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
: Mp4IsoFullBox( file, fourcc, size, offset )
|
||||
{
|
||||
d = new MP4::Mp4MvhdBox::Mp4MvhdBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4MvhdBox::~Mp4MvhdBox()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
TagLib::ulonglong MP4::Mp4MvhdBox::creationTime() const
|
||||
{
|
||||
return d->creationTime;
|
||||
}
|
||||
|
||||
TagLib::ulonglong MP4::Mp4MvhdBox::modificationTime() const
|
||||
{
|
||||
return d->modificationTime;
|
||||
}
|
||||
|
||||
uint MP4::Mp4MvhdBox::timescale() const
|
||||
{
|
||||
return d->timescale;
|
||||
}
|
||||
|
||||
TagLib::ulonglong MP4::Mp4MvhdBox::duration() const
|
||||
{
|
||||
return d->duration;
|
||||
}
|
||||
|
||||
uint MP4::Mp4MvhdBox::rate() const
|
||||
{
|
||||
return d->rate;
|
||||
}
|
||||
|
||||
uint MP4::Mp4MvhdBox::volume() const
|
||||
{
|
||||
return d->volume;
|
||||
}
|
||||
|
||||
uint MP4::Mp4MvhdBox::nextTrackID() const
|
||||
{
|
||||
return d->nextTrackID;
|
||||
}
|
||||
|
||||
|
||||
void MP4::Mp4MvhdBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
if( version() == 1 )
|
||||
{
|
||||
if( !mp4file->readLongLong( d->creationTime ) )
|
||||
return;
|
||||
if( !mp4file->readLongLong( d->modificationTime ) )
|
||||
return;
|
||||
if( !mp4file->readInt( d->timescale ) )
|
||||
return;
|
||||
if( !mp4file->readLongLong( d->duration ) )
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
uint creationTime_tmp, modificationTime_tmp, duration_tmp;
|
||||
|
||||
if( !mp4file->readInt( creationTime_tmp ) )
|
||||
return;
|
||||
if( !mp4file->readInt( modificationTime_tmp ) )
|
||||
return;
|
||||
if( !mp4file->readInt( d->timescale ) )
|
||||
return;
|
||||
if( !mp4file->readInt( duration_tmp ) )
|
||||
return;
|
||||
|
||||
d->creationTime = creationTime_tmp;
|
||||
d->modificationTime = modificationTime_tmp;
|
||||
d->duration = duration_tmp;
|
||||
}
|
||||
if( !mp4file->readInt( d->rate ) )
|
||||
return;
|
||||
if( !mp4file->readInt( d->volume ) )
|
||||
return;
|
||||
// jump over unused fields
|
||||
mp4file->seek( 68, File::Current );
|
||||
|
||||
if( !mp4file->readInt( d->nextTrackID ) )
|
||||
return;
|
||||
// register at proxy
|
||||
mp4file->propProxy()->registerMvhd( this );
|
||||
}
|
@ -1,65 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4MVHDBOX_H
|
||||
#define MP4MVHDBOX_H
|
||||
|
||||
#include "mp4isofullbox.h"
|
||||
#include "mp4fourcc.h"
|
||||
#include "mp4file.h" // ulonglong
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4MvhdBox: public Mp4IsoFullBox
|
||||
{
|
||||
public:
|
||||
Mp4MvhdBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4MvhdBox();
|
||||
|
||||
//! function to get the creation time of the mp4 file
|
||||
ulonglong creationTime() const;
|
||||
//! function to get the modification time of the mp4 file
|
||||
ulonglong modificationTime() const;
|
||||
//! function to get the timescale referenced by the above timestamps
|
||||
uint timescale() const;
|
||||
//! function to get the presentation duration in the mp4 file
|
||||
ulonglong duration() const;
|
||||
//! function to get the rate (playout speed) - typically 1.0;
|
||||
uint rate() const;
|
||||
//! function to get volume level for presentation - typically 1.0;
|
||||
uint volume() const;
|
||||
//! function to get the track ID for adding new tracks - useless for this lib
|
||||
uint nextTrackID() const;
|
||||
|
||||
//! parse mvhd contents
|
||||
void parse();
|
||||
|
||||
private:
|
||||
class Mp4MvhdBoxPrivate;
|
||||
Mp4MvhdBoxPrivate* d;
|
||||
}; // Mp4MvhdBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4MVHDBOX_H
|
@ -1,89 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mp4propsproxy.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4PropsProxy::Mp4PropsProxyPrivate
|
||||
{
|
||||
public:
|
||||
//! the movie header box
|
||||
MP4::Mp4MvhdBox* mvhdbox;
|
||||
//! the sample table box
|
||||
MP4::Mp4AudioSampleEntry* audiosampleentry;
|
||||
};
|
||||
|
||||
|
||||
MP4::Mp4PropsProxy::Mp4PropsProxy()
|
||||
{
|
||||
d = new MP4::Mp4PropsProxy::Mp4PropsProxyPrivate();
|
||||
d->mvhdbox = 0;
|
||||
d->audiosampleentry = 0;
|
||||
}
|
||||
|
||||
MP4::Mp4PropsProxy::~Mp4PropsProxy()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
uint MP4::Mp4PropsProxy::seconds() const
|
||||
{
|
||||
if( d->mvhdbox )
|
||||
return static_cast<uint>( d->mvhdbox->duration() / d->mvhdbox->timescale() );
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint MP4::Mp4PropsProxy::channels() const
|
||||
{
|
||||
if( d->audiosampleentry )
|
||||
return d->audiosampleentry->channels();
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint MP4::Mp4PropsProxy::sampleRate() const
|
||||
{
|
||||
if( d->audiosampleentry )
|
||||
return (d->audiosampleentry->samplerate()>>16);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint MP4::Mp4PropsProxy::bitRate() const
|
||||
{
|
||||
if( d->audiosampleentry )
|
||||
return (d->audiosampleentry->bitrate());
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MP4::Mp4PropsProxy::registerMvhd( MP4::Mp4MvhdBox* mvhdbox )
|
||||
{
|
||||
d->mvhdbox = mvhdbox;
|
||||
}
|
||||
|
||||
void MP4::Mp4PropsProxy::registerAudioSampleEntry( MP4::Mp4AudioSampleEntry* audioSampleEntry )
|
||||
{
|
||||
d->audiosampleentry = audioSampleEntry;
|
||||
}
|
||||
|
@ -1,65 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4PROPSPROXY_H
|
||||
#define MP4PROPSPROXY_H MP4PROPSPROXY_H
|
||||
#include "mp4mvhdbox.h"
|
||||
#include "mp4audiosampleentry.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
//! Mp4PropsProxy is used to access the stsd box and mvhd box directly
|
||||
/*! this class works as a shortcut to avoid stepping through all parent boxes
|
||||
* to access the boxes in question
|
||||
*/
|
||||
class Mp4PropsProxy
|
||||
{
|
||||
public:
|
||||
//! constructor for properties proxy
|
||||
Mp4PropsProxy();
|
||||
//! destructor
|
||||
~Mp4PropsProxy();
|
||||
|
||||
//! function to get length of media in seconds
|
||||
uint seconds() const;
|
||||
//! function to get the nunmber of channels
|
||||
uint channels() const;
|
||||
//! function to get the sample rate
|
||||
uint sampleRate() const;
|
||||
//! function to get the bitrate rate
|
||||
uint bitRate() const;
|
||||
|
||||
//! function to register the movie header box - mvhd
|
||||
void registerMvhd( MP4::Mp4MvhdBox* mvhdbox );
|
||||
//! function to register the sample description box
|
||||
void registerAudioSampleEntry( MP4::Mp4AudioSampleEntry* audiosampleentry );
|
||||
|
||||
private:
|
||||
class Mp4PropsProxyPrivate;
|
||||
Mp4PropsProxyPrivate* d;
|
||||
|
||||
}; // Mp4PropsProxy
|
||||
} // MP4
|
||||
} // TagLib
|
||||
|
||||
#endif // MP4PROPSPROXY_H
|
@ -1,59 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mp4sampleentry.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4file.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4SampleEntry::Mp4SampleEntryPrivate
|
||||
{
|
||||
public:
|
||||
uint data_reference_index;
|
||||
};
|
||||
|
||||
MP4::Mp4SampleEntry::Mp4SampleEntry( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::Mp4SampleEntry::Mp4SampleEntryPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4SampleEntry::~Mp4SampleEntry()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::Mp4SampleEntry::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = dynamic_cast<TagLib::MP4::File*>(file());
|
||||
if(!mp4file)
|
||||
return;
|
||||
|
||||
// skip the first 6 bytes
|
||||
mp4file->seek( 6, TagLib::File::Current );
|
||||
// read data reference index
|
||||
if(!mp4file->readShort( d->data_reference_index))
|
||||
return;
|
||||
parseEntry();
|
||||
}
|
||||
|
@ -1,54 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4SAMPLEENTRY_H
|
||||
#define MP4SAMPLEENTRY_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4SampleEntry: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
Mp4SampleEntry( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4SampleEntry();
|
||||
|
||||
public:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
private:
|
||||
//! function to be implemented in subclass
|
||||
virtual void parseEntry() = 0;
|
||||
|
||||
protected:
|
||||
class Mp4SampleEntryPrivate;
|
||||
Mp4SampleEntryPrivate* d;
|
||||
}; // class Mp4SampleEntry
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4SAMPLEENTRY_H
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mp4skipbox.h"
|
||||
#include "mp4isobox.h"
|
||||
#include "tfile.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4SkipBox::Mp4SkipBoxPrivate
|
||||
{
|
||||
public:
|
||||
};
|
||||
|
||||
MP4::Mp4SkipBox::Mp4SkipBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
:Mp4IsoBox(file, fourcc, size, offset)
|
||||
{
|
||||
d = new MP4::Mp4SkipBox::Mp4SkipBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4SkipBox::~Mp4SkipBox()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
//! parse the content of the box
|
||||
void MP4::Mp4SkipBox::parse()
|
||||
{
|
||||
// skip contents
|
||||
file()->seek( size() - 8, TagLib::File::Current );
|
||||
}
|
||||
|
@ -1,50 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4SKIPBOX_H
|
||||
#define MP4SKIPBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4SkipBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
Mp4SkipBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4SkipBox();
|
||||
|
||||
private:
|
||||
//! parse the content of the box
|
||||
virtual void parse();
|
||||
|
||||
protected:
|
||||
class Mp4SkipBoxPrivate;
|
||||
Mp4SkipBoxPrivate* d;
|
||||
}; // class Mp4SkipBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4SKIPBOX_H
|
@ -1,105 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "tlist.h"
|
||||
#include <iostream>
|
||||
#include "mp4stblbox.h"
|
||||
#include "mp4stsdbox.h"
|
||||
#include "boxfactory.h"
|
||||
#include "mp4file.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4StblBox::Mp4StblBoxPrivate
|
||||
{
|
||||
public:
|
||||
//! container for all boxes in stbl box
|
||||
TagLib::List<Mp4IsoBox*> stblBoxes;
|
||||
//! a box factory for creating the appropriate boxes
|
||||
MP4::BoxFactory boxfactory;
|
||||
//! the handler type for the current trak
|
||||
MP4::Fourcc handler_type;
|
||||
}; // class Mp4StblBoxPrivate
|
||||
|
||||
MP4::Mp4StblBox::Mp4StblBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
: Mp4IsoBox( file, fourcc, size, offset )
|
||||
{
|
||||
d = new MP4::Mp4StblBox::Mp4StblBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4StblBox::~Mp4StblBox()
|
||||
{
|
||||
TagLib::List<Mp4IsoBox*>::Iterator delIter;
|
||||
for( delIter = d->stblBoxes.begin();
|
||||
delIter != d->stblBoxes.end();
|
||||
delIter++ )
|
||||
{
|
||||
delete *delIter;
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MP4::Mp4StblBox::setHandlerType( MP4::Fourcc fourcc )
|
||||
{
|
||||
d->handler_type = fourcc;
|
||||
}
|
||||
|
||||
void MP4::Mp4StblBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
uint totalsize = 8;
|
||||
// parse all contained boxes
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
while( (mp4file->readSizeAndType( size, fourcc ) == true) )
|
||||
{
|
||||
totalsize += size;
|
||||
|
||||
// check for errors
|
||||
if( totalsize > MP4::Mp4IsoBox::size() )
|
||||
{
|
||||
std::cerr << "Error in mp4 file " << mp4file->name() << " stbl box contains bad box with name: " << fourcc.toString() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// create the appropriate subclass and parse it
|
||||
MP4::Mp4IsoBox* curbox = d->boxfactory.createInstance( mp4file, fourcc, size, mp4file->tell() );
|
||||
|
||||
// check for stsd
|
||||
if( static_cast<uint>(fourcc) == 0x73747364 /*'stsd'*/ )
|
||||
{
|
||||
// cast to stsd box
|
||||
MP4::Mp4StsdBox* stsdbox = dynamic_cast<MP4::Mp4StsdBox*>(curbox);
|
||||
if(!stsdbox)
|
||||
return;
|
||||
// set the handler type
|
||||
stsdbox->setHandlerType( d->handler_type );
|
||||
}
|
||||
curbox->parsebox();
|
||||
d->stblBoxes.append( curbox );
|
||||
|
||||
// check for end of stbl box
|
||||
if( totalsize == MP4::Mp4IsoBox::size() )
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4STBLBOX_H
|
||||
#define MP4STBLBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4StblBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
Mp4StblBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4StblBox();
|
||||
|
||||
//! parse stbl contents
|
||||
void parse();
|
||||
//! set the handler type - needed for stsd
|
||||
void setHandlerType( MP4::Fourcc fourcc );
|
||||
|
||||
private:
|
||||
class Mp4StblBoxPrivate;
|
||||
Mp4StblBoxPrivate* d;
|
||||
}; // Mp4StblBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4STBLBOX_H
|
@ -1,91 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "tlist.h"
|
||||
#include <iostream>
|
||||
#include "mp4stsdbox.h"
|
||||
#include "mp4audiosampleentry.h"
|
||||
#include "mp4file.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4StsdBox::Mp4StsdBoxPrivate
|
||||
{
|
||||
public:
|
||||
//! the handler type for the current trak
|
||||
MP4::Fourcc handler_type;
|
||||
//! the audio sample entry
|
||||
MP4::Mp4AudioSampleEntry* audioSampleEntry;
|
||||
}; // class Mp4StsdBoxPrivate
|
||||
|
||||
MP4::Mp4StsdBox::Mp4StsdBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
: Mp4IsoFullBox( file, fourcc, size, offset )
|
||||
{
|
||||
d = new MP4::Mp4StsdBox::Mp4StsdBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4StsdBox::~Mp4StsdBox()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MP4::Mp4StsdBox::setHandlerType( MP4::Fourcc fourcc )
|
||||
{
|
||||
d->handler_type = fourcc;
|
||||
}
|
||||
|
||||
void MP4::Mp4StsdBox::parse()
|
||||
{
|
||||
MP4::File* mp4file = dynamic_cast<MP4::File*>( file() );
|
||||
if(!mp4file)
|
||||
return;
|
||||
|
||||
uint totalsize = 12; // initial size of box
|
||||
|
||||
// check for handler type - only parse if 'soun':
|
||||
if( static_cast<uint>(d->handler_type) == 0x736f756e )
|
||||
{
|
||||
// read entry count
|
||||
uint entry_count;
|
||||
if(!mp4file->readInt( entry_count ))
|
||||
return;
|
||||
|
||||
// simply read first entry and skip all following
|
||||
// read size and type
|
||||
uint cursize;
|
||||
MP4::Fourcc fourcc;
|
||||
if( !mp4file->readSizeAndType( cursize, fourcc ))
|
||||
return;
|
||||
|
||||
totalsize += 12;
|
||||
// alocate an AudioSampleEntry
|
||||
d->audioSampleEntry = new MP4::Mp4AudioSampleEntry( mp4file, fourcc, cursize, mp4file->tell() );
|
||||
// parse the AudioSampleEntry
|
||||
d->audioSampleEntry->parse();
|
||||
totalsize += cursize-8;
|
||||
// skip the remaining box contents
|
||||
mp4file->seek( size()-totalsize, TagLib::File::Current );
|
||||
}
|
||||
else
|
||||
{
|
||||
mp4file->seek( size()-totalsize, TagLib::File::Current );
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4STSDBOX_H
|
||||
#define MP4STSDBOX_H
|
||||
|
||||
#include "mp4isofullbox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4StsdBox: public Mp4IsoFullBox
|
||||
{
|
||||
public:
|
||||
Mp4StsdBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4StsdBox();
|
||||
|
||||
//! parse stsd contents
|
||||
void parse();
|
||||
//! set the handler type - needed for stsd
|
||||
void setHandlerType( MP4::Fourcc fourcc );
|
||||
|
||||
private:
|
||||
class Mp4StsdBoxPrivate;
|
||||
Mp4StsdBoxPrivate* d;
|
||||
}; // Mp4StsdBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4STSDBOX_H
|
@ -1,168 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mp4tagsproxy.h"
|
||||
#include "itunesdatabox.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4TagsProxy::Mp4TagsProxyPrivate
|
||||
{
|
||||
public:
|
||||
ITunesDataBox* titleData;
|
||||
ITunesDataBox* artistData;
|
||||
ITunesDataBox* albumData;
|
||||
ITunesDataBox* coverData;
|
||||
ITunesDataBox* genreData;
|
||||
ITunesDataBox* yearData;
|
||||
ITunesDataBox* trknData;
|
||||
ITunesDataBox* commentData;
|
||||
ITunesDataBox* groupingData;
|
||||
ITunesDataBox* composerData;
|
||||
ITunesDataBox* diskData;
|
||||
ITunesDataBox* bpmData;
|
||||
};
|
||||
|
||||
MP4::Mp4TagsProxy::Mp4TagsProxy()
|
||||
{
|
||||
d = new MP4::Mp4TagsProxy::Mp4TagsProxyPrivate();
|
||||
d->titleData = 0;
|
||||
d->artistData = 0;
|
||||
d->albumData = 0;
|
||||
d->coverData = 0;
|
||||
d->genreData = 0;
|
||||
d->yearData = 0;
|
||||
d->trknData = 0;
|
||||
d->commentData = 0;
|
||||
d->groupingData = 0;
|
||||
d->composerData = 0;
|
||||
d->diskData = 0;
|
||||
d->bpmData = 0;
|
||||
}
|
||||
|
||||
MP4::Mp4TagsProxy::~Mp4TagsProxy()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox* MP4::Mp4TagsProxy::titleData() const
|
||||
{
|
||||
return d->titleData;
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox* MP4::Mp4TagsProxy::artistData() const
|
||||
{
|
||||
return d->artistData;
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox* MP4::Mp4TagsProxy::albumData() const
|
||||
{
|
||||
return d->albumData;
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox* MP4::Mp4TagsProxy::genreData() const
|
||||
{
|
||||
return d->genreData;
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox* MP4::Mp4TagsProxy::yearData() const
|
||||
{
|
||||
return d->yearData;
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox* MP4::Mp4TagsProxy::trknData() const
|
||||
{
|
||||
return d->trknData;
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox* MP4::Mp4TagsProxy::commentData() const
|
||||
{
|
||||
return d->commentData;
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox* MP4::Mp4TagsProxy::groupingData() const
|
||||
{
|
||||
return d->groupingData;
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox* MP4::Mp4TagsProxy::composerData() const
|
||||
{
|
||||
return d->composerData;
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox* MP4::Mp4TagsProxy::diskData() const
|
||||
{
|
||||
return d->diskData;
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox* MP4::Mp4TagsProxy::bpmData() const
|
||||
{
|
||||
return d->bpmData;
|
||||
}
|
||||
|
||||
MP4::ITunesDataBox* MP4::Mp4TagsProxy::coverData() const
|
||||
{
|
||||
return d->coverData;
|
||||
}
|
||||
|
||||
void MP4::Mp4TagsProxy::registerBox( EBoxType boxtype, ITunesDataBox* databox )
|
||||
{
|
||||
switch( boxtype )
|
||||
{
|
||||
case title:
|
||||
d->titleData = databox;
|
||||
break;
|
||||
case artist:
|
||||
d->artistData = databox;
|
||||
break;
|
||||
case album:
|
||||
d->albumData = databox;
|
||||
break;
|
||||
case cover:
|
||||
d->coverData = databox;
|
||||
break;
|
||||
case genre:
|
||||
d->genreData = databox;
|
||||
break;
|
||||
case year:
|
||||
d->yearData = databox;
|
||||
break;
|
||||
case trackno:
|
||||
d->trknData = databox;
|
||||
break;
|
||||
case comment:
|
||||
d->commentData = databox;
|
||||
break;
|
||||
case grouping:
|
||||
d->groupingData = databox;
|
||||
break;
|
||||
case composer:
|
||||
d->composerData = databox;
|
||||
break;
|
||||
case disk:
|
||||
d->diskData = databox;
|
||||
break;
|
||||
case bpm:
|
||||
d->bpmData = databox;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1,99 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4TAGSPROXY_H
|
||||
#define MP4TAGSPROXY_H
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
// forward declaration(s)
|
||||
class ITunesDataBox;
|
||||
/*! proxy for mp4 itunes tag relevant boxes
|
||||
*
|
||||
* this class works as a proxy for the specific tag boxes
|
||||
* in an mp4 itunes file. the boxes are mired in
|
||||
* the mp4 file structure and stepping through all box layers
|
||||
* is avoided by registration at the proxy object.
|
||||
*/
|
||||
class Mp4TagsProxy
|
||||
{
|
||||
public:
|
||||
/*! enum for all supported box types */
|
||||
typedef enum
|
||||
{
|
||||
title = 0,
|
||||
artist,
|
||||
album,
|
||||
cover,
|
||||
genre,
|
||||
year,
|
||||
trackno,
|
||||
comment,
|
||||
grouping,
|
||||
composer,
|
||||
disk,
|
||||
bpm
|
||||
} EBoxType;
|
||||
|
||||
//! constructor
|
||||
Mp4TagsProxy();
|
||||
//! destructor
|
||||
~Mp4TagsProxy();
|
||||
|
||||
//! function to get the data box for the title
|
||||
ITunesDataBox* titleData() const;
|
||||
//! function to get the data box for the artist
|
||||
ITunesDataBox* artistData() const;
|
||||
//! function to get the data box for the album
|
||||
ITunesDataBox* albumData() const;
|
||||
//! function to get the data box for the genre
|
||||
ITunesDataBox* genreData() const;
|
||||
//! function to get the data box for the year
|
||||
ITunesDataBox* yearData() const;
|
||||
//! function to get the data box for the track number
|
||||
ITunesDataBox* trknData() const;
|
||||
//! function to get the data box for the comment
|
||||
ITunesDataBox* commentData() const;
|
||||
//! function to get the data box for the grouping
|
||||
ITunesDataBox* groupingData() const;
|
||||
//! function to get the data box for the composer
|
||||
ITunesDataBox* composerData() const;
|
||||
//! function to get the data box for the disk number
|
||||
ITunesDataBox* diskData() const;
|
||||
//! function to get the data box for the bpm
|
||||
ITunesDataBox* bpmData() const;
|
||||
//! function to get the data box for the cover
|
||||
ITunesDataBox* coverData() const;
|
||||
|
||||
//! function to register a data box for a certain box type
|
||||
void registerBox( EBoxType boxtype, ITunesDataBox* databox );
|
||||
|
||||
private:
|
||||
class Mp4TagsProxyPrivate;
|
||||
//! private data of tags proxy
|
||||
Mp4TagsProxyPrivate* d;
|
||||
}; // class Mp4TagsProxy
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4TAGSPROXY_H
|
@ -1,86 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "tlist.h"
|
||||
#include <iostream>
|
||||
#include "mp4trakbox.h"
|
||||
#include "boxfactory.h"
|
||||
#include "mp4file.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4TrakBox::Mp4TrakBoxPrivate
|
||||
{
|
||||
public:
|
||||
//! container for all boxes in trak box
|
||||
TagLib::List<Mp4IsoBox*> trakBoxes;
|
||||
//! a box factory for creating the appropriate boxes
|
||||
MP4::BoxFactory boxfactory;
|
||||
}; // class Mp4TrakBoxPrivate
|
||||
|
||||
MP4::Mp4TrakBox::Mp4TrakBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
: Mp4IsoBox( file, fourcc, size, offset )
|
||||
{
|
||||
d = new MP4::Mp4TrakBox::Mp4TrakBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4TrakBox::~Mp4TrakBox()
|
||||
{
|
||||
TagLib::List<Mp4IsoBox*>::Iterator delIter;
|
||||
for( delIter = d->trakBoxes.begin();
|
||||
delIter != d->trakBoxes.end();
|
||||
delIter++ )
|
||||
{
|
||||
delete *delIter;
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MP4::Mp4TrakBox::parse()
|
||||
{
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
uint totalsize = 8;
|
||||
// parse all contained boxes
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
while( (mp4file->readSizeAndType( size, fourcc ) == true) )
|
||||
{
|
||||
totalsize += size;
|
||||
|
||||
// check for errors
|
||||
if( totalsize > MP4::Mp4IsoBox::size() )
|
||||
{
|
||||
std::cerr << "Error in mp4 file " << mp4file->name() << " trak box contains bad box with name: " << fourcc.toString() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// create the appropriate subclass and parse it
|
||||
MP4::Mp4IsoBox* curbox = d->boxfactory.createInstance( mp4file, fourcc, size, mp4file->tell() );
|
||||
curbox->parsebox();
|
||||
d->trakBoxes.append( curbox );
|
||||
|
||||
// check for end of trak box
|
||||
if( totalsize == MP4::Mp4IsoBox::size() )
|
||||
break;
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4TRAKBOX_H
|
||||
#define MP4TRAKBOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4TrakBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
Mp4TrakBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4TrakBox();
|
||||
|
||||
//! parse trak contents
|
||||
void parse();
|
||||
|
||||
private:
|
||||
class Mp4TrakBoxPrivate;
|
||||
Mp4TrakBoxPrivate* d;
|
||||
}; // Mp4TrakBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4TRAKBOX_H
|
@ -1,95 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "tlist.h"
|
||||
#include <iostream>
|
||||
#include "mp4udtabox.h"
|
||||
#include "boxfactory.h"
|
||||
#include "mp4file.h"
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
class MP4::Mp4UdtaBox::Mp4UdtaBoxPrivate
|
||||
{
|
||||
public:
|
||||
//! container for all boxes in udta box
|
||||
TagLib::List<Mp4IsoBox*> udtaBoxes;
|
||||
//! a box factory for creating the appropriate boxes
|
||||
MP4::BoxFactory boxfactory;
|
||||
}; // class Mp4UdtaBoxPrivate
|
||||
|
||||
MP4::Mp4UdtaBox::Mp4UdtaBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset )
|
||||
: Mp4IsoBox( file, fourcc, size, offset )
|
||||
{
|
||||
d = new MP4::Mp4UdtaBox::Mp4UdtaBoxPrivate();
|
||||
}
|
||||
|
||||
MP4::Mp4UdtaBox::~Mp4UdtaBox()
|
||||
{
|
||||
TagLib::List<Mp4IsoBox*>::Iterator delIter;
|
||||
for( delIter = d->udtaBoxes.begin();
|
||||
delIter != d->udtaBoxes.end();
|
||||
delIter++ )
|
||||
{
|
||||
delete *delIter;
|
||||
}
|
||||
delete d;
|
||||
}
|
||||
|
||||
void MP4::Mp4UdtaBox::parse()
|
||||
{
|
||||
#if 0
|
||||
std::cout << " parsing udta box" << std::endl;
|
||||
#endif
|
||||
TagLib::MP4::File* mp4file = static_cast<MP4::File*>( file() );
|
||||
|
||||
uint totalsize = 8;
|
||||
// parse all contained boxes
|
||||
uint size;
|
||||
MP4::Fourcc fourcc;
|
||||
|
||||
#if 0
|
||||
std::cout << " ";
|
||||
#endif
|
||||
while( (mp4file->readSizeAndType( size, fourcc ) == true) )
|
||||
{
|
||||
totalsize += size;
|
||||
|
||||
// check for errors
|
||||
if( totalsize > MP4::Mp4IsoBox::size() )
|
||||
{
|
||||
std::cerr << "Error in mp4 file " << mp4file->name() << " udta box contains bad box with name: " << fourcc.toString() << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
// create the appropriate subclass and parse it
|
||||
MP4::Mp4IsoBox* curbox = d->boxfactory.createInstance( mp4file, fourcc, size, mp4file->tell() );
|
||||
curbox->parsebox();
|
||||
d->udtaBoxes.append( curbox );
|
||||
|
||||
// check for end of udta box
|
||||
if( totalsize == MP4::Mp4IsoBox::size() )
|
||||
break;
|
||||
#if 0
|
||||
std::cout << " ";
|
||||
#endif
|
||||
}
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2002, 2003, 2006 by Jochen Issing
|
||||
email : jochen.issing@isign-softart.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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef MP4UDTABOX_H
|
||||
#define MP4UDTABOX_H
|
||||
|
||||
#include "mp4isobox.h"
|
||||
#include "mp4fourcc.h"
|
||||
|
||||
namespace TagLib
|
||||
{
|
||||
namespace MP4
|
||||
{
|
||||
class Mp4UdtaBox: public Mp4IsoBox
|
||||
{
|
||||
public:
|
||||
Mp4UdtaBox( TagLib::File* file, MP4::Fourcc fourcc, uint size, long offset );
|
||||
~Mp4UdtaBox();
|
||||
|
||||
//! parse moov contents
|
||||
void parse();
|
||||
|
||||
private:
|
||||
class Mp4UdtaBoxPrivate;
|
||||
Mp4UdtaBoxPrivate* d;
|
||||
}; // Mp4UdtaBox
|
||||
|
||||
} // namespace MP4
|
||||
} // namespace TagLib
|
||||
|
||||
#endif // MP4UDTABOX_H
|
@ -1,42 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2006 by Martin Aumueller
|
||||
email : aumuell@reserv.at
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "taglib_mp4filetyperesolver.h"
|
||||
#include "mp4file.h"
|
||||
|
||||
#include <string.h>
|
||||
|
||||
TagLib::File *MP4FileTypeResolver::createFile(const char *fileName,
|
||||
bool readProperties,
|
||||
TagLib::AudioProperties::ReadStyle propertiesStyle) const
|
||||
{
|
||||
// fprintf(stderr, "mp4?: %s\n", fileName);
|
||||
const char *ext = strrchr(fileName, '.');
|
||||
if(ext && (!strcasecmp(ext, ".m4a")
|
||||
|| !strcasecmp(ext, ".m4b") || !strcasecmp(ext, ".m4p")
|
||||
|| !strcasecmp(ext, ".mp4")
|
||||
|| !strcasecmp(ext, ".m4v") || !strcasecmp(ext, ".mp4v")))
|
||||
{
|
||||
return new TagLib::MP4::File(fileName, readProperties, propertiesStyle);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2006 by Martin Aumueller
|
||||
email : aumuell@reserv.at
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef TAGLIB_MP4FILETYPERESOLVER_H
|
||||
#define TAGLIB_MP4FILETYPERESOLVER_H
|
||||
|
||||
#include <taglib/tfile.h>
|
||||
#include <taglib/fileref.h>
|
||||
|
||||
|
||||
class MP4FileTypeResolver : public TagLib::FileRef::FileTypeResolver
|
||||
{
|
||||
TagLib::File *createFile(const char *fileName,
|
||||
bool readAudioProperties,
|
||||
TagLib::AudioProperties::ReadStyle audioPropertiesStyle) const;
|
||||
};
|
||||
|
||||
#endif
|
@ -1,32 +0,0 @@
|
||||
#################################################
|
||||
#
|
||||
# (C) 2010-2013 Darrell Anderson
|
||||
# humanreadable (AT) yahoo.com
|
||||
#
|
||||
# Improvements and feedback are welcome
|
||||
#
|
||||
# This file is released under GPL >= 2
|
||||
#
|
||||
#################################################
|
||||
|
||||
include_directories(
|
||||
${CMAKE_BINARY_DIR}
|
||||
${TDE_INCLUDE_DIR}
|
||||
${TQT_INCLUDE_DIRS}
|
||||
${TAGLIB_INCLUDE_DIRS}
|
||||
${MP4V2_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
|
||||
##### tagmp4 (static)
|
||||
|
||||
tde_add_library( common-tagmp4 STATIC_PIC
|
||||
|
||||
SOURCES
|
||||
mp4file.cpp
|
||||
mp4properties.cpp
|
||||
mp4tag.cpp
|
||||
taglib_mp4filetyperesolver.cpp
|
||||
LINK
|
||||
${MP4V2_LIBRARIES}
|
||||
)
|
@ -1,18 +0,0 @@
|
||||
SUBDIRS =
|
||||
|
||||
INCLUDES = $(all_includes) $(MP4V2_INCLUDES) $(TAGLIB_CFLAGS)
|
||||
METASOURCES = AUTO
|
||||
libtagmp4_la_LDFLAGS = $(all_libraries) $(MP4V2_LIBS)
|
||||
noinst_LTLIBRARIES = libtagmp4.la
|
||||
|
||||
libtagmp4_la_SOURCES = \
|
||||
mp4properties.cpp \
|
||||
mp4tag.cpp \
|
||||
mp4file.cpp \
|
||||
taglib_mp4filetyperesolver.cpp
|
||||
|
||||
noinst_HEADERS = \
|
||||
mp4properties.h \
|
||||
mp4tag.h \
|
||||
mp4file.h \
|
||||
taglib_mp4filetyperesolver.h
|
@ -1,260 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2005 by Andy Leadbetter
|
||||
email : andrew.leadbetter@gmail.com
|
||||
|
||||
copyright : (C) 2005 by Martin Aumueller
|
||||
email : aumuell@reserv.at
|
||||
(write support)
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* This library is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License version *
|
||||
* 2.1 as published by the Free Software Foundation. *
|
||||
* *
|
||||
* This library is distributed in the hope that it will be useful, but *
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
|
||||
* Lesser General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU Lesser General Public *
|
||||
* License along with this library; if not, write to the Free Software *
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||
* MA 02110-1301 USA *
|
||||
***************************************************************************/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "mp4file.h"
|
||||
|
||||
#include "mp4tag.h"
|
||||
#include <tfile.h>
|
||||
#include <audioproperties.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstdlib>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_MP4V2_H
|
||||
#define USE_ITMF_TAGS
|
||||
#else
|
||||
#define MP4V2_HAS_WRITE_BUG 1
|
||||
#endif
|
||||
|
||||
namespace TagLib {
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MP4::File::File(const char *file,
|
||||
bool readProperties,
|
||||
Properties::ReadStyle propertiesStyle,
|
||||
MP4FileHandle handle) : TagLib::File(file),
|
||||
mp4tag(NULL), properties(NULL)
|
||||
{
|
||||
|
||||
// debug ("MP4::File: create new file object.");
|
||||
//debug ( file );
|
||||
/**
|
||||
* Create the MP4 file.
|
||||
*/
|
||||
|
||||
if(handle == MP4_INVALID_FILE_HANDLE)
|
||||
{
|
||||
mp4file = MP4Read(file);
|
||||
}
|
||||
else
|
||||
{
|
||||
mp4file = handle;
|
||||
}
|
||||
|
||||
if( isOpen() )
|
||||
{
|
||||
read(readProperties, propertiesStyle );
|
||||
}
|
||||
}
|
||||
|
||||
MP4::File::~File()
|
||||
{
|
||||
MP4Close(mp4file);
|
||||
delete mp4tag;
|
||||
delete properties;
|
||||
}
|
||||
|
||||
TagLib::Tag *MP4::File::tag() const
|
||||
{
|
||||
return mp4tag;
|
||||
}
|
||||
|
||||
TagLib::MP4::Tag *MP4::File::getMP4Tag() const
|
||||
{
|
||||
return mp4tag;
|
||||
}
|
||||
|
||||
MP4::Properties *MP4::File::audioProperties() const
|
||||
{
|
||||
return properties;
|
||||
}
|
||||
|
||||
bool MP4::File::save()
|
||||
{
|
||||
MP4Close(mp4file);
|
||||
|
||||
MP4FileHandle handle = MP4Modify(name());
|
||||
if(handle == MP4_INVALID_FILE_HANDLE)
|
||||
{
|
||||
mp4file = MP4Read(name());
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef USE_ITMF_TAGS
|
||||
const MP4Tags* filetags = MP4TagsAlloc();
|
||||
MP4TagsFetch(filetags, handle);
|
||||
#endif
|
||||
|
||||
#ifdef MP4V2_HAS_WRITE_BUG
|
||||
/* according to gtkpod we have to delete all meta data before modifying it,
|
||||
save the stuff we would not touch */
|
||||
|
||||
// need to fetch/rewrite this only if we aren't going to anyway
|
||||
uint8_t compilation = 0;
|
||||
bool has_compilation = mp4tag->compilation() == MP4::Tag::Undefined ? MP4GetMetadataCompilation(handle, &compilation) : false;
|
||||
|
||||
char *tool = NULL;
|
||||
MP4GetMetadataTool(handle, &tool);
|
||||
|
||||
MP4MetadataDelete(handle);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef USE_ITMF_TAGS
|
||||
MP4TagsSetName(filetags, mp4tag->title().isEmpty() ? "" : mp4tag->title().toCString(true));
|
||||
MP4TagsSetArtist(filetags, mp4tag->artist().isEmpty() ? "" : mp4tag->artist().toCString(true));
|
||||
MP4TagsSetAlbum(filetags, mp4tag->album().isEmpty() ? "" : mp4tag->album().toCString(true));
|
||||
MP4TagsSetComments(filetags, mp4tag->comment().isEmpty() ? "" : mp4tag->comment().toCString(true));
|
||||
MP4TagsSetGenre(filetags, mp4tag->genre().isEmpty() ? "" : mp4tag->genre().toCString(true));
|
||||
MP4TagsSetComposer(filetags, mp4tag->composer().isEmpty() ? "" : mp4tag->composer().toCString(true));
|
||||
#else
|
||||
#define setmeta(val, tag) \
|
||||
if(mp4tag->val().isEmpty()) { \
|
||||
/*MP4DeleteMetadata##tag(handle);*/ \
|
||||
MP4SetMetadata##tag(handle, ""); \
|
||||
} else { \
|
||||
MP4SetMetadata##tag(handle, mp4tag->val().toCString(true)); \
|
||||
}
|
||||
setmeta(title, Name);
|
||||
setmeta(artist, Artist);
|
||||
setmeta(album, Album);
|
||||
setmeta(comment, Comment);
|
||||
setmeta(genre, Genre);
|
||||
setmeta(composer, Writer);
|
||||
#endif
|
||||
|
||||
char buf[100] = "";
|
||||
if(mp4tag->year())
|
||||
snprintf(buf, sizeof(buf), "%u", mp4tag->year());
|
||||
#ifdef USE_ITMF_TAGS
|
||||
MP4TagsSetReleaseDate(filetags, buf);
|
||||
#else
|
||||
MP4SetMetadataYear(handle, buf);
|
||||
#endif
|
||||
u_int16_t t1, t2;
|
||||
|
||||
#ifdef USE_ITMF_TAGS
|
||||
MP4TagTrack track = *filetags->track;
|
||||
track.index = t1;
|
||||
MP4TagsSetTrack(filetags, &track);
|
||||
#else
|
||||
MP4GetMetadataTrack(handle, &t1, &t2);
|
||||
MP4SetMetadataTrack(handle, mp4tag->track(), t2);
|
||||
#endif
|
||||
if(mp4tag->bpm() != 0) {
|
||||
#ifdef USE_ITMF_TAGS
|
||||
u_int16_t tempo = mp4tag->bpm();
|
||||
MP4TagsSetTempo(filetags, &tempo);
|
||||
#else
|
||||
MP4SetMetadataTempo(handle, mp4tag->bpm());
|
||||
#endif
|
||||
}
|
||||
if(mp4tag->compilation() != MP4::Tag::Undefined) {
|
||||
#ifdef USE_ITMF_TAGS
|
||||
u_int8_t compilation = mp4tag->compilation();
|
||||
MP4TagsSetCompilation(filetags, &compilation);
|
||||
#else
|
||||
MP4SetMetadataCompilation(handle, mp4tag->compilation());
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef USE_ITMF_TAGS
|
||||
if(mp4tag->cover().size()) {
|
||||
MP4TagArtwork art;
|
||||
art.size = mp4tag->cover().size();
|
||||
art.data = mp4tag->cover().size() ? const_cast<u_int8_t *>( reinterpret_cast<const u_int8_t *>( mp4tag->cover().data() ) ) : 0;
|
||||
art.type = MP4_ART_UNDEFINED; // delegate typing to libmp4v2
|
||||
if(filetags->artworkCount > 0) {
|
||||
MP4TagsSetArtwork(filetags, 0, &art);
|
||||
}
|
||||
else {
|
||||
MP4TagsAddArtwork(filetags, &art);
|
||||
}
|
||||
}
|
||||
#else
|
||||
MP4SetMetadataCoverArt(handle, mp4tag->cover().size() ? const_cast<u_int8_t *>( reinterpret_cast<const u_int8_t *>( mp4tag->cover().data() ) ) : 0, mp4tag->cover().size());
|
||||
#endif
|
||||
|
||||
#ifdef MP4V2_HAS_WRITE_BUG
|
||||
// set the saved data again
|
||||
|
||||
if(has_compilation)
|
||||
MP4SetMetadataCompilation(handle, compilation);
|
||||
if(tool)
|
||||
{
|
||||
MP4SetMetadataTool(handle, tool);
|
||||
free(tool);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef USE_ITMF_TAGS
|
||||
MP4TagsStore(filetags, handle);
|
||||
MP4TagsFree(filetags);
|
||||
#endif
|
||||
MP4Close(handle);
|
||||
|
||||
mp4file = MP4Read(name());
|
||||
if(mp4file == MP4_INVALID_FILE_HANDLE)
|
||||
{
|
||||
fprintf(stderr, "reopen failed\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MP4::File::isOpen()
|
||||
{
|
||||
return mp4file != MP4_INVALID_FILE_HANDLE;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// private members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
void MP4::File::read(bool readProperties, Properties::ReadStyle propertiesStyle)
|
||||
{
|
||||
properties = new MP4::Properties(propertiesStyle);
|
||||
mp4tag = new MP4::Tag();
|
||||
|
||||
if (mp4file != MP4_INVALID_FILE_HANDLE) {
|
||||
|
||||
if(readProperties)
|
||||
{
|
||||
// Parse bitrate etc.
|
||||
properties->readMP4Properties( mp4file );
|
||||
}
|
||||
|
||||
mp4tag->readTags( mp4file );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,86 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2005 by Andy Leadbetter
|
||||
email : andrew.leadbetter@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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef TAGLIB_MP4FILE_H
|
||||
#define TAGLIB_MP4FILE_H
|
||||
|
||||
#include <tfile.h>
|
||||
#include "mp4properties.h"
|
||||
|
||||
namespace TagLib {
|
||||
|
||||
namespace MP4 {
|
||||
|
||||
class Tag;
|
||||
|
||||
class File : public TagLib::File
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* Contructs a MP4 file from \a file. If \a readProperties is true the
|
||||
* file's audio properties will also be read using \a propertiesStyle. If
|
||||
* false, \a propertiesStyle is ignored.
|
||||
*/
|
||||
File(const char *file, bool readProperties = true,
|
||||
Properties::ReadStyle propertiesStyle = Properties::Average,
|
||||
MP4FileHandle handle=MP4_INVALID_FILE_HANDLE);
|
||||
|
||||
/*!
|
||||
* Destroys this instance of the File.
|
||||
*/
|
||||
virtual ~File();
|
||||
|
||||
|
||||
virtual TagLib::Tag *tag() const;
|
||||
|
||||
/*!
|
||||
* Returns the MP4::Properties for this file. If no audio properties
|
||||
* were read then this will return a null pointer.
|
||||
*/
|
||||
virtual MP4::Properties *audioProperties() const;
|
||||
|
||||
/*!
|
||||
* Save the file.
|
||||
* This is the same as calling save(AllTags);
|
||||
*
|
||||
* \note As of now, saving MP4 tags is not supported.
|
||||
*/
|
||||
virtual bool save();
|
||||
|
||||
void read(bool readProperties, Properties::ReadStyle propertiesStyle);
|
||||
|
||||
MP4::Tag *getMP4Tag() const;
|
||||
|
||||
protected:
|
||||
File(const File &);
|
||||
File &operator=(const File &);
|
||||
bool isOpen();
|
||||
|
||||
|
||||
MP4::Tag *mp4tag;
|
||||
MP4::Properties *properties;
|
||||
MP4FileHandle mp4file;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
@ -1,122 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2005 by Andy Leadbetter
|
||||
email : andrew.leadbetter@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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include "mp4properties.h"
|
||||
|
||||
|
||||
#include <tstring.h>
|
||||
|
||||
#include <config.h>
|
||||
#ifdef HAVE_SYSTEMS_H
|
||||
#include <systems.h>
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
#include <cstring>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifndef UINT64_TO_DOUBLE
|
||||
#define UINT64_TO_DOUBLE(a) ((double)((int64_t)(a)))
|
||||
#endif
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// public members
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
MP4::Properties::Properties(Properties::ReadStyle style) : AudioProperties(style)
|
||||
{
|
||||
m_length = 0;
|
||||
m_bitrate = 0;
|
||||
m_sampleRate = 0;
|
||||
m_channels = 0;
|
||||
}
|
||||
|
||||
MP4::Properties::~Properties()
|
||||
{
|
||||
}
|
||||
|
||||
int MP4::Properties::length() const
|
||||
{
|
||||
return m_length;
|
||||
}
|
||||
|
||||
int MP4::Properties::bitrate() const
|
||||
{
|
||||
return m_bitrate;
|
||||
}
|
||||
|
||||
int MP4::Properties::sampleRate() const
|
||||
{
|
||||
return m_sampleRate;
|
||||
}
|
||||
|
||||
int MP4::Properties::channels() const
|
||||
{
|
||||
return m_channels;
|
||||
}
|
||||
|
||||
void MP4::Properties::readMP4Properties( MP4FileHandle mp4File )
|
||||
{
|
||||
u_int32_t numTracks = MP4GetNumberOfTracks(mp4File);
|
||||
|
||||
for (u_int32_t i = 0; i < numTracks; i++)
|
||||
{
|
||||
MP4TrackId trackId = MP4FindTrackId(mp4File, i);
|
||||
|
||||
const char* trackType =
|
||||
MP4GetTrackType(mp4File, trackId);
|
||||
|
||||
if (!strcmp(trackType, MP4_AUDIO_TRACK_TYPE))
|
||||
{
|
||||
// OK we found an audio track so
|
||||
// decode it.
|
||||
readAudioTrackProperties(mp4File, trackId );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MP4::Properties::readAudioTrackProperties(MP4FileHandle mp4File, MP4TrackId trackId )
|
||||
{
|
||||
|
||||
u_int32_t timeScale =
|
||||
MP4GetTrackTimeScale(mp4File, trackId);
|
||||
|
||||
MP4Duration trackDuration =
|
||||
MP4GetTrackDuration(mp4File, trackId);
|
||||
|
||||
double msDuration =
|
||||
UINT64_TO_DOUBLE(MP4ConvertFromTrackDuration(mp4File, trackId,
|
||||
trackDuration, MP4_MSECS_TIME_SCALE));
|
||||
|
||||
u_int32_t avgBitRate =
|
||||
MP4GetTrackBitRate(mp4File, trackId);
|
||||
|
||||
m_bitrate = (avgBitRate + 500) / 1000;
|
||||
m_sampleRate = timeScale;
|
||||
m_length = (int)(msDuration / 1000.0);
|
||||
m_channels = 2;
|
||||
|
||||
|
||||
|
||||
}
|
@ -1,93 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2005 by Andy Leadbetter
|
||||
email : andrew.leadbetter@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 *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef TAGLIB_MP4PROPERTIES_H
|
||||
#define TAGLIB_MP4PROPERTIES_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <audioproperties.h>
|
||||
#include <tstring.h>
|
||||
#ifdef HAVE_MP4V2_H
|
||||
#include <mp4v2/mp4v2.h>
|
||||
#endif
|
||||
#ifdef HAVE_MP4_H
|
||||
#include <mp4.h>
|
||||
// mp4.h drags in mp4_config.h that defines these
|
||||
// get rid of them so they don't conflict with our config.h
|
||||
#undef VERSION
|
||||
#undef PACKAGE
|
||||
#endif
|
||||
|
||||
namespace TagLib {
|
||||
|
||||
namespace MP4 {
|
||||
|
||||
class File;
|
||||
|
||||
/*!
|
||||
* This reads the data from a MP4 stream to support the
|
||||
* AudioProperties API.
|
||||
*/
|
||||
|
||||
class Properties : public AudioProperties
|
||||
{
|
||||
public:
|
||||
/*!
|
||||
* Initialize this structure
|
||||
*/
|
||||
Properties(Properties::ReadStyle style);
|
||||
|
||||
/*!
|
||||
* Destroys this MP4 Properties instance.
|
||||
*/
|
||||
virtual ~Properties();
|
||||
|
||||
// Reimplementations.
|
||||
|
||||
virtual int length() const;
|
||||
virtual int bitrate() const;
|
||||
virtual int sampleRate() const;
|
||||
virtual int channels() const;
|
||||
|
||||
void readMP4Properties(MP4FileHandle mp4File);
|
||||
|
||||
|
||||
private:
|
||||
void readAudioTrackProperties(MP4FileHandle mp4File, MP4TrackId trackId );
|
||||
friend class MP4::File;
|
||||
|
||||
int m_length;
|
||||
int m_bitrate;
|
||||
int m_sampleRate;
|
||||
int m_channels;
|
||||
|
||||
Properties(const Properties &);
|
||||
Properties &operator=(const Properties &);
|
||||
|
||||
void read();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
@ -1,183 +0,0 @@
|
||||
|
||||
/***************************************************************************
|
||||
copyright : (C) 2005 by Andy Leadbetter
|
||||
email : andrew.leadbetter@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 *
|
||||
***************************************************************************/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include "mp4tag.h"
|
||||
|
||||
#include <tag.h>
|
||||
#include <stdint.h>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <stdlib.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef HAVE_MP4V2_H
|
||||
#define USE_ITMF_TAGS
|
||||
#endif
|
||||
|
||||
using namespace TagLib;
|
||||
|
||||
MP4::Tag::Tag() : TagLib::Tag::Tag() {
|
||||
m_title = String();
|
||||
m_artist = String();
|
||||
m_album = String();
|
||||
m_comment = String();
|
||||
m_genre = String();
|
||||
m_composer = String();
|
||||
m_year = 0;
|
||||
m_track = 0;
|
||||
m_disk = 0;
|
||||
m_bpm = 0;
|
||||
m_compilation = Undefined;
|
||||
}
|
||||
|
||||
MP4::Tag::~Tag() {
|
||||
}
|
||||
|
||||
bool MP4::Tag::isEmpty() const {
|
||||
return m_title.isEmpty() &&
|
||||
m_artist.isEmpty() &&
|
||||
m_album.isEmpty() &&
|
||||
m_comment.isEmpty() &&
|
||||
m_genre.isEmpty() &&
|
||||
m_composer.isEmpty() &&
|
||||
m_year == 0 &&
|
||||
m_track == 0 &&
|
||||
m_disk == 0 &&
|
||||
m_bpm == 0 &&
|
||||
m_compilation == Undefined &&
|
||||
m_image.size() == 0;
|
||||
}
|
||||
|
||||
void MP4::Tag::duplicate(const Tag *source, Tag *target, bool overwrite) {
|
||||
// Duplicate standard information
|
||||
Tag::duplicate(source, target, overwrite);
|
||||
|
||||
if ((overwrite || target->compilation() == Undefined) && (source->compilation() != Undefined)) {
|
||||
target->setCompilation(source->compilation());
|
||||
}
|
||||
|
||||
if (overwrite || target->cover().size() == 0) {
|
||||
target->setCover(source->cover());
|
||||
}
|
||||
}
|
||||
|
||||
void MP4::Tag::readTags( MP4FileHandle mp4file )
|
||||
{
|
||||
// Now parse tag.
|
||||
#ifdef USE_ITMF_TAGS
|
||||
const MP4Tags* filetags = MP4TagsAlloc();
|
||||
MP4TagsFetch(filetags, mp4file);
|
||||
|
||||
if(filetags->name != NULL) {
|
||||
m_title = String(filetags->name, String::UTF8);
|
||||
}
|
||||
if(filetags->artist != NULL) {
|
||||
m_artist = String(filetags->artist, String::UTF8);
|
||||
}
|
||||
if(filetags->comments != NULL) {
|
||||
m_comment = String(filetags->comments, String::UTF8);
|
||||
}
|
||||
if(filetags->releaseDate != NULL) {
|
||||
m_year = strtol(filetags->releaseDate, NULL, 0);
|
||||
}
|
||||
if(filetags->album != NULL) {
|
||||
m_album = String(filetags->album, String::UTF8);
|
||||
}
|
||||
if(filetags->track != NULL) {
|
||||
m_track = filetags->track->index;
|
||||
}
|
||||
if(filetags->disk != NULL) {
|
||||
m_disk = filetags->disk->index;
|
||||
}
|
||||
if(filetags->tempo != NULL) {
|
||||
m_bpm = *filetags->tempo;
|
||||
}
|
||||
if(filetags->compilation != NULL) {
|
||||
m_compilation = *filetags->compilation;
|
||||
}
|
||||
if(filetags->genre != NULL) {
|
||||
m_genre = String(filetags->genre, String::UTF8);
|
||||
}
|
||||
if(filetags->composer != NULL) {
|
||||
m_composer = String(filetags->composer, String::UTF8);
|
||||
}
|
||||
if(filetags->artworkCount > 0) {
|
||||
m_image.setData(reinterpret_cast<const char *>( filetags->artwork[0].data ), filetags->artwork[0].size);
|
||||
}
|
||||
MP4TagsFree(filetags);
|
||||
#else
|
||||
char *value;
|
||||
uint8_t boolvalue;
|
||||
uint16_t numvalue, numvalue2;
|
||||
uint8_t *image;
|
||||
uint32_t imageSize;
|
||||
|
||||
if (MP4GetMetadataName(mp4file, &value) && value != NULL) {
|
||||
m_title = String(value, String::UTF8);
|
||||
free(value);
|
||||
}
|
||||
if (MP4GetMetadataArtist(mp4file, &value) && value != NULL) {
|
||||
m_artist = String(value, String::UTF8);
|
||||
free(value);
|
||||
}
|
||||
|
||||
if (MP4GetMetadataComment(mp4file, &value) && value != NULL) {
|
||||
m_comment = String(value, String::UTF8);
|
||||
free(value);
|
||||
}
|
||||
|
||||
if (MP4GetMetadataYear(mp4file, &value) && value != NULL) {
|
||||
m_year = strtol(value, NULL,0);
|
||||
free(value);
|
||||
}
|
||||
if (MP4GetMetadataAlbum(mp4file, &value) && value != NULL) {
|
||||
m_album = String(value, String::UTF8);
|
||||
free(value);
|
||||
}
|
||||
if (MP4GetMetadataTrack(mp4file, &numvalue, &numvalue2)) {
|
||||
m_track = numvalue;
|
||||
}
|
||||
if (MP4GetMetadataDisk(mp4file, &numvalue, &numvalue2)) {
|
||||
m_disk = numvalue;
|
||||
}
|
||||
if (MP4GetMetadataTempo(mp4file, &numvalue)) {
|
||||
m_bpm = numvalue;
|
||||
}
|
||||
if (MP4GetMetadataCompilation(mp4file, &boolvalue)) {
|
||||
m_compilation = boolvalue;
|
||||
}
|
||||
if (MP4GetMetadataGenre(mp4file, &value) && value != NULL) {
|
||||
m_genre = String(value, String::UTF8);
|
||||
free(value);
|
||||
}
|
||||
if (MP4GetMetadataWriter(mp4file, &value) && value != NULL) {
|
||||
m_composer = String(value, String::UTF8);
|
||||
free(value);
|
||||
}
|
||||
if (MP4GetMetadataCoverArt(mp4file, &image, &imageSize) && image && imageSize) {
|
||||
m_image.setData(reinterpret_cast<const char *>( image ), imageSize);
|
||||
free(image);
|
||||
}
|
||||
#endif
|
||||
}
|
@ -1,234 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2005 by Andy Leadbetter
|
||||
email : andrew.leadbetter@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 *
|
||||
***************************************************************************/
|
||||
#ifndef TAGLIB_MP4TAG_H
|
||||
#define TAGLIB_MP4TAG_H
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <tag.h>
|
||||
#include "mp4file.h"
|
||||
#ifdef HAVE_MP4V2_H
|
||||
#include <mp4v2/mp4v2.h>
|
||||
#endif
|
||||
#ifdef HAVE_MP4_H
|
||||
#include <mp4.h>
|
||||
#endif
|
||||
|
||||
namespace TagLib {
|
||||
|
||||
namespace MP4 {
|
||||
/*!
|
||||
* This implements the generic TagLib::Tag API
|
||||
*/
|
||||
class Tag : public TagLib::Tag
|
||||
{
|
||||
public:
|
||||
static const int Undefined = -1;
|
||||
|
||||
Tag();
|
||||
|
||||
/*!
|
||||
* read tags from the mp4 file.
|
||||
*/
|
||||
void readTags( MP4FileHandle mp4file);
|
||||
|
||||
/*!
|
||||
* Destroys this MP4Tag instance.
|
||||
*/
|
||||
virtual ~Tag();
|
||||
|
||||
/*!
|
||||
* Returns the track name; if no track name is present in the tag
|
||||
* a null String will be returned.
|
||||
*/
|
||||
virtual String title() const { return m_title; }
|
||||
|
||||
/*!
|
||||
* Returns the artist name; if no artist name is present in the tag
|
||||
* a null String will be returned.
|
||||
*/
|
||||
virtual String artist() const { return m_artist; }
|
||||
|
||||
/*!
|
||||
* Returns the album name; if no album name is present in the tag
|
||||
* a null String will be returned.
|
||||
*/
|
||||
virtual String album() const { return m_album; }
|
||||
|
||||
/*!
|
||||
* Returns the track comment; if no comment is present in the tag
|
||||
* a null String will be returned.
|
||||
*/
|
||||
virtual String comment() const { return m_comment; }
|
||||
|
||||
/*!
|
||||
* Returns the genre name; if no genre is present in the tag a null String
|
||||
* will be returned.
|
||||
*/
|
||||
virtual String genre() const { return m_genre; }
|
||||
|
||||
/*!
|
||||
* Returns the composer name; if no composer is present in the tag a null String
|
||||
* will be returned.
|
||||
*/
|
||||
virtual String composer() const { return m_composer; }
|
||||
|
||||
/*!
|
||||
* Returns the year; if there is no year set, this will return 0.
|
||||
*/
|
||||
virtual uint year() const { return m_year; }
|
||||
|
||||
/*!
|
||||
* Returns the track number; if there is no track number set, this will
|
||||
* return 0.
|
||||
*/
|
||||
virtual uint track() const { return m_track; }
|
||||
|
||||
/*!
|
||||
* Returns the disc number; if there is no disc number set, this will
|
||||
* return 0.
|
||||
*/
|
||||
virtual uint disk() const { return m_disk; }
|
||||
|
||||
/*!
|
||||
* Returns the BPM (tempo); if there is no BPM, this will return 0.
|
||||
*/
|
||||
virtual uint bpm() const { return m_bpm; }
|
||||
|
||||
/*!
|
||||
* Returns the embedded cover image; if there is no cover set, this will
|
||||
* return an empty ByteVector.
|
||||
*/
|
||||
virtual const ByteVector &cover() const { return m_image; }
|
||||
|
||||
/*!
|
||||
* Returns whether this is part of a compilation; if this flag is not set,
|
||||
* this will return the Undefined constant.
|
||||
*/
|
||||
virtual int compilation() const { return m_compilation; }
|
||||
|
||||
/*!
|
||||
* Sets the title to \a s. If \a s is a null String then this value will be
|
||||
* cleared.
|
||||
*/
|
||||
virtual void setTitle(const String &s) { m_title = s; }
|
||||
|
||||
/*!
|
||||
* Sets the artist to \a s. If \a s is a null String then this value will be
|
||||
* cleared.
|
||||
*/
|
||||
virtual void setArtist(const String &s) { m_artist = s; }
|
||||
|
||||
/*!
|
||||
* Sets the album to \a s. If \a s is a null String then this value will be
|
||||
* cleared.
|
||||
*/
|
||||
virtual void setAlbum(const String &s) { m_album = s; }
|
||||
|
||||
/*!
|
||||
* Sets the album to \a s. If \a s is a null String then this value will be
|
||||
* cleared.
|
||||
*/
|
||||
virtual void setComment(const String &s) { m_comment = s; }
|
||||
|
||||
/*!
|
||||
* Sets the genre to \a s. If \a s is a null String then this value will be
|
||||
* cleared. For tag formats that use a fixed set of genres, the appropriate
|
||||
* value will be selected based on a string comparison. A list of available
|
||||
* genres for those formats should be available in that type's
|
||||
* implementation.
|
||||
*/
|
||||
virtual void setGenre(const String &s) { m_genre = s; }
|
||||
|
||||
/*!
|
||||
* Sets the year to \a i. If \a s is 0 then this value will be cleared.
|
||||
*/
|
||||
virtual void setYear(uint i) { m_year = i; }
|
||||
|
||||
/*!
|
||||
* Sets the track to \a i. If \a i is 0 then this value will be cleared.
|
||||
*/
|
||||
virtual void setTrack(uint i) { m_track = i; }
|
||||
|
||||
/*!
|
||||
* Sets the disc to \a i. If \a i is 0 then this value will be cleared.
|
||||
*/
|
||||
virtual void setDisk(uint i) { m_disk = i; }
|
||||
|
||||
/*!
|
||||
* Sets the BPM (tempo) to \a i. It \a i is 0 then this value will be cleared.
|
||||
*/
|
||||
virtual void setBpm(uint i) { m_bpm = i; }
|
||||
|
||||
/*!
|
||||
* Sets whether this is part of a compilation.
|
||||
*/
|
||||
virtual void setCompilation(bool compilation) { m_compilation = compilation ? 1 : 0; }
|
||||
|
||||
/*!
|
||||
* Sets the composer to \a s. If \a s is a null String then this value will
|
||||
* be cleared.
|
||||
*/
|
||||
virtual void setComposer(const String &s) { m_composer = s; }
|
||||
|
||||
/*!
|
||||
* Sets the embedded cover image to \a i. If \a i is empty then this value
|
||||
* will be cleared.
|
||||
*/
|
||||
virtual void setCover(const ByteVector &i) { m_image = i; }
|
||||
|
||||
/*!
|
||||
* Returns true if the tag does not contain any data. This should be
|
||||
* reimplemented in subclasses that provide more than the basic tagging
|
||||
* abilities in this class.
|
||||
*/
|
||||
virtual bool isEmpty() const;
|
||||
|
||||
/*!
|
||||
* Copies the generic data from one tag to another.
|
||||
*
|
||||
* \note This will not affect any of the lower level details of the tag. For
|
||||
* instance if any of the tag type specific data (maybe a URL for a band) is
|
||||
* set, this will not modify or copy that. This just copies using the API
|
||||
* in this class.
|
||||
*
|
||||
* If \a overwrite is true then the values will be unconditionally copied.
|
||||
* If false only empty values will be overwritten.
|
||||
*/
|
||||
static void duplicate(const Tag *source, Tag *target, bool overwrite = true);
|
||||
|
||||
protected:
|
||||
String m_title;
|
||||
String m_artist;
|
||||
String m_album;
|
||||
String m_comment;
|
||||
String m_genre;
|
||||
String m_composer;
|
||||
uint m_year;
|
||||
uint m_track;
|
||||
uint m_disk;
|
||||
uint m_bpm;
|
||||
int m_compilation;
|
||||
ByteVector m_image;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
@ -1,53 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2005 by Martin Aumueller
|
||||
email : aumuell@reserv.at
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 *
|
||||
***************************************************************************/
|
||||
|
||||
// (c) 2005 Martin Aumueller <aumuell@reserv.at>
|
||||
// See COPYING file for licensing information
|
||||
|
||||
#include "taglib_mp4filetyperesolver.h"
|
||||
#include "mp4file.h"
|
||||
#include <cstring>
|
||||
|
||||
TagLib::File *MP4FileTypeResolver::createFile(const char *fileName,
|
||||
bool readProperties,
|
||||
TagLib::AudioProperties::ReadStyle propertiesStyle) const
|
||||
{
|
||||
const char *ext = strrchr(fileName, '.');
|
||||
if(ext && (!strcasecmp(ext, ".m4a")
|
||||
|| !strcasecmp(ext, ".m4b") || !strcasecmp(ext, ".m4p")
|
||||
|| !strcasecmp(ext, ".mp4")
|
||||
|| !strcasecmp(ext, ".m4v") || !strcasecmp(ext, ".mp4v")))
|
||||
{
|
||||
#if defined(MP4V2_PROJECT_version_hex) && MP4V2_PROJECT_version_hex >= 0x00020000
|
||||
MP4FileHandle h = MP4Read(fileName);
|
||||
#else
|
||||
MP4FileHandle h = MP4Read(fileName, 0);
|
||||
#endif
|
||||
if(MP4_INVALID_FILE_HANDLE == h)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return new TagLib::MP4::File(fileName, readProperties, propertiesStyle, h);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
/***************************************************************************
|
||||
copyright : (C) 2005 by Martin Aumueller
|
||||
email : aumuell@reserv.at
|
||||
***************************************************************************/
|
||||
|
||||
/***************************************************************************
|
||||
* 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 *
|
||||
***************************************************************************/
|
||||
|
||||
// (c) 2005 Martin Aumueller <aumuell@reserv.at>
|
||||
// See COPYING file for licensing information
|
||||
|
||||
#ifndef TAGLIB_MP4FILETYPERESOLVER_H
|
||||
#define TAGLIB_MP4FILETYPERESOLVER_H
|
||||
|
||||
#include <taglib/tfile.h>
|
||||
#include <taglib/fileref.h>
|
||||
|
||||
|
||||
class MP4FileTypeResolver : public TagLib::FileRef::FileTypeResolver
|
||||
{
|
||||
TagLib::File *createFile(const char *fileName,
|
||||
bool readAudioProperties,
|
||||
TagLib::AudioProperties::ReadStyle audioPropertiesStyle) const;
|
||||
|
||||
public:
|
||||
virtual ~MP4FileTypeResolver() {}
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Reference in new issue