diff options
author | Christian Grothoff <christian@grothoff.org> | 2009-12-19 13:42:26 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2009-12-19 13:42:26 +0000 |
commit | 5307edba27e65305173177ebbeb5759c0c60217a (patch) | |
tree | 64de7fd2401f1a7a43239e611fd09d73185ee558 | |
parent | 6df0f2e9fe520f591cdf9eae66ceb051c4c07808 (diff) | |
download | libextractor-5307edba27e65305173177ebbeb5759c0c60217a.tar.gz libextractor-5307edba27e65305173177ebbeb5759c0c60217a.zip |
breaking build, porting plugins incomplete
-rw-r--r-- | README.debian | 2 | ||||
-rw-r--r-- | TODO | 11 | ||||
-rw-r--r-- | src/plugins/Makefile.am | 94 | ||||
-rw-r--r-- | src/plugins/id3v23_extractor.c (renamed from src/plugins/id3v23extractor.c) | 97 | ||||
-rw-r--r-- | src/plugins/id3v24_extractor.c (renamed from src/plugins/id3v24extractor.c) | 101 | ||||
-rw-r--r-- | src/plugins/id3v2_extractor.c (renamed from src/plugins/id3v2extractor.c) | 106 | ||||
-rw-r--r-- | src/plugins/thumbnailextractorqt.cc | 273 | ||||
-rw-r--r-- | src/plugins/thumbnailffmpeg/Makefile.am | 41 | ||||
-rw-r--r-- | src/plugins/thumbnailffmpeg/README | 105 | ||||
-rw-r--r-- | src/plugins/thumbnailffmpeg_extractor.c (renamed from src/plugins/thumbnailffmpeg/thumbnailextractorffmpeg.c) | 50 |
10 files changed, 229 insertions, 651 deletions
diff --git a/README.debian b/README.debian index e66daf8..ade7d37 100644 --- a/README.debian +++ b/README.debian | |||
@@ -20,6 +20,8 @@ libmpeg2-4-dev | |||
20 | libqt4-dev | 20 | libqt4-dev |
21 | librpm-dev | 21 | librpm-dev |
22 | libexiv2-dev # if you compile with --enable-exiv2 | 22 | libexiv2-dev # if you compile with --enable-exiv2 |
23 | libavformat-dev | ||
24 | libswscale-dev | ||
23 | 25 | ||
24 | For Subversion access and compilation: | 26 | For Subversion access and compilation: |
25 | 27 | ||
@@ -1,8 +1,15 @@ | |||
1 | * ffmpeg needs make 3.81: add configure check for it | 1 | * ffmpeg needs make 3.81: add configure check for it |
2 | 2 | ||
3 | Core: | 3 | Core: |
4 | * error reporting facilities | 4 | * check for symbolic links, do not load same plugin twice! |
5 | * add support for different character sets (to 'all' extractors) | 5 | (happens right now for installations with multiple |
6 | available thumbnailers) | ||
7 | * support "hash" plugins as *optional* plugins | ||
8 | (need a way to indicate that they should not be used | ||
9 | "by default") | ||
10 | * use "-" in config not to append plugin, but to remove one! | ||
11 | * document | ||
12 | * port test cases | ||
6 | 13 | ||
7 | 'Unclean' code: | 14 | 'Unclean' code: |
8 | * ASF | 15 | * ASF |
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am index 9244d14..a790d4d 100644 --- a/src/plugins/Makefile.am +++ b/src/plugins/Makefile.am | |||
@@ -86,6 +86,9 @@ plugin_LTLIBRARIES = \ | |||
86 | libextractor_flv.la \ | 86 | libextractor_flv.la \ |
87 | libextractor_gif.la \ | 87 | libextractor_gif.la \ |
88 | libextractor_html.la \ | 88 | libextractor_html.la \ |
89 | libextractor_id3v2.la \ | ||
90 | libextractor_id3v23.la \ | ||
91 | libextractor_id3v24.la \ | ||
89 | libextractor_it.la \ | 92 | libextractor_it.la \ |
90 | libextractor_jpeg.la \ | 93 | libextractor_jpeg.la \ |
91 | libextractor_man.la \ | 94 | libextractor_man.la \ |
@@ -108,6 +111,8 @@ plugin_LTLIBRARIES = \ | |||
108 | libextractor_sid.la \ | 111 | libextractor_sid.la \ |
109 | libextractor_tar.la \ | 112 | libextractor_tar.la \ |
110 | $(thumbgtk) \ | 113 | $(thumbgtk) \ |
114 | $(thumbqt) \ | ||
115 | $(thumbffmpeg) \ | ||
111 | libextractor_tiff.la \ | 116 | libextractor_tiff.la \ |
112 | libextractor_wav.la \ | 117 | libextractor_wav.la \ |
113 | libextractor_xm.la \ | 118 | libextractor_xm.la \ |
@@ -181,6 +186,27 @@ libextractor_html_la_LDFLAGS = \ | |||
181 | libextractor_html_la_LIBADD = \ | 186 | libextractor_html_la_LIBADD = \ |
182 | $(top_builddir)/src/common/libextractor_common.la | 187 | $(top_builddir)/src/common/libextractor_common.la |
183 | 188 | ||
189 | libextractor_id3v2_la_SOURCES = \ | ||
190 | id3v2_extractor.c | ||
191 | libextractor_id3v2_la_LDFLAGS = \ | ||
192 | $(PLUGINFLAGS) | ||
193 | libextractor_id3v2_la_LIBADD = \ | ||
194 | $(top_builddir)/src/common/libextractor_common.la | ||
195 | |||
196 | libextractor_id3v23_la_SOURCES = \ | ||
197 | id3v23_extractor.c | ||
198 | libextractor_id3v23_la_LDFLAGS = \ | ||
199 | $(PLUGINFLAGS) | ||
200 | libextractor_id3v23_la_LIBADD = \ | ||
201 | $(top_builddir)/src/common/libextractor_common.la | ||
202 | |||
203 | libextractor_id3v24_la_SOURCES = \ | ||
204 | id3v24_extractor.c | ||
205 | libextractor_id3v24_la_LDFLAGS = \ | ||
206 | $(PLUGINFLAGS) | ||
207 | libextractor_id3v24_la_LIBADD = \ | ||
208 | $(top_builddir)/src/common/libextractor_common.la | ||
209 | |||
184 | libextractor_it_la_SOURCES = \ | 210 | libextractor_it_la_SOURCES = \ |
185 | it_extractor.c | 211 | it_extractor.c |
186 | libextractor_it_la_LDFLAGS = \ | 212 | libextractor_it_la_LDFLAGS = \ |
@@ -318,6 +344,13 @@ libextractor_tar_la_SOURCES = \ | |||
318 | libextractor_tar_la_LDFLAGS = \ | 344 | libextractor_tar_la_LDFLAGS = \ |
319 | $(PLUGINFLAGS) | 345 | $(PLUGINFLAGS) |
320 | 346 | ||
347 | libextractor_thumbnailffmpeg_la_SOURCES = \ | ||
348 | thumbnailffmpeg_extractor.c | ||
349 | libextractor_thumbnailffmpeg_la_LIBADD = \ | ||
350 | -lavformat -lavcodec -lswscale -lavutil -lz -lbz2 | ||
351 | libextractor_thumbnailffmpeg_la_LDFLAGS = \ | ||
352 | $(PLUGINFLAGS) | ||
353 | |||
321 | libextractor_thumbnailgtk_la_CFLAGS = \ | 354 | libextractor_thumbnailgtk_la_CFLAGS = \ |
322 | $(GLIB_CFLAGS) $(GTK_CFLAGS) | 355 | $(GLIB_CFLAGS) $(GTK_CFLAGS) |
323 | libextractor_thumbnailgtk_la_LIBADD = \ | 356 | libextractor_thumbnailgtk_la_LIBADD = \ |
@@ -327,6 +360,15 @@ libextractor_thumbnailgtk_la_LDFLAGS = \ | |||
327 | libextractor_thumbnailgtk_la_SOURCES = \ | 360 | libextractor_thumbnailgtk_la_SOURCES = \ |
328 | thumbnailgtk_extractor.c | 361 | thumbnailgtk_extractor.c |
329 | 362 | ||
363 | libextractor_thumbnailqt_la_SOURCES = \ | ||
364 | thumbnailqt_extractor.cc | ||
365 | libextractor_thumbnailqt_la_LDFLAGS = \ | ||
366 | $(PLUGINFLAGS) | ||
367 | libextractor_thumbnailqt_la_LIBADD = \ | ||
368 | $(qtflags) $(svgflags) | ||
369 | libextractor_thumbnailqt_la_CPPFLAGS = \ | ||
370 | $(QT_CFLAGS) $(QT_SVG_CFLAGS) | ||
371 | |||
330 | libextractor_tiff_la_SOURCES = \ | 372 | libextractor_tiff_la_SOURCES = \ |
331 | tiff_extractor.c | 373 | tiff_extractor.c |
332 | libextractor_tiff_la_LDFLAGS = \ | 374 | libextractor_tiff_la_LDFLAGS = \ |
@@ -354,56 +396,6 @@ libextractor_zip_la_LDFLAGS = \ | |||
354 | EXTRA_DIST = template_extractor.c | 396 | EXTRA_DIST = template_extractor.c |
355 | 397 | ||
356 | 398 | ||
357 | |||
358 | # stuff below still needs to be ported to 0.6.x | ||
359 | |||
360 | # SUBDIRS = . $(thumbffmpeg) hash | ||
361 | |||
362 | |||
363 | OLD_LIBS = \ | ||
364 | libextractor_id3v2.la \ | ||
365 | libextractor_id3v24.la \ | ||
366 | libextractor_id3v23.la \ | ||
367 | $(extrampeg) \ | ||
368 | $(thumbqt) | ||
369 | |||
370 | |||
371 | libextractor_id3v2_la_SOURCES = \ | ||
372 | id3v2extractor.c | ||
373 | libextractor_id3v2_la_LDFLAGS = \ | ||
374 | $(PLUGINFLAGS) | ||
375 | libextractor_id3v2_la_LIBADD = \ | ||
376 | $(top_builddir)/src/common/libextractor_common.la | ||
377 | |||
378 | libextractor_id3v23_la_SOURCES = \ | ||
379 | id3v23extractor.c | ||
380 | libextractor_id3v23_la_LDFLAGS = \ | ||
381 | $(PLUGINFLAGS) | ||
382 | libextractor_id3v23_la_LIBADD = \ | ||
383 | $(top_builddir)/src/common/libextractor_common.la | ||
384 | |||
385 | libextractor_id3v24_la_SOURCES = \ | ||
386 | id3v24extractor.c | ||
387 | libextractor_id3v24_la_LDFLAGS = \ | ||
388 | $(PLUGINFLAGS) | ||
389 | libextractor_id3v24_la_LIBADD = \ | ||
390 | $(top_builddir)/src/common/libextractor_common.la | ||
391 | |||
392 | |||
393 | libextractor_thumbnailqt_la_SOURCES = \ | ||
394 | thumbnailextractorqt.cc | ||
395 | libextractor_thumbnailqt_la_LDFLAGS = \ | ||
396 | $(PLUGINFLAGS) | ||
397 | libextractor_thumbnailqt_la_LIBADD = \ | ||
398 | $(qtflags) $(svgflags) \ | ||
399 | $(top_builddir)/src/main/libextractor.la | ||
400 | libextractor_thumbnailqt_la_CPPFLAGS = \ | ||
401 | -I$(top_scrdir)/include \ | ||
402 | $(QT_CFLAGS) $(QT_SVG_CFLAGS) | ||
403 | |||
404 | |||
405 | # FIXME: is this still working ok? Doubtful! | ||
406 | |||
407 | install-exec-hook: | 399 | install-exec-hook: |
408 | mkdir -p $(DESTDIR)$(plugindir) &> /dev/null || true | 400 | mkdir -p $(DESTDIR)$(plugindir) &> /dev/null || true |
409 | rm -f $(DESTDIR)$(plugindir)/libextractor_thumbnail$(LIBEXT) | 401 | rm -f $(DESTDIR)$(plugindir)/libextractor_thumbnail$(LIBEXT) |
@@ -422,5 +414,3 @@ install-exec-hook: | |||
422 | fi \ | 414 | fi \ |
423 | fi \ | 415 | fi \ |
424 | fi | 416 | fi |
425 | |||
426 | |||
diff --git a/src/plugins/id3v23extractor.c b/src/plugins/id3v23_extractor.c index 7029e73..11b04d9 100644 --- a/src/plugins/id3v23extractor.c +++ b/src/plugins/id3v23_extractor.c | |||
@@ -51,60 +51,61 @@ addKeyword (EXTRACTOR_KeywordList * oldhead, | |||
51 | typedef struct | 51 | typedef struct |
52 | { | 52 | { |
53 | const char *text; | 53 | const char *text; |
54 | EXTRACTOR_KeywordType type; | 54 | enum EXTRACTOR_MetaType type; |
55 | } Matches; | 55 | } Matches; |
56 | 56 | ||
57 | static Matches tmap[] = { | 57 | static Matches tmap[] = { |
58 | {"COMM", EXTRACTOR_COMMENT}, | 58 | {"COMM", EXTRACTOR_METATYPE_COMMENT}, |
59 | {"IPLS", EXTRACTOR_CONTRIBUTOR}, | 59 | {"IPLS", EXTRACTOR_METATYPE_CONTRIBUTOR}, |
60 | {"LINK", EXTRACTOR_LINK}, | 60 | {"LINK", EXTRACTOR_METATYPE_LINK}, |
61 | {"MCDI", EXTRACTOR_MUSIC_CD_IDENTIFIER}, | 61 | {"MCDI", EXTRACTOR_METATYPE_MUSIC_CD_IDENTIFIER}, |
62 | {"PCNT", EXTRACTOR_PLAY_COUNTER}, | 62 | {"PCNT", EXTRACTOR_METATYPE_PLAY_COUNTER}, |
63 | {"POPM", EXTRACTOR_POPULARITY_METER}, | 63 | {"POPM", EXTRACTOR_METATYPE_POPULARITY_METER}, |
64 | {"TCOP", EXTRACTOR_COPYRIGHT}, | 64 | {"TCOP", EXTRACTOR_METATYPE_COPYRIGHT}, |
65 | {"TDAT", EXTRACTOR_DATE}, | 65 | {"TDAT", EXTRACTOR_METATYPE_DATE}, |
66 | {"TCON", EXTRACTOR_CONTENT_TYPE}, | 66 | {"TCON", EXTRACTOR_METATYPE_CONTENT_TYPE}, |
67 | {"TIT1", EXTRACTOR_GENRE}, | 67 | {"TIT1", EXTRACTOR_METATYPE_GENRE}, |
68 | {"TENC", EXTRACTOR_ENCODED_BY}, | 68 | {"TENC", EXTRACTOR_METATYPE_ENCODED_BY}, |
69 | {"TEXT", EXTRACTOR_LYRICS}, | 69 | {"TEXT", EXTRACTOR_METATYPE_LYRICS}, |
70 | {"TOLY", EXTRACTOR_CONTRIBUTOR}, | 70 | {"TOLY", EXTRACTOR_METATYPE_CONTRIBUTOR}, |
71 | {"TOPE", EXTRACTOR_CONTRIBUTOR}, | 71 | {"TOPE", EXTRACTOR_METATYPE_CONTRIBUTOR}, |
72 | {"TOWN", EXTRACTOR_OWNER}, | 72 | {"TOWN", EXTRACTOR_METATYPE_OWNER}, |
73 | {"TPE1", EXTRACTOR_ARTIST}, | 73 | {"TPE1", EXTRACTOR_METATYPE_ARTIST}, |
74 | {"TPE2", EXTRACTOR_ARTIST}, | 74 | {"TPE2", EXTRACTOR_METATYPE_ARTIST}, |
75 | {"TPE3", EXTRACTOR_CONDUCTOR}, | 75 | {"TPE3", EXTRACTOR_METATYPE_CONDUCTOR}, |
76 | {"TPE4", EXTRACTOR_INTERPRET}, | 76 | {"TPE4", EXTRACTOR_METATYPE_INTERPRET}, |
77 | {"TMED", EXTRACTOR_MEDIA_TYPE}, | 77 | {"TMED", EXTRACTOR_METATYPE_MEDIA_TYPE}, |
78 | {"TCOM", EXTRACTOR_CREATOR}, | 78 | {"TCOM", EXTRACTOR_METATYPE_CREATOR}, |
79 | {"TIME", EXTRACTOR_TIME}, | 79 | {"TIME", EXTRACTOR_METATYPE_TIME}, |
80 | {"TOFN", EXTRACTOR_FILENAME}, | 80 | {"TOFN", EXTRACTOR_METATYPE_FILENAME}, |
81 | {"TOPE", EXTRACTOR_ARTIST}, | 81 | {"TOPE", EXTRACTOR_METATYPE_ARTIST}, |
82 | {"TPUB", EXTRACTOR_PUBLISHER}, | 82 | {"TPUB", EXTRACTOR_METATYPE_PUBLISHER}, |
83 | {"TRCK", EXTRACTOR_TRACK_NUMBER}, | 83 | {"TRCK", EXTRACTOR_METATYPE_TRACK_NUMBER}, |
84 | {"TRSC", EXTRACTOR_ISRC}, | 84 | {"TRSC", EXTRACTOR_METATYPE_ISRC}, |
85 | {"TRSN", EXTRACTOR_SOURCE}, | 85 | {"TRSN", EXTRACTOR_METATYPE_SOURCE}, |
86 | {"TRSO", EXTRACTOR_CREATED_FOR}, | 86 | {"TRSO", EXTRACTOR_METATYPE_CREATED_FOR}, |
87 | {"TSRC", EXTRACTOR_RESOURCE_IDENTIFIER}, | 87 | {"TSRC", EXTRACTOR_METATYPE_RESOURCE_IDENTIFIER}, |
88 | {"TOAL", EXTRACTOR_ALBUM}, | 88 | {"TOAL", EXTRACTOR_METATYPE_ALBUM}, |
89 | {"TALB", EXTRACTOR_ALBUM}, | 89 | {"TALB", EXTRACTOR_METATYPE_ALBUM}, |
90 | {"TLAN", EXTRACTOR_LANGUAGE}, | 90 | {"TLAN", EXTRACTOR_METATYPE_LANGUAGE}, |
91 | {"TYER", EXTRACTOR_YEAR}, | 91 | {"TYER", EXTRACTOR_METATYPE_YEAR}, |
92 | {"TLEN", EXTRACTOR_DURATION}, | 92 | {"TLEN", EXTRACTOR_METATYPE_DURATION}, |
93 | {"TIT2", EXTRACTOR_TITLE}, | 93 | {"TIT2", EXTRACTOR_METATYPE_TITLE}, |
94 | {"TIT3", EXTRACTOR_DESCRIPTION}, | 94 | {"TIT3", EXTRACTOR_METATYPE_DESCRIPTION}, |
95 | {"WCOM", EXTRACTOR_RELEASE}, | 95 | {"WCOM", EXTRACTOR_METATYPE_RELEASE}, |
96 | {"WCOP", EXTRACTOR_DISCLAIMER}, | 96 | {"WCOP", EXTRACTOR_METATYPE_DISCLAIMER}, |
97 | {"", EXTRACTOR_KEYWORDS}, | 97 | {"", EXTRACTOR_METATYPE_KEYWORDS}, |
98 | {NULL, 0}, | 98 | {NULL, 0} |
99 | }; | 99 | }; |
100 | 100 | ||
101 | 101 | ||
102 | /* mimetype = audio/mpeg */ | 102 | /* mimetype = audio/mpeg */ |
103 | struct EXTRACTOR_Keywords * | 103 | int |
104 | libextractor_id3v23_extract (const char *filename, | 104 | EXTRACTOR_id3v23_extract (const unsigned char *data, |
105 | const unsigned char *data, | 105 | size_t size, |
106 | const size_t size, | 106 | EXTRACTOR_MetaDataProcessor proc, |
107 | struct EXTRACTOR_Keywords *prev) | 107 | void *proc_cls, |
108 | const char *options) | ||
108 | { | 109 | { |
109 | int unsync; | 110 | int unsync; |
110 | int extendedHdr; | 111 | int extendedHdr; |
@@ -215,4 +216,4 @@ libextractor_id3v23_extract (const char *filename, | |||
215 | return prev; | 216 | return prev; |
216 | } | 217 | } |
217 | 218 | ||
218 | /* end of id3v23extractor.c */ | 219 | /* end of id3v23_extractor.c */ |
diff --git a/src/plugins/id3v24extractor.c b/src/plugins/id3v24_extractor.c index cb0231e..ec11e4a 100644 --- a/src/plugins/id3v24extractor.c +++ b/src/plugins/id3v24_extractor.c | |||
@@ -52,62 +52,63 @@ addKeyword (EXTRACTOR_KeywordList * oldhead, | |||
52 | typedef struct | 52 | typedef struct |
53 | { | 53 | { |
54 | char *text; | 54 | char *text; |
55 | EXTRACTOR_KeywordType type; | 55 | enum EXTRACTOR_MetaType type; |
56 | } Matches; | 56 | } Matches; |
57 | 57 | ||
58 | static Matches tmap[] = { | 58 | static Matches tmap[] = { |
59 | {"COMM", EXTRACTOR_COMMENT}, | 59 | {"COMM", EXTRACTOR_METATYPE_COMMENT}, |
60 | {"IPLS", EXTRACTOR_CONTRIBUTOR}, | 60 | {"IPLS", EXTRACTOR_METATYPE_CONTRIBUTOR}, |
61 | {"TIPL", EXTRACTOR_CONTRIBUTOR}, | 61 | {"TIPL", EXTRACTOR_METATYPE_CONTRIBUTOR}, |
62 | {"TMOO", EXTRACTOR_MOOD}, | 62 | {"TMOO", EXTRACTOR_METATYPE_MOOD}, |
63 | {"TMCL", EXTRACTOR_MUSICIAN_CREDITS_LIST}, | 63 | {"TMCL", EXTRACTOR_METATYPE_MUSICIAN_CREDITS_LIST}, |
64 | {"LINK", EXTRACTOR_LINK}, | 64 | {"LINK", EXTRACTOR_METATYPE_LINK}, |
65 | {"MCDI", EXTRACTOR_MUSIC_CD_IDENTIFIER}, | 65 | {"MCDI", EXTRACTOR_METATYPE_MUSIC_CD_IDENTIFIER}, |
66 | {"PCNT", EXTRACTOR_PLAY_COUNTER}, | 66 | {"PCNT", EXTRACTOR_METATYPE_PLAY_COUNTER}, |
67 | {"POPM", EXTRACTOR_POPULARITY_METER}, | 67 | {"POPM", EXTRACTOR_METATYPE_POPULARITY_METER}, |
68 | {"TCOP", EXTRACTOR_COPYRIGHT}, | 68 | {"TCOP", EXTRACTOR_METATYPE_COPYRIGHT}, |
69 | {"TDRC", EXTRACTOR_DATE}, | 69 | {"TDRC", EXTRACTOR_METATYPE_DATE}, |
70 | {"TCON", EXTRACTOR_GENRE}, | 70 | {"TCON", EXTRACTOR_METATYPE_GENRE}, |
71 | {"TIT1", EXTRACTOR_GENRE}, | 71 | {"TIT1", EXTRACTOR_METATYPE_GENRE}, |
72 | {"TENC", EXTRACTOR_ENCODED_BY}, | 72 | {"TENC", EXTRACTOR_METATYPE_ENCODED_BY}, |
73 | {"TEXT", EXTRACTOR_LYRICS}, | 73 | {"TEXT", EXTRACTOR_METATYPE_LYRICS}, |
74 | {"TOLY", EXTRACTOR_CONTRIBUTOR}, | 74 | {"TOLY", EXTRACTOR_METATYPE_CONTRIBUTOR}, |
75 | {"TOPE", EXTRACTOR_CONTRIBUTOR}, | 75 | {"TOPE", EXTRACTOR_METATYPE_CONTRIBUTOR}, |
76 | {"TOWN", EXTRACTOR_OWNER}, | 76 | {"TOWN", EXTRACTOR_METATYPE_OWNER}, |
77 | {"TPE1", EXTRACTOR_ARTIST}, | 77 | {"TPE1", EXTRACTOR_METATYPE_ARTIST}, |
78 | {"TPE2", EXTRACTOR_ARTIST}, | 78 | {"TPE2", EXTRACTOR_METATYPE_ARTIST}, |
79 | {"TPE3", EXTRACTOR_CONDUCTOR}, | 79 | {"TPE3", EXTRACTOR_METATYPE_CONDUCTOR}, |
80 | {"TPE4", EXTRACTOR_INTERPRET}, | 80 | {"TPE4", EXTRACTOR_METATYPE_INTERPRET}, |
81 | {"TIME", EXTRACTOR_TIME}, | 81 | {"TIME", EXTRACTOR_METATYPE_TIME}, |
82 | {"TMED", EXTRACTOR_MEDIA_TYPE}, | 82 | {"TMED", EXTRACTOR_METATYPE_MEDIA_TYPE}, |
83 | {"TCOM", EXTRACTOR_CREATOR}, | 83 | {"TCOM", EXTRACTOR_METATYPE_CREATOR}, |
84 | {"TOFN", EXTRACTOR_FILENAME}, | 84 | {"TOFN", EXTRACTOR_METATYPE_FILENAME}, |
85 | {"TOPE", EXTRACTOR_ARTIST}, | 85 | {"TOPE", EXTRACTOR_METATYPE_ARTIST}, |
86 | {"TPUB", EXTRACTOR_PUBLISHER}, | 86 | {"TPUB", EXTRACTOR_METATYPE_PUBLISHER}, |
87 | {"TRCK", EXTRACTOR_TRACK_NUMBER}, | 87 | {"TRCK", EXTRACTOR_METATYPE_TRACK_NUMBER}, |
88 | {"TRSC", EXTRACTOR_ISRC}, | 88 | {"TRSC", EXTRACTOR_METATYPE_ISRC}, |
89 | {"TRSN", EXTRACTOR_SOURCE}, | 89 | {"TRSN", EXTRACTOR_METATYPE_SOURCE}, |
90 | {"TRSO", EXTRACTOR_CREATED_FOR}, | 90 | {"TRSO", EXTRACTOR_METATYPE_CREATED_FOR}, |
91 | {"TSRC", EXTRACTOR_RESOURCE_IDENTIFIER}, | 91 | {"TSRC", EXTRACTOR_METATYPE_RESOURCE_IDENTIFIER}, |
92 | {"TYER", EXTRACTOR_YEAR}, | 92 | {"TYER", EXTRACTOR_METATYPE_YEAR}, |
93 | {"TOAL", EXTRACTOR_ALBUM}, | 93 | {"TOAL", EXTRACTOR_METATYPE_ALBUM}, |
94 | {"TALB", EXTRACTOR_ALBUM}, | 94 | {"TALB", EXTRACTOR_METATYPE_ALBUM}, |
95 | {"TLAN", EXTRACTOR_LANGUAGE}, | 95 | {"TLAN", EXTRACTOR_METATYPE_LANGUAGE}, |
96 | {"TIT2", EXTRACTOR_TITLE}, | 96 | {"TIT2", EXTRACTOR_METATYPE_TITLE}, |
97 | {"TIT3", EXTRACTOR_DESCRIPTION}, | 97 | {"TIT3", EXTRACTOR_METATYPE_DESCRIPTION}, |
98 | {"WCOM", EXTRACTOR_RELEASE}, | 98 | {"WCOM", EXTRACTOR_METATYPE_RELEASE}, |
99 | {"WCOP", EXTRACTOR_DISCLAIMER}, | 99 | {"WCOP", EXTRACTOR_METATYPE_DISCLAIMER}, |
100 | {"", EXTRACTOR_KEYWORDS}, | 100 | {"", EXTRACTOR_METATYPE_KEYWORDS}, |
101 | {NULL, 0}, | 101 | {NULL, 0} |
102 | }; | 102 | }; |
103 | 103 | ||
104 | 104 | ||
105 | /* mimetype = audio/mpeg */ | 105 | /* mimetype = audio/mpeg */ |
106 | struct EXTRACTOR_Keywords * | 106 | int |
107 | libextractor_id3v24_extract (const char *filename, | 107 | EXTRACTOR_id3v24_extract (const unsigned char *data, |
108 | const unsigned char *data, | 108 | size_t size, |
109 | const size_t size, | 109 | EXTRACTOR_MetaDataProcessor proc, |
110 | struct EXTRACTOR_Keywords *prev) | 110 | void *proc_cls, |
111 | const char *options) | ||
111 | { | 112 | { |
112 | int unsync; | 113 | int unsync; |
113 | int extendedHdr; | 114 | int extendedHdr; |
@@ -226,4 +227,4 @@ libextractor_id3v24_extract (const char *filename, | |||
226 | return prev; | 227 | return prev; |
227 | } | 228 | } |
228 | 229 | ||
229 | /* end of id3v24extractor.c */ | 230 | /* end of id3v24_extractor.c */ |
diff --git a/src/plugins/id3v2extractor.c b/src/plugins/id3v2_extractor.c index 00e353c..fa5fea6 100644 --- a/src/plugins/id3v2extractor.c +++ b/src/plugins/id3v2_extractor.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libextractor. | 2 | This file is part of libextractor. |
3 | (C) 2002, 2003, 2004, 2006 Vidyut Samanta and Christian Grothoff | 3 | (C) 2002, 2003, 2004, 2006, 2009 Vidyut Samanta and Christian Grothoff |
4 | 4 | ||
5 | libextractor is free software; you can redistribute it and/or modify | 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 | 6 | it under the terms of the GNU General Public License as published |
@@ -28,69 +28,57 @@ | |||
28 | 28 | ||
29 | #define DEBUG_EXTRACT_ID3v2 0 | 29 | #define DEBUG_EXTRACT_ID3v2 0 |
30 | 30 | ||
31 | |||
32 | static struct EXTRACTOR_Keywords * | ||
33 | addKeyword (EXTRACTOR_KeywordList * oldhead, | ||
34 | char *phrase, EXTRACTOR_KeywordType type) | ||
35 | { | ||
36 | EXTRACTOR_KeywordList *keyword; | ||
37 | |||
38 | keyword = (EXTRACTOR_KeywordList *) malloc (sizeof (EXTRACTOR_KeywordList)); | ||
39 | keyword->next = oldhead; | ||
40 | keyword->keyword = phrase; | ||
41 | keyword->keywordType = type; | ||
42 | return keyword; | ||
43 | } | ||
44 | |||
45 | typedef struct | 31 | typedef struct |
46 | { | 32 | { |
47 | char *text; | 33 | const char *text; |
48 | EXTRACTOR_KeywordType type; | 34 | enum EXTRACTOR_MetaType type; |
49 | } Matches; | 35 | } Matches; |
50 | 36 | ||
51 | static Matches tmap[] = { | 37 | static Matches tmap[] = { |
52 | {"TAL", EXTRACTOR_TITLE}, | 38 | {"TAL", EXTRACTOR_METATYPE_TITLE}, |
53 | {"TT1", EXTRACTOR_GROUP}, | 39 | {"TT1", EXTRACTOR_METATYPE_GROUP}, |
54 | {"TT2", EXTRACTOR_TITLE}, | 40 | {"TT2", EXTRACTOR_METATYPE_TITLE}, |
55 | {"TT3", EXTRACTOR_TITLE}, | 41 | {"TT3", EXTRACTOR_METATYPE_TITLE}, |
56 | {"TXT", EXTRACTOR_DESCRIPTION}, | 42 | {"TXT", EXTRACTOR_METATYPE_DESCRIPTION}, |
57 | {"TPB", EXTRACTOR_PUBLISHER}, | 43 | {"TPB", EXTRACTOR_METATYPE_PUBLISHER}, |
58 | {"WAF", EXTRACTOR_LOCATION}, | 44 | {"WAF", EXTRACTOR_METATYPE_LOCATION}, |
59 | {"WAR", EXTRACTOR_LOCATION}, | 45 | {"WAR", EXTRACTOR_METATYPE_LOCATION}, |
60 | {"WAS", EXTRACTOR_LOCATION}, | 46 | {"WAS", EXTRACTOR_METATYPE_LOCATION}, |
61 | {"WCP", EXTRACTOR_COPYRIGHT}, | 47 | {"WCP", EXTRACTOR_METATYPE_COPYRIGHT}, |
62 | {"WAF", EXTRACTOR_LOCATION}, | 48 | {"WAF", EXTRACTOR_METATYPE_LOCATION}, |
63 | {"WCM", EXTRACTOR_DISCLAIMER}, | 49 | {"WCM", EXTRACTOR_METATYPE_DISCLAIMER}, |
64 | {"TSS", EXTRACTOR_FORMAT}, | 50 | {"TSS", EXTRACTOR_METATYPE_FORMAT}, |
65 | {"TYE", EXTRACTOR_DATE}, | 51 | {"TYE", EXTRACTOR_METATYPE_DATE}, |
66 | {"TLA", EXTRACTOR_LANGUAGE}, | 52 | {"TLA", EXTRACTOR_METATYPE_LANGUAGE}, |
67 | {"TP1", EXTRACTOR_ARTIST}, | 53 | {"TP1", EXTRACTOR_METATYPE_ARTIST}, |
68 | {"TP2", EXTRACTOR_ARTIST}, | 54 | {"TP2", EXTRACTOR_METATYPE_ARTIST}, |
69 | {"TP3", EXTRACTOR_CONDUCTOR}, | 55 | {"TP3", EXTRACTOR_METATYPE_CONDUCTOR}, |
70 | {"TP4", EXTRACTOR_INTERPRET}, | 56 | {"TP4", EXTRACTOR_METATYPE_INTERPRET}, |
71 | {"IPL", EXTRACTOR_CONTRIBUTOR}, | 57 | {"IPL", EXTRACTOR_METATYPE_CONTRIBUTOR}, |
72 | {"TOF", EXTRACTOR_FILENAME}, | 58 | {"TOF", EXTRACTOR_METATYPE_FILENAME}, |
73 | {"TEN", EXTRACTOR_PRODUCER}, | 59 | {"TEN", EXTRACTOR_METATYPE_PRODUCER}, |
74 | {"TCO", EXTRACTOR_SUBJECT}, | 60 | {"TCO", EXTRACTOR_METATYPE_SUBJECT}, |
75 | {"TCR", EXTRACTOR_COPYRIGHT}, | 61 | {"TCR", EXTRACTOR_METATYPE_COPYRIGHT}, |
76 | {"SLT", EXTRACTOR_LYRICS}, | 62 | {"SLT", EXTRACTOR_METATYPE_LYRICS}, |
77 | {"TOA", EXTRACTOR_ARTIST}, | 63 | {"TOA", EXTRACTOR_METATYPE_ARTIST}, |
78 | {"TRC", EXTRACTOR_ISRC}, | 64 | {"TRC", EXTRACTOR_METATYPE_ISRC}, |
79 | {"TRK", EXTRACTOR_TRACK_NUMBER}, | 65 | {"TRK", EXTRACTOR_METATYPE_TRACK_NUMBER}, |
80 | {"TCM", EXTRACTOR_CREATOR}, | 66 | {"TCM", EXTRACTOR_METATYPE_CREATOR}, |
81 | {"TOT", EXTRACTOR_ALBUM}, | 67 | {"TOT", EXTRACTOR_METATYPE_ALBUM}, |
82 | {"TOL", EXTRACTOR_AUTHOR}, | 68 | {"TOL", EXTRACTOR_METATYPE_AUTHOR}, |
83 | {"COM", EXTRACTOR_COMMENT}, | 69 | {"COM", EXTRACTOR_METATYPE_COMMENT}, |
84 | {"", EXTRACTOR_KEYWORDS}, | 70 | {"", EXTRACTOR_METATYPE_KEYWORDS}, |
85 | {NULL, 0}, | 71 | {NULL, 0}, |
86 | }; | 72 | }; |
87 | 73 | ||
88 | 74 | ||
89 | /* mimetype = audio/mpeg */ | 75 | /* mimetype = audio/mpeg */ |
90 | struct EXTRACTOR_Keywords * | 76 | int |
91 | libextractor_id3v2_extract (const char *filename, | 77 | EXTRACTOR_id3v2_extract (const unsigned char *data, |
92 | const unsigned char *data, | 78 | size_t size, |
93 | size_t size, struct EXTRACTOR_Keywords *prev) | 79 | EXTRACTOR_MetaDataProcessor proc, |
80 | void *proc_cls, | ||
81 | const char *options) | ||
94 | { | 82 | { |
95 | int unsync; | 83 | int unsync; |
96 | unsigned int tsize; | 84 | unsigned int tsize; |
@@ -100,14 +88,14 @@ libextractor_id3v2_extract (const char *filename, | |||
100 | (data[0] != 0x49) || | 88 | (data[0] != 0x49) || |
101 | (data[1] != 0x44) || | 89 | (data[1] != 0x44) || |
102 | (data[2] != 0x33) || (data[3] != 0x02) || (data[4] != 0x00)) | 90 | (data[2] != 0x33) || (data[3] != 0x02) || (data[4] != 0x00)) |
103 | return prev; | 91 | return 0; |
104 | unsync = (data[5] & 0x80) > 0; | 92 | unsync = (data[5] & 0x80) > 0; |
105 | tsize = (((data[6] & 0x7F) << 21) | | 93 | tsize = (((data[6] & 0x7F) << 21) | |
106 | ((data[7] & 0x7F) << 14) | | 94 | ((data[7] & 0x7F) << 14) | |
107 | ((data[8] & 0x7F) << 07) | ((data[9] & 0x7F) << 00)); | 95 | ((data[8] & 0x7F) << 07) | ((data[9] & 0x7F) << 00)); |
108 | 96 | ||
109 | if (tsize + 10 > size) | 97 | if (tsize + 10 > size) |
110 | return prev; | 98 | return 0; |
111 | pos = 10; | 99 | pos = 10; |
112 | while (pos < tsize) | 100 | while (pos < tsize) |
113 | { | 101 | { |
@@ -115,7 +103,7 @@ libextractor_id3v2_extract (const char *filename, | |||
115 | int i; | 103 | int i; |
116 | 104 | ||
117 | if (pos + 6 > tsize) | 105 | if (pos + 6 > tsize) |
118 | return prev; | 106 | return 0; |
119 | csize = (data[pos + 3] << 16) + (data[pos + 4] << 8) + data[pos + 5]; | 107 | csize = (data[pos + 3] << 16) + (data[pos + 4] << 8) + data[pos + 5]; |
120 | if ((pos + 6 + csize > tsize) || (csize > tsize) || (csize == 0)) | 108 | if ((pos + 6 + csize > tsize) || (csize > tsize) || (csize == 0)) |
121 | break; | 109 | break; |
@@ -161,7 +149,7 @@ libextractor_id3v2_extract (const char *filename, | |||
161 | } | 149 | } |
162 | pos += 6 + csize; | 150 | pos += 6 + csize; |
163 | } | 151 | } |
164 | return prev; | 152 | return 0; |
165 | } | 153 | } |
166 | 154 | ||
167 | /* end of id3v2extractor.c */ | 155 | /* end of id3v2_extractor.c */ |
diff --git a/src/plugins/thumbnailextractorqt.cc b/src/plugins/thumbnailextractorqt.cc deleted file mode 100644 index 9ab3079..0000000 --- a/src/plugins/thumbnailextractorqt.cc +++ /dev/null | |||
@@ -1,273 +0,0 @@ | |||
1 | /* | ||
2 | This file is part of libextractor. | ||
3 | (C) 2006 Vidyut Samanta and Christian Grothoff | ||
4 | |||
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. | ||
9 | |||
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. | ||
14 | |||
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. | ||
19 | */ | ||
20 | |||
21 | /** | ||
22 | * @file thumbnailextractorqt.cc | ||
23 | * @author Nils Durner | ||
24 | * @brief this extractor produces a binary (!) encoded | ||
25 | * thumbnail of images (using Qt). | ||
26 | */ | ||
27 | |||
28 | #include "platform.h" | ||
29 | #include "extractor.h" | ||
30 | #include <Qt/qpixmap.h> | ||
31 | #include <Qt/qbytearray.h> | ||
32 | #include <Qt/qbuffer.h> | ||
33 | #include <Qt/qapplication.h> | ||
34 | #include <pthread.h> | ||
35 | |||
36 | #ifdef HAVE_QT_SVG | ||
37 | #include <Qt/qsvgrenderer.h> | ||
38 | #include <Qt/qpainter.h> | ||
39 | #endif | ||
40 | |||
41 | #define THUMBSIZE 128 | ||
42 | |||
43 | extern "C" | ||
44 | { | ||
45 | |||
46 | static EXTRACTOR_KeywordList * addKeyword(EXTRACTOR_KeywordType type, | ||
47 | char * keyword, | ||
48 | EXTRACTOR_KeywordList * next) { | ||
49 | EXTRACTOR_KeywordList * result; | ||
50 | |||
51 | if (keyword == NULL) | ||
52 | return next; | ||
53 | result = (EXTRACTOR_KeywordList *) malloc(sizeof(EXTRACTOR_KeywordList)); | ||
54 | result->next = next; | ||
55 | result->keyword = keyword; | ||
56 | result->keywordType = type; | ||
57 | return result; | ||
58 | } | ||
59 | |||
60 | |||
61 | /* which mime-types maybe subjected to | ||
62 | the thumbnail extractor (ImageMagick | ||
63 | crashes and/or prints errors for bad | ||
64 | formats, so we need to be rather | ||
65 | conservative here) */ | ||
66 | static const char * whitelist[] = { | ||
67 | "image/x-bmp", | ||
68 | "image/gif", | ||
69 | "image/jpeg", | ||
70 | "image/png", | ||
71 | "image/x-png", | ||
72 | "image/x-portable-bitmap", | ||
73 | "image/x-portable-graymap", | ||
74 | "image/x-portable-pixmap", | ||
75 | "image/x-xbitmap", | ||
76 | "image/x-xpixmap" | ||
77 | "image/x-xpm", | ||
78 | #ifdef HAVE_QT_SVG | ||
79 | "image/svg+xml", | ||
80 | #endif | ||
81 | NULL | ||
82 | }; | ||
83 | |||
84 | static struct EXTRACTOR_Keywords * | ||
85 | extract(const unsigned char * data, | ||
86 | size_t size, | ||
87 | struct EXTRACTOR_Keywords * prev, | ||
88 | const char * options) { | ||
89 | QImage *img; | ||
90 | QByteArray bytes; | ||
91 | QBuffer buffer; | ||
92 | unsigned long width; | ||
93 | unsigned long height; | ||
94 | char * binary; | ||
95 | const char * mime; | ||
96 | int j; | ||
97 | char * format; | ||
98 | QImage::Format colors; | ||
99 | |||
100 | /* if the mime-type of the file is not whitelisted | ||
101 | do not run the thumbnail extactor! */ | ||
102 | mime = EXTRACTOR_extractLast(EXTRACTOR_MIMETYPE, | ||
103 | prev); | ||
104 | if (mime == NULL) | ||
105 | return prev; | ||
106 | j = 0; | ||
107 | while (whitelist[j] != NULL) { | ||
108 | if (0 == strcmp(whitelist[j], mime)) | ||
109 | break; | ||
110 | j++; | ||
111 | } | ||
112 | |||
113 | if (whitelist[j] == NULL) | ||
114 | return prev; | ||
115 | |||
116 | /* Determine image format to use */ | ||
117 | if (options == NULL) | ||
118 | colors = QImage::Format_Indexed8; | ||
119 | else | ||
120 | switch(atoi(options)) | ||
121 | { | ||
122 | case 1: | ||
123 | colors = QImage::Format_Mono; | ||
124 | break; | ||
125 | case 8: | ||
126 | colors = QImage::Format_Indexed8; | ||
127 | break; | ||
128 | case 16: | ||
129 | case 24: | ||
130 | colors = QImage::Format_RGB32; | ||
131 | break; | ||
132 | default: | ||
133 | colors = QImage::Format_ARGB32; | ||
134 | break; | ||
135 | } | ||
136 | |||
137 | #ifdef HAVE_QT_SVG | ||
138 | if (strcmp(mime, "image/svg+xml") == 0) | ||
139 | { | ||
140 | /* Render SVG image */ | ||
141 | QSvgRenderer svg; | ||
142 | QSize size; | ||
143 | |||
144 | if (! svg.load(QByteArray((const char *) data))) | ||
145 | return prev; | ||
146 | |||
147 | size = svg.defaultSize(); | ||
148 | img = new QImage(size, QImage::Format_ARGB32); | ||
149 | |||
150 | QPainter painter(img); | ||
151 | painter.setViewport(0, 0, size.width(), size.height()); | ||
152 | painter.eraseRect(0, 0, size.width(), size.height()); | ||
153 | |||
154 | svg.render(&painter); | ||
155 | } | ||
156 | else | ||
157 | #endif | ||
158 | { | ||
159 | /* Load image */ | ||
160 | img = new QImage(); | ||
161 | img->loadFromData(data, size); | ||
162 | } | ||
163 | |||
164 | height = img->height(); | ||
165 | width = img->width(); | ||
166 | format = (char *) malloc(64); | ||
167 | snprintf(format, | ||
168 | 64, | ||
169 | "%ux%u", | ||
170 | (unsigned int) width, | ||
171 | (unsigned int) height); | ||
172 | prev = addKeyword(EXTRACTOR_SIZE, | ||
173 | format, | ||
174 | prev); | ||
175 | if (height == 0) | ||
176 | height = 1; | ||
177 | if (width == 0) | ||
178 | width = 1; | ||
179 | |||
180 | /* Change color depth */ | ||
181 | QImage thumb = img->convertToFormat(colors); | ||
182 | delete img; | ||
183 | |||
184 | /* Resize image | ||
185 | * | ||
186 | * Qt's scaled() produces poor quality if the image is resized to less than | ||
187 | * half the size. Therefore, we resize the image in multiple steps. | ||
188 | * http://lists.trolltech.com/qt-interest/2006-04/msg00376.html */ | ||
189 | while(true) | ||
190 | { | ||
191 | width /= 2; | ||
192 | if (width < THUMBSIZE) | ||
193 | width = THUMBSIZE; | ||
194 | |||
195 | height /= 2; | ||
196 | if (height < THUMBSIZE) | ||
197 | height = THUMBSIZE; | ||
198 | |||
199 | thumb = thumb.scaled(width, height, Qt::KeepAspectRatio, | ||
200 | Qt::SmoothTransformation); | ||
201 | |||
202 | if (width == THUMBSIZE && height == THUMBSIZE) | ||
203 | break; | ||
204 | } | ||
205 | |||
206 | buffer.setBuffer(&bytes); | ||
207 | buffer.open(QIODevice::WriteOnly); | ||
208 | thumb.save(&buffer, "PNG"); | ||
209 | |||
210 | binary | ||
211 | = EXTRACTOR_binaryEncode((const unsigned char*) bytes.data(), | ||
212 | bytes.length()); | ||
213 | |||
214 | if (binary == NULL) | ||
215 | return prev; | ||
216 | |||
217 | return addKeyword(EXTRACTOR_THUMBNAIL_DATA, | ||
218 | binary, | ||
219 | prev); | ||
220 | } | ||
221 | |||
222 | /* create new thread for C++ code (see Mantis #905) */ | ||
223 | |||
224 | struct X { | ||
225 | const unsigned char * data; | ||
226 | size_t size; | ||
227 | struct EXTRACTOR_Keywords * prev; | ||
228 | const char * options; | ||
229 | }; | ||
230 | |||
231 | static void * run(void * arg) { | ||
232 | struct X * x = (struct X*) arg; | ||
233 | return extract(x->data, x->size, x->prev, | ||
234 | x->options); | ||
235 | } | ||
236 | |||
237 | struct EXTRACTOR_Keywords * | ||
238 | libextractor_thumbnailqt_extract(const char * filename, | ||
239 | const unsigned char * data, | ||
240 | size_t size, | ||
241 | struct EXTRACTOR_Keywords * prev, | ||
242 | const char * options) { | ||
243 | pthread_t pt; | ||
244 | struct X cls; | ||
245 | |||
246 | void * ret; | ||
247 | cls.data = data; | ||
248 | cls.size = size; | ||
249 | cls.prev = prev; | ||
250 | cls.options = options; | ||
251 | if (0 == pthread_create(&pt, NULL, &run, &cls)) | ||
252 | if (0 == pthread_join(pt, &ret)) | ||
253 | return (struct EXTRACTOR_Keywords*) ret; | ||
254 | return prev; | ||
255 | } | ||
256 | |||
257 | |||
258 | struct EXTRACTOR_Keywords * | ||
259 | libextractor_thumbnail_extract(const char * filename, | ||
260 | const unsigned char * data, | ||
261 | size_t size, | ||
262 | struct EXTRACTOR_Keywords * prev, | ||
263 | const char * options) { | ||
264 | return libextractor_thumbnailqt_extract(filename, | ||
265 | data, | ||
266 | size, | ||
267 | prev, | ||
268 | options); | ||
269 | } | ||
270 | |||
271 | } // extern "C" | ||
272 | |||
273 | /* end of thumbnailextractorqt.cc */ | ||
diff --git a/src/plugins/thumbnailffmpeg/Makefile.am b/src/plugins/thumbnailffmpeg/Makefile.am deleted file mode 100644 index 8d1684e..0000000 --- a/src/plugins/thumbnailffmpeg/Makefile.am +++ /dev/null | |||
@@ -1,41 +0,0 @@ | |||
1 | include ../Makefile-plugins.am | ||
2 | |||
3 | plugin_LTLIBRARIES = \ | ||
4 | libextractor_thumbnailffmpeg.la | ||
5 | |||
6 | libextractor_thumbnailffmpeg_la_SOURCES = \ | ||
7 | thumbnailextractorffmpeg.c | ||
8 | libextractor_thumbnailffmpeg_la_LIBADD = \ | ||
9 | $(top_builddir)/src/main/libextractor.la \ | ||
10 | ../ffmpeg/libavformat/libavformat.a \ | ||
11 | ../ffmpeg/libavcodec/libavcodec.a \ | ||
12 | ../ffmpeg/libavutil/libavutil.a \ | ||
13 | ../ffmpeg/libswscale/libswscale.a \ | ||
14 | -lz -lbz2 | ||
15 | libextractor_thumbnailffmpeg_la_LDFLAGS = \ | ||
16 | $(PLUGINFLAGS) $(retaincommand) | ||
17 | libextractor_thumbnailffmpeg_la_CPPFLAGS = \ | ||
18 | -I$(top_scrdir)/include \ | ||
19 | -I../ffmpeg \ | ||
20 | -I../ffmpeg/libavformat \ | ||
21 | -I../ffmpeg/libavcodec \ | ||
22 | -I../ffmpeg/libavutil \ | ||
23 | -I../ffmpeg/libswscale | ||
24 | |||
25 | ../ffmpeg/libavformat/libavformat.a: Makefile | ||
26 | cd ../ffmpeg && $(MAKE) $(AM_MAKEFLAGS) all | ||
27 | ../ffmpeg/libavcodec/libavcodec.a: Makefile | ||
28 | cd ../ffmpeg && $(MAKE) $(AM_MAKEFLAGS) all | ||
29 | ../ffmpeg/libavutil/libavutil.a: Makefile | ||
30 | cd ../ffmpeg && $(MAKE) $(AM_MAKEFLAGS) all | ||
31 | ../ffmpeg/libswscale/libswscale.a: Makefile | ||
32 | cd ../ffmpeg && $(MAKE) $(AM_MAKEFLAGS) all | ||
33 | |||
34 | clean-local: | ||
35 | cd ../ffmpeg && $(MAKE) $(AM_MAKEFLAGS) clean | ||
36 | distclean-local: | ||
37 | cd ../ffmpeg && $(MAKE) $(AM_MAKEFLAGS) distclean | ||
38 | |||
39 | dist-hook: clean-local | ||
40 | |||
41 | |||
diff --git a/src/plugins/thumbnailffmpeg/README b/src/plugins/thumbnailffmpeg/README deleted file mode 100644 index 297adc8..0000000 --- a/src/plugins/thumbnailffmpeg/README +++ /dev/null | |||
@@ -1,105 +0,0 @@ | |||
1 | This is a thumbnail extractor using the ffmpeg libraries that will eventually | ||
2 | support extracting thumbnails from both image and video files. Compiling | ||
3 | the ffmpeg libraries requires at least GNU make version 3.81. | ||
4 | |||
5 | A local ffmpeg tree is used, because | ||
6 | (1) there are no recent official releases of the ffmpeg libs, | ||
7 | (2) mainline ffmpeg is not reentrant, | ||
8 | (3) security issues can be handled locally. | ||
9 | |||
10 | Originally: | ||
11 | svn export -r 13836 --ignore-externals svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg | ||
12 | svn export -r 27100 svn://svn.mplayerhq.hu/mplayer/trunk/libswscale ffmpeg/libswscale | ||
13 | sync with ffmpeg: | ||
14 | FFREV=14311 | ||
15 | SWSREV=27332 | ||
16 | cd /tmp | ||
17 | svn co -r $FFREV --ignore-externals svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg | ||
18 | svn co -r $SWSREV svn://svn.mplayerhq.hu/mplayer/trunk/libswscale ffmpeg/libswscale | ||
19 | cd Extractor/src/plugins/thumbnailffmpeg | ||
20 | # copy, rsync skips .svn dirs | ||
21 | rsync -aC ffmpeg /tmp/ | ||
22 | cd /tmp/ffmpeg | ||
23 | svn update | ||
24 | <resolve conflicts> | ||
25 | cd Extractor/src/plugins/thumbnailffmpeg | ||
26 | rsync -aC /tmp/ffmpeg . | ||
27 | # check for deletions | ||
28 | diff -qr . /tmp/ffmpeg -x .svn | ||
29 | <svn delete ...> | ||
30 | # check for additions | ||
31 | <svn status, svn add> | ||
32 | |||
33 | update ffmpeg_distfiles.am: | ||
34 | svn list -R src/plugins/ffmpeg | \ | ||
35 | sed '/\/$/d' | \ | ||
36 | sed '$!s/$/ \\/g' | \ | ||
37 | sed 's/^/ffmpeg\//' | \ | ||
38 | grep -v "no-indent" | \ | ||
39 | sed '1 i EXTRA_DIST = \\' > src/plugins/ffmpeg_distfiles.am | ||
40 | |||
41 | Plan: test & enable ffmpeg decoders one by one | ||
42 | tests: | ||
43 | - multithreading test | ||
44 | - zzuf test | ||
45 | - random input test | ||
46 | (- valgrind) | ||
47 | |||
48 | At least, the following should be eventually enabled: | ||
49 | if ! ./configure \ | ||
50 | --prefix=/tmp/FF \ | ||
51 | --disable-mmx \ | ||
52 | --disable-altivec \ | ||
53 | --enable-shared \ | ||
54 | --enable-swscale \ | ||
55 | --enable-gpl \ | ||
56 | --disable-vhook \ | ||
57 | --disable-postproc \ | ||
58 | --disable-network \ | ||
59 | --disable-ffmpeg \ | ||
60 | --disable-ffserver \ | ||
61 | --disable-ffplay \ | ||
62 | --disable-devices \ | ||
63 | --disable-protocols \ | ||
64 | --disable-bsfs \ | ||
65 | --disable-parsers \ | ||
66 | --disable-muxers \ | ||
67 | --disable-demuxers \ | ||
68 | --disable-encoders \ | ||
69 | --disable-decoders \ | ||
70 | --enable-parser=h263 \ | ||
71 | --enable-parser=h264 \ | ||
72 | --enable-parser=mjpeg \ | ||
73 | --enable-parser=mpeg4video \ | ||
74 | --enable-parser=mpegvideo \ | ||
75 | --enable-encoder=png \ | ||
76 | --enable-encoder=mjpeg \ | ||
77 | --enable-decoder=bmp \ | ||
78 | --enable-decoder=pcx \ | ||
79 | --enable-decoder=png \ | ||
80 | --enable-decoder=mjpeg \ | ||
81 | --enable-decoder=mjpegb \ | ||
82 | --enable-decoder=targa \ | ||
83 | --enable-decoder=tiff \ | ||
84 | --enable-decoder=flashsv \ | ||
85 | --enable-decoder=h263 \ | ||
86 | --enable-decoder=flv \ | ||
87 | --enable-decoder=h264 \ | ||
88 | --enable-decoder=mpeg1video \ | ||
89 | --enable-decoder=mpeg2video \ | ||
90 | --enable-decoder=mpegvideo \ | ||
91 | --enable-decoder=mpeg4 \ | ||
92 | --enable-decoder=vp6 \ | ||
93 | --enable-decoder=vp6a \ | ||
94 | --enable-decoder=vp6f \ | ||
95 | --enable-demuxer=asf \ | ||
96 | --enable-demuxer=avi \ | ||
97 | --enable-demuxer=flv \ | ||
98 | --enable-demuxer=mjpeg \ | ||
99 | --enable-demuxer=mpegps \ | ||
100 | --enable-demuxer=mpegts \ | ||
101 | --enable-demuxer=mpegvideo \ | ||
102 | --enable-demuxer=mov \ | ||
103 | --enable-demuxer=ogg \ | ||
104 | --enable-demuxer=rm | ||
105 | |||
diff --git a/src/plugins/thumbnailffmpeg/thumbnailextractorffmpeg.c b/src/plugins/thumbnailffmpeg_extractor.c index 62f437d..7fbde2d 100644 --- a/src/plugins/thumbnailffmpeg/thumbnailextractorffmpeg.c +++ b/src/plugins/thumbnailffmpeg_extractor.c | |||
@@ -19,18 +19,28 @@ | |||
19 | */ | 19 | */ |
20 | 20 | ||
21 | /** | 21 | /** |
22 | * @file thumbnailextractorffmpeg.c | 22 | * @file thumbnailffmpeg_extractor.c |
23 | * @author Heikki Lindholm | 23 | * @author Heikki Lindholm |
24 | * @brief this extractor produces a binary encoded | 24 | * @brief this extractor produces a binary encoded |
25 | * thumbnail of images and videos using the ffmpeg libs. | 25 | * thumbnail of images and videos using the ffmpeg libs. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | /* This is a thumbnail extractor using the ffmpeg libraries that will eventually | ||
29 | support extracting thumbnails from both image and video files. | ||
30 | |||
31 | Note that ffmpeg has a few issues: | ||
32 | (1) there are no recent official releases of the ffmpeg libs | ||
33 | (2) ffmpeg has a history of having security issues (parser is not robust) | ||
34 | |||
35 | So this plugin cannot be recommended for system with high security | ||
36 | requirements. | ||
37 | */ | ||
38 | |||
28 | #include "platform.h" | 39 | #include "platform.h" |
29 | #include "extractor.h" | 40 | #include "extractor.h" |
30 | 41 | #include <libavformat/avformat.h> | |
31 | #include <avformat.h> | 42 | #include <libavcodec/avcodec.h> |
32 | #include <avcodec.h> | 43 | #include <libswscale/swscale.h> |
33 | #include <swscale.h> | ||
34 | 44 | ||
35 | #define DEBUG 0 | 45 | #define DEBUG 0 |
36 | 46 | ||
@@ -148,21 +158,19 @@ static const struct MimeToDecoderMapping m2d_map[] = { | |||
148 | #define THUMBSIZE 128 /* max dimension in pixels */ | 158 | #define THUMBSIZE 128 /* max dimension in pixels */ |
149 | #define MAX_THUMB_SIZE (100*1024) /* in bytes */ | 159 | #define MAX_THUMB_SIZE (100*1024) /* in bytes */ |
150 | 160 | ||
151 | struct EXTRACTOR_Keywords * | 161 | int |
152 | libextractor_thumbnailffmpeg_extract (const char *filename, | 162 | EXTRACTOR_thumbnailffmpeg_extract (const unsigned char *data, |
153 | const unsigned char *data, | 163 | size_t size, |
154 | size_t size, | 164 | EXTRACTOR_MetaDataProcessor proc, |
155 | struct EXTRACTOR_Keywords *prev) | 165 | void *proc_cls, |
166 | const char *options) | ||
156 | { | 167 | { |
157 | int score; | 168 | int score; |
158 | |||
159 | AVInputFormat *fmt; | 169 | AVInputFormat *fmt; |
160 | AVProbeData pdat; | 170 | AVProbeData pdat; |
161 | |||
162 | ByteIOContext *bio_ctx = NULL; | 171 | ByteIOContext *bio_ctx = NULL; |
163 | uint8_t *bio_buffer; | 172 | uint8_t *bio_buffer; |
164 | struct StreamDescriptor reader_state; | 173 | struct StreamDescriptor reader_state; |
165 | |||
166 | AVFormatContext *format_ctx = NULL; | 174 | AVFormatContext *format_ctx = NULL; |
167 | AVCodecContext *codec_ctx = NULL; | 175 | AVCodecContext *codec_ctx = NULL; |
168 | AVPacket packet; | 176 | AVPacket packet; |
@@ -515,14 +523,14 @@ out: | |||
515 | return prev; | 523 | return prev; |
516 | } | 524 | } |
517 | 525 | ||
518 | struct EXTRACTOR_Keywords * | 526 | int |
519 | libextractor_thumbnail_extract (const char *filename, | 527 | EXTRACTOR_thumbnail_extract (const unsigned char *data, |
520 | const unsigned char *data, | 528 | size_t size, |
521 | size_t size, | 529 | EXTRACTOR_MetaDataProcessor proc, |
522 | struct EXTRACTOR_Keywords *prev, | 530 | void *proc_cls, |
523 | const char *options) | 531 | const char *options) |
524 | { | 532 | { |
525 | return libextractor_thumbnailffmpeg_extract (filename, data, size, prev); | 533 | return EXTRACTOR_thumbnailffmpeg_extract (data, size, proc, proc_cls, options); |
526 | } | 534 | } |
527 | 535 | ||
528 | /* end of thumbnailextractorffmpeg.c */ | 536 | /* end of thumbnailffmpeg_extractor.c */ |