diff options
-rw-r--r-- | src/plugins/Makefile.am | 14 | ||||
-rw-r--r-- | src/plugins/s3m_extractor.c (renamed from src/plugins/s3mextractor.c) | 54 |
2 files changed, 21 insertions, 47 deletions
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 3858ffc..03dc995 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am | |||
@@ -102,6 +102,7 @@ plugin_LTLIBRARIES = \ | |||
102 | libextractor_real.la \ | 102 | libextractor_real.la \ |
103 | libextractor_riff.la \ | 103 | libextractor_riff.la \ |
104 | $(rpm) \ | 104 | $(rpm) \ |
105 | libextractor_s3m.la \ | ||
105 | libextractor_sid.la \ | 106 | libextractor_sid.la \ |
106 | libextractor_tar.la \ | 107 | libextractor_tar.la \ |
107 | $(thumbgtk) \ | 108 | $(thumbgtk) \ |
@@ -290,6 +291,11 @@ libextractor_rpm_la_LDFLAGS = \ | |||
290 | libextractor_rpm_la_LIBADD = \ | 291 | libextractor_rpm_la_LIBADD = \ |
291 | -lrpm | 292 | -lrpm |
292 | 293 | ||
294 | libextractor_s3m_la_SOURCES = \ | ||
295 | s3m_extractor.c | ||
296 | libextractor_s3m_la_LDFLAGS = \ | ||
297 | $(PLUGINFLAGS) | ||
298 | |||
293 | libextractor_sid_la_SOURCES = \ | 299 | libextractor_sid_la_SOURCES = \ |
294 | sid_extractor.c | 300 | sid_extractor.c |
295 | libextractor_sid_la_LDFLAGS = \ | 301 | libextractor_sid_la_LDFLAGS = \ |
@@ -349,7 +355,6 @@ OLD_LIBS = \ | |||
349 | $(extrampeg) \ | 355 | $(extrampeg) \ |
350 | libextractor_nsf.la \ | 356 | libextractor_nsf.la \ |
351 | libextractor_nsfe.la \ | 357 | libextractor_nsfe.la \ |
352 | libextractor_s3m.la \ | ||
353 | libextractor_tar.la \ | 358 | libextractor_tar.la \ |
354 | $(thumbqt) \ | 359 | $(thumbqt) \ |
355 | libextractor_xm.la \ | 360 | libextractor_xm.la \ |
@@ -392,13 +397,6 @@ libextractor_nsfe_la_LDFLAGS = \ | |||
392 | libextractor_nsfe_la_LIBADD = \ | 397 | libextractor_nsfe_la_LIBADD = \ |
393 | $(top_builddir)/src/main/libextractor.la | 398 | $(top_builddir)/src/main/libextractor.la |
394 | 399 | ||
395 | libextractor_s3m_la_SOURCES = \ | ||
396 | s3mextractor.c | ||
397 | libextractor_s3m_la_LDFLAGS = \ | ||
398 | $(PLUGINFLAGS) | ||
399 | libextractor_s3m_la_LIBADD = \ | ||
400 | $(top_builddir)/src/main/libextractor.la | ||
401 | |||
402 | libextractor_thumbnailqt_la_SOURCES = \ | 400 | libextractor_thumbnailqt_la_SOURCES = \ |
403 | thumbnailextractorqt.cc | 401 | thumbnailextractorqt.cc |
404 | libextractor_thumbnailqt_la_LDFLAGS = \ | 402 | libextractor_thumbnailqt_la_LDFLAGS = \ |
diff --git a/src/plugins/s3mextractor.c b/src/plugins/s3m_extractor.c index 379bf57..7e8ae40 100644 --- a/src/plugins/s3mextractor.c +++ b/src/plugins/s3m_extractor.c | |||
@@ -32,19 +32,7 @@ struct header | |||
32 | char magicid[4]; | 32 | char magicid[4]; |
33 | }; | 33 | }; |
34 | 34 | ||
35 | 35 | #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) | |
36 | static struct EXTRACTOR_Keywords *addkword | ||
37 | (EXTRACTOR_KeywordList * oldhead, | ||
38 | const char *phrase, EXTRACTOR_KeywordType type) | ||
39 | { | ||
40 | EXTRACTOR_KeywordList *keyword; | ||
41 | |||
42 | keyword = malloc (sizeof (EXTRACTOR_KeywordList)); | ||
43 | keyword->next = oldhead; | ||
44 | keyword->keyword = strdup (phrase); | ||
45 | keyword->keywordType = type; | ||
46 | return (keyword); | ||
47 | } | ||
48 | 36 | ||
49 | 37 | ||
50 | /* "extract" keyword from a Scream Tracker 3 Module | 38 | /* "extract" keyword from a Scream Tracker 3 Module |
@@ -54,39 +42,27 @@ static struct EXTRACTOR_Keywords *addkword | |||
54 | * written. | 42 | * written. |
55 | * | 43 | * |
56 | */ | 44 | */ |
57 | struct EXTRACTOR_Keywords *libextractor_s3m_extract | 45 | int |
58 | (const char *filename, | 46 | EXTRACTOR_s3m_extract (const unsigned char *data, |
59 | char *data, size_t size, struct EXTRACTOR_Keywords *prev) | 47 | size_t size, |
48 | EXTRACTOR_MetaDataProcessor proc, | ||
49 | void *proc_cls, | ||
50 | const char *options) | ||
60 | { | 51 | { |
61 | char title[29]; | 52 | char title[29]; |
62 | struct header *head; | 53 | const struct header *head; |
63 | 54 | ||
64 | /* Check header size */ | 55 | /* Check header size */ |
65 | 56 | ||
66 | if (size < HEADER_SIZE) | 57 | if (size < HEADER_SIZE) |
67 | { | 58 | return 0; |
68 | return (prev); | 59 | head = (const struct header *) data; |
69 | } | ||
70 | |||
71 | head = (struct header *) data; | ||
72 | |||
73 | /* Check "magic" id bytes */ | ||
74 | |||
75 | if (memcmp (head->magicid, "SCRM", 4)) | 60 | if (memcmp (head->magicid, "SCRM", 4)) |
76 | { | 61 | return 0; |
77 | return (prev); | 62 | ADD ("audio/x-s3m", EXTRACTOR_METATYPE_MIMETYPE); |
78 | } | ||
79 | |||
80 | /* Mime-type */ | ||
81 | |||
82 | prev = addkword (prev, "audio/x-s3m", EXTRACTOR_MIMETYPE); | ||
83 | |||
84 | /* Song title */ | ||
85 | 63 | ||
86 | memcpy (&title, head->title, 28); | 64 | memcpy (&title, head->title, 28); |
87 | title[28] = '\0'; | 65 | title[28] = '\0'; |
88 | prev = addkword (prev, title, EXTRACTOR_TITLE); | 66 | ADD (title, EXTRACTOR_METATYPE_TITLE); |
89 | 67 | return 0; | |
90 | return (prev); | ||
91 | |||
92 | } | 68 | } |