Tracker Extract Library Reference Manual: Exif

## Exif Exif — Exchangeable Image File Format (EXIF) |

## Stability Level

Stable, unless otherwise indicated

## Synopsis

    #include <libtracker-extract/tracker-extract.h>

                        TrackerExifData;
    TrackerExifData *   tracker_exif_new                    (const guchar *buffer,
                                                             size_t len,
                                                             const gchar *uri);
    void                tracker_exif_free                   (TrackerExifData *data);
    gboolean            tracker_exif_read                   (const unsigned char *buffer,
                                                             size_t len,
                                                             const gchar *uri,
                                                             TrackerExifData *data);

## Description

Exchangeable Image File Format (EXIF) is a specification for the image file format used by digital cameras. The specification uses the existing JPEG, TIFF Rev. 6.0, and RIFF WAV file formats, with the addition of specific metadata tags. It is not supported in JPEG 2000, PNG, or GIF.

This API is provided to remove code duplication between extractors using these standards.

## Details

### TrackerExifData

    typedef struct {
    	gchar *y_dimension;
    	gchar *x_dimension;
    	gchar *image_width;
    	gchar *document_name;
    	gchar *time;
    	gchar *time_original;
    	gchar *artist;
    	gchar *user_comment;
    	gchar *description;
    	gchar *make;
    	gchar *model;
    	gchar *orientation;
    	gchar *exposure_time;
    	gchar *fnumber;
    	gchar *flash;
    	gchar *focal_length;
    	gchar *iso_speed_ratings;
    	gchar *metering_mode;
    	gchar *white_balance;
    	gchar *copyright;
    	gchar *software;
    	gchar *x_resolution;
    	gchar *y_resolution;
    	gint resolution_unit;

    	/* ABI barrier (don't change things above this) */
    	gchar *gps_altitude;
    	gchar *gps_latitude;
    	gchar *gps_longitude;
    	gchar *gps_direction;
    } TrackerExifData;

Structure defining EXIF data.

gchar *`y_dimension`; | Y dimension.
gchar *`x_dimension`; | X dimension.
gchar *`image_width`; | Image width.
gchar *`document_name`; | Document name.
gchar *`time`; | Time.
gchar *`time_original`; | Original time.
gchar *`artist`; | Artist.
gchar *`user_comment`; | User-provided comment.
gchar *`description`; | Description.
gchar *`make`; | Make info.
gchar *`model`; | Model info.
gchar *`orientation`; | Orientation.
gchar *`exposure_time`; | Exposure time.
gchar *`fnumber`; | Focal ratio
gchar *`flash`; | Flash info.
gchar *`focal_length`; | Focal length.
gchar *`iso_speed_ratings`; | ISO speed ratings.
gchar *`metering_mode`; | Metering mode.
gchar *`white_balance`; | White balance.
gchar *`copyright`; | Copyright.
gchar *`software`; | Software used.
gchar *`x_resolution`; | Horizontal resolution.
gchar *`y_resolution`; | Vertical resolution.
gint `resolution_unit`; | Resolution units.
gchar *`gps_altitude`; | GPS altitude.
gchar *`gps_latitude`; | GPS latitude.
gchar *`gps_longitude`; | GPS longitude.
gchar *`gps_direction`; | GPS direction information.

### tracker_exif_new ()

    TrackerExifData *   tracker_exif_new                    (const guchar *buffer,
                                                             size_t len,
                                                             const gchar *uri);

This function takes `len` bytes of `buffer` and runs it through the EXIF library.

`buffer` : | a chunk of data with exif data in it.
`len` : | the size of `buffer`.
`uri` : | the URI this is related to.
Returns : | a newly allocated TrackerExifData struct if EXIF data was found, `NULL` otherwise. Free the returned struct with `tracker_exif_free()`.

Since 0.10

### tracker_exif_free ()

    void                tracker_exif_free                   (TrackerExifData *data);

Frees `data` and all TrackerExifData members. `NULL` will produce a a warning.

`data` : | a TrackerExifData

Since 0.10

### tracker_exif_read ()

    gboolean            tracker_exif_read                   (const unsigned char *buffer,
                                                             size_t len,
                                                             const gchar *uri,
                                                             TrackerExifData *data);

### Warning

`tracker_exif_read` is deprecated and should not be used in newly-written code. 0.9. Use `tracker_exif_new()` instead.

This function takes `len` bytes of `buffer` and runs it through the EXIF library. The result is that `data` is populated with the EXIF data found in `uri`.

`buffer` : | a chunk of data with exif data in it.
`len` : | the size of `buffer`.
`uri` : | the URI this is related to.
`data` : | a pointer to a TrackerExifData struture to populate.
Returns : | `TRUE` if the `data` was populated successfully, otherwise `FALSE` is returned.

Since 0.8