[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r3805 - in Extractor: . src/main src/plugins
From: |
cyberix |
Subject: |
[GNUnet-SVN] r3805 - in Extractor: . src/main src/plugins |
Date: |
Mon, 20 Nov 2006 11:43:05 -0800 (PST) |
Author: cyberix
Date: 2006-11-20 11:42:55 -0800 (Mon, 20 Nov 2006)
New Revision: 3805
Added:
Extractor/src/plugins/sidextractor.c
Modified:
Extractor/AUTHORS
Extractor/ChangeLog
Extractor/NEWS
Extractor/src/main/extractor.c
Extractor/src/plugins/Makefile.am
Log:
Added sid support.
Modified: Extractor/AUTHORS
===================================================================
--- Extractor/AUTHORS 2006-11-20 06:13:15 UTC (rev 3804)
+++ Extractor/AUTHORS 2006-11-20 19:42:55 UTC (rev 3805)
@@ -34,6 +34,7 @@
language - Roberto Cappuccio <address@hidden> (from libkat)
word - Ariya Hidayat <address@hidden> and Sacha Fuentes
<address@hidden>
nsf - Toni Ruottu <address@hidden>
+sid - Toni Ruottu <address@hidden>
General contributors:
Yuri N. Sedunov <address@hidden>
Modified: Extractor/ChangeLog
===================================================================
--- Extractor/ChangeLog 2006-11-20 06:13:15 UTC (rev 3804)
+++ Extractor/ChangeLog 2006-11-20 19:42:55 UTC (rev 3805)
@@ -1,3 +1,6 @@
+Mon Nov 20 22:08:55 EET 2006
+ Added an SID (C64 music file) plugin
+
Sat Nov 11 16:04:38 MST 2006
Fixed libltdl side-effect of loading libextractor; code
now preserves the old library search path and only appends
Modified: Extractor/NEWS
===================================================================
--- Extractor/NEWS 2006-11-20 06:13:15 UTC (rev 3804)
+++ Extractor/NEWS 2006-11-20 19:42:55 UTC (rev 3805)
@@ -1,3 +1,6 @@
+Mon Nov 20 22:08:55 EET 2006
+ Added an SID (C64 music file) plugin
+
Sat Nov 11 00:04:34 EET 2006
Added an NSF ( NES Sound Format ) plugin
Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c 2006-11-20 06:13:15 UTC (rev 3804)
+++ Extractor/src/main/extractor.c 2006-11-20 19:42:55 UTC (rev 3805)
@@ -240,6 +240,7 @@
libextractor_elf:\
libextractor_oo:\
libextractor_asf:\
+libextractor_sid:\
libextractor_nsf"
#define DEFAULT_LIBRARIES EXSO OLESO OGGSO QTSO DEFSO
Modified: Extractor/src/plugins/Makefile.am
===================================================================
--- Extractor/src/plugins/Makefile.am 2006-11-20 06:13:15 UTC (rev 3804)
+++ Extractor/src/plugins/Makefile.am 2006-11-20 19:42:55 UTC (rev 3805)
@@ -80,6 +80,7 @@
$(extraqt) \
libextractor_real.la \
libextractor_riff.la \
+ libextractor_sid.la \
libextractor_split.la \
libextractor_tar.la \
libextractor_tiff.la \
@@ -292,6 +293,13 @@
$(top_builddir)/src/main/libextractor.la \
libconvert.la
+libextractor_sid_la_SOURCES = \
+ sidextractor.c
+libextractor_sid_la_LDFLAGS = \
+ $(PLUGINFLAGS) $(retaincommand)
+libextractor_sid_la_LIBADD = \
+ $(top_builddir)/src/main/libextractor.la
+
libextractor_nsf_la_SOURCES = \
nsfextractor.c
libextractor_nsf_la_LDFLAGS = \
Added: Extractor/src/plugins/sidextractor.c
===================================================================
--- Extractor/src/plugins/sidextractor.c 2006-11-20 06:13:15 UTC (rev
3804)
+++ Extractor/src/plugins/sidextractor.c 2006-11-20 19:42:55 UTC (rev
3805)
@@ -0,0 +1,169 @@
+/*
+ This file is part of libextractor.
+ (C) 2006 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"
+
+
+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 SID file
+ *
+ * This plugin is based on the nsf extractor
+ *
+ * */
+struct EXTRACTOR_Keywords *
+libextractor_sid_extract(const char * filename,
+ char * data,
+ size_t size,
+ struct EXTRACTOR_Keywords * prev) {
+ int i, version;
+ char name[33];
+ char artist[33];
+ char copyright[33];
+ char songs[32];
+ char startingsong[32];
+
+
+ /* Check header size and "magic" id bytes */
+
+ if
+ (
+ size < 0x76 ||
+ ( data[0] != 'P' && data[0] != 'R' ) ||
+ data[1] != 'S' ||
+ data[2] != 'I' ||
+ data[3] != 'D'
+ )
+ {
+ return prev;
+ }
+
+
+ /* Mime-type */
+
+ prev = addkword(prev, "audio/prs.sid", EXTRACTOR_MIMETYPE);
+
+ /* Version of SID format */
+
+ version = data[4] * 0xff + data[5];
+ sprintf( startingsong, "%d", version );
+ prev = addkword(prev, startingsong, EXTRACTOR_FORMAT_VERSION);
+
+
+ /* Get song count */
+
+ sprintf( songs, "%d", data[0x0e] * 0xff + data[0x0f] );
+ prev = addkword(prev, songs, EXTRACTOR_SONG_COUNT);
+
+
+ /* Get number of the first song to be played */
+
+ sprintf( startingsong, "%d", data[0x10] * 0xff + data[0x11] );
+ prev = addkword(prev, startingsong, EXTRACTOR_STARTING_SONG);
+
+
+ /* Parse name, artist, copyright fields */
+
+ for( i = 0; i < 32; i++ )
+ {
+ name[i] = data[ 0x16 + i ];
+ artist[i] = data[ 0x36 + i ];
+ copyright[i] = data[ 0x56 + i ];
+ }
+
+ name[32] = '\0';
+ artist[32] = '\0';
+ copyright[32] = '\0';
+
+ prev = addkword(prev, name, EXTRACTOR_TITLE);
+ prev = addkword(prev, artist, EXTRACTOR_ARTIST);
+ prev = addkword(prev, copyright, EXTRACTOR_COPYRIGHT);
+
+
+ if( version < 2 || size < 0x7c )
+ {
+ return prev;
+ }
+
+ /* Version 2 specific options follow
+ *
+ * Note: Had some troubles understanding specification
+ * on the flags in version 2. I hope this is correct.
+ *
+ */
+
+ /* PAL or NTSC */
+
+ if( data[0x77] & 16 )
+ {
+ if( data[0x77] & 32 )
+ {
+ prev = addkword(prev, "PAL/NTSC", EXTRACTOR_TELEVISION_SYSTEM);
+ }
+ else
+ {
+ prev = addkword(prev, "PAL", EXTRACTOR_TELEVISION_SYSTEM);
+ }
+ }
+ else
+ {
+ if( data[0x77] & 32 )
+ {
+ prev = addkword(prev, "NTSC", EXTRACTOR_TELEVISION_SYSTEM);
+ }
+ }
+
+ /* Detect SID Chips suitable for play the files */
+
+ if( data[0x77] & 4 )
+ {
+ if( data[0x77] & 8 )
+ {
+ prev = addkword(prev, "MOS6581/MOS8580", EXTRACTOR_HARDWARE_DEPENDENCY);
+ }
+ else
+ {
+ prev = addkword(prev, "MOS6581", EXTRACTOR_HARDWARE_DEPENDENCY);
+ }
+ }
+ else
+ {
+ if( data[0x77] & 8 )
+ {
+ prev = addkword(prev, "MOS8580", EXTRACTOR_HARDWARE_DEPENDENCY);
+ }
+ }
+
+ return prev;
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r3805 - in Extractor: . src/main src/plugins,
cyberix <=