gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r9784 - in Extractor/src: include main plugins


From: gnunet
Subject: [GNUnet-SVN] r9784 - in Extractor/src: include main plugins
Date: Thu, 17 Dec 2009 15:10:03 +0100

Author: grothoff
Date: 2009-12-17 15:10:02 +0100 (Thu, 17 Dec 2009)
New Revision: 9784

Added:
   Extractor/src/plugins/ogg_extractor.c
Removed:
   Extractor/src/plugins/oggextractor.c
Modified:
   Extractor/src/include/extractor.h
   Extractor/src/main/extractor_metatypes.c
   Extractor/src/plugins/Makefile.am
   Extractor/src/plugins/mp3_extractor.c
   Extractor/src/plugins/rpm_extractor.c
Log:
ogg

Modified: Extractor/src/include/extractor.h
===================================================================
--- Extractor/src/include/extractor.h   2009-12-17 13:41:48 UTC (rev 9783)
+++ Extractor/src/include/extractor.h   2009-12-17 14:10:02 UTC (rev 9784)
@@ -205,7 +205,7 @@
     EXTRACTOR_METATYPE_PACKAGE_ESSENTIAL = 82,
     EXTRACTOR_METATYPE_TARGET_ARCHITECTURE = 83,
     EXTRACTOR_METATYPE_PACKAGE_PRE_DEPENDENCY = 84,
-    EXTRACTOR_METATYPE_PACKAGE_LICENSE = 85,
+    EXTRACTOR_METATYPE_LICENSE = 85,
     EXTRACTOR_METATYPE_PACKAGE_DISTRIBUTION = 86,
     EXTRACTOR_METATYPE_PACKAGE_BUILDHOST = 87,
     EXTRACTOR_METATYPE_VENDOR = 88,
@@ -257,22 +257,25 @@
 
 
     /* music / video specifics */
-    EXTRACTOR_METATYPE_DURATION = 111,
-    EXTRACTOR_METATYPE_ALBUM = 11,
-    EXTRACTOR_METATYPE_ARTIST = 5,
-    EXTRACTOR_METATYPE_GENRE = 12,
+    EXTRACTOR_METATYPE_DURATION = 128,
+    EXTRACTOR_METATYPE_ALBUM = 129,
+    EXTRACTOR_METATYPE_ARTIST = 130,
+    EXTRACTOR_METATYPE_GENRE = 131,
     EXTRACTOR_METATYPE_TRACK_NUMBER = 132,
+    EXTRACTOR_METATYPE_DISC_NUMBER = 133,
+    EXTRACTOR_METATYPE_PERFORMER = 134,
+    EXTRACTOR_METATYPE_CONTACT_INFORMATION = 135,
+    EXTRACTOR_METATYPE_SONG_VERSION = 136,
 
+    EXTRACTOR_METATYPE_PLAY_COUNTER = 118,
     EXTRACTOR_METATYPE_LYRICS = 67,
     EXTRACTOR_METATYPE_CONDUCTOR = 64,
     EXTRACTOR_METATYPE_INTERPRET = 65,
     EXTRACTOR_METATYPE_MUSIC_CD_IDENTIFIER = 117,
-    EXTRACTOR_METATYPE_PLAY_COUNTER = 118,
     EXTRACTOR_METATYPE_MOVIE_DIRECTOR = 110,
     EXTRACTOR_METATYPE_SONG_COUNT = 127,
     EXTRACTOR_METATYPE_STARTING_SONG = 128,
     EXTRACTOR_METATYPE_MUSICIAN_CREDITS_LIST = 123,
-    EXTRACTOR_METATYPE_DISC_NUMBER = 134,
 
     
     /* fixme: used up to here! */
@@ -317,7 +320,6 @@
     EXTRACTOR_METATYPE_GROUP = 42,
     EXTRACTOR_METATYPE_OWNER = 66,
     EXTRACTOR_METATYPE_MEDIA_TYPE = 68,
-    EXTRACTOR_METATYPE_CONTACT = 69,
     EXTRACTOR_METATYPE_SECURITY = 97,
     EXTRACTOR_METATYPE_INFORMATION = 112,
     EXTRACTOR_METATYPE_FULL_NAME = 113,

Modified: Extractor/src/main/extractor_metatypes.c
===================================================================
--- Extractor/src/main/extractor_metatypes.c    2009-12-17 13:41:48 UTC (rev 
9783)
+++ Extractor/src/main/extractor_metatypes.c    2009-12-17 14:10:02 UTC (rev 
9784)
@@ -138,7 +138,7 @@
   { gettext_noop ("description"),
     gettext_noop ("description") },
   { gettext_noop ("copyright"),
-    gettext_noop ("copyright information") },
+    gettext_noop ("Name of the entity holding the copyright") },
   { gettext_noop ("rights"),
     gettext_noop ("information about rights") },
   { gettext_noop ("keywords"),
@@ -222,7 +222,7 @@
     gettext_noop ("dependency that must be satisfied before installation") }, 
   /* 85 */
   { gettext_noop ("license"),
-    gettext_noop ("applicable license") }, 
+    gettext_noop ("applicable copyright license") }, 
   { gettext_noop ("distribution"),
     gettext_noop ("distribution the package is a part of") }, 
   { gettext_noop ("build host"),
@@ -303,15 +303,17 @@
   /* 120 */
   { gettext_noop ("word count"),
     gettext_noop ("number of words") }, 
+  { gettext_noop ("character count"),
+    gettext_noop ("number of characters") }, 
   { gettext_noop ("page orientation"),
     gettext_noop ("") }, 
   { gettext_noop ("paper size"),
     gettext_noop ("") }, 
   { gettext_noop ("template"),
     gettext_noop ("template the document uses or is based on") }, 
+  /* 125 */
   { gettext_noop ("company"),
     gettext_noop ("") }, 
-  /* 125 */
   { gettext_noop ("manager"),
     gettext_noop ("") }, 
   { gettext_noop ("revision number"),
@@ -320,26 +322,28 @@
     gettext_noop ("play time for the medium") }, 
   { gettext_noop ("album"),
     gettext_noop ("name of the album") }, 
+  /* 130 */
   { gettext_noop ("artist"),
     gettext_noop ("name of the artist or band") }, 
   { gettext_noop ("genre"),
     gettext_noop ("") }, 
   { gettext_noop ("track number"),
     gettext_noop ("original number of the track on the distribution medium") 
}, 
+  { gettext_noop ("disk number"),
+    gettext_noop ("number of the disk in a multi-disk (or volume) 
distribution") }, 
+  { gettext_noop ("performer"),
+    gettext_noop ("The artist(s) who performed the work (conductor, orchestra, 
soloists, actor, etc.)") }, 
+  /* 135 */
+  { gettext_noop ("contact"),
+    gettext_noop ("Contact information for the creator or distributor") }, 
+  { gettext_noop ("song version"),
+    gettext_noop ("name of the version of the song (i.e. remix information)") 
}, 
   { gettext_noop (""),
     gettext_noop ("") }, 
   { gettext_noop (""),
     gettext_noop ("") }, 
   { gettext_noop (""),
     gettext_noop ("") }, 
-  { gettext_noop (""),
-    gettext_noop ("") }, 
-  { gettext_noop (""),
-    gettext_noop ("") }, 
-  { gettext_noop (""),
-    gettext_noop ("") }, 
-  { gettext_noop (""),
-    gettext_noop ("") }, 
 #if 0
   
   gettext_noop("author"),

Modified: Extractor/src/plugins/Makefile.am
===================================================================
--- Extractor/src/plugins/Makefile.am   2009-12-17 13:41:48 UTC (rev 9783)
+++ Extractor/src/plugins/Makefile.am   2009-12-17 14:10:02 UTC (rev 9784)
@@ -80,8 +80,9 @@
   libextractor_man.la \
   libextractor_mime.la \
   libextractor_mp3.la \
-  $(ole2) \
   libextractor_odf.la \
+  $(ogg) \
+  $(ole2) \
   $(pdf) \
   $(rpm) \
   $(thumbgtk)
@@ -171,6 +172,21 @@
   $(top_builddir)/src/common/libextractor_common.la \
   $(LE_LIBINTL)
 
+libextractor_odf_la_SOURCES = \
+  odf_extractor.c
+libextractor_odf_la_LDFLAGS = \
+ $(PLUGINFLAGS)
+libextractor_odf_la_LIBADD = \
+ $(top_builddir)/src/common/libextractor_common.la \
+ -lz 
+
+libextractor_ogg_la_SOURCES = \
+  ogg_extractor.c
+libextractor_ogg_la_LDFLAGS = \
+  $(PLUGINFLAGS)
+libextractor_ogg_la_LIBADD = \
+  -lvorbisfile $(vorbisflag) -logg
+
 libextractor_ole2_la_SOURCES =  \
   ole2_extractor.c
 libextractor_ole2_la_CFLAGS = \
@@ -181,14 +197,6 @@
 libextractor_ole2_la_LDFLAGS = \
   $(PLUGINFLAGS) 
 
-libextractor_odf_la_SOURCES = \
-  odf_extractor.c
-libextractor_odf_la_LDFLAGS = \
- $(PLUGINFLAGS)
-libextractor_odf_la_LIBADD = \
- $(top_builddir)/src/common/libextractor_common.la \
- -lz 
-
 libextractor_pdf_la_SOURCES = \
   pdf_extractor.cc 
 libextractor_pdf_la_LDFLAGS = \
@@ -230,7 +238,6 @@
   $(extrampeg) \
   libextractor_nsf.la \
   libextractor_nsfe.la \
-  $(extraogg) \
   libextractor_png.la \
   libextractor_ps.la \
   $(extraqt) \
@@ -245,16 +252,6 @@
   libextractor_xm.la \
   libextractor_zip.la 
 
-if HAVE_VORBISFILE
-libextractor_ogg_la_SOURCES = \
-  oggextractor.c
-libextractor_ogg_la_LDFLAGS = \
-  $(PLUGINFLAGS)
-libextractor_ogg_la_LIBADD = \
-  -lvorbisfile $(vorbisflag) -logg
-endif
-
-
 if HAVE_FLAC
 libextractor_flac_la_SOURCES = \
   flacextractor.c

Modified: Extractor/src/plugins/mp3_extractor.c
===================================================================
--- Extractor/src/plugins/mp3_extractor.c       2009-12-17 13:41:48 UTC (rev 
9783)
+++ Extractor/src/plugins/mp3_extractor.c       2009-12-17 14:10:02 UTC (rev 
9784)
@@ -475,7 +475,7 @@
 }
 
 
-#define ADD(s,t) do { if (0 != proc (proc_cls, "mp3", t, 
EXTRACTOR_METAFORMAT_UTF8, "text/plain", s, strlen(s)+1)) goto FINISH; } while 
(0)
+#define ADD(s,t) do { if (0 != (ret = proc (proc_cls, "mp3", t, 
EXTRACTOR_METAFORMAT_UTF8, "text/plain", s, strlen(s)+1))) goto FINISH; } while 
(0)
 
 
 /* mimetype = audio/mpeg */

Copied: Extractor/src/plugins/ogg_extractor.c (from rev 9782, 
Extractor/src/plugins/oggextractor.c)
===================================================================
--- Extractor/src/plugins/ogg_extractor.c                               (rev 0)
+++ Extractor/src/plugins/ogg_extractor.c       2009-12-17 14:10:02 UTC (rev 
9784)
@@ -0,0 +1,127 @@
+/*
+     This file is part of libextractor.
+     (C) 2002, 2003, 2009 Vidyut Samanta and Christian Grothoff
+
+     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"
+
+#define DEBUG_EXTRACT_OGG 0
+#define OGG_HEADER 0x4f676753
+
+#if HAVE_VORBIS_VORBISFILE_H
+#include <vorbis/vorbisfile.h>
+#else
+#error You must install the libvorbis header files!
+#endif
+
+static char *
+get_comment (vorbis_comment * vc, char *label)
+{
+  char *tag;
+  if (vc && (tag = vorbis_comment_query (vc, label, 0)) != NULL)
+    return tag;
+  return NULL;
+}
+
+static size_t
+readError (void *ptr, size_t size, size_t nmemb, void *datasource)
+{
+  return -1;
+}
+
+static int
+seekError (void *datasource, int64_t offset, int whence)
+{
+  return -1;
+}
+
+static int
+closeOk (void *datasource)
+{
+  return 0;
+}
+
+static long
+tellError (void *datasource)
+{
+  return -1;
+}
+
+#define ADD(t,s) do { if (0 != (ret = proc (proc_cls, "ogg", t, 
EXTRACTOR_METAFORMAT_UTF8, "text/plain", s, strlen(s)+1))) goto FINISH; } while 
(0)
+
+#define ADDG(t,d) do { m = get_comment (comments, d); if (m != NULL) ADD(t,m); 
} while (0)
+
+/* mimetype = application/ogg */
+int 
+EXTRACTOR_ogg_extract (const char *data,
+                      size_t size,
+                      EXTRACTOR_MetaDataProcessor proc,
+                      void *proc_cls,
+                      const char *options)
+{
+  OggVorbis_File vf;
+  vorbis_comment *comments;
+  ov_callbacks callbacks;
+  int ret;
+  const char *m;
+
+  if (size < 2 * sizeof (int))
+    return 0;
+  if (OGG_HEADER != ntohl (*(int *) data))
+    return 0;
+  callbacks.read_func = &readError;
+  callbacks.seek_func = &seekError;
+  callbacks.close_func = &closeOk;
+  callbacks.tell_func = &tellError;
+  if (0 != ov_open_callbacks (NULL, &vf, (char*) data, size, callbacks))
+    {
+      ov_clear (&vf);
+      return 0;
+    }
+  comments = ov_comment (&vf, -1);
+  if (NULL == comments)
+    {
+      ov_clear (&vf);
+      return 0;
+    }
+  ret = 0;
+  ADD (EXTRACTOR_METATYPE_MIMETYPE, "application/ogg");
+  if ((comments->vendor != NULL) && (strlen (comments->vendor) > 0))
+    ADD (EXTRACTOR_METATYPE_VENDOR, comments->vendor);
+  ADDG (EXTRACTOR_METATYPE_TITLE, "title");
+  ADDG (EXTRACTOR_METATYPE_ARTIST, "artist");
+  ADDG (EXTRACTOR_METATYPE_PERFORMER, "performer");
+  ADDG (EXTRACTOR_METATYPE_ALBUM, "album");
+  ADDG (EXTRACTOR_METATYPE_TRACK_NUMBER, "tracknumber");
+  ADDG (EXTRACTOR_METATYPE_DISC_NUMBER, "discnumber");
+  ADDG (EXTRACTOR_METATYPE_CONTACT_INFORMATION, "contact");
+  ADDG (EXTRACTOR_METATYPE_GENRE, "genre");
+  ADDG (EXTRACTOR_METATYPE_CREATION_DATE, "date");
+  ADDG (EXTRACTOR_METATYPE_COMMENT, "");
+  ADDG (EXTRACTOR_METATYPE_LOCATION_SUBLOCATION, "location");
+  ADDG (EXTRACTOR_METATYPE_DESCRIPTION, "description");
+  ADDG (EXTRACTOR_METATYPE_ISRC, "isrc");
+  ADDG (EXTRACTOR_METATYPE_ORGANIZATION, "organization");
+  ADDG (EXTRACTOR_METATYPE_COPYRIGHT, "copyright");
+  ADDG (EXTRACTOR_METATYPE_LICENSE, "license");
+  ADDG (EXTRACTOR_METATYPE_SONG_VERSION, "version");
+ FINISH:
+  ov_clear (&vf);
+  return ret;
+}

Deleted: Extractor/src/plugins/oggextractor.c
===================================================================
--- Extractor/src/plugins/oggextractor.c        2009-12-17 13:41:48 UTC (rev 
9783)
+++ Extractor/src/plugins/oggextractor.c        2009-12-17 14:10:02 UTC (rev 
9784)
@@ -1,194 +0,0 @@
-/*
-     This file is part of libextractor.
-     (C) 2002, 2003 Vidyut Samanta and Christian Grothoff
-
-     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"
-
-#define DEBUG_EXTRACT_OGG 0
-#define OGG_HEADER 0x4f676753
-
-#if HAVE_VORBIS_VORBISFILE_H
-#include <vorbis/vorbisfile.h>
-#else
-#error You must install the libvorbis header files!
-#endif
-
-static char *
-get_comment (vorbis_comment * vc, char *label)
-{
-  char *tag;
-  if (vc && (tag = vorbis_comment_query (vc, label, 0)) != NULL)
-    return tag;
-  else
-    return NULL;
-}
-
-static struct EXTRACTOR_Keywords *
-addKeyword (EXTRACTOR_KeywordType type,
-            char *keyword, struct EXTRACTOR_Keywords *next)
-{
-  EXTRACTOR_KeywordList *result;
-
-  if (keyword == NULL)
-    return next;
-  result = malloc (sizeof (EXTRACTOR_KeywordList));
-  result->next = next;
-  result->keyword = strdup (keyword);
-  result->keywordType = type;
-  return result;
-}
-
-static size_t
-readError (void *ptr, size_t size, size_t nmemb, void *datasource)
-{
-  return -1;
-}
-
-static int
-seekError (void *datasource, int64_t offset, int whence)
-{
-  return -1;
-}
-
-static int
-closeOk (void *datasource)
-{
-  return 0;
-}
-
-static long
-tellError (void *datasource)
-{
-  return -1;
-}
-
-/* mimetype = application/ogg */
-struct EXTRACTOR_Keywords *
-libextractor_ogg_extract (const char *filename,
-                          char *data,
-                          size_t size, struct EXTRACTOR_Keywords *prev)
-{
-  OggVorbis_File vf;
-  vorbis_comment *comments;
-  ov_callbacks callbacks;
-
-  if (size < 2 * sizeof (int))
-    {
-      return prev;
-    }
-  if (OGG_HEADER != ntohl (*(int *) data))
-    {
-      return prev;
-    }
-
-  callbacks.read_func = &readError;
-  callbacks.seek_func = &seekError;
-  callbacks.close_func = &closeOk;
-  callbacks.tell_func = &tellError;
-  if (0 != ov_open_callbacks (NULL, &vf, data, size, callbacks))
-    {
-      ov_clear (&vf);
-      return prev;
-    }
-  comments = ov_comment (&vf, -1);
-
-  if (NULL == comments)
-    {
-      ov_clear (&vf);
-      return prev;
-    }
-  if ((comments->vendor != NULL) && (strlen (comments->vendor) > 0))
-    prev = addKeyword (EXTRACTOR_PUBLISHER, comments->vendor, prev);
-
-  prev = addKeyword (EXTRACTOR_TITLE, get_comment (comments, "title"), prev);
-  prev =
-    addKeyword (EXTRACTOR_ARTIST, get_comment (comments, "artist"), prev);
-  prev =
-    addKeyword (EXTRACTOR_INTERPRET, get_comment (comments, "performer"),
-                prev);
-  prev = addKeyword (EXTRACTOR_ALBUM, get_comment (comments, "album"), prev);
-  prev = addKeyword (EXTRACTOR_TRACK_NUMBER, 
-                     get_comment (comments, "tracknumber"), prev);
-  prev = addKeyword (EXTRACTOR_DISC_NUMBER,
-                     get_comment (comments, "discnumber"), prev);
-  prev =
-    addKeyword (EXTRACTOR_CONTACT, get_comment (comments, "contact"), prev);
-  prev = addKeyword (EXTRACTOR_GENRE, get_comment (comments, "genre"), prev);
-  prev = addKeyword (EXTRACTOR_DATE, get_comment (comments, "date"), prev);
-  prev = addKeyword (EXTRACTOR_COMMENT, get_comment (comments, ""), prev);
-  prev =
-    addKeyword (EXTRACTOR_LOCATION, get_comment (comments, "location"), prev);
-  prev =
-    addKeyword (EXTRACTOR_DESCRIPTION, get_comment (comments, "description"),
-                prev);
-  prev =
-    addKeyword (EXTRACTOR_VERSIONNUMBER, get_comment (comments, "version"),
-                prev);
-  prev =
-    addKeyword (EXTRACTOR_ISRC, get_comment (comments, "isrc"),
-                prev);
-  prev =
-    addKeyword (EXTRACTOR_ORGANIZATION,
-                get_comment (comments, "organization"), prev);
-  prev =
-    addKeyword (EXTRACTOR_COPYRIGHT, get_comment (comments, "copyright"),
-                prev);
-  /* we have determined for sure that this is an
-     ogg-vorbis stream, we should add this as a keyword, too */
-  prev = addKeyword (EXTRACTOR_MIMETYPE, "application/ogg", prev);
-  /* build a description from artist, title and album */
-  {
-    EXTRACTOR_KeywordList *keyword = malloc (sizeof (EXTRACTOR_KeywordList));
-    char *word;
-    int len = 1 + 2 + 2 + 1;
-    if (get_comment (comments, "artist") != NULL)
-      len += strlen (get_comment (comments, "artist"));
-    if (get_comment (comments, "title") != NULL)
-      len += strlen (get_comment (comments, "title"));
-    if (get_comment (comments, "album") != NULL)
-      len += strlen (get_comment (comments, "album"));
-
-    word = malloc (len);
-    word[0] = 0;
-    if (get_comment (comments, "artist") != NULL)
-      {
-        strcat (word, get_comment (comments, "artist"));
-      }
-    if (get_comment (comments, "title") != NULL)
-      {
-        strcat (word, ": ");
-        strcat (word, get_comment (comments, "title"));
-      }
-    if (get_comment (comments, "album") != NULL)
-      {
-        strcat (word, " (");
-        strcat (word, get_comment (comments, "album"));
-        strcat (word, ")");
-      }
-    keyword->next = prev;
-    keyword->keyword = word;
-    keyword->keywordType = EXTRACTOR_DESCRIPTION;
-    prev = keyword;
-
-  }
-
-  ov_clear (&vf);
-  return prev;
-}

Modified: Extractor/src/plugins/rpm_extractor.c
===================================================================
--- Extractor/src/plugins/rpm_extractor.c       2009-12-17 13:41:48 UTC (rev 
9783)
+++ Extractor/src/plugins/rpm_extractor.c       2009-12-17 14:10:02 UTC (rev 
9784)
@@ -79,7 +79,7 @@
 #ifdef RPMTAG_COPYRIGHT
   {RPMTAG_COPYRIGHT, EXTRACTOR_METATYPE_COPYRIGHT},
 #endif
-  {RPMTAG_LICENSE, EXTRACTOR_METATYPE_PACKAGE_LICENSE},
+  {RPMTAG_LICENSE, EXTRACTOR_METATYPE_LICENSE},
   {RPMTAG_DISTRIBUTION, EXTRACTOR_METATYPE_PACKAGE_DISTRIBUTION},
   {RPMTAG_BUILDHOST, EXTRACTOR_METATYPE_PACKAGE_BUILDHOST},
   {RPMTAG_VENDOR, EXTRACTOR_METATYPE_VENDOR},





reply via email to

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