libextractor

GNU libextractor
Log | Files | Refs | Submodules | README | LICENSE

commit 905497232f1a1c1cc824daf310334526f629e981
parent 4da12980f72371f894eb2ef8160720bb7f2eae55
Author: Christian Grothoff <christian@grothoff.org>
Date:   Wed,  6 Sep 2006 19:42:46 +0000

adding tIME support to PNG extractor

Diffstat:
MChangeLog | 3+++
Msrc/plugins/pngextractor.c | 39++++++++++++++++++++++++++++++++++++++-
2 files changed, 41 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog @@ -1,3 +1,6 @@ +Wed Sep 6 13:38:55 PDT 2006 + Added tIME support to PNG extractor. Bugfixes in PDF extractors. + Wed May 17 02:05:37 PDT 2006 Switched mpegextractor to use libmpeg2 (improves correctness, adds dependency!). Releasing libextractor 0.5.14. diff --git a/src/plugins/pngextractor.c b/src/plugins/pngextractor.c @@ -215,7 +215,6 @@ static struct EXTRACTOR_Keywords * processIHDR(const char * data, prev); } -/* not supported... */ static struct EXTRACTOR_Keywords * processzTXt(const char * data, unsigned int length, struct EXTRACTOR_Keywords * prev) { @@ -278,6 +277,42 @@ static struct EXTRACTOR_Keywords * processzTXt(const char * data, prev); } +static struct EXTRACTOR_Keywords * processtIME(const char * data, + unsigned int length, + struct EXTRACTOR_Keywords * prev) { + unsigned short y; + unsigned int year; + unsigned int mo; + unsigned int day; + unsigned int h; + unsigned int m; + unsigned int s; + char val[256]; + + if (length != 7) + return prev; + memcpy(&y, + &data[4], + sizeof(unsigned short)); + year = ntohs(y); + mo = (unsigned char) data[6]; + day = (unsigned char) data[7]; + h = (unsigned char) data[8]; + m = (unsigned char) data[9]; + s = (unsigned char) data[10]; + sprintf(val, + "%04u-%02u-%02u %02d:%02d:%02d", + year, + mo, + day, + h, + m, + s); + return addKeyword(EXTRACTOR_MODIFICATION_DATE, + strdup(val), + prev); +} + #define PNG_HEADER "\211PNG\r\n\032\n" @@ -318,6 +353,8 @@ struct EXTRACTOR_Keywords * libextractor_png_extract(const char * filename, result = processtEXt(pos, length, result); if (0 == strncmp(pos, "zTXt", 4)) result = processzTXt(pos, length, result); + if (0 == strncmp(pos, "tIME", 4)) + result = processtIME(pos, length, result); pos += 4+length+4; /* Chunk type, data, crc */ } return result;