From d367a2f429f8eec0e096df66108706f8b6a2e0d7 Mon Sep 17 00:00:00 2001 From: Scott Wheeler Date: Fri, 16 May 2008 04:20:50 +0000 Subject: [PATCH] Add the skeleton of an AIFF implementation. git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808225 283d02a7-25f6-0310-bc7c-ecb5cbfe19da --- taglib/riff/Makefile.am | 3 +- taglib/riff/aiff/Makefile.am | 13 +++++ taglib/riff/aiff/aifffile.cpp | 96 +++++++++++++++++++++++++++++++ taglib/riff/aiff/aifffile.h | 105 ++++++++++++++++++++++++++++++++++ 4 files changed, 216 insertions(+), 1 deletion(-) create mode 100644 taglib/riff/aiff/Makefile.am create mode 100644 taglib/riff/aiff/aifffile.cpp create mode 100644 taglib/riff/aiff/aifffile.h diff --git a/taglib/riff/Makefile.am b/taglib/riff/Makefile.am index 60fe0a4a..509d4ebb 100644 --- a/taglib/riff/Makefile.am +++ b/taglib/riff/Makefile.am @@ -1,7 +1,8 @@ +SUBDIRS = aiff + INCLUDES = \ -I$(top_srcdir)/taglib \ -I$(top_srcdir)/taglib/toolkit \ - -I$(top_srcdir)/taglib/mpeg/id3v2 \ $(all_includes) noinst_LTLIBRARIES = libriff.la diff --git a/taglib/riff/aiff/Makefile.am b/taglib/riff/aiff/Makefile.am new file mode 100644 index 00000000..c465245c --- /dev/null +++ b/taglib/riff/aiff/Makefile.am @@ -0,0 +1,13 @@ +INCLUDES = \ + -I$(top_srcdir)/taglib \ + -I$(top_srcdir)/taglib/toolkit \ + -I$(top_srcdir)/taglib/riff \ + -I$(top_srcdir)/taglib/mpeg/id3v2 \ + $(all_includes) + +noinst_LTLIBRARIES = libaiff.la + +libaiff_la_SOURCES = aifffile.cpp + +taglib_include_HEADERS = aifffile.h +taglib_includedir = $(includedir)/taglib diff --git a/taglib/riff/aiff/aifffile.cpp b/taglib/riff/aiff/aifffile.cpp new file mode 100644 index 00000000..48505ae5 --- /dev/null +++ b/taglib/riff/aiff/aifffile.cpp @@ -0,0 +1,96 @@ +/*************************************************************************** + copyright : (C) 2006 by Lukáš Lalinský + email : lalinsky@gmail.com + + copyright : (C) 2004 by Allan Sandfeld Jensen + email : kde@carewolf.org + (original MPC implementation) + ***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + * * + * Alternatively, this file is available under the Mozilla Public * + * License Version 1.1. You may obtain a copy of the License at * + * http://www.mozilla.org/MPL/ * + ***************************************************************************/ + +#include +#include +#include + +#include "aifffile.h" + +using namespace TagLib; + +class RIFF::AIFF::File::FilePrivate +{ +public: + FilePrivate() + { + + } + + ~FilePrivate() + { + + } +}; + +//////////////////////////////////////////////////////////////////////////////// +// public members +//////////////////////////////////////////////////////////////////////////////// + +RIFF::AIFF::File::File(FileName file, bool readProperties, + Properties::ReadStyle propertiesStyle) : RIFF::File(file, BigEndian) +{ + d = new FilePrivate; + if(isOpen()) + read(readProperties, propertiesStyle); +} + +RIFF::AIFF::File::~File() +{ + delete d; +} + +ID3v2::Tag *RIFF::AIFF::File::tag() const +{ + return 0; +} + +RIFF::AIFF::Properties *RIFF::AIFF::File::audioProperties() const +{ + return 0; +} + +bool RIFF::AIFF::File::save() +{ + if(readOnly()) { + debug("RIFF::AIFF::File::save() -- File is read only."); + return false; + } + + return true; +} + +//////////////////////////////////////////////////////////////////////////////// +// private members +//////////////////////////////////////////////////////////////////////////////// + +void RIFF::AIFF::File::read(bool readProperties, Properties::ReadStyle /* propertiesStyle */) +{ + +} diff --git a/taglib/riff/aiff/aifffile.h b/taglib/riff/aiff/aifffile.h new file mode 100644 index 00000000..ad588c2f --- /dev/null +++ b/taglib/riff/aiff/aifffile.h @@ -0,0 +1,105 @@ +/*************************************************************************** + copyright : (C) 2008 by Scott Wheeler + email : wheeler@kde.org +***************************************************************************/ + +/*************************************************************************** + * This library is free software; you can redistribute it and/or modify * + * it under the terms of the GNU Lesser General Public License version * + * 2.1 as published by the Free Software Foundation. * + * * + * This library is distributed in the hope that it will be useful, but * + * WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with this library; if not, write to the Free Software * + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * + * USA * + * * + * Alternatively, this file is available under the Mozilla Public * + * License Version 1.1. You may obtain a copy of the License at * + * http://www.mozilla.org/MPL/ * + ***************************************************************************/ + +#ifndef TAGLIB_AIFFFILE_H +#define TAGLIB_AIFFFILE_H + +#include +#include + +namespace TagLib { + + namespace ID3v2 { class Tag; } + + namespace RIFF { + + //! An implementation of AIFF metadata + + /*! + * This is implementation of AIFF metadata. + * + * This supports an ID3v2 tag as well as reading stream from the ID3 RIFF + * chunk as well as properties from the file. + */ + + namespace AIFF { + + class Properties : public AudioProperties {}; + + //! An implementation of TagLib::File with AIFF specific methods + + /*! + * This implements and provides an interface for AIFF 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 AIFF files. + */ + + class TAGLIB_EXPORT File : public TagLib::RIFF::File + { + public: + /*! + * Contructs an AIFF file from \a file. If \a readProperties is true the + * file's audio properties will also be read using \a propertiesStyle. If + * false, \a propertiesStyle is ignored. + */ + File(FileName file, bool readProperties = true, + Properties::ReadStyle propertiesStyle = Properties::Average); + + /*! + * Destroys this instance of the File. + */ + virtual ~File(); + + /*! + * Returns the Tag for this file. + */ + virtual ID3v2::Tag *tag() const; + + /*! + * Returns the AIFF::Properties for this file. If no audio properties + * were read then this will return a null pointer. + */ + virtual Properties *audioProperties() const; + + /*! + * Saves the file. + */ + virtual bool save(); + + private: + File(const File &); + File &operator=(const File &); + + void read(bool readProperties, Properties::ReadStyle propertiesStyle); + + class FilePrivate; + FilePrivate *d; + }; + } + } +} + +#endif