summaryrefslogtreecommitdiffstats
path: root/src/metadata/audible
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-03-01 19:09:31 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-03-01 19:09:31 +0000
commitf2cfda2a54780868dfe0af7bd652fcd4906547da (patch)
treec6ac23545528f5701818424f2af5f79ce3665e6c /src/metadata/audible
downloadsoundkonverter-f2cfda2a54780868dfe0af7bd652fcd4906547da.tar.gz
soundkonverter-f2cfda2a54780868dfe0af7bd652fcd4906547da.zip
Added KDE3 version of SoundKonverter
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/soundkonverter@1097614 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'src/metadata/audible')
-rw-r--r--src/metadata/audible/Makefile.am17
-rw-r--r--src/metadata/audible/audibleproperties.cpp86
-rw-r--r--src/metadata/audible/audibleproperties.h85
-rw-r--r--src/metadata/audible/audibletag.cpp163
-rw-r--r--src/metadata/audible/audibletag.h185
-rw-r--r--src/metadata/audible/taglib_audiblefile.cpp121
-rw-r--r--src/metadata/audible/taglib_audiblefile.h93
-rw-r--r--src/metadata/audible/taglib_audiblefiletyperesolver.cpp44
-rw-r--r--src/metadata/audible/taglib_audiblefiletyperesolver.h36
9 files changed, 830 insertions, 0 deletions
diff --git a/src/metadata/audible/Makefile.am b/src/metadata/audible/Makefile.am
new file mode 100644
index 0000000..dcade34
--- /dev/null
+++ b/src/metadata/audible/Makefile.am
@@ -0,0 +1,17 @@
+SUBDIRS =
+
+INCLUDES = $(all_includes) $(taglib_includes)
+METASOURCES = AUTO
+libtagaudible_la_LDFLAGS = $(all_libraries)
+noinst_LTLIBRARIES = libtagaudible.la
+
+libtagaudible_la_SOURCES = audibleproperties.cpp \
+ audibletag.cpp \
+ taglib_audiblefile.cpp \
+ taglib_audiblefiletyperesolver.cpp
+
+noinst_HEADERS = audibleproperties.h \
+ audibletag.h \
+ taglib_audiblefile.h \
+ taglib_audiblefiletyperesolver.h
+
diff --git a/src/metadata/audible/audibleproperties.cpp b/src/metadata/audible/audibleproperties.cpp
new file mode 100644
index 0000000..4f39322
--- /dev/null
+++ b/src/metadata/audible/audibleproperties.cpp
@@ -0,0 +1,86 @@
+/***************************************************************************
+ copyright : (C) 2005 by Martin Aumueller
+
+ copyright : (C) 2005 by Andy Leadbetter
+ (original mp4 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., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include <stdio.h>
+
+#include "audibleproperties.h"
+
+#include <taglib/tstring.h>
+
+#include "taglib_audiblefile.h"
+
+#include <netinet/in.h> // ntohl
+
+using namespace TagLib;
+
+
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+Audible::Properties::Properties(Properties::ReadStyle style) : AudioProperties(style)
+{
+ m_length = 0;
+ m_bitrate = 0;
+ m_sampleRate = 0;
+ m_channels = 0;
+}
+
+Audible::Properties::~Properties()
+{
+}
+
+int Audible::Properties::length() const
+{
+ return m_length;
+}
+
+int Audible::Properties::bitrate() const
+{
+ return m_bitrate;
+}
+
+int Audible::Properties::sampleRate() const
+{
+ return m_sampleRate;
+}
+
+int Audible::Properties::channels() const
+{
+ return m_channels;
+}
+
+#define LENGTH_OFF 61
+
+void Audible::Properties::readAudibleProperties( FILE *fp, int off )
+{
+ fseek(fp, off+LENGTH_OFF, SEEK_SET );
+ fread(&m_length, sizeof(m_length), 1, fp);
+ m_length = ntohl(m_length);
+ //fprintf(stderr, "len (sec): %d\n", m_length);
+ m_bitrate = 0;
+ m_sampleRate = 0;
+ m_channels = 1;
+}
diff --git a/src/metadata/audible/audibleproperties.h b/src/metadata/audible/audibleproperties.h
new file mode 100644
index 0000000..948fc30
--- /dev/null
+++ b/src/metadata/audible/audibleproperties.h
@@ -0,0 +1,85 @@
+/***************************************************************************
+ copyright : (C) 2005 by Martin Aumueller
+
+ copyright : (C) 2005 by Andy Leadbetter
+ (original mp4 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., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef TAGLIB_AUDIBLEPROPERTIES_H
+#define TAGLIB_AUDIBLEPROPERTIES_H
+
+#include <config.h>
+
+#include <taglib/audioproperties.h>
+#include <taglib/tstring.h>
+
+namespace TagLib {
+
+ namespace Audible {
+
+ class File;
+
+ /*!
+ * This reads the data from a Audible stream to support the
+ * AudioProperties API.
+ */
+
+ class Properties : public AudioProperties
+ {
+ public:
+ /*!
+ * Initialize this structure
+ */
+ Properties(Properties::ReadStyle style);
+
+ /*!
+ * Destroys this Audible Properties instance.
+ */
+ virtual ~Properties();
+
+ // Reimplementations.
+
+ virtual int length() const;
+ virtual int bitrate() const;
+ virtual int sampleRate() const;
+ virtual int channels() const;
+
+ void readAudibleProperties(FILE *file, int off);
+
+
+ private:
+ void readAudioTrackProperties(FILE *file);
+ friend class Audible::File;
+
+ int m_length;
+ int m_bitrate;
+ int m_sampleRate;
+ int m_channels;
+
+ Properties(const Properties &);
+ Properties &operator=(const Properties &);
+
+ void read();
+ };
+ }
+}
+
+#endif
diff --git a/src/metadata/audible/audibletag.cpp b/src/metadata/audible/audibletag.cpp
new file mode 100644
index 0000000..0fe786f
--- /dev/null
+++ b/src/metadata/audible/audibletag.cpp
@@ -0,0 +1,163 @@
+/***************************************************************************
+ copyright : (C) 2005 by Martin Aumueller
+
+ copyright : (C) 2005 by Andy Leadbetter
+ (original mp4 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., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include <stdio.h>
+
+#include "audibletag.h"
+
+#include <taglib/tag.h>
+
+#include <netinet/in.h> // ntohl
+#include <stdlib.h>
+#include <string.h>
+
+using namespace TagLib;
+
+Audible::Tag::Tag() : TagLib::Tag::Tag() {
+ m_title = String::null;
+ m_artist = String::null;
+ m_album = String::null;
+ m_comment = String::null;
+ m_genre = String::null;
+ m_year = 0;
+ m_track = 0;
+ m_userID = 0;
+ m_tagsEndOffset = -1;
+}
+
+Audible::Tag::~Tag() {
+}
+
+bool Audible::Tag::isEmpty() const {
+ return m_title == String::null &&
+ m_artist == String::null &&
+ m_album == String::null &&
+ m_comment == String::null &&
+ m_genre == String::null &&
+ m_year == 0 &&
+ m_track == 0 &&
+ m_userID == 0;
+}
+
+void Audible::Tag::duplicate(const Tag *source, Tag *target, bool overwrite) {
+ // No nonstandard information stored yet
+ Tag::duplicate(source, target, overwrite);
+}
+
+#define OFF_PRODUCT_ID 197
+#define OFF_TAGS 189
+
+void Audible::Tag::readTags( FILE *fp )
+{
+ char buf[1023];
+ fseek(fp, OFF_PRODUCT_ID, SEEK_SET);
+ fread(buf, strlen("product_id"), 1, fp);
+ if(memcmp(buf, "product_id", strlen("product_id")))
+ {
+ buf[20]='\0';
+ fprintf(stderr, "no valid Audible aa file: %s\n", buf);
+ return;
+ }
+
+ // Now parse tag.
+
+ fseek(fp, OFF_TAGS, SEEK_SET);
+ char *name, *value;
+
+ m_tagsEndOffset = OFF_TAGS;
+
+ bool lasttag = false;
+ while(!lasttag)
+ {
+ lasttag = !readTag(fp, &name, &value);
+ if(!strcmp(name, "title"))
+ {
+ m_title = String(value, String::Latin1);
+ }
+ else if(!strcmp(name, "author"))
+ {
+ m_artist = String(value, String::Latin1);
+ }
+ else if(!strcmp(name, "long_description"))
+ {
+ m_comment = String(value, String::Latin1);
+ }
+ else if(!strcmp(name, "description"))
+ {
+ if( m_comment.isNull() )
+ m_comment = String(value, String::Latin1);
+ }
+ else if(!strcmp(name, "pubdate"))
+ {
+ m_year = 0;
+ char *p = strrchr(value, '-');
+ if(p)
+ m_year = strtol(p+1, NULL, 10);
+ }
+ else if(!strcmp(name, "user_id"))
+ {
+ m_userID = strtol(value, NULL, 10);
+ }
+
+ delete[] name;
+ delete[] value;
+ }
+
+ m_album = String("", String::Latin1);
+ m_track = 0;
+ m_genre = String("Audiobook", String::Latin1);
+}
+
+bool Audible::Tag::readTag( FILE *fp, char **name, char **value)
+{
+ uint32_t nlen;
+ fread(&nlen, sizeof(nlen), 1, fp);
+ nlen = ntohl(nlen);
+ //fprintf(stderr, "tagname len=%x\n", (unsigned)nlen);
+ *name = new char[nlen+1];
+ (*name)[nlen] = '\0';
+
+ uint32_t vlen;
+ fread(&vlen, sizeof(vlen), 1, fp);
+ vlen = ntohl(vlen);
+ //fprintf(stderr, "tag len=%x\n", (unsigned)vlen);
+ *value = new char[vlen+1];
+ (*value)[vlen] = '\0';
+
+ fread(*name, nlen, 1, fp);
+ fread(*value, vlen, 1, fp);
+ char lasttag;
+ fread(&lasttag, 1, 1, fp);
+ //fprintf(stderr, "%s: \"%s\"\n", *name, *value);
+
+ m_tagsEndOffset += 2 * 4 + nlen + vlen + 1;
+
+ return !lasttag;
+}
+
+int Audible::Tag::getTagsEndOffset()
+{
+ return m_tagsEndOffset;
+}
diff --git a/src/metadata/audible/audibletag.h b/src/metadata/audible/audibletag.h
new file mode 100644
index 0000000..f03966f
--- /dev/null
+++ b/src/metadata/audible/audibletag.h
@@ -0,0 +1,185 @@
+/***************************************************************************
+ copyright : (C) 2005 by Martin Aumueller
+
+ copyright : (C) 2005 by Andy Leadbetter
+ (original mp4 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., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef TAGLIB_AUDIBLETAG_H
+#define TAGLIB_AUDIBLETAG_H
+
+#include <config.h>
+
+#include <taglib/tag.h>
+#include "taglib_audiblefile.h"
+
+namespace TagLib {
+
+ namespace Audible {
+ /*!
+ * This implements the generic TagLib::Tag API
+ */
+ class Tag : public TagLib::Tag
+ {
+ public:
+ Tag();
+
+ /*!
+ * read tags from the aa file.
+ */
+ void readTags( FILE *file );
+
+ /*!
+ * Destroys this AudibleTag instance.
+ */
+ virtual ~Tag();
+
+ /*!
+ * Returns the track name; if no track name is present in the tag
+ * String::null will be returned.
+ */
+ virtual String title() const { return m_title; }
+
+ /*!
+ * Returns the artist name; if no artist name is present in the tag
+ * String::null will be returned.
+ */
+ virtual String artist() const { return m_artist; }
+
+ /*!
+ * Returns the album name; if no album name is present in the tag
+ * String::null will be returned.
+ */
+ virtual String album() const { return m_album; }
+
+ /*!
+ * Returns the track comment; if no comment is present in the tag
+ * String::null will be returned.
+ */
+ virtual String comment() const { return m_comment; }
+
+ /*!
+ * Returns the genre name; if no genre is present in the tag String::null
+ * will be returned.
+ */
+ virtual String genre() const { return m_genre; }
+
+ /*!
+ * 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 user id for this file.
+ */
+ virtual uint userID() const { return m_userID; }
+
+ /*!
+ * Sets the title to \a s. If \a s is String::null 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 String::null 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 String::null 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 String::null 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 String::null 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 s is 0 then this value will be cleared.
+ */
+ virtual void setTrack(uint i) { m_track = 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);
+
+ virtual void setUserID(uint id) { m_userID = id; }
+
+ int getTagsEndOffset();
+
+
+
+ protected:
+ String m_title;
+ String m_artist;
+ String m_album;
+ String m_comment;
+ String m_genre;
+ uint m_year;
+ uint m_track;
+ uint m_userID;
+ bool readTag( FILE *fp, char **name, char **value);
+ int m_tagsEndOffset;
+ };
+ }
+}
+
+#endif
diff --git a/src/metadata/audible/taglib_audiblefile.cpp b/src/metadata/audible/taglib_audiblefile.cpp
new file mode 100644
index 0000000..47f5182
--- /dev/null
+++ b/src/metadata/audible/taglib_audiblefile.cpp
@@ -0,0 +1,121 @@
+/***************************************************************************
+ copyright : (C) 2005 by Martin Aumueller
+
+ copyright : (C) 2005 by Andy Leadbetter
+ (original mp4 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., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#include <stdio.h>
+
+#include "taglib_audiblefile.h"
+
+#include "audibletag.h"
+#include <taglib/tfile.h>
+#include <taglib/audioproperties.h>
+
+namespace TagLib {
+////////////////////////////////////////////////////////////////////////////////
+// public members
+////////////////////////////////////////////////////////////////////////////////
+
+Audible::File::File(const char *file,
+ bool readProperties,
+ Properties::ReadStyle propertiesStyle,
+ FILE *fp)
+ : TagLib::File(file)
+ , audibletag( NULL )
+ , properties( NULL )
+{
+
+ // debug ("Audible::File: create new file object.");
+ //debug ( file );
+
+ /**
+ * Create the Audible file.
+ */
+
+ if(fp)
+ audiblefile = fp;
+ else
+ audiblefile = fopen(file, "rb");
+
+ if( isOpen() )
+ {
+ read(readProperties, propertiesStyle );
+ }
+}
+
+Audible::File::~File()
+{
+ if(audiblefile)
+ fclose(audiblefile);
+ delete audibletag;
+ delete properties;
+}
+
+TagLib::Tag *Audible::File::tag() const
+{
+ return audibletag;
+}
+
+TagLib::Audible::Tag *Audible::File::getAudibleTag() const
+{
+ return audibletag;
+}
+
+Audible::Properties *Audible::File::audioProperties() const
+{
+ return properties;
+}
+
+bool Audible::File::save()
+{
+ return false;
+}
+
+bool Audible::File::isOpen()
+{
+ return audiblefile != NULL;
+}
+
+////////////////////////////////////////////////////////////////////////////////
+// private members
+////////////////////////////////////////////////////////////////////////////////
+
+void Audible::File::read(bool readProperties, Properties::ReadStyle propertiesStyle)
+{
+ properties = new Audible::Properties(propertiesStyle);
+ audibletag = new Audible::Tag();
+
+ if (audiblefile != NULL) {
+ audibletag->readTags( audiblefile );
+ int off = audibletag->getTagsEndOffset();
+ //fprintf(stderr, "off=%d\n", off);
+
+ if(readProperties)
+ {
+ // Parse bitrate etc.
+ properties->readAudibleProperties( audiblefile, off );
+ }
+ }
+}
+
+}
diff --git a/src/metadata/audible/taglib_audiblefile.h b/src/metadata/audible/taglib_audiblefile.h
new file mode 100644
index 0000000..c1860ae
--- /dev/null
+++ b/src/metadata/audible/taglib_audiblefile.h
@@ -0,0 +1,93 @@
+/***************************************************************************
+ copyright : (C) 2005 by Martin Aumueller
+
+ copyright : (C) 2005 by Andy Leadbetter
+ (original mp4 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., 51 Franklin Street, Fifth Floor, Boston, *
+ * MA 02110-1301 USA *
+ ***************************************************************************/
+
+#ifndef TAGLIB_AUDIBLEFILE_H
+#define TAGLIB_AUDIBLEFILE_H
+
+#include <taglib/tfile.h>
+#include "audibleproperties.h"
+#include "audibletag.h"
+
+namespace TagLib {
+
+ namespace Audible {
+
+ class Tag;
+
+ class File : public TagLib::File
+ {
+ public:
+ /*!
+ * Contructs a Audible 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,
+ FILE *fp=NULL);
+
+ /*!
+ * Destroys this instance of the File.
+ */
+ virtual ~File();
+
+
+ virtual TagLib::Tag *tag() const;
+
+ /*!
+ * Returns the Audible::Properties for this file. If no audio properties
+ * were read then this will return a null pointer.
+ */
+ virtual Audible::Properties *audioProperties() const;
+
+ /*!
+ * Save the file.
+ * This is the same as calling save(AllTags);
+ *
+ * \note As of now, saving Audible tags is not supported.
+ */
+ virtual bool save();
+
+ void read(bool readProperties, Properties::ReadStyle propertiesStyle);
+
+ Audible::Tag *getAudibleTag() const;
+
+ bool isAudibleFile() const;
+
+ protected:
+ File(const File &);
+ File &operator=(const File &);
+ bool isOpen();
+
+
+ Audible::Tag *audibletag;
+ Audible::Properties *properties;
+
+ FILE *audiblefile;
+ };
+ }
+}
+
+#endif
diff --git a/src/metadata/audible/taglib_audiblefiletyperesolver.cpp b/src/metadata/audible/taglib_audiblefiletyperesolver.cpp
new file mode 100644
index 0000000..152b17c
--- /dev/null
+++ b/src/metadata/audible/taglib_audiblefiletyperesolver.cpp
@@ -0,0 +1,44 @@
+/***************************************************************************
+ copyright : (C) 2005 by Martin Aumueller
+ ***************************************************************************/
+
+/***************************************************************************
+ * 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 <stdio.h>
+
+#include "taglib_audiblefiletyperesolver.h"
+#include "taglib_audiblefile.h"
+
+#include <string.h>
+
+TagLib::File *AudibleFileTypeResolver::createFile(const char *fileName,
+ bool readProperties,
+ TagLib::AudioProperties::ReadStyle propertiesStyle) const
+{
+ const char *ext = strrchr(fileName, '.');
+ if(ext && !strcasecmp(ext, ".aa"))
+ {
+ FILE *fp = fopen(fileName, "rb");
+ if(!fp)
+ return 0;
+
+ return new TagLib::Audible::File(fileName, readProperties, propertiesStyle, fp);
+ }
+
+ return 0;
+}
diff --git a/src/metadata/audible/taglib_audiblefiletyperesolver.h b/src/metadata/audible/taglib_audiblefiletyperesolver.h
new file mode 100644
index 0000000..6f1e705
--- /dev/null
+++ b/src/metadata/audible/taglib_audiblefiletyperesolver.h
@@ -0,0 +1,36 @@
+/***************************************************************************
+ copyright : (C) 2005 by Martin Aumueller
+ ***************************************************************************/
+
+/***************************************************************************
+ * 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_AUDIBLEFILETYPERESOLVER_H
+#define TAGLIB_AUDIBLEFILETYPERESOLVER_H
+
+#include <taglib/tfile.h>
+#include <taglib/fileref.h>
+
+
+class AudibleFileTypeResolver : public TagLib::FileRef::FileTypeResolver
+{
+ TagLib::File *createFile(const char *fileName,
+ bool readAudioProperties,
+ TagLib::AudioProperties::ReadStyle audioPropertiesStyle) const;
+};
+
+#endif