]> granicus.if.org Git - taglib/commitdiff
Add the skeleton of an AIFF implementation.
authorScott Wheeler <wheeler@kde.org>
Fri, 16 May 2008 04:20:50 +0000 (04:20 +0000)
committerScott Wheeler <wheeler@kde.org>
Fri, 16 May 2008 04:20:50 +0000 (04:20 +0000)
git-svn-id: svn://anonsvn.kde.org/home/kde/trunk/kdesupport/taglib@808225 283d02a7-25f6-0310-bc7c-ecb5cbfe19da

taglib/riff/Makefile.am
taglib/riff/aiff/Makefile.am [new file with mode: 0644]
taglib/riff/aiff/aifffile.cpp [new file with mode: 0644]
taglib/riff/aiff/aifffile.h [new file with mode: 0644]

index 60fe0a4ae6ebc696871e8894eb1bcc7b45a99034..509d4ebbc856ec531d59a5b92550f87b6820e022 100644 (file)
@@ -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 (file)
index 0000000..c465245
--- /dev/null
@@ -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 (file)
index 0000000..48505ae
--- /dev/null
@@ -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 <tbytevector.h>
+#include <tdebug.h>
+#include <id3v2tag.h>
+
+#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 (file)
index 0000000..ad588c2
--- /dev/null
@@ -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 <rifffile.h>
+#include <audioproperties.h>
+
+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