libextractor  1.11
About: GNU libextractor is a library used to extract meta-data from files of arbitrary type.
  Fossies Dox: libextractor-1.11.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

tiff_extractor.c File Reference

plugin to support TIFF files More...

#include "platform.h"
#include "extractor.h"
#include <tiffio.h>
Include dependency graph for tiff_extractor.c:

Go to the source code of this file.

Data Structures

struct  Matches
 

Functions

static void error_cb (const char *module, const char *fmt, va_list ap)
 
static tsize_t read_cb (thandle_t ctx, tdata_t data, tsize_t size)
 
static tsize_t write_cb (thandle_t ctx, tdata_t data, tsize_t size)
 
static toff_t seek_cb (thandle_t ctx, toff_t offset, int whence)
 
static toff_t size_cb (thandle_t ctx)
 
static int close_cb (thandle_t ctx)
 
void EXTRACTOR_tiff_extract_method (struct EXTRACTOR_ExtractContext *ec)
 

Variables

static struct Matches tmap []
 

Detailed Description

plugin to support TIFF files

Author
Christian Grothoff

Definition in file tiff_extractor.c.

Function Documentation

◆ close_cb()

static int close_cb ( thandle_t  ctx)
static

Callback invoked by TIFF lib for closing the file. Does nothing.

Parameters
ctxthe 'struct EXTRACTOR_ExtractContext'

Definition at line 127 of file tiff_extractor.c.

Referenced by EXTRACTOR_tiff_extract_method().

◆ error_cb()

static void error_cb ( const char *  module,
const char *  fmt,
va_list  ap 
)
static

Error handler for libtiff. Does nothing.

Parameters
modulewhere did the error arise?
fmtformat string
aparguments for fmt

Definition at line 38 of file tiff_extractor.c.

Referenced by EXTRACTOR_tiff_extract_method().

◆ EXTRACTOR_tiff_extract_method()

void EXTRACTOR_tiff_extract_method ( struct EXTRACTOR_ExtractContext ec)

Main entry method for the 'image/tiff' extraction plugin.

Parameters
ecextraction context provided to the plugin

Definition at line 176 of file tiff_extractor.c.

References close_cb(), EXTRACTOR_ExtractContext::cls, error_cb(), EXTRACTOR_METAFORMAT_UTF8, EXTRACTOR_METATYPE_IMAGE_DIMENSIONS, EXTRACTOR_METATYPE_MIMETYPE, NULL, EXTRACTOR_ExtractContext::proc, read_cb(), seek_cb(), size_cb(), Matches::tag, tmap, Matches::type, and write_cb().

◆ read_cb()

static tsize_t read_cb ( thandle_t  ctx,
tdata_t  data,
tsize_t  size 
)
static

Callback invoked by TIFF lib for reading.

Parameters
ctxthe 'struct EXTRACTOR_ExtractContext'
datawhere to write data
sizenumber of bytes to read
Returns
number of bytes read

Definition at line 55 of file tiff_extractor.c.

References EXTRACTOR_ExtractContext::cls, and EXTRACTOR_ExtractContext::read.

Referenced by EXTRACTOR_tiff_extract_method().

◆ seek_cb()

static toff_t seek_cb ( thandle_t  ctx,
toff_t  offset,
int  whence 
)
static

Callback invoked by TIFF lib for seeking.

Parameters
ctxthe 'struct EXTRACTOR_ExtractContext'
offsettarget offset
whencetarget is relative to where
Returns
new offset

Definition at line 96 of file tiff_extractor.c.

References EXTRACTOR_ExtractContext::cls, and EXTRACTOR_ExtractContext::seek.

Referenced by EXTRACTOR_tiff_extract_method().

◆ size_cb()

static toff_t size_cb ( thandle_t  ctx)
static

Callback invoked by TIFF lib for getting the file size.

Parameters
ctxthe 'struct EXTRACTOR_ExtractContext'
Returns
file size

Definition at line 113 of file tiff_extractor.c.

References EXTRACTOR_ExtractContext::cls, and EXTRACTOR_ExtractContext::get_size.

Referenced by EXTRACTOR_tiff_extract_method().

◆ write_cb()

static tsize_t write_cb ( thandle_t  ctx,
tdata_t  data,
tsize_t  size 
)
static

Callback invoked by TIFF lib for writing. Always fails.

Parameters
ctxthe 'struct EXTRACTOR_ExtractContext'
datawhere to write data
sizenumber of bytes to read
Returns
-1 (error)

Definition at line 79 of file tiff_extractor.c.

Referenced by EXTRACTOR_tiff_extract_method().

Variable Documentation

◆ tmap

struct Matches tmap[]
static
Initial value:
= {
{ TIFFTAG_ARTIST, EXTRACTOR_METATYPE_ARTIST },
{ TIFFTAG_COPYRIGHT, EXTRACTOR_METATYPE_COPYRIGHT },
{ TIFFTAG_DATETIME, EXTRACTOR_METATYPE_CREATION_DATE },
{ TIFFTAG_DOCUMENTNAME, EXTRACTOR_METATYPE_TITLE },
{ TIFFTAG_HOSTCOMPUTER, EXTRACTOR_METATYPE_BUILDHOST },
{ TIFFTAG_IMAGEDESCRIPTION, EXTRACTOR_METATYPE_DESCRIPTION },
{ TIFFTAG_MAKE, EXTRACTOR_METATYPE_CAMERA_MAKE },
{ TIFFTAG_MODEL, EXTRACTOR_METATYPE_CAMERA_MODEL },
{ TIFFTAG_PAGENAME, EXTRACTOR_METATYPE_PAGE_RANGE },
{ TIFFTAG_TARGETPRINTER, EXTRACTOR_METATYPE_TARGET_ARCHITECTURE },
{ 0, 0 }
}
@ EXTRACTOR_METATYPE_CAMERA_MAKE
Definition: extractor.h:238
@ EXTRACTOR_METATYPE_TARGET_ARCHITECTURE
Definition: extractor.h:224
@ EXTRACTOR_METATYPE_CAMERA_MODEL
Definition: extractor.h:239
@ EXTRACTOR_METATYPE_TITLE
Definition: extractor.h:134
@ EXTRACTOR_METATYPE_ARTIST
Definition: extractor.h:279
@ EXTRACTOR_METATYPE_CREATED_BY_SOFTWARE
Definition: extractor.h:194
@ EXTRACTOR_METATYPE_CREATION_DATE
Definition: extractor.h:196
@ EXTRACTOR_METATYPE_PAGE_RANGE
Definition: extractor.h:142
@ EXTRACTOR_METATYPE_COPYRIGHT
Definition: extractor.h:183
@ EXTRACTOR_METATYPE_BUILDHOST
Definition: extractor.h:228
@ EXTRACTOR_METATYPE_DESCRIPTION
Definition: extractor.h:182

Mapping of TIFF tags to LE types. NULL-terminated.

Definition at line 127 of file tiff_extractor.c.

Referenced by EXTRACTOR_tiff_extract_method().