gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r9808 - Extractor/src/plugins


From: gnunet
Subject: [GNUnet-SVN] r9808 - Extractor/src/plugins
Date: Sat, 19 Dec 2009 13:37:09 +0100

Author: grothoff
Date: 2009-12-19 13:37:09 +0100 (Sat, 19 Dec 2009)
New Revision: 9808

Added:
   Extractor/src/plugins/s3m_extractor.c
Removed:
   Extractor/src/plugins/s3mextractor.c
Modified:
   Extractor/src/plugins/Makefile.am
Log:
s3m

Modified: Extractor/src/plugins/Makefile.am
===================================================================
--- Extractor/src/plugins/Makefile.am   2009-12-19 12:34:10 UTC (rev 9807)
+++ Extractor/src/plugins/Makefile.am   2009-12-19 12:37:09 UTC (rev 9808)
@@ -102,6 +102,7 @@
   libextractor_real.la \
   libextractor_riff.la \
   $(rpm) \
+  libextractor_s3m.la \
   libextractor_sid.la \
   libextractor_tar.la \
   $(thumbgtk) \
@@ -290,6 +291,11 @@
 libextractor_rpm_la_LIBADD = \
   -lrpm
 
+libextractor_s3m_la_SOURCES = \
+  s3m_extractor.c 
+libextractor_s3m_la_LDFLAGS = \
+  $(PLUGINFLAGS)
+
 libextractor_sid_la_SOURCES = \
   sid_extractor.c 
 libextractor_sid_la_LDFLAGS = \
@@ -349,7 +355,6 @@
   $(extrampeg) \
   libextractor_nsf.la \
   libextractor_nsfe.la \
-  libextractor_s3m.la \
   libextractor_tar.la \
   $(thumbqt) \
   libextractor_xm.la \
@@ -392,13 +397,6 @@
 libextractor_nsfe_la_LIBADD = \
   $(top_builddir)/src/main/libextractor.la
 
-libextractor_s3m_la_SOURCES = \
-  s3mextractor.c 
-libextractor_s3m_la_LDFLAGS = \
-  $(PLUGINFLAGS)
-libextractor_s3m_la_LIBADD = \
-  $(top_builddir)/src/main/libextractor.la
-
 libextractor_thumbnailqt_la_SOURCES = \
   thumbnailextractorqt.cc
 libextractor_thumbnailqt_la_LDFLAGS = \

Copied: Extractor/src/plugins/s3m_extractor.c (from rev 9803, 
Extractor/src/plugins/s3mextractor.c)
===================================================================
--- Extractor/src/plugins/s3m_extractor.c                               (rev 0)
+++ Extractor/src/plugins/s3m_extractor.c       2009-12-19 12:37:09 UTC (rev 
9808)
@@ -0,0 +1,68 @@
+/*
+ * 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];
+};
+
+#define ADD(s,t) do { if (0 != proc (proc_cls, "s3m", t, 
EXTRACTOR_METAFORMAT_UTF8, "text/plain", s, strlen(s)+1)) return 1; } while (0)
+
+
+/* "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.
+ *
+ */
+int 
+EXTRACTOR_s3m_extract (const unsigned char *data,
+                      size_t size,
+                      EXTRACTOR_MetaDataProcessor proc,
+                      void *proc_cls,
+                      const char *options)
+{
+  char title[29];
+  const struct header *head;
+
+  /* Check header size */
+
+  if (size < HEADER_SIZE)    
+    return 0;    
+  head = (const struct header *) data;
+  if (memcmp (head->magicid, "SCRM", 4))
+    return 0;
+  ADD ("audio/x-s3m", EXTRACTOR_METATYPE_MIMETYPE);
+
+  memcpy (&title, head->title, 28);
+  title[28] = '\0';
+  ADD (title, EXTRACTOR_METATYPE_TITLE);
+  return 0;
+}

Deleted: Extractor/src/plugins/s3mextractor.c
===================================================================
--- Extractor/src/plugins/s3mextractor.c        2009-12-19 12:34:10 UTC (rev 
9807)
+++ Extractor/src/plugins/s3mextractor.c        2009-12-19 12:37:09 UTC (rev 
9808)
@@ -1,92 +0,0 @@
-/*
- * 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[28] = '\0';
-  prev = addkword (prev, title, EXTRACTOR_TITLE);
-
-  return (prev);
-
-}





reply via email to

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