exif-loader.c File Reference

#include <config.h>
#include <libexif/exif-loader.h>
#include <libexif/exif-utils.h>
#include <libexif/i18n.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  _ExifLoader

Defines

#define JPEG_MARKER_SOI   0xd8
#define JPEG_MARKER_APP0   0xe0
#define JPEG_MARKER_APP1   0xe1
#define JPEG_MARKER_APP2   0xe2
#define JPEG_MARKER_APP13   0xed
#define JPEG_MARKER_COM   0xfe
#define MIN(a, b)   (((a) < (b)) ? (a) : (b))

Enumerations

enum  ExifLoaderState {
  EL_READ = 0, EL_READ_SIZE_BYTE_24, EL_READ_SIZE_BYTE_16, EL_READ_SIZE_BYTE_08,
  EL_READ_SIZE_BYTE_00, EL_SKIP_BYTES, EL_EXIF_FOUND
}
enum  ExifLoaderDataFormat { EL_DATA_FORMAT_UNKNOWN, EL_DATA_FORMAT_EXIF, EL_DATA_FORMAT_JPEG, EL_DATA_FORMAT_FUJI_RAW }

Functions

static void * exif_loader_alloc (ExifLoader *l, unsigned int i)
void exif_loader_write_file (ExifLoader *l, const char *path)
static unsigned int exif_loader_copy (ExifLoader *eld, unsigned char *buf, unsigned int len)
unsigned char exif_loader_write (ExifLoader *eld, unsigned char *buf, unsigned int len)
ExifLoaderexif_loader_new (void)
ExifLoaderexif_loader_new_mem (ExifMem *mem)
void exif_loader_ref (ExifLoader *loader)
static void exif_loader_free (ExifLoader *loader)
void exif_loader_unref (ExifLoader *loader)
void exif_loader_reset (ExifLoader *loader)
ExifDataexif_loader_get_data (ExifLoader *loader)
void exif_loader_log (ExifLoader *loader, ExifLog *log)

Variables

static const unsigned char ExifHeader [] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00}


Define Documentation

#define JPEG_MARKER_APP0   0xe0

Definition at line 34 of file exif-loader.c.

#define JPEG_MARKER_APP1   0xe1

Definition at line 36 of file exif-loader.c.

#define JPEG_MARKER_APP13   0xed

Definition at line 40 of file exif-loader.c.

#define JPEG_MARKER_APP2   0xe2

Definition at line 38 of file exif-loader.c.

#define JPEG_MARKER_COM   0xfe

Definition at line 42 of file exif-loader.c.

#define JPEG_MARKER_SOI   0xd8

Definition at line 32 of file exif-loader.c.

#define MIN ( a,
 )     (((a) < (b)) ? (a) : (b))

Definition at line 98 of file exif-loader.c.

Referenced by exif_entry_get_value(), exif_loader_copy(), exif_loader_write(), mnote_canon_entry_count_values(), mnote_canon_entry_get_value(), mnote_olympus_entry_get_value(), and mnote_pentax_entry_get_value().


Enumeration Type Documentation

enum ExifLoaderDataFormat

Enumerator:
EL_DATA_FORMAT_UNKNOWN 
EL_DATA_FORMAT_EXIF 
EL_DATA_FORMAT_JPEG 
EL_DATA_FORMAT_FUJI_RAW 

Definition at line 54 of file exif-loader.c.

enum ExifLoaderState

Enumerator:
EL_READ 
EL_READ_SIZE_BYTE_24 
EL_READ_SIZE_BYTE_16 
EL_READ_SIZE_BYTE_08 
EL_READ_SIZE_BYTE_00 
EL_SKIP_BYTES 
EL_EXIF_FOUND 

Definition at line 44 of file exif-loader.c.


Function Documentation

static void* exif_loader_alloc ( ExifLoader l,
unsigned int  i 
) [static]

Definition at line 82 of file exif-loader.c.

References EXIF_LOG_NO_MEMORY, exif_mem_alloc(), _ExifLoader::log, and _ExifLoader::mem.

Referenced by exif_loader_copy().

static unsigned int exif_loader_copy ( ExifLoader eld,
unsigned char *  buf,
unsigned int  len 
) [static]

Definition at line 127 of file exif-loader.c.

References _ExifLoader::buf, _ExifLoader::bytes_read, exif_loader_alloc(), MIN, and _ExifLoader::size.

Referenced by exif_loader_write().

static void exif_loader_free ( ExifLoader loader  )  [static]

Definition at line 342 of file exif-loader.c.

References exif_loader_reset(), exif_mem_free(), exif_mem_unref(), and _ExifLoader::mem.

Referenced by exif_loader_unref().

ExifData* exif_loader_get_data ( ExifLoader loader  ) 

Get an ExifData out of an ExifLoader

Parameters:
[in] loader the loader
Returns:
and allocated ExifData

Definition at line 378 of file exif-loader.c.

References _ExifLoader::buf, _ExifLoader::bytes_read, exif_data_load_data(), exif_data_log(), exif_data_new_mem(), _ExifLoader::log, and _ExifLoader::mem.

Referenced by exif_data_new_from_file().

void exif_loader_log ( ExifLoader loader,
ExifLog log 
)

Definition at line 393 of file exif-loader.c.

References exif_log_ref(), exif_log_unref(), and _ExifLoader::log.

ExifLoader* exif_loader_new ( void   ) 

Allocate a new ExifLoader

Returns:
the allocated ExifLoader

Definition at line 305 of file exif-loader.c.

References exif_loader_new_mem(), exif_mem_new_default(), and exif_mem_unref().

Referenced by exif_data_new_from_file().

ExifLoader* exif_loader_new_mem ( ExifMem mem  ) 

Allocate a new ExifLoader using an ExifMem

Parameters:
[in] mem the ExifMem
Returns:
the allocated ExifLoader

Definition at line 316 of file exif-loader.c.

References exif_mem_alloc(), exif_mem_ref(), _ExifLoader::mem, and _ExifLoader::ref_count.

Referenced by exif_loader_new().

void exif_loader_ref ( ExifLoader loader  ) 

Increase the refcount of the ExifLoader

Parameters:
[in] loader the ExifLoader to increase the refcount of.

Definition at line 335 of file exif-loader.c.

References _ExifLoader::ref_count.

void exif_loader_reset ( ExifLoader loader  ) 

Reset the ExifLoader

Parameters:
[in] loader the loader

Definition at line 365 of file exif-loader.c.

References _ExifLoader::b_len, _ExifLoader::buf, _ExifLoader::bytes_read, _ExifLoader::data_format, EL_DATA_FORMAT_UNKNOWN, exif_mem_free(), _ExifLoader::mem, _ExifLoader::size, and _ExifLoader::state.

Referenced by exif_loader_free().

void exif_loader_unref ( ExifLoader loader  ) 

Decrease the refcount of the ExifLoader

Parameters:
[in] loader the ExifLoader to decrease the refcount of. If the refcount reaches 0, the ExifLoader is freeed.

Definition at line 356 of file exif-loader.c.

References exif_loader_free(), and _ExifLoader::ref_count.

Referenced by exif_data_new_from_file().

unsigned char exif_loader_write ( ExifLoader loader,
unsigned char *  buf,
unsigned int  sz 
)

Write a buffer to the ExifLoader

Parameters:
[in] loader the loader to write too
[in] buf the buffer to read from
[in] sz the size of the buffer
Returns:
1 while EXIF data is read (or while there is still hope that there will be EXIF data later on), 0 otherwise.

Definition at line 147 of file exif-loader.c.

References _ExifLoader::b, _ExifLoader::b_len, _ExifLoader::data_format, EL_DATA_FORMAT_EXIF, EL_DATA_FORMAT_FUJI_RAW, EL_DATA_FORMAT_JPEG, EL_DATA_FORMAT_UNKNOWN, EL_EXIF_FOUND, EL_READ, EL_READ_SIZE_BYTE_00, EL_READ_SIZE_BYTE_08, EL_READ_SIZE_BYTE_16, EL_READ_SIZE_BYTE_24, EL_SKIP_BYTES, exif_loader_copy(), exif_log(), EXIF_LOG_CODE_DEBUG, ExifHeader, _ExifLoader::log, MIN, _ExifLoader::size, and _ExifLoader::state.

Referenced by exif_loader_write_file().

void exif_loader_write_file ( ExifLoader loader,
const char *  fname 
)

Write a file to the ExifLoader

Parameters:
[in] loader the loader
[in] fname the path to the file to read

Definition at line 101 of file exif-loader.c.

References _, exif_loader_write(), exif_log(), EXIF_LOG_CODE_NONE, _ExifLoader::log, and size.

Referenced by exif_data_new_from_file().


Variable Documentation

const unsigned char ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00} [static]

Definition at line 79 of file exif-loader.c.


Generated on Fri Jun 15 20:58:44 2007 for EXIF library (libexif) Internals by  doxygen 1.5.0