2
* This file is part of libextractor.
5
* libextractor is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published
7
* by the Free Software Foundation; either version 2, or (at your
8
* option) any later version.
10
* libextractor is distributed in the hope that it will be useful, but
11
* WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
* General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with libextractor; see the file COPYING. If not, write to the
17
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18
* Boston, MA 02111-1307, USA.
23
#include "extractor.h"
26
#define HEADER_SIZE 0x70
36
static struct EXTRACTOR_Keywords *addkword
37
(EXTRACTOR_KeywordList * oldhead,
38
const char *phrase, EXTRACTOR_KeywordType type)
40
EXTRACTOR_KeywordList *keyword;
42
keyword = malloc (sizeof (EXTRACTOR_KeywordList));
43
keyword->next = oldhead;
44
keyword->keyword = strdup (phrase);
45
keyword->keywordType = type;
50
/* "extract" keyword from a Scream Tracker 3 Module
52
* "Scream Tracker 3.01 BETA File Formats And Mixing Info"
53
* was used, while this piece of software was originally
57
struct EXTRACTOR_Keywords *libextractor_s3m_extract
58
(const char *filename,
59
char *data, size_t size, struct EXTRACTOR_Keywords *prev)
64
/* Check header size */
66
if (size < HEADER_SIZE)
71
head = (struct header *) data;
73
/* Check "magic" id bytes */
75
if (memcmp (head->magicid, "SCRM", 4))
82
prev = addkword (prev, "audio/x-s3m", EXTRACTOR_MIMETYPE);
86
memcpy (&title, head->title, 28);
88
prev = addkword (prev, title, EXTRACTOR_TITLE);