gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r9804 - in Extractor: doc src/plugins


From: gnunet
Subject: [GNUnet-SVN] r9804 - in Extractor: doc src/plugins
Date: Sat, 19 Dec 2009 13:17:07 +0100

Author: grothoff
Date: 2009-12-19 13:17:06 +0100 (Sat, 19 Dec 2009)
New Revision: 9804

Added:
   Extractor/src/plugins/xm_extractor.c
Removed:
   Extractor/src/plugins/xmextractor.c
Modified:
   Extractor/doc/version.texi
   Extractor/src/plugins/Makefile.am
Log:
xm

Modified: Extractor/doc/version.texi
===================================================================
--- Extractor/doc/version.texi  2009-12-18 21:52:30 UTC (rev 9803)
+++ Extractor/doc/version.texi  2009-12-19 12:17:06 UTC (rev 9804)
@@ -1,4 +1,4 @@
address@hidden UPDATED 22 October 2009
address@hidden UPDATED 1 October 2009
 @set UPDATED-MONTH October 2009
 @set EDITION 0.6.0
 @set VERSION 0.6.0

Modified: Extractor/src/plugins/Makefile.am
===================================================================
--- Extractor/src/plugins/Makefile.am   2009-12-18 21:52:30 UTC (rev 9803)
+++ Extractor/src/plugins/Makefile.am   2009-12-19 12:17:06 UTC (rev 9804)
@@ -97,6 +97,7 @@
   $(thumbgtk) \
   libextractor_tiff.la \
   libextractor_wav.la \
+  libextractor_xm.la \
   libextractor_zip.la
 
 libextractor_applefile_la_SOURCES = \
@@ -307,6 +308,11 @@
 libextractor_wav_la_LIBADD = \
   $(LE_LIBINTL)
 
+libextractor_xm_la_SOURCES = \
+  xm_extractor.c 
+libextractor_xm_la_LDFLAGS = \
+  $(PLUGINFLAGS)
+
 libextractor_zip_la_SOURCES = \
   zip_extractor.c
 libextractor_zip_la_LDFLAGS = \
@@ -379,13 +385,6 @@
 libextractor_nsfe_la_LIBADD = \
   $(top_builddir)/src/main/libextractor.la
 
-libextractor_xm_la_SOURCES = \
-  xmextractor.c 
-libextractor_xm_la_LDFLAGS = \
-  $(PLUGINFLAGS)
-libextractor_xm_la_LIBADD = \
-  $(top_builddir)/src/main/libextractor.la
-
 libextractor_s3m_la_SOURCES = \
   s3mextractor.c 
 libextractor_s3m_la_LDFLAGS = \

Copied: Extractor/src/plugins/xm_extractor.c (from rev 9803, 
Extractor/src/plugins/xmextractor.c)
===================================================================
--- Extractor/src/plugins/xm_extractor.c                                (rev 0)
+++ Extractor/src/plugins/xm_extractor.c        2009-12-19 12:17:06 UTC (rev 
9804)
@@ -0,0 +1,84 @@
+/*
+ * This file is part of libextractor.
+ * (C) 2008, 2009 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];
+};
+
+#define ADD(s,t) do { if (0 != proc (proc_cls, "xm", t, 
EXTRACTOR_METAFORMAT_UTF8, "text/plain", s, strlen(s)+1)) return 1; } while (0)
+
+
+/* "extract" keyword from an Extended 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.
+ *
+ */
+int 
+EXTRACTOR_xm_extract (const unsigned char *data,
+                     size_t size,
+                     EXTRACTOR_MetaDataProcessor proc,
+                     void *proc_cls,
+                     const char *options)
+{
+  char title[21];
+  char tracker[21];
+  char xmversion[8];
+  const struct header *head;
+
+  /* Check header size */
+  if (size < HEADER_SIZE)
+    return 0;
+  head = (const struct header *) data;
+  /* Check "magic" id bytes */
+  if (memcmp (head->magicid, "Extended Module: ", 17))
+    return 0;
+  ADD("audio/x-xm", EXTRACTOR_METATYPE_MIMETYPE);
+  /* Version of Tracker */
+  snprintf (xmversion, 
+           sizeof(xmversion),
+           "%d.%d", 
+           head->version[1],
+           head->version[0]);
+  ADD (xmversion, EXTRACTOR_METATYPE_FORMAT_VERSION);
+  /* Song title */
+  memcpy (&title, head->title, 20);
+  title[20] = '\0';
+  ADD (title, EXTRACTOR_METATYPE_TITLE);
+  /* software used for creating the data */
+  memcpy (&tracker, head->tracker, 20);
+  tracker[20] = '\0';
+  ADD (tracker, EXTRACTOR_METATYPE_CREATED_BY_SOFTWARE);
+  return 0;
+}

Deleted: Extractor/src/plugins/xmextractor.c
===================================================================
--- Extractor/src/plugins/xmextractor.c 2009-12-18 21:52:30 UTC (rev 9803)
+++ Extractor/src/plugins/xmextractor.c 2009-12-19 12:17:06 UTC (rev 9804)
@@ -1,108 +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  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 Extended 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[20] = '\0';
-  prev = addkword (prev, title, EXTRACTOR_TITLE);
-
-  /* software used for creating the data */
-
-  memcpy (&tracker, head->tracker, 20);
-  tracker[20] = '\0';
-  prev = addkword (prev, tracker, EXTRACTOR_SOFTWARE);
-
-  return (prev);
-
-}





reply via email to

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