gnunet-svn
[Top][All Lists]
Advanced

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

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


From: gnunet
Subject: [GNUnet-SVN] r7543 - in Extractor: . src/main src/plugins
Date: Mon, 11 Aug 2008 19:43:59 -0600 (MDT)

Author: cyberix
Date: 2008-08-11 19:43:59 -0600 (Mon, 11 Aug 2008)
New Revision: 7543

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

Modified: Extractor/AUTHORS
===================================================================
--- Extractor/AUTHORS   2008-08-12 01:01:28 UTC (rev 7542)
+++ Extractor/AUTHORS   2008-08-12 01:43:59 UTC (rev 7543)
@@ -42,6 +42,7 @@
 applefile     - Heikki Lindholm
 it            - Toni Ruottu <address@hidden>
 xm            - Toni Ruottu <address@hidden>
+s3m           - Toni Ruottu <address@hidden>
 
 General contributors:
 Yuri N. Sedunov <address@hidden>

Modified: Extractor/ChangeLog
===================================================================
--- Extractor/ChangeLog 2008-08-12 01:01:28 UTC (rev 7542)
+++ Extractor/ChangeLog 2008-08-12 01:43:59 UTC (rev 7543)
@@ -1,3 +1,6 @@
+Tue Aug 12 04:40:49 EEST 2008
+       Added an S3M (Scream Tracker 3 Module) plugin.
+
 Tue Aug 12 03:55:01 EEST 2008
        Added an XM (eXtended Module) plugin.
 

Modified: Extractor/NEWS
===================================================================
--- Extractor/NEWS      2008-08-12 01:01:28 UTC (rev 7542)
+++ Extractor/NEWS      2008-08-12 01:43:59 UTC (rev 7543)
@@ -1,3 +1,4 @@
+       Added an S3M (Scream Tracker 3 Module) plugin.
        Added an XM (eXtended Module) plugin.
        Added an IT (Impulse Tracker) plugin.
 

Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c      2008-08-12 01:01:28 UTC (rev 7542)
+++ Extractor/src/main/extractor.c      2008-08-12 01:43:59 UTC (rev 7543)
@@ -265,7 +265,8 @@
 libextractor_nsfe:\
 libextractor_nsf:\
 libextractor_it:\
-libextractor_xm"
+libextractor_xm:\
+libextractor_s3m"
 
 #define DEFAULT_LIBRARIES MPEGSO EXSO OLESO OGGSO FLACSO QTSO DEFSO
 

Modified: Extractor/src/plugins/Makefile.am
===================================================================
--- Extractor/src/plugins/Makefile.am   2008-08-12 01:01:28 UTC (rev 7542)
+++ Extractor/src/plugins/Makefile.am   2008-08-12 01:43:59 UTC (rev 7543)
@@ -113,6 +113,7 @@
   $(extraqt) \
   libextractor_real.la \
   libextractor_riff.la \
+  libextractor_s3m.la \
   libextractor_sid.la \
   libextractor_split.la \
   libextractor_tar.la \
@@ -390,6 +391,13 @@
 libextractor_xm_la_LIBADD = \
   $(top_builddir)/src/main/libextractor.la
 
+libextractor_s3m_la_SOURCES = \
+  s3mextractor.c 
+libextractor_s3m_la_LDFLAGS = \
+  $(PLUGINFLAGS)  $(retaincommand)
+libextractor_s3m_la_LIBADD = \
+  $(top_builddir)/src/main/libextractor.la
+
 libextractor_split_la_SOURCES = \
   splitextractor.c 
 libextractor_split_la_LDFLAGS = \

Added: Extractor/src/plugins/s3mextractor.c
===================================================================
--- Extractor/src/plugins/s3mextractor.c                                (rev 0)
+++ Extractor/src/plugins/s3mextractor.c        2008-08-12 01:43:59 UTC (rev 
7543)
@@ -0,0 +1,92 @@
+/*
+ * 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  0x70
+
+struct header
+{
+  char title[28];
+  char something[16];
+  char magicid[4];
+};
+
+
+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 a Scream Tracker 3 Module
+ *
+ * "Scream Tracker 3.01 BETA File Formats And Mixing Info"
+ * was used, while this piece of software was originally
+ * written.
+ *
+ */
+struct EXTRACTOR_Keywords *libextractor_s3m_extract
+  (const char *filename,
+   char *data, size_t size, struct EXTRACTOR_Keywords *prev)
+{
+  char title[29];
+  struct header *head;
+
+  /* Check header size */
+
+  if (size < HEADER_SIZE)
+    {
+      return (prev);
+    }
+
+  head = (struct header *) data;
+
+  /* Check "magic" id bytes */
+
+  if (memcmp (head->magicid, "SCRM", 4))
+    {
+      return (prev);
+    }
+
+  /* Mime-type */
+
+  prev = addkword (prev, "audio/x-s3m", EXTRACTOR_MIMETYPE);
+
+  /* Song title */
+
+  memcpy (&title, head->title, 28);
+  title[29] = '\0';
+  prev = addkword (prev, title, EXTRACTOR_TITLE);
+
+  return (prev);
+
+}





reply via email to

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