gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r7541 - in Extractor: . src/main src/plugins


From: gnunet
Subject: [GNUnet-SVN] r7541 - in Extractor: . src/main src/plugins
Date: Mon, 11 Aug 2008 18:57:58 -0600 (MDT)

Author: cyberix
Date: 2008-08-11 18:57:58 -0600 (Mon, 11 Aug 2008)
New Revision: 7541

Added:
   Extractor/src/plugins/xmextractor.c
Modified:
   Extractor/AUTHORS
   Extractor/ChangeLog
   Extractor/NEWS
   Extractor/src/main/extractor.c
   Extractor/src/plugins/Makefile.am
Log:
Added xm support.

Modified: Extractor/AUTHORS
===================================================================
--- Extractor/AUTHORS   2008-08-11 23:04:51 UTC (rev 7540)
+++ Extractor/AUTHORS   2008-08-12 00:57:58 UTC (rev 7541)
@@ -41,6 +41,7 @@
 nsfe          - Toni Ruottu <address@hidden>
 applefile     - Heikki Lindholm
 it            - Toni Ruottu <address@hidden>
+xm            - Toni Ruottu <address@hidden>
 
 General contributors:
 Yuri N. Sedunov <address@hidden>

Modified: Extractor/ChangeLog
===================================================================
--- Extractor/ChangeLog 2008-08-11 23:04:51 UTC (rev 7540)
+++ Extractor/ChangeLog 2008-08-12 00:57:58 UTC (rev 7541)
@@ -1,3 +1,6 @@
+Tue Aug 12 03:55:01 EEST 2008
+       Added an XM (eXtended Module) plugin.
+
 Mon Aug 11 00:43:46 EEST 2008
        Added an IT (Impulse Tracker) plugin.
 

Modified: Extractor/NEWS
===================================================================
--- Extractor/NEWS      2008-08-11 23:04:51 UTC (rev 7540)
+++ Extractor/NEWS      2008-08-12 00:57:58 UTC (rev 7541)
@@ -1,3 +1,4 @@
+       Added an XM (eXtended Module) plugin.
        Added an IT (Impulse Tracker) plugin.
 
 Mon Jun 23 19:05:07 EET 2008

Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c      2008-08-11 23:04:51 UTC (rev 7540)
+++ Extractor/src/main/extractor.c      2008-08-12 00:57:58 UTC (rev 7541)
@@ -264,7 +264,8 @@
 libextractor_sid:\
 libextractor_nsfe:\
 libextractor_nsf:\
-libextractor_it"
+libextractor_it:\
+libextractor_xm"
 
 #define DEFAULT_LIBRARIES MPEGSO EXSO OLESO OGGSO FLACSO QTSO DEFSO
 

Modified: Extractor/src/plugins/Makefile.am
===================================================================
--- Extractor/src/plugins/Makefile.am   2008-08-11 23:04:51 UTC (rev 7540)
+++ Extractor/src/plugins/Makefile.am   2008-08-12 00:57:58 UTC (rev 7541)
@@ -120,6 +120,7 @@
   $(thumbqt) \
   libextractor_translit.la \
   libextractor_wav.la \
+  libextractor_xm.la \
   libextractor_zip.la 
 
 if HAVE_VORBISFILE
@@ -382,6 +383,13 @@
 libextractor_nsfe_la_LIBADD = \
   $(top_builddir)/src/main/libextractor.la
 
+libextractor_xm_la_SOURCES = \
+  xmextractor.c 
+libextractor_xm_la_LDFLAGS = \
+  $(PLUGINFLAGS)  $(retaincommand)
+libextractor_xm_la_LIBADD = \
+  $(top_builddir)/src/main/libextractor.la
+
 libextractor_split_la_SOURCES = \
   splitextractor.c 
 libextractor_split_la_LDFLAGS = \

Added: Extractor/src/plugins/xmextractor.c
===================================================================
--- Extractor/src/plugins/xmextractor.c                         (rev 0)
+++ Extractor/src/plugins/xmextractor.c 2008-08-12 00:57:58 UTC (rev 7541)
@@ -0,0 +1,108 @@
+/*
+ * This file is part of libextractor.
+ * (C) 2008 Toni Ruottu
+ *
+ * libextractor is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published
+ * by the Free Software Foundation; either version 2, or (at your
+ * option) any later version.
+ *
+ * libextractor 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
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with libextractor; see the file COPYING.  If not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "platform.h"
+#include "extractor.h"
+#include "convert.h"
+
+#define HEADER_SIZE  64
+
+struct header
+{
+  char magicid[17];
+  char title[20];
+  char something[1];
+  char tracker[20];
+  char version[2];
+};
+
+
+static struct EXTRACTOR_Keywords *addkword
+  (EXTRACTOR_KeywordList * oldhead,
+   const char *phrase, EXTRACTOR_KeywordType type)
+{
+  EXTRACTOR_KeywordList *keyword;
+
+  keyword = malloc (sizeof (EXTRACTOR_KeywordList));
+  keyword->next = oldhead;
+  keyword->keyword = strdup (phrase);
+  keyword->keywordType = type;
+  return (keyword);
+}
+
+
+/* "extract" keyword from an Impulse Tracker module
+ *
+ * The XM module format description for XM files
+ * version $0104 that was written by Mr.H of Triton
+ * in 1994 was used, while this piece of software
+ * was originally written.
+ *
+ */
+struct EXTRACTOR_Keywords *libextractor_xm_extract
+  (const char *filename,
+   char *data, size_t size, struct EXTRACTOR_Keywords *prev)
+{
+  char title[21];
+  char tracker[21];
+  char xmversion[8];
+  struct header *head;
+
+  /* Check header size */
+
+  if (size < HEADER_SIZE)
+    {
+      return (prev);
+    }
+
+  head = (struct header *) data;
+
+  /* Check "magic" id bytes */
+
+  if (memcmp (head->magicid, "Extended Module: ", 17))
+    {
+      return (prev);
+    }
+
+  /* Mime-type */
+
+  prev = addkword (prev, "audio/x-xm", EXTRACTOR_MIMETYPE);
+
+  /* Version of Tracker */
+
+  sprintf (xmversion, "%d.%d", head->version[1],head->version[0]);
+  prev = addkword (prev, xmversion, EXTRACTOR_FORMAT_VERSION);
+
+  /* Song title */
+
+  memcpy (&title, head->title, 20);
+  title[21] = '\0';
+  prev = addkword (prev, title, EXTRACTOR_TITLE);
+
+  /* software used for creating the data */
+
+  memcpy (&tracker, head->tracker, 20);
+  tracker[21] = '\0';
+  prev = addkword (prev, tracker, EXTRACTOR_SOFTWARE);
+
+  return (prev);
+
+}





reply via email to

[Prev in Thread] Current Thread [Next in Thread]