Media drivers initial commit.
Change-Id: Iec13c0e0e8263e8e9d84afaa51b4bbb680bf265f
This commit is contained in:
19
common.mk
19
common.mk
@@ -44,7 +44,11 @@ PRODUCT_PACKAGES := \
|
||||
gps.smdkv310 \
|
||||
sensors.smdkv310 \
|
||||
lights.smdkv310 \
|
||||
mediaserver.smdkv310
|
||||
mediaserver.smdkv310 \
|
||||
overlay.smdkv310 \
|
||||
libstagefrighthw \
|
||||
libexifa \
|
||||
libjpega
|
||||
|
||||
# These are the hardware-specific configuration files
|
||||
PRODUCT_COPY_FILES := \
|
||||
@@ -130,8 +134,15 @@ PRODUCT_COPY_FILES += \
|
||||
|
||||
# configuration files
|
||||
PRODUCT_COPY_FILES += \
|
||||
device/samsung/c1-common/etc/media_profiles.xml:system/etc/media_profiles.xml
|
||||
|
||||
|
||||
device/samsung/c1-common/etc/media_profiles.xml:system/etc/media_profiles.xml \
|
||||
device/samsung/c1-common/sec_mm/sec_omx/sec_omx_core/secomxregistry:system/etc/secomxregistry \
|
||||
|
||||
# These are the OpenMAX IL modules
|
||||
PRODUCT_PACKAGES += \
|
||||
libSEC_OMX_Core.smdkv310 \
|
||||
libOMX.SEC.AVC.Decoder.smdkv310 \
|
||||
libOMX.SEC.M4V.Decoder.smdkv310 \
|
||||
libOMX.SEC.M4V.Encoder.smdkv310 \
|
||||
libOMX.SEC.AVC.Encoder.smdkv310
|
||||
|
||||
|
||||
|
||||
63
include/s3c_bc.h
Executable file
63
include/s3c_bc.h
Executable file
@@ -0,0 +1,63 @@
|
||||
/*!****************************************************************************
|
||||
@File s3c_bc.h
|
||||
|
||||
@Title s3c_bc kernel driver parameters
|
||||
|
||||
@Author Imagination Technologies
|
||||
Samsung Electronics Co. LTD
|
||||
|
||||
@Date 03/03/2010
|
||||
|
||||
@Copyright Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
@Platform Generic
|
||||
|
||||
@Description s3c_bc kernel driver parameters
|
||||
|
||||
@DoxygenVer
|
||||
|
||||
******************************************************************************/
|
||||
|
||||
/******************************************************************************
|
||||
Modifications :-
|
||||
$Log: s3c_bc.h $
|
||||
******************************************************************************/
|
||||
#ifndef __S3C_BC_H__
|
||||
#define __S3C_BC_H__
|
||||
|
||||
#include <linux/ioctl.h>
|
||||
|
||||
#define S3C_BC_DEVICE_NAME "s3c_bc"
|
||||
|
||||
#define S3C_BC_DEVICE_ID 0
|
||||
#define S3C_BC_DEVICE_BUFFER_COUNT 4 /* TODO: Modify this accordingly. */
|
||||
|
||||
#define S3C_BC_DEVICE_PHYS_PAGE_SIZE 0x1000 /* 4KB */
|
||||
|
||||
typedef struct S3C_BC_ioctl_package_TAG
|
||||
{
|
||||
int inputparam;
|
||||
int outputparam;
|
||||
} S3C_BC_ioctl_package, *PS3C_BC_ioctl_package;
|
||||
|
||||
/*!< Nov 2006: according to ioctl-number.txt 'g' wasn't in use. */
|
||||
#define S3C_BC_IOC_GID 'g'
|
||||
|
||||
#define S3C_BC_IOWR(INDEX) _IOWR(S3C_BC_IOC_GID, INDEX, S3C_BC_ioctl_package)
|
||||
|
||||
#define S3C_BC_ioctl_get_physical_base_address S3C_BC_IOWR(0)
|
||||
|
||||
#endif /* __S3C_BC__H__ */
|
||||
/******************************************************************************
|
||||
End of file (s3c_bc.h)
|
||||
******************************************************************************/
|
||||
56
include/s3c_mem.h
Executable file
56
include/s3c_mem.h
Executable file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
* Copyright@ Samsung Electronics Co. LTD
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _S3C_MEM_COMMON_H_
|
||||
#define _S3C_MEM_COMMON_H_
|
||||
|
||||
#define MEM_IOCTL_MAGIC 'M'
|
||||
|
||||
#define S3C_MEM_ALLOC _IOWR(MEM_IOCTL_MAGIC, 310, struct s3c_mem_alloc)
|
||||
#define S3C_MEM_FREE _IOWR(MEM_IOCTL_MAGIC, 311, struct s3c_mem_alloc)
|
||||
|
||||
#define S3C_MEM_SHARE_ALLOC _IOWR(MEM_IOCTL_MAGIC, 314, struct s3c_mem_alloc)
|
||||
#define S3C_MEM_SHARE_FREE _IOWR(MEM_IOCTL_MAGIC, 315, struct s3c_mem_alloc)
|
||||
|
||||
#define S3C_MEM_CACHEABLE_ALLOC _IOWR(MEM_IOCTL_MAGIC, 316, struct s3c_mem_alloc)
|
||||
#define S3C_MEM_CACHEABLE_SHARE_ALLOC _IOWR(MEM_IOCTL_MAGIC, 317, struct s3c_mem_alloc)
|
||||
|
||||
#define S3C_MEM_DMA_COPY _IOWR(MEM_IOCTL_MAGIC, 318, struct s3c_mem_dma_param)
|
||||
#define S3C_MEM_DMA_SET _IOWR(MEM_IOCTL_MAGIC, 319, struct s3c_mem_dma_param)
|
||||
|
||||
#define S3C_MEM_CACHE_INV _IOWR(MEM_IOCTL_MAGIC, 330, struct s3c_mem_dma_param)
|
||||
|
||||
|
||||
struct s3c_mem_alloc {
|
||||
int size;
|
||||
unsigned int vir_addr;
|
||||
unsigned int phy_addr;
|
||||
};
|
||||
|
||||
struct s3c_mem_dma_param {
|
||||
int size;
|
||||
unsigned int src_addr;
|
||||
unsigned int dst_addr;
|
||||
int cfg;
|
||||
};
|
||||
|
||||
#if 0
|
||||
typedef struct _s3c_mem_t{
|
||||
int dev_fd;
|
||||
struct s3c_mem_alloc mem_alloc_info;
|
||||
}s3c_mem_t;
|
||||
#endif
|
||||
#endif // _S3C_MEM_COMMON_H_
|
||||
153
include/s5p_fimc.h
Executable file
153
include/s5p_fimc.h
Executable file
@@ -0,0 +1,153 @@
|
||||
/*
|
||||
* Copyright@ Samsung Electronics Co. LTD
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef _S5P_FIMC_H_
|
||||
#define _S5P_FIMC_H_
|
||||
|
||||
#include <linux/videodev2.h>
|
||||
|
||||
/*
|
||||
* G E N E R A L S
|
||||
*
|
||||
*/
|
||||
#define MIN(x, y) ((x < y) ? x : y)
|
||||
|
||||
/*
|
||||
* P I X E L F O R M A T G U I D E
|
||||
*
|
||||
* The 'x' means 'DO NOT CARE'
|
||||
* The '*' means 'FIMC SPECIFIC'
|
||||
* For some fimc formats, we couldn't find equivalent format in the V4L2 FOURCC.
|
||||
*
|
||||
* FIMC TYPE PLANES ORDER V4L2_PIX_FMT
|
||||
* ---------------------------------------------------------
|
||||
* RGB565 x x V4L2_PIX_FMT_RGB565
|
||||
* RGB888 x x V4L2_PIX_FMT_RGB24
|
||||
* YUV420 2 LSB_CBCR V4L2_PIX_FMT_NV12
|
||||
* YUV420 2 LSB_CRCB V4L2_PIX_FMT_NV21
|
||||
* YUV420 2 MSB_CBCR V4L2_PIX_FMT_NV21X*
|
||||
* YUV420 2 MSB_CRCB V4L2_PIX_FMT_NV12X*
|
||||
* YUV420 3 x V4L2_PIX_FMT_YUV420
|
||||
* YUV422 1 YCBYCR V4L2_PIX_FMT_YUYV
|
||||
* YUV422 1 YCRYCB V4L2_PIX_FMT_YVYU
|
||||
* YUV422 1 CBYCRY V4L2_PIX_FMT_UYVY
|
||||
* YUV422 1 CRYCBY V4L2_PIX_FMT_VYUY*
|
||||
* YUV422 2 LSB_CBCR V4L2_PIX_FMT_NV16*
|
||||
* YUV422 2 LSB_CRCB V4L2_PIX_FMT_NV61*
|
||||
* YUV422 2 MSB_CBCR V4L2_PIX_FMT_NV16X*
|
||||
* YUV422 2 MSB_CRCB V4L2_PIX_FMT_NV61X*
|
||||
* YUV422 3 x V4L2_PIX_FMT_YUV422P
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* V 4 L 2 F I M C E X T E N S I O N S
|
||||
*
|
||||
*/
|
||||
#define V4L2_PIX_FMT_YVYU v4l2_fourcc('Y', 'V', 'Y', 'U')
|
||||
|
||||
/* FOURCC for FIMC specific */
|
||||
#define V4L2_PIX_FMT_NV12X v4l2_fourcc('N', '1', '2', 'X')
|
||||
#define V4L2_PIX_FMT_NV21X v4l2_fourcc('N', '2', '1', 'X')
|
||||
#define V4L2_PIX_FMT_VYUY v4l2_fourcc('V', 'Y', 'U', 'Y')
|
||||
#define V4L2_PIX_FMT_NV16 v4l2_fourcc('N', 'V', '1', '6')
|
||||
#define V4L2_PIX_FMT_NV61 v4l2_fourcc('N', 'V', '6', '1')
|
||||
#define V4L2_PIX_FMT_NV16X v4l2_fourcc('N', '1', '6', 'X')
|
||||
#define V4L2_PIX_FMT_NV61X v4l2_fourcc('N', '6', '1', 'X')
|
||||
|
||||
#define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2') /* 12 Y/CbCr 4:2:0 64x32 macroblocks */
|
||||
|
||||
/* CID extensions */
|
||||
#define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0)
|
||||
#define V4L2_CID_RESERVED_MEM_BASE_ADDR (V4L2_CID_PRIVATE_BASE + 20)
|
||||
#define V4L2_CID_FIMC_VERSION (V4L2_CID_PRIVATE_BASE + 21)
|
||||
/*
|
||||
* U S E R D E F I N E D T Y P E S
|
||||
*
|
||||
*/
|
||||
|
||||
typedef unsigned int dma_addr_t;
|
||||
|
||||
struct fimc_buf {
|
||||
dma_addr_t base[3];
|
||||
size_t length[3];
|
||||
};
|
||||
|
||||
struct fimc_buffer {
|
||||
void *virt_addr;
|
||||
void *phys_addr;
|
||||
size_t length;
|
||||
};
|
||||
|
||||
struct yuv_fmt_list {
|
||||
const char *name;
|
||||
const char *desc;
|
||||
unsigned int fmt;
|
||||
int bpp;
|
||||
int planes;
|
||||
};
|
||||
|
||||
struct img_offset {
|
||||
int y_h;
|
||||
int y_v;
|
||||
int cb_h;
|
||||
int cb_v;
|
||||
int cr_h;
|
||||
int cr_v;
|
||||
};
|
||||
|
||||
//------------ STRUCT ---------------------------------------------------------//
|
||||
|
||||
typedef struct
|
||||
{
|
||||
unsigned int full_width; // Source Image Full Width (Virtual screen size)
|
||||
unsigned int full_height; // Source Image Full Height (Virtual screen size)
|
||||
unsigned int start_x; // Source Image Start width offset
|
||||
unsigned int start_y; // Source Image Start height offset
|
||||
unsigned int width; // Source Image Width
|
||||
unsigned int height; // Source Image Height
|
||||
unsigned int buf_addr_phy_rgb_y; // Base Address of the Source Image (RGB or Y): Physical Address
|
||||
unsigned int buf_addr_phy_cb; // Base Address of the Source Image (CB Component) : Physical Address
|
||||
unsigned int buf_addr_phy_cr; // Base Address of the Source Image (CR Component) : Physical Address
|
||||
unsigned int color_space; // Color Space of the Source Image
|
||||
} s5p_fimc_img_info;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
s5p_fimc_img_info src;
|
||||
s5p_fimc_img_info dst;
|
||||
} s5p_fimc_params_t;
|
||||
|
||||
typedef struct _s5p_fimc_t {
|
||||
int dev_fd;
|
||||
struct fimc_buffer out_buf;
|
||||
|
||||
s5p_fimc_params_t params;
|
||||
|
||||
int use_ext_out_mem;
|
||||
unsigned int hw_ver;
|
||||
}s5p_fimc_t;
|
||||
|
||||
//------------------------ functions for v4l2 ------------------------------//
|
||||
int fimc_v4l2_set_src(int fd, unsigned int hw_ver, s5p_fimc_img_info *src);
|
||||
int fimc_v4l2_set_dst(int fd, s5p_fimc_img_info *dst, int rotation, unsigned int addr);
|
||||
int fimc_v4l2_stream_on(int fd, enum v4l2_buf_type type);
|
||||
int fimc_v4l2_queue(int fd, struct fimc_buf *fimc_buf);
|
||||
int fimc_v4l2_dequeue(int fd);
|
||||
int fimc_v4l2_stream_off(int fd);
|
||||
int fimc_v4l2_clr_buf(int fd);
|
||||
int fimc_handle_oneshot(int fd, struct fimc_buf *fimc_buf);
|
||||
#endif
|
||||
633
include/videodev2_samsung.h
Executable file
633
include/videodev2_samsung.h
Executable file
@@ -0,0 +1,633 @@
|
||||
/*
|
||||
* Video for Linux Two header file for samsung
|
||||
*
|
||||
* Copyright (C) 2009, Samsung Electronics
|
||||
*
|
||||
* This header file contains several v4l2 APIs to be proposed to v4l2
|
||||
* community and until bein accepted, will be used restrictly in Samsung's
|
||||
* camera interface driver FIMC.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Alternatively, Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_VIDEODEV2_SAMSUNG_H
|
||||
#define __LINUX_VIDEODEV2_SAMSUNG_H
|
||||
|
||||
/* Values for 'capabilities' field */
|
||||
/* Object detection device */
|
||||
#define V4L2_CAP_OBJ_RECOGNITION 0x10000000
|
||||
/* strobe control */
|
||||
#define V4L2_CAP_STROBE 0x20000000
|
||||
|
||||
#define V4L2_CID_FOCUS_MODE (V4L2_CID_CAMERA_CLASS_BASE + 17)
|
||||
/* Focus Methods */
|
||||
enum v4l2_focus_mode {
|
||||
V4L2_FOCUS_MODE_AUTO = 0,
|
||||
V4L2_FOCUS_MODE_MACRO = 1,
|
||||
V4L2_FOCUS_MODE_MANUAL = 2,
|
||||
V4L2_FOCUS_MODE_LASTP = 2,
|
||||
};
|
||||
|
||||
#define V4L2_CID_ZOOM_MODE (V4L2_CID_CAMERA_CLASS_BASE + 18)
|
||||
/* Zoom Methods */
|
||||
enum v4l2_zoom_mode {
|
||||
V4L2_ZOOM_MODE_CONTINUOUS = 0,
|
||||
V4L2_ZOOM_MODE_OPTICAL = 1,
|
||||
V4L2_ZOOM_MODE_DIGITAL = 2,
|
||||
V4L2_ZOOM_MODE_LASTP = 2,
|
||||
};
|
||||
|
||||
/* Exposure Methods */
|
||||
#define V4L2_CID_PHOTOMETRY (V4L2_CID_CAMERA_CLASS_BASE + 19)
|
||||
enum v4l2_photometry_mode {
|
||||
V4L2_PHOTOMETRY_MULTISEG = 0, /*Multi Segment */
|
||||
V4L2_PHOTOMETRY_CWA = 1, /*Centre Weighted Average */
|
||||
V4L2_PHOTOMETRY_SPOT = 2,
|
||||
V4L2_PHOTOMETRY_AFSPOT = 3, /*Spot metering on focused point */
|
||||
V4L2_PHOTOMETRY_LASTP = V4L2_PHOTOMETRY_AFSPOT,
|
||||
};
|
||||
|
||||
/* Manual exposure control items menu type: iris, shutter, iso */
|
||||
#define V4L2_CID_CAM_APERTURE (V4L2_CID_CAMERA_CLASS_BASE + 20)
|
||||
#define V4L2_CID_CAM_SHUTTER (V4L2_CID_CAMERA_CLASS_BASE + 21)
|
||||
#define V4L2_CID_CAM_ISO (V4L2_CID_CAMERA_CLASS_BASE + 22)
|
||||
|
||||
/* Following CIDs are menu type */
|
||||
#define V4L2_CID_SCENEMODE (V4L2_CID_CAMERA_CLASS_BASE + 23)
|
||||
#define V4L2_CID_CAM_STABILIZE (V4L2_CID_CAMERA_CLASS_BASE + 24)
|
||||
#define V4L2_CID_CAM_MULTISHOT (V4L2_CID_CAMERA_CLASS_BASE + 25)
|
||||
|
||||
/* Control dynamic range */
|
||||
#define V4L2_CID_CAM_DR (V4L2_CID_CAMERA_CLASS_BASE + 26)
|
||||
|
||||
/* White balance preset control */
|
||||
#define V4L2_CID_WHITE_BALANCE_PRESET (V4L2_CID_CAMERA_CLASS_BASE + 27)
|
||||
|
||||
/* CID extensions */
|
||||
#define V4L2_CID_ROTATION (V4L2_CID_PRIVATE_BASE + 0)
|
||||
#define V4L2_CID_PADDR_Y (V4L2_CID_PRIVATE_BASE + 1)
|
||||
#define V4L2_CID_PADDR_CB (V4L2_CID_PRIVATE_BASE + 2)
|
||||
#define V4L2_CID_PADDR_CR (V4L2_CID_PRIVATE_BASE + 3)
|
||||
#define V4L2_CID_PADDR_CBCR (V4L2_CID_PRIVATE_BASE + 4)
|
||||
#define V4L2_CID_OVERLAY_AUTO (V4L2_CID_PRIVATE_BASE + 5)
|
||||
#define V4L2_CID_OVERLAY_VADDR0 (V4L2_CID_PRIVATE_BASE + 6)
|
||||
#define V4L2_CID_OVERLAY_VADDR1 (V4L2_CID_PRIVATE_BASE + 7)
|
||||
#define V4L2_CID_OVERLAY_VADDR2 (V4L2_CID_PRIVATE_BASE + 8)
|
||||
#define V4L2_CID_OVLY_MODE (V4L2_CID_PRIVATE_BASE + 9)
|
||||
#define V4L2_CID_DST_INFO (V4L2_CID_PRIVATE_BASE + 10)
|
||||
#define V4L2_CID_IMAGE_EFFECT_FN (V4L2_CID_PRIVATE_BASE + 16)
|
||||
#define V4L2_CID_IMAGE_EFFECT_APPLY (V4L2_CID_PRIVATE_BASE + 17)
|
||||
#define V4L2_CID_IMAGE_EFFECT_CB (V4L2_CID_PRIVATE_BASE + 18)
|
||||
#define V4L2_CID_IMAGE_EFFECT_CR (V4L2_CID_PRIVATE_BASE + 19)
|
||||
#define V4L2_CID_RESERVED_MEM_BASE_ADDR (V4L2_CID_PRIVATE_BASE + 20)
|
||||
#define V4L2_CID_FIMC_VERSION (V4L2_CID_PRIVATE_BASE + 21)
|
||||
|
||||
#define V4L2_CID_STREAM_PAUSE (V4L2_CID_PRIVATE_BASE + 53)
|
||||
|
||||
/* CID Extensions for camera sensor operations */
|
||||
#define V4L2_CID_CAM_PREVIEW_ONOFF (V4L2_CID_PRIVATE_BASE + 64)
|
||||
#define V4L2_CID_CAM_CAPTURE (V4L2_CID_PRIVATE_BASE + 65)
|
||||
#define V4L2_CID_CAM_JPEG_MEMSIZE (V4L2_CID_PRIVATE_BASE + 66)
|
||||
|
||||
#define V4L2_CID_CAM_DATE_INFO_YEAR (V4L2_CID_PRIVATE_BASE + 14)
|
||||
#define V4L2_CID_CAM_DATE_INFO_MONTH (V4L2_CID_PRIVATE_BASE + 15)
|
||||
#define V4L2_CID_CAM_DATE_INFO_DATE (V4L2_CID_PRIVATE_BASE + 22)
|
||||
#define V4L2_CID_CAM_SENSOR_VER (V4L2_CID_PRIVATE_BASE + 23)
|
||||
#define V4L2_CID_CAM_FW_MINOR_VER (V4L2_CID_PRIVATE_BASE + 24)
|
||||
#define V4L2_CID_CAM_FW_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 25)
|
||||
#define V4L2_CID_CAM_PRM_MINOR_VER (V4L2_CID_PRIVATE_BASE + 26)
|
||||
#define V4L2_CID_CAM_PRM_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 27)
|
||||
#define V4L2_CID_CAM_FW_VER (V4L2_CID_PRIVATE_BASE + 28)
|
||||
#define V4L2_CID_CAM_SET_FW_ADDR (V4L2_CID_PRIVATE_BASE + 29)
|
||||
#define V4L2_CID_CAM_SET_FW_SIZE (V4L2_CID_PRIVATE_BASE + 30)
|
||||
#define V4L2_CID_CAM_UPDATE_FW (V4L2_CID_PRIVATE_BASE + 31)
|
||||
#define V4L2_CID_CAM_JPEG_MAIN_SIZE (V4L2_CID_PRIVATE_BASE + 32)
|
||||
#define V4L2_CID_CAM_JPEG_MAIN_OFFSET (V4L2_CID_PRIVATE_BASE + 33)
|
||||
#define V4L2_CID_CAM_JPEG_THUMB_SIZE (V4L2_CID_PRIVATE_BASE + 34)
|
||||
#define V4L2_CID_CAM_JPEG_THUMB_OFFSET (V4L2_CID_PRIVATE_BASE + 35)
|
||||
#define V4L2_CID_CAM_JPEG_POSTVIEW_OFFSET (V4L2_CID_PRIVATE_BASE + 36)
|
||||
#define V4L2_CID_CAM_JPEG_QUALITY (V4L2_CID_PRIVATE_BASE + 37)
|
||||
#define V4L2_CID_CAM_SENSOR_MAKER (V4L2_CID_PRIVATE_BASE + 38)
|
||||
#define V4L2_CID_CAM_SENSOR_OPTICAL (V4L2_CID_PRIVATE_BASE + 39)
|
||||
#define V4L2_CID_CAM_AF_VER_LOW (V4L2_CID_PRIVATE_BASE + 40)
|
||||
#define V4L2_CID_CAM_AF_VER_HIGH (V4L2_CID_PRIVATE_BASE + 41)
|
||||
#define V4L2_CID_CAM_GAMMA_RG_LOW (V4L2_CID_PRIVATE_BASE + 42)
|
||||
#define V4L2_CID_CAM_GAMMA_RG_HIGH (V4L2_CID_PRIVATE_BASE + 43)
|
||||
#define V4L2_CID_CAM_GAMMA_BG_LOW (V4L2_CID_PRIVATE_BASE + 44)
|
||||
#define V4L2_CID_CAM_GAMMA_BG_HIGH (V4L2_CID_PRIVATE_BASE + 45)
|
||||
#define V4L2_CID_CAM_DUMP_FW (V4L2_CID_PRIVATE_BASE + 46)
|
||||
#define V4L2_CID_CAM_GET_DUMP_SIZE (V4L2_CID_PRIVATE_BASE + 47)
|
||||
#define V4L2_CID_CAMERA_VT_MODE (V4L2_CID_PRIVATE_BASE + 48)
|
||||
#define V4L2_CID_CAMERA_VGA_BLUR (V4L2_CID_PRIVATE_BASE + 49)
|
||||
#define V4L2_CID_CAMERA_CAPTURE (V4L2_CID_PRIVATE_BASE + 50)
|
||||
|
||||
#define V4L2_CID_MAIN_SW_DATE_INFO_YEAR (V4L2_CID_PRIVATE_BASE + 54)
|
||||
#define V4L2_CID_MAIN_SW_DATE_INFO_MONTH (V4L2_CID_PRIVATE_BASE + 55)
|
||||
#define V4L2_CID_MAIN_SW_DATE_INFO_DATE (V4L2_CID_PRIVATE_BASE + 56)
|
||||
#define V4L2_CID_MAIN_SW_FW_MINOR_VER (V4L2_CID_PRIVATE_BASE + 57)
|
||||
#define V4L2_CID_MAIN_SW_FW_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 58)
|
||||
#define V4L2_CID_MAIN_SW_PRM_MINOR_VER (V4L2_CID_PRIVATE_BASE + 59)
|
||||
#define V4L2_CID_MAIN_SW_PRM_MAJOR_VER (V4L2_CID_PRIVATE_BASE + 60)
|
||||
|
||||
enum v4l2_blur {
|
||||
BLUR_LEVEL_0 = 0,
|
||||
BLUR_LEVEL_1,
|
||||
BLUR_LEVEL_2,
|
||||
BLUR_LEVEL_3,
|
||||
BLUR_LEVEL_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_SCENE_MODE (V4L2_CID_PRIVATE_BASE + 70)
|
||||
enum v4l2_scene_mode {
|
||||
SCENE_MODE_BASE,
|
||||
SCENE_MODE_NONE,
|
||||
SCENE_MODE_PORTRAIT,
|
||||
SCENE_MODE_NIGHTSHOT,
|
||||
SCENE_MODE_BACK_LIGHT,
|
||||
SCENE_MODE_LANDSCAPE,
|
||||
SCENE_MODE_SPORTS,
|
||||
SCENE_MODE_PARTY_INDOOR,
|
||||
SCENE_MODE_BEACH_SNOW,
|
||||
SCENE_MODE_SUNSET,
|
||||
SCENE_MODE_DUST_DAWN,
|
||||
SCENE_MODE_FALL_COLOR,
|
||||
SCENE_MODE_FIREWORKS,
|
||||
SCENE_MODE_TEXT,
|
||||
SCENE_MODE_CANDLE_LIGHT,
|
||||
SCENE_MODE_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_FLASH_MODE (V4L2_CID_PRIVATE_BASE + 71)
|
||||
enum v4l2_flash_mode {
|
||||
FLASH_MODE_BASE,
|
||||
FLASH_MODE_OFF,
|
||||
FLASH_MODE_AUTO,
|
||||
FLASH_MODE_ON,
|
||||
FLASH_MODE_TORCH,
|
||||
FLASH_MODE_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_BRIGHTNESS (V4L2_CID_PRIVATE_BASE + 72)
|
||||
enum v4l2_ev_mode {
|
||||
EV_MINUS_4 = 0,
|
||||
EV_MINUS_3,
|
||||
EV_MINUS_2,
|
||||
EV_MINUS_1,
|
||||
EV_DEFAULT,
|
||||
EV_PLUS_1,
|
||||
EV_PLUS_2,
|
||||
EV_PLUS_3,
|
||||
EV_PLUS_4,
|
||||
EV_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_WHITE_BALANCE (V4L2_CID_PRIVATE_BASE + 73)
|
||||
enum v4l2_wb_mode {
|
||||
WHITE_BALANCE_BASE = 0,
|
||||
WHITE_BALANCE_AUTO,
|
||||
WHITE_BALANCE_SUNNY,
|
||||
WHITE_BALANCE_CLOUDY,
|
||||
WHITE_BALANCE_TUNGSTEN,
|
||||
WHITE_BALANCE_FLUORESCENT,
|
||||
WHITE_BALANCE_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_EFFECT (V4L2_CID_PRIVATE_BASE + 74)
|
||||
enum v4l2_effect_mode {
|
||||
IMAGE_EFFECT_BASE = 0,
|
||||
IMAGE_EFFECT_NONE,
|
||||
IMAGE_EFFECT_BNW,
|
||||
IMAGE_EFFECT_SEPIA,
|
||||
IMAGE_EFFECT_AQUA,
|
||||
IMAGE_EFFECT_ANTIQUE,
|
||||
IMAGE_EFFECT_NEGATIVE,
|
||||
IMAGE_EFFECT_SHARPEN,
|
||||
IMAGE_EFFECT_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_ISO (V4L2_CID_PRIVATE_BASE + 75)
|
||||
enum v4l2_iso_mode {
|
||||
ISO_AUTO = 0,
|
||||
ISO_50,
|
||||
ISO_100,
|
||||
ISO_200,
|
||||
ISO_400,
|
||||
ISO_800,
|
||||
ISO_1600,
|
||||
ISO_SPORTS,
|
||||
ISO_NIGHT,
|
||||
ISO_MOVIE,
|
||||
ISO_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_METERING (V4L2_CID_PRIVATE_BASE + 76)
|
||||
enum v4l2_metering_mode {
|
||||
METERING_BASE = 0,
|
||||
METERING_MATRIX,
|
||||
METERING_CENTER,
|
||||
METERING_SPOT,
|
||||
METERING_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_CONTRAST (V4L2_CID_PRIVATE_BASE + 77)
|
||||
enum v4l2_contrast_mode {
|
||||
CONTRAST_MINUS_2 = 0,
|
||||
CONTRAST_MINUS_1,
|
||||
CONTRAST_DEFAULT,
|
||||
CONTRAST_PLUS_1,
|
||||
CONTRAST_PLUS_2,
|
||||
CONTRAST_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_SATURATION (V4L2_CID_PRIVATE_BASE + 78)
|
||||
enum v4l2_saturation_mode {
|
||||
SATURATION_MINUS_2 = 0,
|
||||
SATURATION_MINUS_1,
|
||||
SATURATION_DEFAULT,
|
||||
SATURATION_PLUS_1,
|
||||
SATURATION_PLUS_2,
|
||||
SATURATION_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_SHARPNESS (V4L2_CID_PRIVATE_BASE + 79)
|
||||
enum v4l2_sharpness_mode {
|
||||
SHARPNESS_MINUS_2 = 0,
|
||||
SHARPNESS_MINUS_1,
|
||||
SHARPNESS_DEFAULT,
|
||||
SHARPNESS_PLUS_1,
|
||||
SHARPNESS_PLUS_2,
|
||||
SHARPNESS_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_WDR (V4L2_CID_PRIVATE_BASE + 80)
|
||||
enum v4l2_wdr_mode {
|
||||
WDR_OFF,
|
||||
WDR_ON,
|
||||
WDR_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_ANTI_SHAKE (V4L2_CID_PRIVATE_BASE + 81)
|
||||
enum v4l2_anti_shake_mode {
|
||||
ANTI_SHAKE_OFF,
|
||||
ANTI_SHAKE_STILL_ON,
|
||||
ANTI_SHAKE_MOVIE_ON,
|
||||
ANTI_SHAKE_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_TOUCH_AF_START_STOP (V4L2_CID_PRIVATE_BASE + 82)
|
||||
enum v4l2_touch_af {
|
||||
TOUCH_AF_STOP = 0,
|
||||
TOUCH_AF_START,
|
||||
TOUCH_AF_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_SMART_AUTO (V4L2_CID_PRIVATE_BASE + 83)
|
||||
enum v4l2_smart_auto {
|
||||
SMART_AUTO_OFF = 0,
|
||||
SMART_AUTO_ON,
|
||||
SMART_AUTO_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_VINTAGE_MODE (V4L2_CID_PRIVATE_BASE + 84)
|
||||
enum v4l2_vintage_mode {
|
||||
VINTAGE_MODE_BASE,
|
||||
VINTAGE_MODE_OFF,
|
||||
VINTAGE_MODE_NORMAL,
|
||||
VINTAGE_MODE_WARM,
|
||||
VINTAGE_MODE_COOL,
|
||||
VINTAGE_MODE_BNW,
|
||||
VINTAGE_MODE_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_JPEG_QUALITY (V4L2_CID_PRIVATE_BASE + 85)
|
||||
#define V4L2_CID_CAMERA_GPS_LATITUDE (V4L2_CID_CAMERA_CLASS_BASE + 30)
|
||||
#define V4L2_CID_CAMERA_GPS_LONGITUDE (V4L2_CID_CAMERA_CLASS_BASE + 31)
|
||||
#define V4L2_CID_CAMERA_GPS_TIMESTAMP (V4L2_CID_CAMERA_CLASS_BASE + 32)
|
||||
#define V4L2_CID_CAMERA_GPS_ALTITUDE (V4L2_CID_CAMERA_CLASS_BASE + 33)
|
||||
#define V4L2_CID_CAMERA_EXIF_TIME_INFO (V4L2_CID_CAMERA_CLASS_BASE + 34)
|
||||
#define V4L2_CID_CAMERA_ZOOM (V4L2_CID_PRIVATE_BASE + 90)
|
||||
enum v4l2_zoom_level {
|
||||
ZOOM_LEVEL_0 = 0,
|
||||
ZOOM_LEVEL_1,
|
||||
ZOOM_LEVEL_2,
|
||||
ZOOM_LEVEL_3,
|
||||
ZOOM_LEVEL_4,
|
||||
ZOOM_LEVEL_5,
|
||||
ZOOM_LEVEL_6,
|
||||
ZOOM_LEVEL_7,
|
||||
ZOOM_LEVEL_8,
|
||||
ZOOM_LEVEL_9,
|
||||
ZOOM_LEVEL_10,
|
||||
ZOOM_LEVEL_11,
|
||||
ZOOM_LEVEL_12,
|
||||
ZOOM_LEVEL_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_FACE_DETECTION (V4L2_CID_PRIVATE_BASE + 91)
|
||||
enum v4l2_face_detection {
|
||||
FACE_DETECTION_OFF = 0,
|
||||
FACE_DETECTION_ON,
|
||||
FACE_DETECTION_NOLINE,
|
||||
FACE_DETECTION_ON_BEAUTY,
|
||||
FACE_DETECTION_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_SMART_AUTO_STATUS (V4L2_CID_PRIVATE_BASE + 92)
|
||||
enum v4l2_smart_auto_status {
|
||||
SMART_AUTO_STATUS_AUTO = 0,
|
||||
SMART_AUTO_STATUS_LANDSCAPE,
|
||||
SMART_AUTO_STATUS_PORTRAIT,
|
||||
SMART_AUTO_STATUS_MACRO,
|
||||
SMART_AUTO_STATUS_NIGHT,
|
||||
SMART_AUTO_STATUS_PORTRAIT_NIGHT,
|
||||
SMART_AUTO_STATUS_BACKLIT,
|
||||
SMART_AUTO_STATUS_PORTRAIT_BACKLIT,
|
||||
SMART_AUTO_STATUS_ANTISHAKE,
|
||||
SMART_AUTO_STATUS_PORTRAIT_ANTISHAKE,
|
||||
SMART_AUTO_STATUS_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_SET_AUTO_FOCUS (V4L2_CID_PRIVATE_BASE + 93)
|
||||
enum v4l2_auto_focus {
|
||||
AUTO_FOCUS_OFF = 0,
|
||||
AUTO_FOCUS_ON,
|
||||
AUTO_FOCUS_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_BEAUTY_SHOT (V4L2_CID_PRIVATE_BASE + 94)
|
||||
enum v4l2_beauty_shot {
|
||||
BEAUTY_SHOT_OFF = 0,
|
||||
BEAUTY_SHOT_ON,
|
||||
BEAUTY_SHOT_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_AEAWB_LOCK_UNLOCK (V4L2_CID_PRIVATE_BASE + 95)
|
||||
enum v4l2_ae_awb_lockunlock {
|
||||
AE_UNLOCK_AWB_UNLOCK = 0,
|
||||
AE_LOCK_AWB_UNLOCK,
|
||||
AE_UNLOCK_AWB_LOCK,
|
||||
AE_LOCK_AWB_LOCK,
|
||||
AE_AWB_MAX
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_FACEDETECT_LOCKUNLOCK (V4L2_CID_PRIVATE_BASE + 96)
|
||||
enum v4l2_face_lock {
|
||||
FACE_LOCK_OFF = 0,
|
||||
FACE_LOCK_ON,
|
||||
FIRST_FACE_TRACKING,
|
||||
FACE_LOCK_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_OBJECT_POSITION_X (V4L2_CID_PRIVATE_BASE + 97)
|
||||
#define V4L2_CID_CAMERA_OBJECT_POSITION_Y (V4L2_CID_PRIVATE_BASE + 98)
|
||||
#define V4L2_CID_CAMERA_FOCUS_MODE (V4L2_CID_PRIVATE_BASE + 99)
|
||||
enum v4l2_focusmode {
|
||||
FOCUS_MODE_AUTO = 0,
|
||||
FOCUS_MODE_MACRO,
|
||||
FOCUS_MODE_FACEDETECT,
|
||||
FOCUS_MODE_AUTO_DEFAULT,
|
||||
FOCUS_MODE_MACRO_DEFAULT,
|
||||
FOCUS_MODE_FACEDETECT_DEFAULT,
|
||||
FOCUS_MODE_INFINITY,
|
||||
FOCUS_MODE_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_OBJ_TRACKING_STATUS (V4L2_CID_PRIVATE_BASE + 100)
|
||||
enum v4l2_obj_tracking_status {
|
||||
OBJECT_TRACKING_STATUS_BASE,
|
||||
OBJECT_TRACKING_STATUS_PROGRESSING,
|
||||
OBJECT_TRACKING_STATUS_SUCCESS,
|
||||
OBJECT_TRACKING_STATUS_FAIL,
|
||||
OBJECT_TRACKING_STATUS_MISSING,
|
||||
OBJECT_TRACKING_STATUS_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_OBJ_TRACKING_START_STOP (V4L2_CID_PRIVATE_BASE + 101)
|
||||
enum v4l2_ot_start_stop {
|
||||
OT_STOP = 0,
|
||||
OT_START,
|
||||
OT_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_CAF_START_STOP (V4L2_CID_PRIVATE_BASE + 102)
|
||||
enum v4l2_caf_start_stop {
|
||||
CAF_STOP = 0,
|
||||
CAF_START,
|
||||
CAF_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_AUTO_FOCUS_RESULT (V4L2_CID_PRIVATE_BASE + 103)
|
||||
#define V4L2_CID_CAMERA_FRAME_RATE (V4L2_CID_PRIVATE_BASE + 104)
|
||||
enum v4l2_frame_rate {
|
||||
FRAME_RATE_AUTO = 0,
|
||||
FRAME_RATE_7 = 7,
|
||||
FRAME_RATE_15 = 15,
|
||||
FRAME_RATE_30 = 30,
|
||||
FRAME_RATE_60 = 60,
|
||||
FRAME_RATE_120 = 120,
|
||||
FRAME_RATE_MAX
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_ANTI_BANDING (V4L2_CID_PRIVATE_BASE + 105)
|
||||
enum v4l2_anti_banding {
|
||||
ANTI_BANDING_AUTO = 0,
|
||||
ANTI_BANDING_50HZ = 1,
|
||||
ANTI_BANDING_60HZ = 2,
|
||||
ANTI_BANDING_OFF = 3,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_SET_GAMMA (V4L2_CID_PRIVATE_BASE + 106)
|
||||
enum v4l2_gamma_mode {
|
||||
GAMMA_OFF = 0,
|
||||
GAMMA_ON = 1,
|
||||
GAMMA_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_SET_SLOW_AE (V4L2_CID_PRIVATE_BASE + 107)
|
||||
enum v4l2_slow_ae_mode {
|
||||
SLOW_AE_OFF,
|
||||
SLOW_AE_ON,
|
||||
SLOW_AE_MAX,
|
||||
};
|
||||
|
||||
#define V4L2_CID_CAMERA_BATCH_REFLECTION (V4L2_CID_PRIVATE_BASE + 108)
|
||||
#define V4L2_CID_CAMERA_EXIF_ORIENTATION (V4L2_CID_PRIVATE_BASE + 109)
|
||||
|
||||
#define V4L2_CID_CAMERA_RESET (V4L2_CID_PRIVATE_BASE + 111)
|
||||
#define V4L2_CID_CAMERA_CHECK_DATALINE (V4L2_CID_PRIVATE_BASE + 112)
|
||||
#define V4L2_CID_CAMERA_CHECK_DATALINE_STOP (V4L2_CID_PRIVATE_BASE + 113)
|
||||
#define V4L2_CID_CAMERA_GET_ISO (V4L2_CID_PRIVATE_BASE + 114)
|
||||
#define V4L2_CID_CAMERA_GET_SHT_TIME (V4L2_CID_PRIVATE_BASE + 115)
|
||||
#define V4L2_CID_CAMERA_SENSOR_MODE (V4L2_CID_PRIVATE_BASE + 116)
|
||||
#define V4L2_CID_ESD_INT (V4L2_CID_PRIVATE_BASE + 117)
|
||||
#define V4L2_CID_CAMERA_GET_FLASH_ONOFF (V4L2_CID_PRIVATE_BASE + 118)
|
||||
#define V4L2_CID_CAMERA_RETURN_FOCUS (V4L2_CID_PRIVATE_BASE + 119)
|
||||
|
||||
/* Pixel format FOURCC depth Description */
|
||||
/* 12 Y/CbCr 4:2:0 64x32 macroblocks */
|
||||
#define V4L2_PIX_FMT_NV12T v4l2_fourcc('T', 'V', '1', '2')
|
||||
|
||||
/*
|
||||
* * V4L2 extention for digital camera
|
||||
* */
|
||||
/* Strobe flash light */
|
||||
enum v4l2_strobe_control {
|
||||
/* turn off the flash light */
|
||||
V4L2_STROBE_CONTROL_OFF = 0,
|
||||
/* turn on the flash light */
|
||||
V4L2_STROBE_CONTROL_ON = 1,
|
||||
/* act guide light before splash */
|
||||
V4L2_STROBE_CONTROL_AFGUIDE = 2,
|
||||
/* charge the flash light */
|
||||
V4L2_STROBE_CONTROL_CHARGE = 3,
|
||||
};
|
||||
|
||||
enum v4l2_strobe_conf {
|
||||
V4L2_STROBE_OFF = 0, /* Always off */
|
||||
V4L2_STROBE_ON = 1, /* Always splashes */
|
||||
/* Auto control presets */
|
||||
V4L2_STROBE_AUTO = 2,
|
||||
V4L2_STROBE_REDEYE_REDUCTION = 3,
|
||||
V4L2_STROBE_SLOW_SYNC = 4,
|
||||
V4L2_STROBE_FRONT_CURTAIN = 5,
|
||||
V4L2_STROBE_REAR_CURTAIN = 6,
|
||||
/* Extra manual control presets */
|
||||
/* keep turned on until turning off */
|
||||
V4L2_STROBE_PERMANENT = 7,
|
||||
V4L2_STROBE_EXTERNAL = 8,
|
||||
};
|
||||
|
||||
enum v4l2_strobe_status {
|
||||
V4L2_STROBE_STATUS_OFF = 0,
|
||||
/* while processing configurations */
|
||||
V4L2_STROBE_STATUS_BUSY = 1,
|
||||
V4L2_STROBE_STATUS_ERR = 2,
|
||||
V4L2_STROBE_STATUS_CHARGING = 3,
|
||||
V4L2_STROBE_STATUS_CHARGED = 4,
|
||||
};
|
||||
|
||||
/* capabilities field */
|
||||
/* No strobe supported */
|
||||
#define V4L2_STROBE_CAP_NONE 0x0000
|
||||
/* Always flash off mode */
|
||||
#define V4L2_STROBE_CAP_OFF 0x0001
|
||||
/* Always use flash light mode */
|
||||
#define V4L2_STROBE_CAP_ON 0x0002
|
||||
/* Flashlight works automatic */
|
||||
#define V4L2_STROBE_CAP_AUTO 0x0004
|
||||
/* Red-eye reduction */
|
||||
#define V4L2_STROBE_CAP_REDEYE 0x0008
|
||||
/* Slow sync */
|
||||
#define V4L2_STROBE_CAP_SLOWSYNC 0x0010
|
||||
/* Front curtain */
|
||||
#define V4L2_STROBE_CAP_FRONT_CURTAIN 0x0020
|
||||
/* Rear curtain */
|
||||
#define V4L2_STROBE_CAP_REAR_CURTAIN 0x0040
|
||||
/* keep turned on until turning off */
|
||||
#define V4L2_STROBE_CAP_PERMANENT 0x0080
|
||||
/* use external strobe */
|
||||
#define V4L2_STROBE_CAP_EXTERNAL 0x0100
|
||||
|
||||
/* Set mode and Get status */
|
||||
struct v4l2_strobe {
|
||||
/* off/on/charge:0/1/2 */
|
||||
enum v4l2_strobe_control control;
|
||||
/* supported strobe capabilities */
|
||||
__u32 capabilities;
|
||||
enum v4l2_strobe_conf mode;
|
||||
enum v4l2_strobe_status status; /* read only */
|
||||
/* default is 0 and range of value varies from each models */
|
||||
__u32 flash_ev;
|
||||
__u32 reserved[4];
|
||||
};
|
||||
|
||||
#define VIDIOC_S_STROBE _IOWR('V', 83, struct v4l2_strobe)
|
||||
#define VIDIOC_G_STROBE _IOR('V', 84, struct v4l2_strobe)
|
||||
|
||||
/* Object recognition and collateral actions */
|
||||
enum v4l2_recog_mode {
|
||||
V4L2_RECOGNITION_MODE_OFF = 0,
|
||||
V4L2_RECOGNITION_MODE_ON = 1,
|
||||
V4L2_RECOGNITION_MODE_LOCK = 2,
|
||||
};
|
||||
|
||||
enum v4l2_recog_action {
|
||||
V4L2_RECOGNITION_ACTION_NONE = 0, /* only recognition */
|
||||
V4L2_RECOGNITION_ACTION_BLINK = 1, /* Capture on blinking */
|
||||
V4L2_RECOGNITION_ACTION_SMILE = 2, /* Capture on smiling */
|
||||
};
|
||||
|
||||
enum v4l2_recog_pattern {
|
||||
V4L2_RECOG_PATTERN_FACE = 0, /* Face */
|
||||
V4L2_RECOG_PATTERN_HUMAN = 1, /* Human */
|
||||
V4L2_RECOG_PATTERN_CHAR = 2, /* Character */
|
||||
};
|
||||
|
||||
struct v4l2_recog_rect {
|
||||
enum v4l2_recog_pattern p; /* detected pattern */
|
||||
struct v4l2_rect o; /* detected area */
|
||||
__u32 reserved[4];
|
||||
};
|
||||
|
||||
struct v4l2_recog_data {
|
||||
__u8 detect_cnt; /* detected object counter */
|
||||
struct v4l2_rect o; /* detected area */
|
||||
__u32 reserved[4];
|
||||
};
|
||||
|
||||
struct v4l2_recognition {
|
||||
enum v4l2_recog_mode mode;
|
||||
|
||||
/* Which pattern to detect */
|
||||
enum v4l2_recog_pattern pattern;
|
||||
|
||||
/* How many object to detect */
|
||||
__u8 obj_num;
|
||||
|
||||
/* select detected object */
|
||||
__u32 detect_idx;
|
||||
|
||||
/* read only :Get object coordination */
|
||||
struct v4l2_recog_data data;
|
||||
|
||||
enum v4l2_recog_action action;
|
||||
__u32 reserved[4];
|
||||
};
|
||||
|
||||
#define VIDIOC_S_RECOGNITION _IOWR('V', 85, struct v4l2_recognition)
|
||||
#define VIDIOC_G_RECOGNITION _IOR('V', 86, struct v4l2_recognition)
|
||||
|
||||
/* We use this struct as the v4l2_streamparm raw_data for
|
||||
* VIDIOC_G_PARM and VIDIOC_S_PARM
|
||||
*/
|
||||
struct sec_cam_parm {
|
||||
struct v4l2_captureparm capture;
|
||||
int contrast;
|
||||
int effects;
|
||||
int brightness;
|
||||
int flash_mode;
|
||||
int focus_mode;
|
||||
int iso;
|
||||
int metering;
|
||||
int saturation;
|
||||
int scene_mode;
|
||||
int sharpness;
|
||||
int white_balance;
|
||||
};
|
||||
|
||||
#endif /* __LINUX_VIDEODEV2_SAMSUNG_H */
|
||||
46
libexifa/Android.mk
Executable file
46
libexifa/Android.mk
Executable file
@@ -0,0 +1,46 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_PRELINK_MODULE:=false
|
||||
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)\
|
||||
$(LOCAL_PATH)/libexif/\
|
||||
$(LOCAL_PATH)/libexif/canon/\
|
||||
$(LOCAL_PATH)/libexif/fuji/\
|
||||
$(LOCAL_PATH)/libexif/olympus/\
|
||||
$(LOCAL_PATH)/libexif/pentax/
|
||||
|
||||
LOCAL_SRC_FILES:=\
|
||||
canon/exif-mnote-data-canon.c\
|
||||
canon/mnote-canon-tag.c\
|
||||
canon/mnote-canon-entry.c\
|
||||
pentax/mnote-pentax-tag.c\
|
||||
pentax/mnote-pentax-entry.c\
|
||||
pentax/exif-mnote-data-pentax.c\
|
||||
exif-loader.c\
|
||||
exif-byte-order.c\
|
||||
exif-content.c\
|
||||
exif-log.c\
|
||||
exif-mem.c\
|
||||
olympus/mnote-olympus-tag.c\
|
||||
olympus/mnote-olympus-entry.c\
|
||||
olympus/exif-mnote-data-olympus.c\
|
||||
exif-format.c\
|
||||
exif-utils.c\
|
||||
exif-entry.c\
|
||||
exif-ifd.c\
|
||||
exif-data.c\
|
||||
exif-tag.c\
|
||||
fuji/mnote-fuji-tag.c\
|
||||
fuji/mnote-fuji-entry.c\
|
||||
fuji/exif-mnote-data-fuji.c\
|
||||
exif-mnote-data.c
|
||||
|
||||
#LOCAL_CFLAGS:=-O2 -g
|
||||
#LOCAL_CFLAGS+=-DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -Dlinux -D__GLIBC__ -D_GNU_SOURCE
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_MODULE:= libexifa
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
0
libexifa/MODULE_LICENSE_LGPL
Executable file
0
libexifa/MODULE_LICENSE_LGPL
Executable file
504
libexifa/NOTICE
Executable file
504
libexifa/NOTICE
Executable file
@@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
389
libexifa/canon/exif-mnote-data-canon.c
Executable file
389
libexifa/canon/exif-mnote-data-canon.c
Executable file
@@ -0,0 +1,389 @@
|
||||
/* exif-mnote-data-canon.c
|
||||
*
|
||||
* Copyright (c) 2002, 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
* Copyright (c) 2003 Matthieu Castet <mat-c@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "exif-mnote-data-canon.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-utils.h>
|
||||
#include <libexif/exif-data.h>
|
||||
|
||||
#define DEBUG
|
||||
|
||||
static void
|
||||
exif_mnote_data_canon_clear (ExifMnoteDataCanon *n)
|
||||
{
|
||||
ExifMnoteData *d = (ExifMnoteData *) n;
|
||||
unsigned int i;
|
||||
|
||||
if (!n) return;
|
||||
|
||||
if (n->entries) {
|
||||
for (i = 0; i < n->count; i++)
|
||||
if (n->entries[i].data) {
|
||||
exif_mem_free (d->mem, n->entries[i].data);
|
||||
n->entries[i].data = NULL;
|
||||
}
|
||||
exif_mem_free (d->mem, n->entries);
|
||||
n->entries = NULL;
|
||||
n->count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_canon_free (ExifMnoteData *n)
|
||||
{
|
||||
if (!n) return;
|
||||
|
||||
exif_mnote_data_canon_clear ((ExifMnoteDataCanon *) n);
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_canon_get_tags (ExifMnoteDataCanon *dc, unsigned int n,
|
||||
unsigned int *m, unsigned int *s)
|
||||
{
|
||||
unsigned int from = 0, to;
|
||||
|
||||
if (!dc || !m) return;
|
||||
for (*m = 0; *m < dc->count; (*m)++) {
|
||||
to = from + mnote_canon_entry_count_values (&dc->entries[*m]);
|
||||
if (to > n) {
|
||||
if (s) *s = n - from;
|
||||
break;
|
||||
}
|
||||
from = to;
|
||||
}
|
||||
}
|
||||
|
||||
static char *
|
||||
exif_mnote_data_canon_get_value (ExifMnoteData *note, unsigned int n, char *val, unsigned int maxlen)
|
||||
{
|
||||
ExifMnoteDataCanon *dc = (ExifMnoteDataCanon *) note;
|
||||
unsigned int m, s;
|
||||
|
||||
if (!dc) return NULL;
|
||||
exif_mnote_data_canon_get_tags (dc, n, &m, &s);
|
||||
if (m >= dc->count) return NULL;
|
||||
return mnote_canon_entry_get_value (&dc->entries[m], s, val, maxlen);
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_canon_set_byte_order (ExifMnoteData *d, ExifByteOrder o)
|
||||
{
|
||||
ExifByteOrder o_orig;
|
||||
ExifMnoteDataCanon *n = (ExifMnoteDataCanon *) d;
|
||||
unsigned int i;
|
||||
|
||||
if (!n) return;
|
||||
|
||||
o_orig = n->order;
|
||||
n->order = o;
|
||||
for (i = 0; i < n->count; i++) {
|
||||
n->entries[i].order = o;
|
||||
exif_array_set_byte_order (n->entries[i].format, n->entries[i].data,
|
||||
n->entries[i].components, o_orig, o);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_canon_set_offset (ExifMnoteData *n, unsigned int o)
|
||||
{
|
||||
if (n) ((ExifMnoteDataCanon *) n)->offset = o;
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_canon_save (ExifMnoteData *ne,
|
||||
unsigned char **buf, unsigned int *buf_size)
|
||||
{
|
||||
ExifMnoteDataCanon *n = (ExifMnoteDataCanon *) ne;
|
||||
size_t i, o, s, doff;
|
||||
unsigned char *t;
|
||||
size_t ts;
|
||||
|
||||
if (!n || !buf || !buf_size) return;
|
||||
|
||||
/*
|
||||
* Allocate enough memory for all entries and the number
|
||||
* of entries.
|
||||
*/
|
||||
*buf_size = 2 + n->count * 12 + 4;
|
||||
*buf = exif_mem_alloc (ne->mem, sizeof (char) * *buf_size);
|
||||
if (!*buf) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteCanon", *buf_size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Save the number of entries */
|
||||
exif_set_short (*buf, n->order, (ExifShort) n->count);
|
||||
|
||||
/* Save each entry */
|
||||
for (i = 0; i < n->count; i++) {
|
||||
o = 2 + i * 12;
|
||||
exif_set_short (*buf + o + 0, n->order, (ExifShort) n->entries[i].tag);
|
||||
exif_set_short (*buf + o + 2, n->order, (ExifShort) n->entries[i].format);
|
||||
exif_set_long (*buf + o + 4, n->order,
|
||||
n->entries[i].components);
|
||||
o += 8;
|
||||
s = exif_format_get_size (n->entries[i].format) *
|
||||
n->entries[i].components;
|
||||
if (s > 65536) {
|
||||
/* Corrupt data: EXIF data size is limited to the
|
||||
* maximum size of a JPEG segment (64 kb).
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
if (s > 4) {
|
||||
ts = *buf_size + s;
|
||||
|
||||
/* Ensure even offsets. Set padding bytes to 0. */
|
||||
if (s & 1) ts += 1;
|
||||
t = exif_mem_realloc (ne->mem, *buf,
|
||||
sizeof (char) * ts);
|
||||
if (!t) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteCanon", ts);
|
||||
return;
|
||||
}
|
||||
*buf = t;
|
||||
*buf_size = ts;
|
||||
doff = *buf_size - s;
|
||||
if (s & 1) { doff--; *(*buf + *buf_size - 1) = '\0'; }
|
||||
exif_set_long (*buf + o, n->order, n->offset + doff);
|
||||
} else
|
||||
doff = o;
|
||||
|
||||
/*
|
||||
* Write the data. Fill unneeded bytes with 0. Do not
|
||||
* crash if data is NULL.
|
||||
*/
|
||||
if (!n->entries[i].data) memset (*buf + doff, 0, s);
|
||||
else memcpy (*buf + doff, n->entries[i].data, s);
|
||||
if (s < 4) memset (*buf + doff + s, 0, (4 - s));
|
||||
}
|
||||
}
|
||||
|
||||
/* XXX
|
||||
* FIXME: exif_mnote_data_canon_load() may fail and there is no
|
||||
* semantics to express that.
|
||||
* See bug #1054323 for details, especially the comment by liblit
|
||||
* after it has supposedly been fixed:
|
||||
*
|
||||
* https://sourceforge.net/tracker/?func=detail&aid=1054323&group_id=12272&atid=112272
|
||||
* Unfortunately, the "return" statements aren't commented at
|
||||
* all, so it isn't trivial to find out what is a normal
|
||||
* return, and what is a reaction to an error condition.
|
||||
*/
|
||||
|
||||
static void
|
||||
exif_mnote_data_canon_load (ExifMnoteData *ne,
|
||||
const unsigned char *buf, unsigned int buf_size)
|
||||
{
|
||||
ExifMnoteDataCanon *n = (ExifMnoteDataCanon *) ne;
|
||||
ExifShort c;
|
||||
size_t i, tcount, o, datao;
|
||||
|
||||
if (!n || !buf || !buf_size) {
|
||||
exif_log (ne->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteCanon", "Short MakerNote");
|
||||
return;
|
||||
}
|
||||
datao = 6 + n->offset;
|
||||
if ((datao + 2 < datao) || (datao + 2 < 2) || (datao + 2 > buf_size)) {
|
||||
exif_log (ne->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteCanon", "Short MakerNote");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Read the number of tags */
|
||||
c = exif_get_short (buf + datao, n->order);
|
||||
datao += 2;
|
||||
|
||||
/* Remove any old entries */
|
||||
exif_mnote_data_canon_clear (n);
|
||||
|
||||
/* Reserve enough space for all the possible MakerNote tags */
|
||||
n->entries = exif_mem_alloc (ne->mem, sizeof (MnoteCanonEntry) * c);
|
||||
if (!n->entries) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteCanon", sizeof (MnoteCanonEntry) * c);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Parse the entries */
|
||||
tcount = 0;
|
||||
for (i = c, o = datao; i; --i, o += 12) {
|
||||
size_t s;
|
||||
if ((o + 12 < o) || (o + 12 < 12) || (o + 12 > buf_size)) {
|
||||
exif_log (ne->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteCanon", "Short MakerNote");
|
||||
break;
|
||||
}
|
||||
|
||||
n->entries[tcount].tag = exif_get_short (buf + o, n->order);
|
||||
n->entries[tcount].format = exif_get_short (buf + o + 2, n->order);
|
||||
n->entries[tcount].components = exif_get_long (buf + o + 4, n->order);
|
||||
n->entries[tcount].order = n->order;
|
||||
|
||||
exif_log (ne->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteCanon",
|
||||
"Loading entry 0x%x ('%s')...", n->entries[tcount].tag,
|
||||
mnote_canon_tag_get_name (n->entries[tcount].tag));
|
||||
|
||||
/*
|
||||
* Size? If bigger than 4 bytes, the actual data is not
|
||||
* in the entry but somewhere else (offset).
|
||||
*/
|
||||
s = exif_format_get_size (n->entries[tcount].format) *
|
||||
n->entries[tcount].components;
|
||||
n->entries[tcount].size = s;
|
||||
if (!s) {
|
||||
exif_log (ne->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteCanon",
|
||||
"Invalid zero-length tag size");
|
||||
continue;
|
||||
|
||||
} else {
|
||||
size_t dataofs = o + 8;
|
||||
if (s > 4) dataofs = exif_get_long (buf + dataofs, n->order) + 6;
|
||||
if ((dataofs + s < s) || (dataofs + s < dataofs) || (dataofs + s > buf_size)) {
|
||||
exif_log (ne->log, EXIF_LOG_CODE_DEBUG,
|
||||
"ExifMnoteCanon",
|
||||
"Tag data past end of buffer (%u > %u)",
|
||||
dataofs + s, buf_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
n->entries[tcount].data = exif_mem_alloc (ne->mem, s);
|
||||
if (!n->entries[tcount].data) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteCanon", s);
|
||||
continue;
|
||||
}
|
||||
memcpy (n->entries[tcount].data, buf + dataofs, s);
|
||||
}
|
||||
|
||||
/* Tag was successfully parsed */
|
||||
++tcount;
|
||||
}
|
||||
/* Store the count of successfully parsed tags */
|
||||
n->count = tcount;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
exif_mnote_data_canon_count (ExifMnoteData *n)
|
||||
{
|
||||
ExifMnoteDataCanon *dc = (ExifMnoteDataCanon *) n;
|
||||
unsigned int i, c;
|
||||
|
||||
for (i = c = 0; dc && (i < dc->count); i++)
|
||||
c += mnote_canon_entry_count_values (&dc->entries[i]);
|
||||
return c;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
exif_mnote_data_canon_get_id (ExifMnoteData *d, unsigned int i)
|
||||
{
|
||||
ExifMnoteDataCanon *dc = (ExifMnoteDataCanon *) d;
|
||||
unsigned int m;
|
||||
|
||||
if (!dc) return 0;
|
||||
exif_mnote_data_canon_get_tags (dc, i, &m, NULL);
|
||||
if (m >= dc->count) return 0;
|
||||
return dc->entries[m].tag;
|
||||
}
|
||||
|
||||
static const char *
|
||||
exif_mnote_data_canon_get_name (ExifMnoteData *note, unsigned int i)
|
||||
{
|
||||
ExifMnoteDataCanon *dc = (ExifMnoteDataCanon *) note;
|
||||
unsigned int m, s;
|
||||
|
||||
if (!dc) return NULL;
|
||||
exif_mnote_data_canon_get_tags (dc, i, &m, &s);
|
||||
if (m >= dc->count) return NULL;
|
||||
return mnote_canon_tag_get_name_sub (dc->entries[m].tag, s, dc->options);
|
||||
}
|
||||
|
||||
static const char *
|
||||
exif_mnote_data_canon_get_title (ExifMnoteData *note, unsigned int i)
|
||||
{
|
||||
ExifMnoteDataCanon *dc = (ExifMnoteDataCanon *) note;
|
||||
unsigned int m, s;
|
||||
|
||||
if (!dc) return NULL;
|
||||
exif_mnote_data_canon_get_tags (dc, i, &m, &s);
|
||||
if (m >= dc->count) return NULL;
|
||||
return mnote_canon_tag_get_title_sub (dc->entries[m].tag, s, dc->options);
|
||||
}
|
||||
|
||||
static const char *
|
||||
exif_mnote_data_canon_get_description (ExifMnoteData *note, unsigned int i)
|
||||
{
|
||||
ExifMnoteDataCanon *dc = (ExifMnoteDataCanon *) note;
|
||||
unsigned int m;
|
||||
|
||||
if (!dc) return NULL;
|
||||
exif_mnote_data_canon_get_tags (dc, i, &m, NULL);
|
||||
if (m >= dc->count) return NULL;
|
||||
return mnote_canon_tag_get_description (dc->entries[m].tag);
|
||||
}
|
||||
|
||||
int
|
||||
exif_mnote_data_canon_identify (const ExifData *ed, const ExifEntry *e)
|
||||
{
|
||||
char value[8];
|
||||
ExifEntry *em = exif_data_get_entry (ed, EXIF_TAG_MAKE);
|
||||
if (!em)
|
||||
return 0;
|
||||
return !strcmp (exif_entry_get_value (em, value, sizeof (value)), "Canon");
|
||||
}
|
||||
|
||||
ExifMnoteData *
|
||||
exif_mnote_data_canon_new (ExifMem *mem, ExifDataOption o)
|
||||
{
|
||||
ExifMnoteData *d;
|
||||
ExifMnoteDataCanon *dc;
|
||||
|
||||
if (!mem) return NULL;
|
||||
|
||||
d = exif_mem_alloc (mem, sizeof (ExifMnoteDataCanon));
|
||||
if (!d)
|
||||
return NULL;
|
||||
|
||||
exif_mnote_data_construct (d, mem);
|
||||
|
||||
/* Set up function pointers */
|
||||
d->methods.free = exif_mnote_data_canon_free;
|
||||
d->methods.set_byte_order = exif_mnote_data_canon_set_byte_order;
|
||||
d->methods.set_offset = exif_mnote_data_canon_set_offset;
|
||||
d->methods.load = exif_mnote_data_canon_load;
|
||||
d->methods.save = exif_mnote_data_canon_save;
|
||||
d->methods.count = exif_mnote_data_canon_count;
|
||||
d->methods.get_id = exif_mnote_data_canon_get_id;
|
||||
d->methods.get_name = exif_mnote_data_canon_get_name;
|
||||
d->methods.get_title = exif_mnote_data_canon_get_title;
|
||||
d->methods.get_description = exif_mnote_data_canon_get_description;
|
||||
d->methods.get_value = exif_mnote_data_canon_get_value;
|
||||
|
||||
dc = (ExifMnoteDataCanon*)d;
|
||||
dc->options = o;
|
||||
return d;
|
||||
}
|
||||
759
libexifa/canon/mnote-canon-entry.c
Executable file
759
libexifa/canon/mnote-canon-entry.c
Executable file
@@ -0,0 +1,759 @@
|
||||
/* mnote-canon-entry.c
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
* Copyright (c) 2003 Matthieu Castet <mat-c@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "mnote-canon-entry.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/exif-utils.h>
|
||||
#include <libexif/i18n.h>
|
||||
|
||||
/* #define DEBUG */
|
||||
|
||||
#define CF(format,target,v,maxlen) \
|
||||
{ \
|
||||
if (format != target) { \
|
||||
snprintf (v, maxlen, \
|
||||
_("Invalid format '%s', " \
|
||||
"expected '%s'."), \
|
||||
exif_format_get_name (format), \
|
||||
exif_format_get_name (target)); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CC(number,target,v,maxlen) \
|
||||
{ \
|
||||
if (number != target) { \
|
||||
snprintf (v, maxlen, \
|
||||
_("Invalid number of components (%i, " \
|
||||
"expected %i)."), (int) number, (int) target); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
#define CC2(number,t1,t2,v,maxlen) \
|
||||
{ \
|
||||
if ((number != t1) && (number != t2)) { \
|
||||
snprintf (v, maxlen, \
|
||||
_("Invalid number of components (%i, " \
|
||||
"expected %i or %i)."), (int) number, \
|
||||
(int) t1, (int) t2); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define UNDEFINED 0xFF
|
||||
|
||||
static const struct canon_entry_table_t {
|
||||
unsigned int subtag;
|
||||
ExifShort value;
|
||||
const char *name;
|
||||
} entries_settings_1 [] = {
|
||||
#ifndef NO_VERBOSE_TAG_DATA
|
||||
{ 0, 1, N_("Macro")},
|
||||
{ 0, 2, N_("Normal")},
|
||||
{ 2, 1, N_("Economy")},
|
||||
{ 2, 2, N_("Normal")},
|
||||
{ 2, 3, N_("Fine")},
|
||||
{ 2, 4, N_("RAW")},
|
||||
{ 2, 5, N_("Superfine")},
|
||||
{ 3, 0, N_("Off")},
|
||||
{ 3, 1, N_("Auto")},
|
||||
{ 3, 2, N_("On")},
|
||||
{ 3, 3, N_("Red-eye reduction")},
|
||||
{ 3, 4, N_("Slow synchro")},
|
||||
{ 3, 5, N_("Auto, red-eye reduction")},
|
||||
{ 3, 6, N_("On, red-eye reduction")},
|
||||
{ 3, 16, N_("External flash")},
|
||||
{ 4, 0, N_("Single")},
|
||||
{ 4, 1, N_("Continuous")},
|
||||
{ 4, 2, N_("Movie")},
|
||||
{ 4, 3, N_("Continuous, speed priority")},
|
||||
{ 4, 4, N_("Continuous, low")},
|
||||
{ 4, 5, N_("Continuous, high")},
|
||||
{ 6, 0, N_("One-shot AF")},
|
||||
{ 6, 1, N_("AI servo AF")},
|
||||
{ 6, 2, N_("AI focus AF")},
|
||||
{ 6, 3, N_("Manual focus")},
|
||||
{ 6, 4, N_("Single")},
|
||||
{ 6, 5, N_("Continuous")},
|
||||
{ 6, 6, N_("Manual focus")},
|
||||
{ 6, 16, N_("Pan focus")},
|
||||
{ 8, 1, N_("JPEG")},
|
||||
{ 8, 2, N_("CRW+THM")},
|
||||
{ 8, 3, N_("AVI+THM")},
|
||||
{ 8, 4, N_("TIF")},
|
||||
{ 8, 5, N_("TIF+JPEG")},
|
||||
{ 8, 6, N_("CR2")},
|
||||
{ 8, 7, N_("CR2+JPEG")},
|
||||
{ 9, 0, N_("Large")},
|
||||
{ 9, 1, N_("Medium")},
|
||||
{ 9, 2, N_("Small")},
|
||||
{ 9, 5, N_("Medium 1")},
|
||||
{ 9, 6, N_("Medium 2")},
|
||||
{ 9, 7, N_("Medium 3")},
|
||||
{ 9, 8, N_("Postcard")},
|
||||
{ 9, 9, N_("Widescreen")},
|
||||
{10, 0, N_("Full auto")},
|
||||
{10, 1, N_("Manual")},
|
||||
{10, 2, N_("Landscape")},
|
||||
{10, 3, N_("Fast shutter")},
|
||||
{10, 4, N_("Slow shutter")},
|
||||
{10, 5, N_("Night")},
|
||||
{10, 6, N_("Grayscale")},
|
||||
{10, 7, N_("Sepia")},
|
||||
{10, 8, N_("Portrait")},
|
||||
{10, 9, N_("Sports")},
|
||||
{10, 10, N_("Macro")},
|
||||
{10, 11, N_("Black & white")},
|
||||
{10, 12, N_("Pan focus")},
|
||||
{10, 13, N_("Vivid")},
|
||||
{10, 14, N_("Neutral")},
|
||||
{10, 15, N_("Flash off")},
|
||||
{10, 16, N_("Long shutter")},
|
||||
{10, 17, N_("Super macro")},
|
||||
{10, 18, N_("Foliage")},
|
||||
{10, 19, N_("Indoor")},
|
||||
{10, 20, N_("Fireworks")},
|
||||
{10, 21, N_("Beach")},
|
||||
{10, 22, N_("Underwater")},
|
||||
{10, 23, N_("Snow")},
|
||||
{10, 24, N_("Kids & pets")},
|
||||
{10, 25, N_("Night snapshot")},
|
||||
{10, 26, N_("Digital macro")},
|
||||
{10, 27, N_("My colors")},
|
||||
{10, 28, N_("Still image")},
|
||||
{10, 30, N_("Color accent")},
|
||||
{10, 31, N_("Color swap")},
|
||||
{10, 32, N_("Aquarium")},
|
||||
{10, 33, N_("ISO 3200")},
|
||||
{11, 0, N_("None")},
|
||||
{11, 1, N_("2x")},
|
||||
{11, 2, N_("4x")},
|
||||
{11, 3, N_("Other")},
|
||||
{12, 0x0000, N_("Normal")},
|
||||
{12, 0x0001, N_("High")},
|
||||
{12, 0xffff, N_("Low")},
|
||||
{13, 0x0000, N_("Normal")},
|
||||
{13, 0x0001, N_("High")},
|
||||
{13, 0xffff, N_("Low")},
|
||||
{14, 0x0000, N_("Normal")},
|
||||
{14, 0x0001, N_("High")},
|
||||
{14, 0xffff, N_("Low")},
|
||||
{15, 14, N_("Auto high")},
|
||||
{15, 15, N_("Auto")},
|
||||
{15, 16, N_("50")},
|
||||
{15, 17, N_("100")},
|
||||
{15, 18, N_("200")},
|
||||
{15, 19, N_("400")},
|
||||
{15, 20, N_("800")},
|
||||
{16, 0, N_("Default")},
|
||||
{16, 1, N_("Spot")},
|
||||
{16, 2, N_("Average")},
|
||||
{16, 3, N_("Evaluative")},
|
||||
{16, 4, N_("Partial")},
|
||||
{16, 5, N_("Center-weighted average")},
|
||||
{17, 0, N_("Manual")},
|
||||
{17, 1, N_("Auto")},
|
||||
{17, 2, N_("Not known")},
|
||||
{17, 3, N_("Macro")},
|
||||
{17, 4, N_("Very close")},
|
||||
{17, 5, N_("Close")},
|
||||
{17, 6, N_("Middle range")},
|
||||
{17, 7, N_("Far range")},
|
||||
{17, 8, N_("Pan focus")},
|
||||
{17, 9, N_("Super macro")},
|
||||
{17, 10, N_("Infinity")},
|
||||
{18, 0x2005, N_("Manual AF point selection")},
|
||||
{18, 0x3000, N_("None (MF)")},
|
||||
{18, 0x3001, N_("Auto-selected")},
|
||||
{18, 0x3002, N_("Right")},
|
||||
{18, 0x3003, N_("Center")},
|
||||
{18, 0x3004, N_("Left")},
|
||||
{18, 0x4001, N_("Auto AF point selection")},
|
||||
{19, 0, N_("Easy shooting")},
|
||||
{19, 1, N_("Program")},
|
||||
{19, 2, N_("Tv-priority")},
|
||||
{19, 3, N_("Av-priority")},
|
||||
{19, 4, N_("Manual")},
|
||||
{19, 5, N_("A-DEP")},
|
||||
{19, 6, N_("M-DEP")},
|
||||
{21, 1, N_("Canon EF 50mm f/1.8")},
|
||||
{21, 2, N_("Canon EF 28mm f/2.8")},
|
||||
{21, 4, N_("Sigma UC Zoom 35-135mm f/4-5.6")},
|
||||
{21, 6, N_("Tokina AF193-2 19-35mm f/3.5-4.5")},
|
||||
{21, 7, N_("Canon EF 100-300mm F5.6L")},
|
||||
{21, 10, N_("Sigma 50mm f/2.8 EX or 28mm f/1.8")},
|
||||
{21, 11, N_("Canon EF 35mm f/2")},
|
||||
{21, 13, N_("Canon EF 15mm f/2.8")},
|
||||
{21, 21, N_("Canon EF 80-200mm f/2.8L")},
|
||||
{21, 22, N_("Tokina AT-X280AF PRO 28-80mm F2.8 Aspherical")},
|
||||
{21, 26, N_("Cosina 100mm f/3.5 Macro AF")},
|
||||
{21, 28, N_("Tamron AF Aspherical 28-200mm f/3.8-5.6")},
|
||||
{21, 29, N_("Canon EF 50mm f/1.8 MkII")},
|
||||
{21, 31, N_("Tamron SP AF 300mm f/2.8 LD IF")},
|
||||
{21, 32, N_("Canon EF 24mm f/2.8 or Sigma 15mm f/2.8 EX Fisheye")},
|
||||
{21, 39, N_("Canon EF 75-300mm f/4-5.6")},
|
||||
{21, 40, N_("Canon EF 28-80mm f/3.5-5.6")},
|
||||
{21, 43, N_("Canon EF 28-105mm f/4-5.6")},
|
||||
{21, 45, N_("Canon EF-S 18-55mm f/3.5-5.6")},
|
||||
{21, 124, N_("Canon MP-E 65mm f/2.8 1-5x Macro Photo")},
|
||||
{21, 125, N_("Canon TS-E 24mm f/3.5L")},
|
||||
{21, 126, N_("Canon TS-E 45mm f/2.8")},
|
||||
{21, 127, N_("Canon TS-E 90mm f/2.8")},
|
||||
{21, 130, N_("Canon EF 50mm f/1.0L")},
|
||||
{21, 131, N_("Sigma 17-35mm f2.8-4 EX Aspherical HSM")},
|
||||
{21, 134, N_("Canon EF 600mm f/4L IS")},
|
||||
{21, 135, N_("Canon EF 200mm f/1.8L")},
|
||||
{21, 136, N_("Canon EF 300mm f/2.8L")},
|
||||
{21, 137, N_("Canon EF 85mm f/1.2L")},
|
||||
{21, 139, N_("Canon EF 400mm f/2.8L")},
|
||||
{21, 141, N_("Canon EF 500mm f/4.5L")},
|
||||
{21, 142, N_("Canon EF 300mm f/2.8L IS")},
|
||||
{21, 143, N_("Canon EF 500mm f/4L IS")},
|
||||
{21, 149, N_("Canon EF 100mm f/2")},
|
||||
{21, 150, N_("Sigma 20mm EX f/1.8")},
|
||||
{21, 151, N_("Canon EF 200mm f/2.8L")},
|
||||
{21, 152, N_("Sigma 10-20mm F4-5.6 or 12-24mm f/4.5-5.6 or 14mm f/2.8")},
|
||||
{21, 153, N_("Canon EF 35-350mm f/3.5-5.6L")},
|
||||
{21, 155, N_("Canon EF 85mm f/1.8 USM")},
|
||||
{21, 156, N_("Canon EF 28-105mm f/3.5-4.5 USM")},
|
||||
{21, 160, N_("Canon EF 20-35mm f/3.5-4.5 USM")},
|
||||
{21, 161, N_("Canon EF 28-70mm f/2.8L or Sigma 24-70mm EX f/2.8")},
|
||||
{21, 165, N_("Canon EF 70-200mm f/2.8 L")},
|
||||
{21, 166, N_("Canon EF 70-200mm f/2.8 L + x1.4")},
|
||||
{21, 167, N_("Canon EF 70-200mm f/2.8 L + x2")},
|
||||
{21, 168, N_("Canon EF 28mm f/1.8 USM")},
|
||||
{21, 169, N_("Sigma 15-30mm f/3.5-4.5 EX DG Aspherical")},
|
||||
{21, 170, N_("Canon EF 200mm f/2.8L II")},
|
||||
{21, 173, N_("Canon EF 180mm Macro f/3.5L or Sigma 180mm EX HSM Macro f/3.5")},
|
||||
{21, 174, N_("Canon EF 135mm f/2L")},
|
||||
{21, 176, N_("Canon EF 24-85mm f/3.5-4.5 USM")},
|
||||
{21, 177, N_("Canon EF 300mm f/4L IS")},
|
||||
{21, 178, N_("Canon EF 28-135mm f/3.5-5.6 IS")},
|
||||
{21, 180, N_("Canon EF 35mm f/1.4L")},
|
||||
{21, 181, N_("Canon EF 100-400mm f/4.5-5.6L IS + x1.4")},
|
||||
{21, 182, N_("Canon EF 100-400mm f/4.5-5.6L IS + x2")},
|
||||
{21, 183, N_("Canon EF 100-400mm f/4.5-5.6L IS")},
|
||||
{21, 184, N_("Canon EF 400mm f/2.8L + x2")},
|
||||
{21, 186, N_("Canon EF 70-200mm f/4L")},
|
||||
{21, 190, N_("Canon EF 100mm f/2.8 Macro")},
|
||||
{21, 191, N_("Canon EF 400mm f/4 DO IS")},
|
||||
{21, 197, N_("Canon EF 75-300mm f/4-5.6 IS")},
|
||||
{21, 198, N_("Canon EF 50mm f/1.4")},
|
||||
{21, 202, N_("Canon EF 28-80 f/3.5-5.6 USM IV")},
|
||||
{21, 211, N_("Canon EF 28-200mm f/3.5-5.6")},
|
||||
{21, 213, N_("Canon EF 90-300mm f/4.5-5.6")},
|
||||
{21, 214, N_("Canon EF-S 18-55mm f/3.5-4.5 USM")},
|
||||
{21, 224, N_("Canon EF 70-200mm f/2.8L IS USM")},
|
||||
{21, 225, N_("Canon EF 70-200mm f/2.8L IS USM + x1.4")},
|
||||
{21, 226, N_("Canon EF 70-200mm f/2.8L IS USM + x2")},
|
||||
{21, 229, N_("Canon EF 16-35mm f/2.8L")},
|
||||
{21, 230, N_("Canon EF 24-70mm f/2.8L")},
|
||||
{21, 231, N_("Canon EF 17-40mm f/4L")},
|
||||
{21, 232, N_("Canon EF 70-300mm f/4.5-5.6 DO IS USM")},
|
||||
{21, 234, N_("Canon EF-S 17-85mm f4-5.6 IS USM")},
|
||||
{21, 235, N_("Canon EF-S10-22mm F3.5-4.5 USM")},
|
||||
{21, 236, N_("Canon EF-S60mm F2.8 Macro USM")},
|
||||
{21, 237, N_("Canon EF 24-105mm f/4L IS")},
|
||||
{21, 238, N_("Canon EF 70-300mm F4-5.6 IS USM")},
|
||||
{21, 241, N_("Canon EF 50mm F1.2L USM")},
|
||||
{21, 242, N_("Canon EF 70-200mm f/4L IS USM")},
|
||||
{28, 0, N_("Manual")},
|
||||
{28, 1, N_("TTL")},
|
||||
{28, 2, N_("A-TTL")},
|
||||
{28, 3, N_("E-TTL")},
|
||||
{28, 4, N_("FP sync enabled")},
|
||||
{28, 7, N_("2nd-curtain sync used")},
|
||||
{28, 11, N_("FP sync used")},
|
||||
{28, 13, N_("Internal")},
|
||||
{28, 14, N_("External")},
|
||||
{31, 0, N_("Single")},
|
||||
{31, 1, N_("Continuous")},
|
||||
{32, 0, N_("Normal AE")},
|
||||
{32, 1, N_("Exposure compensation")},
|
||||
{32, 2, N_("AE lock")},
|
||||
{32, 3, N_("AE lock + exposure compensation")},
|
||||
{32, 4, N_("No AE")},
|
||||
{33, 0, N_("Off")},
|
||||
{33, 1, N_("On")},
|
||||
{33, 2, N_("On, shot only")},
|
||||
{39, 0, N_("Off")},
|
||||
{39, 1, N_("Vivid")},
|
||||
{39, 2, N_("Neutral")},
|
||||
{39, 3, N_("Smooth")},
|
||||
{39, 4, N_("Sepia")},
|
||||
{39, 5, N_("Black & white")},
|
||||
{39, 6, N_("Custom")},
|
||||
{39, 100, N_("My color data")},
|
||||
{40, 0, N_("Off")},
|
||||
{40, 0x0500, N_("Full")},
|
||||
{40, 0x0502, N_("2/3")},
|
||||
{40, 0x0504, N_("1/3")},
|
||||
#endif
|
||||
{ 0, 0, NULL}
|
||||
},
|
||||
entries_focal_length [] = {
|
||||
#ifndef NO_VERBOSE_TAG_DATA
|
||||
{0, 1, N_("Fixed")},
|
||||
{0, 2, N_("Zoom")},
|
||||
#endif
|
||||
{0, 0, NULL}
|
||||
},
|
||||
entries_settings_2 [] = {
|
||||
#ifndef NO_VERBOSE_TAG_DATA
|
||||
{ 6, 0, N_("Auto")},
|
||||
{ 6, 1, N_("Sunny")},
|
||||
{ 6, 2, N_("Cloudy")},
|
||||
{ 6, 3, N_("Tungsten")},
|
||||
{ 6, 4, N_("Fluorescent")},
|
||||
{ 6, 5, N_("Flash")},
|
||||
{ 6, 6, N_("Custom")},
|
||||
{ 6, 7, N_("Black & white")},
|
||||
{ 6, 8, N_("Shade")},
|
||||
{ 6, 9, N_("Manual temperature (Kelvin)")},
|
||||
{ 6, 10, N_("PC set 1")},
|
||||
{ 6, 11, N_("PC set 2")},
|
||||
{ 6, 12, N_("PC set 3")},
|
||||
{ 6, 14, N_("Daylight fluorescent")},
|
||||
{ 6, 15, N_("Custom 1")},
|
||||
{ 6, 16, N_("Custom 2")},
|
||||
{ 6, 17, N_("Underwater")},
|
||||
{ 7, 0, N_("Off")},
|
||||
{ 7, 1, N_("Night scene")},
|
||||
{ 7, 2, N_("On")},
|
||||
{ 7, 3, N_("None")},
|
||||
{ 13, 0x3000, N_("None (MF)")},
|
||||
{ 13, 0x3001, N_("Right")},
|
||||
{ 13, 0x3002, N_("Center")},
|
||||
{ 13, 0x3003, N_("Center-right")},
|
||||
{ 13, 0x3004, N_("Left")},
|
||||
{ 13, 0x3005, N_("Left-right")},
|
||||
{ 13, 0x3006, N_("Left-center")},
|
||||
{ 13, 0x3007, N_("All")},
|
||||
{ 15, 0, N_("Off")},
|
||||
{ 15, 1, N_("On (shot 1)")},
|
||||
{ 15, 2, N_("On (shot 2)")},
|
||||
{ 15, 3, N_("On (shot 3)")},
|
||||
{ 15, 0xffff, N_("On")},
|
||||
{ 25, 248, N_("EOS high-end")},
|
||||
{ 25, 250, N_("Compact")},
|
||||
{ 25, 252, N_("EOS mid-range")},
|
||||
{ 26, 0, N_("None")},
|
||||
{ 26, 1, N_("Rotate 90 CW")},
|
||||
{ 26, 2, N_("Rotate 180")},
|
||||
{ 26, 3, N_("Rotate 270 CW")},
|
||||
{ 26, 0xffff, N_("Rotated by software")},
|
||||
{ 27, 0, N_("Off")},
|
||||
{ 27, 1, N_("On")},
|
||||
{ 32, 0, N_("Off")},
|
||||
{ 32, 0x0014, N_("1/3")},
|
||||
{ 32, 0x008c, N_("2/3")},
|
||||
{ 32, 0x07d0, N_("Full")},
|
||||
#endif
|
||||
{0, 0, NULL}
|
||||
},
|
||||
entries_panorama [] = {
|
||||
#ifndef NO_VERBOSE_TAG_DATA
|
||||
{0, 0, N_("Left to right")},
|
||||
{0, 1, N_("Right to left")},
|
||||
{0, 2, N_("Bottom to top")},
|
||||
{0, 3, N_("Top to bottom")},
|
||||
{0, 4, N_("2x2 matrix (clockwise)")},
|
||||
#endif
|
||||
{0, 0, NULL}
|
||||
},
|
||||
color_information [] = {
|
||||
#ifndef NO_VERBOSE_TAG_DATA
|
||||
{0, 0, N_("Standard")},
|
||||
{0, 1, N_("Manual")},
|
||||
{0, 2, N_("Custom")},
|
||||
{2, 0, N_("N/A")},
|
||||
{2, 1, N_("Lowest")},
|
||||
{2, 2, N_("Low")},
|
||||
{2, 3, N_("Standard")},
|
||||
{2, 4, N_("High")},
|
||||
{2, 5, N_("Highest")},
|
||||
{7, 0, N_("Auto")},
|
||||
{7, 1, N_("Daylight")},
|
||||
{7, 2, N_("Cloudy")},
|
||||
{7, 3, N_("Tungsten")},
|
||||
{7, 4, N_("Fluorescent")},
|
||||
{7, 5, N_("Flash")},
|
||||
{7, 6, N_("Custom")},
|
||||
{7, 7, N_("Black & white")},
|
||||
{7, 8, N_("Shade")},
|
||||
{7, 9, N_("Manual temperature (Kelvin)")},
|
||||
{7, 10, N_("PC set 1")},
|
||||
{7, 11, N_("PC set 2")},
|
||||
{7, 12, N_("PC set 3")},
|
||||
{7, 14, N_("Daylight fluorescent")},
|
||||
{7, 15, N_("Custom 1")},
|
||||
{7, 16, N_("Custom 2")},
|
||||
{7, 17, N_("Underwater")},
|
||||
{9, 0x00, N_("None")},
|
||||
{9, 0x01, N_("Standard")},
|
||||
{9, 0x02, N_("Set 1")},
|
||||
{9, 0x03, N_("Set 2")},
|
||||
{9, 0x04, N_("Set 3")},
|
||||
{9, 0x21, N_("User def. 1")},
|
||||
{9, 0x22, N_("User def. 2")},
|
||||
{9, 0x23, N_("User def. 3")},
|
||||
{9, 0x41, N_("External 1")},
|
||||
{9, 0x42, N_("External 2")},
|
||||
{9, 0x43, N_("External 3")},
|
||||
{9, 0x81, N_("Standard")},
|
||||
{9, 0x82, N_("Portrait")},
|
||||
{9, 0x83, N_("Landscape")},
|
||||
{9, 0x84, N_("Neutral")},
|
||||
{9, 0x85, N_("Faithful")},
|
||||
{9, 0x86, N_("Monochrome")},
|
||||
#endif
|
||||
{0, 0, NULL}
|
||||
};
|
||||
|
||||
static void
|
||||
canon_search_table_value (const struct canon_entry_table_t table[],
|
||||
unsigned int t, ExifShort vs, char *val, unsigned int maxlen)
|
||||
{
|
||||
unsigned int j;
|
||||
|
||||
/* Search the table for the first matching subtag and value. */
|
||||
for (j = 0; table[j].name && ((table[j].subtag < t) ||
|
||||
((table[j].subtag == t) && table[j].value <= vs)); j++) {
|
||||
if ((table[j].subtag == t) && (table[j].value == vs)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((table[j].subtag == t) && (table[j].value == vs) && table[j].name) {
|
||||
/* Matching subtag and value found. */
|
||||
strncpy (val, _(table[j].name), maxlen);
|
||||
} else {
|
||||
/* No matching subtag and/or value found. */
|
||||
snprintf (val, maxlen, "0x%04x", vs);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
canon_search_table_bitfield (const struct canon_entry_table_t table[],
|
||||
unsigned int t, ExifShort vs, char *val, unsigned int maxlen)
|
||||
{
|
||||
unsigned int j;
|
||||
|
||||
/* Search the table for the first matching subtag. */
|
||||
for (j = 0; table[j].name && (table[j].subtag <= t); j++) {
|
||||
if (table[j].subtag == t) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((table[j].subtag == t) && table[j].name) {
|
||||
unsigned int i, bit, lastbit = 0;
|
||||
|
||||
/*
|
||||
* Search the table for the last matching bit, because
|
||||
* that one needs no additional comma appended.
|
||||
*/
|
||||
for (i = j; table[i].name && (table[i].subtag == t); i++) {
|
||||
bit = table[i].value;
|
||||
if ((vs >> bit) & 1) {
|
||||
lastbit = bit;
|
||||
}
|
||||
}
|
||||
/* Search the table for all matching bits. */
|
||||
for (i = j; table[i].name && (table[i].subtag == t); i++) {
|
||||
bit = table[i].value;
|
||||
if ((vs >> bit) & 1) {
|
||||
strncat(val, _(table[i].name), maxlen - strlen (val));
|
||||
if (bit != lastbit)
|
||||
strncat (val, _(", "), maxlen - strlen (val));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* No matching subtag found. */
|
||||
snprintf (val, maxlen, "0x%04x", vs);
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int
|
||||
mnote_canon_entry_count_values (const MnoteCanonEntry *entry)
|
||||
{
|
||||
unsigned int val;
|
||||
|
||||
if (!entry) return 0;
|
||||
|
||||
switch (entry->tag) {
|
||||
case MNOTE_CANON_TAG_FOCAL_LENGTH:
|
||||
case MNOTE_CANON_TAG_PANORAMA:
|
||||
return entry->components;
|
||||
case MNOTE_CANON_TAG_SETTINGS_1:
|
||||
case MNOTE_CANON_TAG_SETTINGS_2:
|
||||
case MNOTE_CANON_TAG_CUSTOM_FUNCS:
|
||||
case MNOTE_CANON_TAG_COLOR_INFORMATION:
|
||||
if (entry->format != EXIF_FORMAT_SHORT) return 0;
|
||||
|
||||
val = exif_get_short (entry->data, entry->order);
|
||||
/* val is buffer size, i.e. # of values plus 1 */
|
||||
return MIN (entry->size - 2, val) / 2;
|
||||
default:
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* For reference, see Exif 2.1 specification (Appendix C),
|
||||
* or http://en.wikipedia.org/wiki/APEX_system
|
||||
*/
|
||||
static double
|
||||
apex_value_to_aperture (double x)
|
||||
{
|
||||
return pow (2, x / 2.);
|
||||
}
|
||||
|
||||
static double
|
||||
apex_value_to_shutter_speed(double x)
|
||||
{
|
||||
return 1.0 / pow (2, x);
|
||||
}
|
||||
|
||||
static double
|
||||
apex_value_to_iso_speed (double x)
|
||||
{
|
||||
return 3.125 * pow (2, x);
|
||||
}
|
||||
|
||||
char *
|
||||
mnote_canon_entry_get_value (const MnoteCanonEntry *entry, unsigned int t, char *val, unsigned int maxlen)
|
||||
{
|
||||
char buf[128];
|
||||
ExifLong vl;
|
||||
ExifShort vs, n;
|
||||
unsigned char *data;
|
||||
double d;
|
||||
|
||||
if (!entry)
|
||||
return NULL;
|
||||
|
||||
data = entry->data;
|
||||
|
||||
memset (val, 0, maxlen);
|
||||
maxlen--;
|
||||
|
||||
switch (entry->tag) {
|
||||
case MNOTE_CANON_TAG_SETTINGS_1:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
|
||||
n = exif_get_short (data, entry->order) / 2;
|
||||
if (t >= n) return NULL;
|
||||
CC (entry->components, n, val, maxlen);
|
||||
vs = exif_get_short (data + 2 + t * 2, entry->order);
|
||||
switch (t) {
|
||||
case 1:
|
||||
if (!vs) {
|
||||
strncpy(val, _("Off"), maxlen);
|
||||
break;
|
||||
}
|
||||
snprintf (val, maxlen, _("%i (ms)"), vs * 100);
|
||||
break;
|
||||
case 15:
|
||||
if (((vs & 0xC000) == 0x4000) && (vs != 0x7FFF)) {
|
||||
/* Canon S3 IS - directly specified value */
|
||||
snprintf (val, maxlen, "%i", vs & ~0x4000);
|
||||
} else {
|
||||
/* Standard Canon - index into lookup table */
|
||||
canon_search_table_value (entries_settings_1, t, vs, val, maxlen);
|
||||
}
|
||||
break;
|
||||
case 22:
|
||||
case 23:
|
||||
case 24:
|
||||
snprintf (val, maxlen, "%u", vs);
|
||||
break;
|
||||
case 25:
|
||||
case 26:
|
||||
snprintf (val, maxlen, "%.2f", apex_value_to_aperture (vs / 32.0));
|
||||
break;
|
||||
case 28:
|
||||
canon_search_table_bitfield(entries_settings_1, t, vs, val, maxlen);
|
||||
break;
|
||||
case 34:
|
||||
snprintf (val, maxlen, "%.2f", vs / 10.0);
|
||||
break;
|
||||
case 35:
|
||||
case 36:
|
||||
snprintf (val, maxlen, "%u", vs);
|
||||
break;
|
||||
default:
|
||||
canon_search_table_value (entries_settings_1, t, vs, val, maxlen);
|
||||
}
|
||||
break;
|
||||
|
||||
case MNOTE_CANON_TAG_FOCAL_LENGTH:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
|
||||
vs = exif_get_short (data + t * 2, entry->order);
|
||||
switch (t) {
|
||||
case 1:
|
||||
snprintf (val, maxlen, "%u", vs);
|
||||
break;
|
||||
case 2:
|
||||
case 3:
|
||||
snprintf (val, maxlen, _("%.2f mm"), vs * 25.4 / 1000);
|
||||
break;
|
||||
default:
|
||||
canon_search_table_value (entries_focal_length, t, vs, val, maxlen);
|
||||
}
|
||||
break;
|
||||
|
||||
case MNOTE_CANON_TAG_SETTINGS_2:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
|
||||
n = exif_get_short (data, entry->order) / 2;
|
||||
if (t >= n) return NULL;
|
||||
CC (entry->components, n, val, maxlen);
|
||||
vs = exif_get_short (data + 2 + t * 2, entry->order);
|
||||
switch (t) {
|
||||
case 0:
|
||||
snprintf (val, maxlen, "%.3f", pow (2, (ExifSShort)vs / 32.0));
|
||||
break;
|
||||
case 1:
|
||||
snprintf (val, maxlen, "%.0f", apex_value_to_iso_speed ((ExifSShort)vs / 32.0));
|
||||
break;
|
||||
case 2:
|
||||
case 5:
|
||||
case 14:
|
||||
case 16:
|
||||
snprintf (val, maxlen, _("%.2f EV"), (ExifSShort)vs / 32.0);
|
||||
break;
|
||||
case 3:
|
||||
case 20:
|
||||
snprintf (val, maxlen, "%.2f", apex_value_to_aperture (vs / 32.0));
|
||||
break;
|
||||
case 4:
|
||||
case 21:
|
||||
d = apex_value_to_shutter_speed ((ExifSShort)vs / 32.0);
|
||||
if (d < 1)
|
||||
snprintf (val, maxlen, _("1/%i"),(int)(1.0 / d));
|
||||
else
|
||||
snprintf (val, maxlen, "%i", (int) d);
|
||||
break;
|
||||
case 8:
|
||||
snprintf (val, maxlen, "%u", vs);
|
||||
break;
|
||||
case 12:
|
||||
snprintf (val, maxlen, "%.2f", vs / 32.0);
|
||||
break;
|
||||
case 18:
|
||||
case 19:
|
||||
snprintf (val, maxlen, _("%u mm"), vs);
|
||||
break;
|
||||
case 28:
|
||||
if ((ExifSShort)vs <= 0) {
|
||||
strncpy(val, _("Off"), maxlen);
|
||||
break;
|
||||
}
|
||||
snprintf (val, maxlen, _("%i (ms)"), vs * 100);
|
||||
break;
|
||||
default:
|
||||
canon_search_table_value (entries_settings_2, t, vs, val, maxlen);
|
||||
}
|
||||
break;
|
||||
|
||||
case MNOTE_CANON_TAG_PANORAMA:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
|
||||
vs = exif_get_short (data + t * 2, entry->order);
|
||||
canon_search_table_value (entries_panorama, t, vs, val, maxlen);
|
||||
break;
|
||||
|
||||
case MNOTE_CANON_TAG_OWNER:
|
||||
CC (entry->components, 32, val, maxlen);
|
||||
/* Fall through; ImageType can have many sizes */
|
||||
case MNOTE_CANON_TAG_IMAGE_TYPE:
|
||||
CF (entry->format, EXIF_FORMAT_ASCII, val, maxlen);
|
||||
strncpy (val, (char *)data, MIN (entry->size, maxlen));
|
||||
break;
|
||||
|
||||
case MNOTE_CANON_TAG_FIRMWARE:
|
||||
CF (entry->format, EXIF_FORMAT_ASCII, val, maxlen);
|
||||
/* CC2 (entry->components, 24, 32, val, maxlen); Can also be 22 */
|
||||
strncpy (val, (char *)data, MIN (entry->size, maxlen));
|
||||
break;
|
||||
|
||||
case MNOTE_CANON_TAG_IMAGE_NUMBER:
|
||||
CF (entry->format, EXIF_FORMAT_LONG, val, maxlen);
|
||||
CC (entry->components, 1, val, maxlen);
|
||||
vl = exif_get_long (data, entry->order);
|
||||
snprintf (val, maxlen, "%03lu-%04lu",
|
||||
(unsigned long) vl/10000,
|
||||
(unsigned long) vl%10000);
|
||||
break;
|
||||
|
||||
case MNOTE_CANON_TAG_SERIAL_NUMBER:
|
||||
CF (entry->format, EXIF_FORMAT_LONG, val, maxlen);
|
||||
CC (entry->components, 1, val, maxlen);
|
||||
vl = exif_get_long (data, entry->order);
|
||||
snprintf (val, maxlen, "%04X-%05d", (int)vl>>16,(int)vl&0xffff);
|
||||
break;
|
||||
|
||||
case MNOTE_CANON_TAG_CUSTOM_FUNCS:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
|
||||
n = exif_get_short (data, entry->order) / 2;
|
||||
if (t >= n) return NULL;
|
||||
CC (entry->components, n, val, maxlen);
|
||||
vs = exif_get_short (data + 2 + t * 2, entry->order);
|
||||
snprintf (buf, sizeof (buf), "%u", vs);
|
||||
strncat (val, buf, maxlen - strlen (val));
|
||||
break;
|
||||
|
||||
case MNOTE_CANON_TAG_COLOR_INFORMATION:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
|
||||
n = exif_get_short (data, entry->order) / 2;
|
||||
if (t >= n) return NULL;
|
||||
CC (entry->components, n, val, maxlen);
|
||||
vs = exif_get_short (data + 2 + t * 2, entry->order);
|
||||
canon_search_table_value (color_information, t, vs, val, maxlen);
|
||||
break;
|
||||
|
||||
default:
|
||||
#ifdef DEBUG
|
||||
{
|
||||
int i;
|
||||
if (entry->format == EXIF_FORMAT_SHORT)
|
||||
for(i=0;i<entry->components;i++) {
|
||||
vs = exif_get_short (data, entry->order);
|
||||
data+=2;
|
||||
printf ("Value%d=%d\n", i, vs);
|
||||
}
|
||||
else if (entry->format == EXIF_FORMAT_LONG)
|
||||
for(i=0;i<entry->components;i++) {
|
||||
vl = exif_get_long (data, entry->order);
|
||||
data+=4;
|
||||
printf ("Value%d=%d\n", i, vs);
|
||||
}
|
||||
else if (entry->format == EXIF_FORMAT_ASCII)
|
||||
strncpy (val, data, MIN (entry->size, maxlen));
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
return val;
|
||||
}
|
||||
201
libexifa/canon/mnote-canon-tag.c
Executable file
201
libexifa/canon/mnote-canon-tag.c
Executable file
@@ -0,0 +1,201 @@
|
||||
/* mnote-canon-tag.c
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "mnote-canon-tag.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libexif/i18n.h>
|
||||
|
||||
static const struct {
|
||||
MnoteCanonTag tag;
|
||||
const char *name;
|
||||
const char *title;
|
||||
const char *description;
|
||||
} table[] = {
|
||||
#ifndef NO_VERBOSE_TAG_STRINGS
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, "Settings1", N_("Settings (First Part)"), ""},
|
||||
{MNOTE_CANON_TAG_FOCAL_LENGTH, "FocalLength", N_("Focal Length"), ""},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, "Settings2", N_("Settings (Second Part)"), ""},
|
||||
{MNOTE_CANON_TAG_PANORAMA, "Panorama", N_("Panorama"), ""},
|
||||
{MNOTE_CANON_TAG_IMAGE_TYPE, "ImageType", N_("Image Type"), ""},
|
||||
{MNOTE_CANON_TAG_FIRMWARE, "FirmwareVersion", N_("Firmware Version"), ""},
|
||||
{MNOTE_CANON_TAG_IMAGE_NUMBER, "ImageNumber", N_("Image Number"), ""},
|
||||
{MNOTE_CANON_TAG_OWNER, "OwnerName", N_("Owner Name"), ""},
|
||||
{MNOTE_CANON_TAG_COLOR_INFORMATION, "ColorInformation", N_("Color Information"), ""},
|
||||
{MNOTE_CANON_TAG_SERIAL_NUMBER, "SerialNumber", N_("Serial Number"), ""},
|
||||
{MNOTE_CANON_TAG_CUSTOM_FUNCS, "CustomFunctions", N_("Custom Functions"), ""},
|
||||
#endif
|
||||
{0, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
static const struct {
|
||||
MnoteCanonTag tag;
|
||||
unsigned int subtag;
|
||||
const char *name;
|
||||
} table_sub[] = {
|
||||
#ifndef NO_VERBOSE_TAG_STRINGS
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 0, N_("Macro Mode")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 1, N_("Self-timer")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 2, N_("Quality")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 3, N_("Flash Mode")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 4, N_("Drive Mode")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 6, N_("Focus Mode")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 8, N_("Record Mode")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 9, N_("Image Size")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 10, N_("Easy Shooting Mode")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 11, N_("Digital Zoom")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 12, N_("Contrast")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 13, N_("Saturation")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 14, N_("Sharpness")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 15, N_("ISO")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 16, N_("Metering Mode")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 17, N_("Focus Range")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 18, N_("AF Point")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 19, N_("Exposure Mode")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 21, N_("Lens Type")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 22, N_("Long Focal Length of Lens")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 23, N_("Short Focal Length of Lens")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 24, N_("Focal Units per mm")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 25, N_("Maximal Aperture")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 26, N_("Minimal Aperture")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 27, N_("Flash Activity")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 28, N_("Flash Details")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 31, N_("Focus Mode")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 32, N_("AE Setting")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 33, N_("Image Stabilization")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 34, N_("Display Aperture")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 35, N_("Zoom Source Width")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 36, N_("Zoom Target Width")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 39, N_("Photo Effect")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 40, N_("Manual Flash Output")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_1, 41, N_("Color Tone")},
|
||||
{MNOTE_CANON_TAG_FOCAL_LENGTH, 0, N_("Focal Type")},
|
||||
{MNOTE_CANON_TAG_FOCAL_LENGTH, 1, N_("Focal Length")},
|
||||
{MNOTE_CANON_TAG_FOCAL_LENGTH, 2, N_("Focal Plane X Size")},
|
||||
{MNOTE_CANON_TAG_FOCAL_LENGTH, 3, N_("Focal Plane Y Size")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 0, N_("Auto ISO")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 1, N_("Shot ISO")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 2, N_("Measured EV")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 3, N_("Target Aperture")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 4, N_("Target Exposure Time")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 5, N_("Exposure Compensation")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 6, N_("White Balance")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 7, N_("Slow Shutter")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 8, N_("Sequence Number")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 12, N_("Flash Guide Number")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 13, N_("AF Point")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 14, N_("Flash Exposure Compensation")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 15, N_("AE Bracketing")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 16, N_("AE Bracket Value")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 18, N_("Focus Distance Upper")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 19, N_("Focus Distance Lower")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 20, N_("FNumber")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 21, N_("Exposure Time")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 23, N_("Bulb Duration")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 25, N_("Camera Type")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 26, N_("Auto Rotate")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 27, N_("ND Filter")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 28, N_("Self-timer")},
|
||||
{MNOTE_CANON_TAG_SETTINGS_2, 32, N_("Manual Flash Output")},
|
||||
{MNOTE_CANON_TAG_PANORAMA, 2, N_("Panorama Frame")},
|
||||
{MNOTE_CANON_TAG_PANORAMA, 5, N_("Panorama Direction")},
|
||||
{MNOTE_CANON_TAG_COLOR_INFORMATION, 0, N_("Tone Curve")},
|
||||
{MNOTE_CANON_TAG_COLOR_INFORMATION, 2, N_("Sharpness Frequency")},
|
||||
{MNOTE_CANON_TAG_COLOR_INFORMATION, 7, N_("White Balance")},
|
||||
{MNOTE_CANON_TAG_COLOR_INFORMATION, 9, N_("Picture Style")},
|
||||
#endif
|
||||
{0, 0, NULL}
|
||||
};
|
||||
|
||||
const char *
|
||||
mnote_canon_tag_get_name (MnoteCanonTag t)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
|
||||
if (table[i].tag == t) return table[i].name; /* do not translate */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
mnote_canon_tag_get_name_sub (MnoteCanonTag t, unsigned int s, ExifDataOption o)
|
||||
{
|
||||
unsigned int i;
|
||||
int tag_found = 0;
|
||||
|
||||
for (i = 0; i < sizeof (table_sub) / sizeof (table_sub[0]); i++) {
|
||||
if (table_sub[i].tag == t) {
|
||||
if (table_sub[i].subtag == s)
|
||||
return table_sub[i].name;
|
||||
tag_found = 1;
|
||||
}
|
||||
}
|
||||
if (!tag_found || !(o & EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS))
|
||||
return mnote_canon_tag_get_name (t);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
mnote_canon_tag_get_title (MnoteCanonTag t)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
|
||||
if (table[i].tag == t) return (_(table[i].title));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
mnote_canon_tag_get_title_sub (MnoteCanonTag t, unsigned int s, ExifDataOption o)
|
||||
{
|
||||
unsigned int i;
|
||||
int tag_found = 0;
|
||||
|
||||
for (i = 0; i < sizeof (table_sub) / sizeof (table_sub[0]); i++) {
|
||||
if (table_sub[i].tag == t) {
|
||||
if (table_sub[i].subtag == s)
|
||||
return _(table_sub[i].name);
|
||||
tag_found = 1;
|
||||
}
|
||||
}
|
||||
if (!tag_found || !(o & EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS))
|
||||
return mnote_canon_tag_get_title (t);
|
||||
else
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
mnote_canon_tag_get_description (MnoteCanonTag t)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
|
||||
if (table[i].tag == t) {
|
||||
if (!*table[i].description)
|
||||
return "";
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
return _(table[i].description);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
39
libexifa/exif-byte-order.c
Executable file
39
libexifa/exif-byte-order.c
Executable file
@@ -0,0 +1,39 @@
|
||||
/* exif-byte-order.c
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/i18n.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
const char *
|
||||
exif_byte_order_get_name (ExifByteOrder order)
|
||||
{
|
||||
switch (order) {
|
||||
case EXIF_BYTE_ORDER_MOTOROLA:
|
||||
return (_("Motorola"));
|
||||
case EXIF_BYTE_ORDER_INTEL:
|
||||
return (_("Intel"));
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
327
libexifa/exif-content.c
Executable file
327
libexifa/exif-content.c
Executable file
@@ -0,0 +1,327 @@
|
||||
/* exif-content.c
|
||||
*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <libexif/exif-content.h>
|
||||
#include <libexif/exif-system.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* unused constant
|
||||
* static const unsigned char ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
|
||||
*/
|
||||
|
||||
struct _ExifContentPrivate
|
||||
{
|
||||
unsigned int ref_count;
|
||||
|
||||
ExifMem *mem;
|
||||
ExifLog *log;
|
||||
};
|
||||
|
||||
ExifContent *
|
||||
exif_content_new (void)
|
||||
{
|
||||
ExifMem *mem = exif_mem_new_default ();
|
||||
ExifContent *content = exif_content_new_mem (mem);
|
||||
|
||||
exif_mem_unref (mem);
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
ExifContent *
|
||||
exif_content_new_mem (ExifMem *mem)
|
||||
{
|
||||
ExifContent *content;
|
||||
|
||||
if (!mem) return NULL;
|
||||
|
||||
content = exif_mem_alloc (mem, (ExifLong) sizeof (ExifContent));
|
||||
if (!content)
|
||||
return NULL;
|
||||
content->priv = exif_mem_alloc (mem,
|
||||
(ExifLong) sizeof (ExifContentPrivate));
|
||||
if (!content->priv) {
|
||||
exif_mem_free (mem, content);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content->priv->ref_count = 1;
|
||||
|
||||
content->priv->mem = mem;
|
||||
exif_mem_ref (mem);
|
||||
|
||||
return content;
|
||||
}
|
||||
|
||||
void
|
||||
exif_content_ref (ExifContent *content)
|
||||
{
|
||||
content->priv->ref_count++;
|
||||
}
|
||||
|
||||
void
|
||||
exif_content_unref (ExifContent *content)
|
||||
{
|
||||
content->priv->ref_count--;
|
||||
if (!content->priv->ref_count)
|
||||
exif_content_free (content);
|
||||
}
|
||||
|
||||
void
|
||||
exif_content_free (ExifContent *content)
|
||||
{
|
||||
ExifMem *mem = (content && content->priv) ? content->priv->mem : NULL;
|
||||
unsigned int i;
|
||||
|
||||
if (!content) return;
|
||||
|
||||
for (i = 0; i < content->count; i++)
|
||||
exif_entry_unref (content->entries[i]);
|
||||
exif_mem_free (mem, content->entries);
|
||||
|
||||
if (content->priv) {
|
||||
exif_log_unref (content->priv->log);
|
||||
}
|
||||
|
||||
exif_mem_free (mem, content->priv);
|
||||
exif_mem_free (mem, content);
|
||||
exif_mem_unref (mem);
|
||||
}
|
||||
|
||||
void
|
||||
exif_content_dump (ExifContent *content, unsigned int indent)
|
||||
{
|
||||
char buf[1024];
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < 2 * indent; i++)
|
||||
buf[i] = ' ';
|
||||
buf[i] = '\0';
|
||||
|
||||
if (!content)
|
||||
return;
|
||||
|
||||
printf ("%sDumping exif content (%u entries)...\n", buf,
|
||||
content->count);
|
||||
for (i = 0; i < content->count; i++)
|
||||
exif_entry_dump (content->entries[i], indent + 1);
|
||||
}
|
||||
|
||||
void
|
||||
exif_content_add_entry (ExifContent *c, ExifEntry *entry)
|
||||
{
|
||||
ExifEntry **entries;
|
||||
if (!c || !c->priv || !entry || entry->parent) return;
|
||||
|
||||
/* One tag can only be added once to an IFD. */
|
||||
if (exif_content_get_entry (c, entry->tag)) {
|
||||
exif_log (c->priv->log, EXIF_LOG_CODE_DEBUG, "ExifContent",
|
||||
"An attempt has been made to add "
|
||||
"the tag '%s' twice to an IFD. This is against "
|
||||
"specification.", exif_tag_get_name (entry->tag));
|
||||
return;
|
||||
}
|
||||
|
||||
entries = exif_mem_realloc (c->priv->mem,
|
||||
c->entries, sizeof (ExifEntry*) * (c->count + 1));
|
||||
if (!entries) return;
|
||||
entry->parent = c;
|
||||
entries[c->count++] = entry;
|
||||
c->entries = entries;
|
||||
exif_entry_ref (entry);
|
||||
}
|
||||
|
||||
void
|
||||
exif_content_remove_entry (ExifContent *c, ExifEntry *e)
|
||||
{
|
||||
unsigned int i;
|
||||
ExifEntry **t, *temp;
|
||||
|
||||
if (!c || !c->priv || !e || (e->parent != c)) return;
|
||||
|
||||
/* Search the entry */
|
||||
for (i = 0; i < c->count; i++)
|
||||
if (c->entries[i] == e)
|
||||
break;
|
||||
|
||||
if (i == c->count)
|
||||
return;
|
||||
|
||||
/* Remove the entry */
|
||||
temp = c->entries[c->count-1];
|
||||
if (c->count > 1) {
|
||||
t = exif_mem_realloc (c->priv->mem, c->entries,
|
||||
sizeof(ExifEntry*) * (c->count - 1));
|
||||
if (!t) {
|
||||
return;
|
||||
}
|
||||
c->entries = t;
|
||||
c->count--;
|
||||
if (i != c->count) { /* we deallocated the last slot already */
|
||||
memmove (&t[i], &t[i + 1], sizeof (ExifEntry*) * (c->count - i - 1));
|
||||
t[c->count-1] = temp;
|
||||
}
|
||||
} else {
|
||||
exif_mem_free (c->priv->mem, c->entries);
|
||||
c->entries = NULL;
|
||||
c->count = 0;
|
||||
}
|
||||
e->parent = NULL;
|
||||
exif_entry_unref (e);
|
||||
}
|
||||
|
||||
ExifEntry *
|
||||
exif_content_get_entry (ExifContent *content, ExifTag tag)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (!content)
|
||||
return (NULL);
|
||||
|
||||
for (i = 0; i < content->count; i++)
|
||||
if (content->entries[i]->tag == tag)
|
||||
return (content->entries[i]);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
exif_content_foreach_entry (ExifContent *content,
|
||||
ExifContentForeachEntryFunc func, void *data)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (!content || !func)
|
||||
return;
|
||||
|
||||
for (i = 0; i < content->count; i++)
|
||||
func (content->entries[i], data);
|
||||
}
|
||||
|
||||
void
|
||||
exif_content_log (ExifContent *content, ExifLog *log)
|
||||
{
|
||||
if (!content || !content->priv || !log || content->priv->log == log)
|
||||
return;
|
||||
|
||||
if (content->priv->log) exif_log_unref (content->priv->log);
|
||||
content->priv->log = log;
|
||||
exif_log_ref (log);
|
||||
}
|
||||
|
||||
ExifIfd
|
||||
exif_content_get_ifd (ExifContent *c)
|
||||
{
|
||||
if (!c || !c->parent) return EXIF_IFD_COUNT;
|
||||
|
||||
return
|
||||
((c)->parent->ifd[EXIF_IFD_EXIF] == (c)) ? EXIF_IFD_EXIF :
|
||||
((c)->parent->ifd[EXIF_IFD_0] == (c)) ? EXIF_IFD_0 :
|
||||
((c)->parent->ifd[EXIF_IFD_1] == (c)) ? EXIF_IFD_1 :
|
||||
((c)->parent->ifd[EXIF_IFD_GPS] == (c)) ? EXIF_IFD_GPS :
|
||||
((c)->parent->ifd[EXIF_IFD_INTEROPERABILITY] == (c)) ? EXIF_IFD_INTEROPERABILITY :
|
||||
EXIF_IFD_COUNT;
|
||||
}
|
||||
|
||||
static void
|
||||
fix_func (ExifEntry *e, void *UNUSED(data))
|
||||
{
|
||||
exif_entry_fix (e);
|
||||
}
|
||||
|
||||
/*!
|
||||
* Check if this entry is unknown and if so, delete it.
|
||||
* \note Be careful calling this function in a loop. Deleting an entry from
|
||||
* an ExifContent changes the index of subsequent entries, as well as the
|
||||
* total size of the entries array.
|
||||
*/
|
||||
static void
|
||||
remove_not_recorded (ExifEntry *e, void *UNUSED(data))
|
||||
{
|
||||
ExifIfd ifd = exif_entry_get_ifd(e) ;
|
||||
ExifContent *c = e->parent;
|
||||
ExifDataType dt = exif_data_get_data_type (c->parent);
|
||||
ExifTag t = e->tag;
|
||||
|
||||
if (exif_tag_get_support_level_in_ifd (t, ifd, dt) ==
|
||||
EXIF_SUPPORT_LEVEL_NOT_RECORDED) {
|
||||
exif_log (c->priv->log, EXIF_LOG_CODE_DEBUG, "exif-content",
|
||||
"Tag 0x%04x is not recorded in IFD '%s' and has therefore been "
|
||||
"removed.", t, exif_ifd_get_name (ifd));
|
||||
exif_content_remove_entry (c, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
exif_content_fix (ExifContent *c)
|
||||
{
|
||||
ExifIfd ifd = exif_content_get_ifd (c);
|
||||
ExifDataType dt;
|
||||
ExifEntry *e;
|
||||
unsigned int i, num;
|
||||
|
||||
if (!c)
|
||||
return;
|
||||
|
||||
dt = exif_data_get_data_type (c->parent);
|
||||
|
||||
/*
|
||||
* First of all, fix all existing entries.
|
||||
*/
|
||||
exif_content_foreach_entry (c, fix_func, NULL);
|
||||
|
||||
/*
|
||||
* Go through each tag and if it's not recorded, remove it. If one
|
||||
* is removed, exif_content_foreach_entry() will skip the next entry,
|
||||
* so if this happens do the loop again from the beginning to ensure
|
||||
* they're all checked. This could be avoided if we stop relying on
|
||||
* exif_content_foreach_entry but loop intelligently here.
|
||||
*/
|
||||
do {
|
||||
num = c->count;
|
||||
exif_content_foreach_entry (c, remove_not_recorded, NULL);
|
||||
} while (num != c->count);
|
||||
|
||||
/*
|
||||
* Then check for non-existing mandatory tags and create them if needed
|
||||
*/
|
||||
num = exif_tag_table_count();
|
||||
for (i = 0; i < num; ++i) {
|
||||
const ExifTag t = exif_tag_table_get_tag (i);
|
||||
if (exif_tag_get_support_level_in_ifd (t, ifd, dt) ==
|
||||
EXIF_SUPPORT_LEVEL_MANDATORY) {
|
||||
if (exif_content_get_entry (c, t))
|
||||
/* This tag already exists */
|
||||
continue;
|
||||
exif_log (c->priv->log, EXIF_LOG_CODE_DEBUG, "exif-content",
|
||||
"Tag '%s' is mandatory in IFD '%s' and has therefore been added.",
|
||||
exif_tag_get_name_in_ifd (t, ifd), exif_ifd_get_name (ifd));
|
||||
e = exif_entry_new ();
|
||||
exif_content_add_entry (c, e);
|
||||
exif_entry_initialize (e, t);
|
||||
exif_entry_unref (e);
|
||||
}
|
||||
}
|
||||
}
|
||||
1266
libexifa/exif-data.c
Executable file
1266
libexifa/exif-data.c
Executable file
File diff suppressed because it is too large
Load Diff
1710
libexifa/exif-entry.c
Executable file
1710
libexifa/exif-entry.c
Executable file
File diff suppressed because it is too large
Load Diff
81
libexifa/exif-format.c
Executable file
81
libexifa/exif-format.c
Executable file
@@ -0,0 +1,81 @@
|
||||
/* exif-format.c
|
||||
*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/i18n.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
/*! Table of data format types, descriptions and sizes.
|
||||
* This table should be sorted in decreasing order of popularity in order
|
||||
* to decrease the total average lookup time.
|
||||
*/
|
||||
static const struct {
|
||||
ExifFormat format;
|
||||
const char *name;
|
||||
unsigned char size;
|
||||
} ExifFormatTable[] = {
|
||||
{EXIF_FORMAT_SHORT, N_("Short"), 2},
|
||||
{EXIF_FORMAT_RATIONAL, N_("Rational"), 8},
|
||||
{EXIF_FORMAT_SRATIONAL, N_("SRational"), 8},
|
||||
{EXIF_FORMAT_UNDEFINED, N_("Undefined"), 1},
|
||||
{EXIF_FORMAT_ASCII, N_("ASCII"), 1},
|
||||
{EXIF_FORMAT_LONG, N_("Long"), 4},
|
||||
{EXIF_FORMAT_BYTE, N_("Byte"), 1},
|
||||
{EXIF_FORMAT_SBYTE, N_("SByte"), 1},
|
||||
{EXIF_FORMAT_SSHORT, N_("SShort"), 2},
|
||||
{EXIF_FORMAT_SLONG, N_("SLong"), 4},
|
||||
{EXIF_FORMAT_FLOAT, N_("Float"), 4},
|
||||
{EXIF_FORMAT_DOUBLE, N_("Double"), 8},
|
||||
{0, NULL, 0}
|
||||
};
|
||||
|
||||
const char *
|
||||
exif_format_get_name (ExifFormat format)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
/* FIXME: This belongs to somewhere else. */
|
||||
/* libexif should use the default system locale.
|
||||
* If an application specifically requires UTF-8, then we
|
||||
* must give the application a way to tell libexif that.
|
||||
*
|
||||
* bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
||||
*/
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
|
||||
for (i = 0; ExifFormatTable[i].name; i++)
|
||||
if (ExifFormatTable[i].format == format)
|
||||
return _(ExifFormatTable[i].name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
exif_format_get_size (ExifFormat format)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; ExifFormatTable[i].size; i++)
|
||||
if (ExifFormatTable[i].format == format)
|
||||
return ExifFormatTable[i].size;
|
||||
return 0;
|
||||
}
|
||||
49
libexifa/exif-ifd.c
Executable file
49
libexifa/exif-ifd.c
Executable file
@@ -0,0 +1,49 @@
|
||||
/* exif-ifd.c
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <libexif/exif-ifd.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
static const struct {
|
||||
ExifIfd ifd;
|
||||
const char *name;
|
||||
} ExifIfdTable[] = {
|
||||
{EXIF_IFD_0, "0"},
|
||||
{EXIF_IFD_1, "1"},
|
||||
{EXIF_IFD_EXIF, "EXIF"},
|
||||
{EXIF_IFD_GPS, "GPS"},
|
||||
{EXIF_IFD_INTEROPERABILITY, "Interoperability"},
|
||||
{0, NULL}
|
||||
};
|
||||
|
||||
const char *
|
||||
exif_ifd_get_name (ExifIfd ifd)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; ExifIfdTable[i].name; i++)
|
||||
if (ExifIfdTable[i].ifd == ifd)
|
||||
break;
|
||||
|
||||
return (ExifIfdTable[i].name);
|
||||
}
|
||||
434
libexifa/exif-loader.c
Executable file
434
libexifa/exif-loader.c
Executable file
@@ -0,0 +1,434 @@
|
||||
/* exif-loader.c
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <libexif/exif-loader.h>
|
||||
#include <libexif/exif-utils.h>
|
||||
#include <libexif/i18n.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#undef JPEG_MARKER_DHT
|
||||
#define JPEG_MARKER_DHT 0xc4
|
||||
#undef JPEG_MARKER_SOI
|
||||
#define JPEG_MARKER_SOI 0xd8
|
||||
#undef JPEG_MARKER_DQT
|
||||
#define JPEG_MARKER_DQT 0xdb
|
||||
#undef JPEG_MARKER_APP0
|
||||
#define JPEG_MARKER_APP0 0xe0
|
||||
#undef JPEG_MARKER_APP1
|
||||
#define JPEG_MARKER_APP1 0xe1
|
||||
#undef JPEG_MARKER_APP2
|
||||
#define JPEG_MARKER_APP2 0xe2
|
||||
#undef JPEG_MARKER_APP13
|
||||
#define JPEG_MARKER_APP13 0xed
|
||||
#undef JPEG_MARKER_COM
|
||||
#define JPEG_MARKER_COM 0xfe
|
||||
|
||||
typedef enum {
|
||||
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,
|
||||
} ExifLoaderState;
|
||||
|
||||
typedef enum {
|
||||
EL_DATA_FORMAT_UNKNOWN,
|
||||
EL_DATA_FORMAT_EXIF,
|
||||
EL_DATA_FORMAT_JPEG,
|
||||
EL_DATA_FORMAT_FUJI_RAW
|
||||
} ExifLoaderDataFormat;
|
||||
|
||||
/*! \internal */
|
||||
struct _ExifLoader {
|
||||
ExifLoaderState state;
|
||||
ExifLoaderDataFormat data_format;
|
||||
|
||||
/*! Small buffer used for detection of format */
|
||||
unsigned char b[12];
|
||||
|
||||
/*! Number of bytes in the small buffer \c b */
|
||||
unsigned char b_len;
|
||||
|
||||
unsigned int size;
|
||||
unsigned char *buf;
|
||||
unsigned int bytes_read;
|
||||
|
||||
unsigned int ref_count;
|
||||
|
||||
ExifLog *log;
|
||||
ExifMem *mem;
|
||||
};
|
||||
|
||||
/*! Magic number for EXIF header */
|
||||
static const unsigned char ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, 0x00};
|
||||
|
||||
static void *
|
||||
exif_loader_alloc (ExifLoader *l, unsigned int i)
|
||||
{
|
||||
void *d;
|
||||
|
||||
if (!l || !i)
|
||||
return NULL;
|
||||
|
||||
d = exif_mem_alloc (l->mem, i);
|
||||
if (d)
|
||||
return d;
|
||||
|
||||
EXIF_LOG_NO_MEMORY (l->log, "ExifLog", i);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
exif_loader_write_file (ExifLoader *l, const char *path)
|
||||
{
|
||||
FILE *f;
|
||||
int size;
|
||||
unsigned char data[1024];
|
||||
|
||||
if (!l)
|
||||
return;
|
||||
|
||||
f = fopen (path, "rb");
|
||||
if (!f) {
|
||||
exif_log (l->log, EXIF_LOG_CODE_NONE, "ExifLoader",
|
||||
_("The file '%s' could not be opened."), path);
|
||||
return;
|
||||
}
|
||||
while (1) {
|
||||
size = fread (data, 1, sizeof (data), f);
|
||||
if (size <= 0)
|
||||
break;
|
||||
if (!exif_loader_write (l, data, size))
|
||||
break;
|
||||
}
|
||||
fclose (f);
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
exif_loader_copy (ExifLoader *eld, unsigned char *buf, unsigned int len)
|
||||
{
|
||||
if (!eld || (len && !buf) || (eld->bytes_read >= eld->size))
|
||||
return 0;
|
||||
|
||||
/* If needed, allocate the buffer. */
|
||||
if (!eld->buf)
|
||||
eld->buf = exif_loader_alloc (eld, eld->size);
|
||||
if (!eld->buf)
|
||||
return 0;
|
||||
|
||||
/* Copy memory */
|
||||
len = MIN (len, eld->size - eld->bytes_read);
|
||||
memcpy (eld->buf + eld->bytes_read, buf, len);
|
||||
eld->bytes_read += len;
|
||||
|
||||
return (eld->bytes_read >= eld->size) ? 0 : 1;
|
||||
}
|
||||
|
||||
unsigned char
|
||||
exif_loader_write (ExifLoader *eld, unsigned char *buf, unsigned int len)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (!eld || (len && !buf))
|
||||
return 0;
|
||||
|
||||
switch (eld->state) {
|
||||
case EL_EXIF_FOUND:
|
||||
return exif_loader_copy (eld, buf, len);
|
||||
case EL_SKIP_BYTES:
|
||||
if (eld->size > len) {
|
||||
eld->size -= len;
|
||||
return 1;
|
||||
}
|
||||
len -= eld->size;
|
||||
buf += eld->size;
|
||||
eld->size = 0;
|
||||
eld->b_len = 0;
|
||||
switch (eld->data_format) {
|
||||
case EL_DATA_FORMAT_FUJI_RAW:
|
||||
eld->state = EL_READ_SIZE_BYTE_24;
|
||||
break;
|
||||
default:
|
||||
eld->state = EL_READ;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case EL_READ:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (!len)
|
||||
return 1;
|
||||
exif_log (eld->log, EXIF_LOG_CODE_DEBUG, "ExifLoader",
|
||||
"Scanning %i byte(s) of data...", len);
|
||||
|
||||
/*
|
||||
* First fill the small buffer. Only continue if the buffer
|
||||
* is filled. Note that EXIF data contains at least 12 bytes.
|
||||
*/
|
||||
i = MIN (len, sizeof (eld->b) - eld->b_len);
|
||||
if (i) {
|
||||
memcpy (&eld->b[eld->b_len], buf, i);
|
||||
eld->b_len += i;
|
||||
if (eld->b_len < sizeof (eld->b))
|
||||
return 1;
|
||||
buf += i;
|
||||
len -= i;
|
||||
}
|
||||
|
||||
switch (eld->data_format) {
|
||||
case EL_DATA_FORMAT_UNKNOWN:
|
||||
|
||||
/* Check the small buffer against known formats. */
|
||||
if (!memcmp (eld->b, "FUJIFILM", 8)) {
|
||||
|
||||
/* Skip to byte 84. There is another offset there. */
|
||||
eld->data_format = EL_DATA_FORMAT_FUJI_RAW;
|
||||
eld->size = 84;
|
||||
eld->state = EL_SKIP_BYTES;
|
||||
eld->size = 84;
|
||||
|
||||
} else if (!memcmp (eld->b + 2, ExifHeader, sizeof (ExifHeader))) {
|
||||
|
||||
/* Read the size (2 bytes). */
|
||||
eld->data_format = EL_DATA_FORMAT_EXIF;
|
||||
eld->state = EL_READ_SIZE_BYTE_08;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof (eld->b); i++)
|
||||
switch (eld->state) {
|
||||
case EL_EXIF_FOUND:
|
||||
if (!exif_loader_copy (eld, eld->b + i,
|
||||
sizeof (eld->b) - i))
|
||||
return 0;
|
||||
return exif_loader_copy (eld, buf, len);
|
||||
case EL_SKIP_BYTES:
|
||||
eld->size--;
|
||||
if (!eld->size)
|
||||
eld->state = EL_READ;
|
||||
break;
|
||||
|
||||
case EL_READ_SIZE_BYTE_24:
|
||||
eld->size |= eld->b[i] << 24;
|
||||
eld->state = EL_READ_SIZE_BYTE_16;
|
||||
break;
|
||||
case EL_READ_SIZE_BYTE_16:
|
||||
eld->size |= eld->b[i] << 16;
|
||||
eld->state = EL_READ_SIZE_BYTE_08;
|
||||
break;
|
||||
case EL_READ_SIZE_BYTE_08:
|
||||
eld->size |= eld->b[i] << 8;
|
||||
eld->state = EL_READ_SIZE_BYTE_00;
|
||||
break;
|
||||
case EL_READ_SIZE_BYTE_00:
|
||||
eld->size |= eld->b[i] << 0;
|
||||
switch (eld->data_format) {
|
||||
case EL_DATA_FORMAT_JPEG:
|
||||
eld->state = EL_SKIP_BYTES;
|
||||
eld->size -= 2;
|
||||
break;
|
||||
case EL_DATA_FORMAT_FUJI_RAW:
|
||||
eld->data_format = EL_DATA_FORMAT_EXIF;
|
||||
eld->state = EL_SKIP_BYTES;
|
||||
eld->size -= 86;
|
||||
break;
|
||||
case EL_DATA_FORMAT_EXIF:
|
||||
eld->state = EL_EXIF_FOUND;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
switch (eld->b[i]) {
|
||||
case JPEG_MARKER_APP1:
|
||||
if (!memcmp (eld->b + i + 3, ExifHeader, MIN((ssize_t)(sizeof(ExifHeader)), MAX(0, ((ssize_t)(sizeof(eld->b))) - ((ssize_t)i) - 3)))) {
|
||||
eld->data_format = EL_DATA_FORMAT_EXIF;
|
||||
} else {
|
||||
eld->data_format = EL_DATA_FORMAT_JPEG; /* Probably JFIF - keep searching for APP1 EXIF*/
|
||||
}
|
||||
eld->size = 0;
|
||||
eld->state = EL_READ_SIZE_BYTE_08;
|
||||
break;
|
||||
case JPEG_MARKER_DHT:
|
||||
case JPEG_MARKER_DQT:
|
||||
case JPEG_MARKER_APP0:
|
||||
case JPEG_MARKER_APP2:
|
||||
case JPEG_MARKER_APP13:
|
||||
case JPEG_MARKER_COM:
|
||||
eld->data_format = EL_DATA_FORMAT_JPEG;
|
||||
eld->size = 0;
|
||||
eld->state = EL_READ_SIZE_BYTE_08;
|
||||
break;
|
||||
case 0xff:
|
||||
case JPEG_MARKER_SOI:
|
||||
break;
|
||||
default:
|
||||
exif_log (eld->log,
|
||||
EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifLoader", _("The data supplied "
|
||||
"does not seem to contain "
|
||||
"EXIF data."));
|
||||
exif_loader_reset (eld);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If we reach this point, the buffer has not been big enough
|
||||
* to read all data we need. Fill it with new data.
|
||||
*/
|
||||
eld->b_len = 0;
|
||||
return exif_loader_write (eld, buf, len);
|
||||
}
|
||||
|
||||
ExifLoader *
|
||||
exif_loader_new (void)
|
||||
{
|
||||
ExifMem *mem = exif_mem_new_default ();
|
||||
ExifLoader *l = exif_loader_new_mem (mem);
|
||||
|
||||
exif_mem_unref (mem);
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
ExifLoader *
|
||||
exif_loader_new_mem (ExifMem *mem)
|
||||
{
|
||||
ExifLoader *loader;
|
||||
|
||||
if (!mem)
|
||||
return NULL;
|
||||
|
||||
loader = exif_mem_alloc (mem, sizeof (ExifLoader));
|
||||
if (!loader)
|
||||
return NULL;
|
||||
loader->ref_count = 1;
|
||||
|
||||
loader->mem = mem;
|
||||
exif_mem_ref (mem);
|
||||
|
||||
return loader;
|
||||
}
|
||||
|
||||
void
|
||||
exif_loader_ref (ExifLoader *loader)
|
||||
{
|
||||
if (loader)
|
||||
loader->ref_count++;
|
||||
}
|
||||
|
||||
static void
|
||||
exif_loader_free (ExifLoader *loader)
|
||||
{
|
||||
ExifMem *mem;
|
||||
|
||||
if (!loader)
|
||||
return;
|
||||
|
||||
mem = loader->mem;
|
||||
exif_loader_reset (loader);
|
||||
exif_log_unref (loader->log);
|
||||
exif_mem_free (mem, loader);
|
||||
exif_mem_unref (mem);
|
||||
}
|
||||
|
||||
void
|
||||
exif_loader_unref (ExifLoader *loader)
|
||||
{
|
||||
if (!loader)
|
||||
return;
|
||||
if (!--loader->ref_count)
|
||||
exif_loader_free (loader);
|
||||
}
|
||||
|
||||
void
|
||||
exif_loader_reset (ExifLoader *loader)
|
||||
{
|
||||
if (!loader)
|
||||
return;
|
||||
exif_mem_free (loader->mem, loader->buf); loader->buf = NULL;
|
||||
loader->size = 0;
|
||||
loader->bytes_read = 0;
|
||||
loader->state = 0;
|
||||
loader->b_len = 0;
|
||||
loader->data_format = EL_DATA_FORMAT_UNKNOWN;
|
||||
}
|
||||
|
||||
ExifData *
|
||||
exif_loader_get_data (ExifLoader *loader)
|
||||
{
|
||||
ExifData *ed;
|
||||
|
||||
if (!loader || (loader->data_format == EL_DATA_FORMAT_UNKNOWN) ||
|
||||
!loader->bytes_read)
|
||||
return NULL;
|
||||
|
||||
ed = exif_data_new_mem (loader->mem);
|
||||
exif_data_log (ed, loader->log);
|
||||
exif_data_load_data (ed, loader->buf, loader->bytes_read);
|
||||
|
||||
return ed;
|
||||
}
|
||||
|
||||
void
|
||||
exif_loader_get_buf (ExifLoader *loader, const unsigned char **buf,
|
||||
unsigned int *buf_size)
|
||||
{
|
||||
const unsigned char* b = NULL;
|
||||
unsigned int s = 0;
|
||||
|
||||
if (!loader || (loader->data_format == EL_DATA_FORMAT_UNKNOWN)) {
|
||||
exif_log (loader->log, EXIF_LOG_CODE_DEBUG, "ExifLoader",
|
||||
"Loader format unknown");
|
||||
} else {
|
||||
b = loader->buf;
|
||||
s = loader->bytes_read;
|
||||
}
|
||||
if (buf)
|
||||
*buf = b;
|
||||
if (buf_size)
|
||||
*buf_size = s;
|
||||
}
|
||||
|
||||
void
|
||||
exif_loader_log (ExifLoader *loader, ExifLog *log)
|
||||
{
|
||||
if (!loader)
|
||||
return;
|
||||
exif_log_unref (loader->log);
|
||||
loader->log = log;
|
||||
exif_log_ref (log);
|
||||
}
|
||||
152
libexifa/exif-log.c
Executable file
152
libexifa/exif-log.c
Executable file
@@ -0,0 +1,152 @@
|
||||
/* exif-log.c
|
||||
*
|
||||
* Copyright (c) 2004 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <libexif/exif-log.h>
|
||||
#include <libexif/i18n.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
struct _ExifLog {
|
||||
unsigned int ref_count;
|
||||
|
||||
ExifLogFunc func;
|
||||
void *data;
|
||||
|
||||
ExifMem *mem;
|
||||
};
|
||||
|
||||
static const struct {
|
||||
ExifLogCode code;
|
||||
const char *title;
|
||||
const char *message;
|
||||
} codes[] = {
|
||||
{ EXIF_LOG_CODE_DEBUG, N_("Debugging information"),
|
||||
N_("Debugging information is available.") },
|
||||
{ EXIF_LOG_CODE_NO_MEMORY, N_("Not enough memory"),
|
||||
N_("The system cannot provide enough memory.") },
|
||||
{ EXIF_LOG_CODE_CORRUPT_DATA, N_("Corrupt data"),
|
||||
N_("The data provided does not follow the specification.") },
|
||||
{ 0, NULL, NULL }
|
||||
};
|
||||
|
||||
const char *
|
||||
exif_log_code_get_title (ExifLogCode code)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; codes[i].title; i++) if (codes[i].code == code) break;
|
||||
return _(codes[i].title);
|
||||
}
|
||||
|
||||
const char *
|
||||
exif_log_code_get_message (ExifLogCode code)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; codes[i].message; i++) if (codes[i].code == code) break;
|
||||
return _(codes[i].message);
|
||||
}
|
||||
|
||||
ExifLog *
|
||||
exif_log_new_mem (ExifMem *mem)
|
||||
{
|
||||
ExifLog *log;
|
||||
|
||||
log = exif_mem_alloc (mem, sizeof (ExifLog));
|
||||
if (!log) return NULL;
|
||||
log->ref_count = 1;
|
||||
|
||||
log->mem = mem;
|
||||
exif_mem_ref (mem);
|
||||
|
||||
return log;
|
||||
}
|
||||
|
||||
ExifLog *
|
||||
exif_log_new (void)
|
||||
{
|
||||
ExifMem *mem = exif_mem_new_default ();
|
||||
ExifLog *log = exif_log_new_mem (mem);
|
||||
|
||||
exif_mem_unref (mem);
|
||||
|
||||
return log;
|
||||
}
|
||||
|
||||
void
|
||||
exif_log_ref (ExifLog *log)
|
||||
{
|
||||
if (!log) return;
|
||||
log->ref_count++;
|
||||
}
|
||||
|
||||
void
|
||||
exif_log_unref (ExifLog *log)
|
||||
{
|
||||
if (!log) return;
|
||||
if (log->ref_count > 0) log->ref_count--;
|
||||
if (!log->ref_count) exif_log_free (log);
|
||||
}
|
||||
|
||||
void
|
||||
exif_log_free (ExifLog *log)
|
||||
{
|
||||
ExifMem *mem = log ? log->mem : NULL;
|
||||
|
||||
if (!log) return;
|
||||
|
||||
exif_mem_free (mem, log);
|
||||
exif_mem_unref (mem);
|
||||
}
|
||||
|
||||
void
|
||||
exif_log_set_func (ExifLog *log, ExifLogFunc func, void *data)
|
||||
{
|
||||
if (!log) return;
|
||||
log->func = func;
|
||||
log->data = data;
|
||||
}
|
||||
|
||||
#ifdef NO_VERBOSE_TAG_STRINGS
|
||||
/* exif_log forms part of the API and can't be commented away */
|
||||
#undef exif_log
|
||||
#endif
|
||||
void
|
||||
exif_log (ExifLog *log, ExifLogCode code, const char *domain,
|
||||
const char *format, ...)
|
||||
{
|
||||
va_list args;
|
||||
|
||||
va_start (args, format);
|
||||
exif_logv (log, code, domain, format, args);
|
||||
va_end (args);
|
||||
}
|
||||
|
||||
void
|
||||
exif_logv (ExifLog *log, ExifLogCode code, const char *domain,
|
||||
const char *format, va_list args)
|
||||
{
|
||||
if (!log) return;
|
||||
if (!log->func) return;
|
||||
log->func (log, code, domain, format, args, log->data);
|
||||
}
|
||||
99
libexifa/exif-mem.c
Executable file
99
libexifa/exif-mem.c
Executable file
@@ -0,0 +1,99 @@
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
struct _ExifMem {
|
||||
unsigned int ref_count;
|
||||
ExifMemAllocFunc alloc_func;
|
||||
ExifMemReallocFunc realloc_func;
|
||||
ExifMemFreeFunc free_func;
|
||||
};
|
||||
|
||||
/*! Default memory allocation function. */
|
||||
static void *
|
||||
exif_mem_alloc_func (ExifLong ds)
|
||||
{
|
||||
return calloc ((size_t) ds, 1);
|
||||
}
|
||||
|
||||
/*! Default memory reallocation function. */
|
||||
static void *
|
||||
exif_mem_realloc_func (void *d, ExifLong ds)
|
||||
{
|
||||
return realloc (d, (size_t) ds);
|
||||
}
|
||||
|
||||
/*! Default memory free function. */
|
||||
static void
|
||||
exif_mem_free_func (void *d)
|
||||
{
|
||||
free (d);
|
||||
}
|
||||
|
||||
ExifMem *
|
||||
exif_mem_new (ExifMemAllocFunc alloc_func, ExifMemReallocFunc realloc_func,
|
||||
ExifMemFreeFunc free_func)
|
||||
{
|
||||
ExifMem *mem;
|
||||
|
||||
if (!alloc_func && !realloc_func)
|
||||
return NULL;
|
||||
mem = alloc_func ? alloc_func (sizeof (ExifMem)) :
|
||||
realloc_func (NULL, sizeof (ExifMem));
|
||||
if (!mem) return NULL;
|
||||
mem->ref_count = 1;
|
||||
|
||||
mem->alloc_func = alloc_func;
|
||||
mem->realloc_func = realloc_func;
|
||||
mem->free_func = free_func;
|
||||
|
||||
return mem;
|
||||
}
|
||||
|
||||
void
|
||||
exif_mem_ref (ExifMem *mem)
|
||||
{
|
||||
if (!mem) return;
|
||||
mem->ref_count++;
|
||||
}
|
||||
|
||||
void
|
||||
exif_mem_unref (ExifMem *mem)
|
||||
{
|
||||
if (!mem) return;
|
||||
if (!--mem->ref_count)
|
||||
exif_mem_free (mem, mem);
|
||||
}
|
||||
|
||||
void
|
||||
exif_mem_free (ExifMem *mem, void *d)
|
||||
{
|
||||
if (!mem) return;
|
||||
if (mem->free_func) {
|
||||
mem->free_func (d);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
exif_mem_alloc (ExifMem *mem, ExifLong ds)
|
||||
{
|
||||
if (!mem) return NULL;
|
||||
if (mem->alloc_func || mem->realloc_func)
|
||||
return mem->alloc_func ? mem->alloc_func (ds) :
|
||||
mem->realloc_func (NULL, ds);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void *
|
||||
exif_mem_realloc (ExifMem *mem, void *d, ExifLong ds)
|
||||
{
|
||||
return (mem && mem->realloc_func) ? mem->realloc_func (d, ds) : NULL;
|
||||
}
|
||||
|
||||
ExifMem *
|
||||
exif_mem_new_default (void)
|
||||
{
|
||||
return exif_mem_new (exif_mem_alloc_func, exif_mem_realloc_func,
|
||||
exif_mem_free_func);
|
||||
}
|
||||
158
libexifa/exif-mnote-data.c
Executable file
158
libexifa/exif-mnote-data.c
Executable file
@@ -0,0 +1,158 @@
|
||||
/* exif-mnote-data.c
|
||||
*
|
||||
* Copyright (C) 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <libexif/exif-mnote-data.h>
|
||||
#include <libexif/exif-mnote-data-priv.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
struct _ExifMnoteDataPriv
|
||||
{
|
||||
unsigned int ref_count;
|
||||
};
|
||||
|
||||
void
|
||||
exif_mnote_data_construct (ExifMnoteData *d, ExifMem *mem)
|
||||
{
|
||||
if (!d || !mem) return;
|
||||
if (d->priv) return;
|
||||
d->priv = exif_mem_alloc (mem, sizeof (ExifMnoteDataPriv));
|
||||
if (!d->priv) return;
|
||||
|
||||
d->priv->ref_count = 1;
|
||||
|
||||
d->mem = mem;
|
||||
exif_mem_ref (mem);
|
||||
}
|
||||
|
||||
void
|
||||
exif_mnote_data_ref (ExifMnoteData *d)
|
||||
{
|
||||
if (d && d->priv) d->priv->ref_count++;
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_free (ExifMnoteData *d)
|
||||
{
|
||||
ExifMem *mem = d ? d->mem : NULL;
|
||||
|
||||
if (!d) return;
|
||||
if (d->priv) {
|
||||
if (d->methods.free) d->methods.free (d);
|
||||
exif_mem_free (mem, d->priv);
|
||||
d->priv = NULL;
|
||||
}
|
||||
exif_log_unref (d->log);
|
||||
exif_mem_free (mem, d);
|
||||
exif_mem_unref (mem);
|
||||
}
|
||||
|
||||
void
|
||||
exif_mnote_data_unref (ExifMnoteData *d)
|
||||
{
|
||||
if (!d || !d->priv) return;
|
||||
if (d->priv->ref_count > 0) d->priv->ref_count--;
|
||||
if (!d->priv->ref_count)
|
||||
exif_mnote_data_free (d);
|
||||
}
|
||||
|
||||
void
|
||||
exif_mnote_data_load (ExifMnoteData *d, const unsigned char *buf,
|
||||
unsigned int buf_size)
|
||||
{
|
||||
if (!d || !d->methods.load) return;
|
||||
d->methods.load (d, buf, buf_size);
|
||||
}
|
||||
|
||||
void
|
||||
exif_mnote_data_save (ExifMnoteData *d, unsigned char **buf,
|
||||
unsigned int *buf_size)
|
||||
{
|
||||
if (!d || !d->methods.save) return;
|
||||
d->methods.save (d, buf, buf_size);
|
||||
}
|
||||
|
||||
void
|
||||
exif_mnote_data_set_byte_order (ExifMnoteData *d, ExifByteOrder o)
|
||||
{
|
||||
if (!d || !d->methods.set_byte_order) return;
|
||||
d->methods.set_byte_order (d, o);
|
||||
}
|
||||
|
||||
void
|
||||
exif_mnote_data_set_offset (ExifMnoteData *d, unsigned int o)
|
||||
{
|
||||
if (!d || !d->methods.set_offset) return;
|
||||
d->methods.set_offset (d, o);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
exif_mnote_data_count (ExifMnoteData *d)
|
||||
{
|
||||
if (!d || !d->methods.count) return 0;
|
||||
return d->methods.count (d);
|
||||
}
|
||||
|
||||
unsigned int
|
||||
exif_mnote_data_get_id (ExifMnoteData *d, unsigned int n)
|
||||
{
|
||||
if (!d || !d->methods.get_id) return 0;
|
||||
return d->methods.get_id (d, n);
|
||||
}
|
||||
|
||||
const char *
|
||||
exif_mnote_data_get_name (ExifMnoteData *d, unsigned int n)
|
||||
{
|
||||
if (!d || !d->methods.get_name) return NULL;
|
||||
return d->methods.get_name (d, n);
|
||||
}
|
||||
|
||||
const char *
|
||||
exif_mnote_data_get_title (ExifMnoteData *d, unsigned int n)
|
||||
{
|
||||
if (!d || !d->methods.get_title) return NULL;
|
||||
return d->methods.get_title (d, n);
|
||||
}
|
||||
|
||||
const char *
|
||||
exif_mnote_data_get_description (ExifMnoteData *d, unsigned int n)
|
||||
{
|
||||
if (!d || !d->methods.get_description) return NULL;
|
||||
return d->methods.get_description (d, n);
|
||||
}
|
||||
|
||||
char *
|
||||
exif_mnote_data_get_value (ExifMnoteData *d, unsigned int n, char *val, unsigned int maxlen)
|
||||
{
|
||||
if (!d || !d->methods.get_value) return NULL;
|
||||
return d->methods.get_value (d, n, val, maxlen);
|
||||
}
|
||||
|
||||
void
|
||||
exif_mnote_data_log (ExifMnoteData *d, ExifLog *log)
|
||||
{
|
||||
if (!d) return;
|
||||
exif_log_unref (d->log);
|
||||
d->log = log;
|
||||
exif_log_ref (log);
|
||||
}
|
||||
1180
libexifa/exif-tag.c
Executable file
1180
libexifa/exif-tag.c
Executable file
File diff suppressed because it is too large
Load Diff
253
libexifa/exif-utils.c
Executable file
253
libexifa/exif-utils.c
Executable file
@@ -0,0 +1,253 @@
|
||||
/* exif-utils.c
|
||||
*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <libexif/exif-utils.h>
|
||||
|
||||
void
|
||||
exif_array_set_byte_order (ExifFormat f, unsigned char *b, unsigned int n,
|
||||
ExifByteOrder o_orig, ExifByteOrder o_new)
|
||||
{
|
||||
unsigned int j;
|
||||
unsigned int fs = exif_format_get_size (f);
|
||||
ExifShort s;
|
||||
ExifSShort ss;
|
||||
ExifLong l;
|
||||
ExifSLong sl;
|
||||
ExifRational r;
|
||||
ExifSRational sr;
|
||||
|
||||
if (!b || !n || !fs) return;
|
||||
|
||||
switch (f) {
|
||||
case EXIF_FORMAT_SHORT:
|
||||
for (j = 0; j < n; j++) {
|
||||
s = exif_get_short (b + j * fs, o_orig);
|
||||
exif_set_short (b + j * fs, o_new, s);
|
||||
}
|
||||
break;
|
||||
case EXIF_FORMAT_SSHORT:
|
||||
for (j = 0; j < n; j++) {
|
||||
ss = exif_get_sshort (b + j * fs, o_orig);
|
||||
exif_set_sshort (b + j * fs, o_new, ss);
|
||||
}
|
||||
break;
|
||||
case EXIF_FORMAT_LONG:
|
||||
for (j = 0; j < n; j++) {
|
||||
l = exif_get_long (b + j * fs, o_orig);
|
||||
exif_set_long (b + j * fs, o_new, l);
|
||||
}
|
||||
break;
|
||||
case EXIF_FORMAT_RATIONAL:
|
||||
for (j = 0; j < n; j++) {
|
||||
r = exif_get_rational (b + j * fs, o_orig);
|
||||
exif_set_rational (b + j * fs, o_new, r);
|
||||
}
|
||||
break;
|
||||
case EXIF_FORMAT_SLONG:
|
||||
for (j = 0; j < n; j++) {
|
||||
sl = exif_get_slong (b + j * fs, o_orig);
|
||||
exif_set_slong (b + j * fs, o_new, sl);
|
||||
}
|
||||
break;
|
||||
case EXIF_FORMAT_SRATIONAL:
|
||||
for (j = 0; j < n; j++) {
|
||||
sr = exif_get_srational (b + j * fs, o_orig);
|
||||
exif_set_srational (b + j * fs, o_new, sr);
|
||||
}
|
||||
break;
|
||||
case EXIF_FORMAT_UNDEFINED:
|
||||
case EXIF_FORMAT_BYTE:
|
||||
case EXIF_FORMAT_ASCII:
|
||||
default:
|
||||
/* Nothing here. */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ExifSShort
|
||||
exif_get_sshort (const unsigned char *buf, ExifByteOrder order)
|
||||
{
|
||||
if (!buf) return 0;
|
||||
switch (order) {
|
||||
case EXIF_BYTE_ORDER_MOTOROLA:
|
||||
return ((buf[0] << 8) | buf[1]);
|
||||
case EXIF_BYTE_ORDER_INTEL:
|
||||
return ((buf[1] << 8) | buf[0]);
|
||||
}
|
||||
|
||||
/* Won't be reached */
|
||||
return (0);
|
||||
}
|
||||
|
||||
ExifShort
|
||||
exif_get_short (const unsigned char *buf, ExifByteOrder order)
|
||||
{
|
||||
return (exif_get_sshort (buf, order) & 0xffff);
|
||||
}
|
||||
|
||||
void
|
||||
exif_set_sshort (unsigned char *b, ExifByteOrder order, ExifSShort value)
|
||||
{
|
||||
if (!b) return;
|
||||
switch (order) {
|
||||
case EXIF_BYTE_ORDER_MOTOROLA:
|
||||
b[0] = (unsigned char) (value >> 8);
|
||||
b[1] = (unsigned char) value;
|
||||
break;
|
||||
case EXIF_BYTE_ORDER_INTEL:
|
||||
b[0] = (unsigned char) value;
|
||||
b[1] = (unsigned char) (value >> 8);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
exif_set_short (unsigned char *b, ExifByteOrder order, ExifShort value)
|
||||
{
|
||||
exif_set_sshort (b, order, value);
|
||||
}
|
||||
|
||||
ExifSLong
|
||||
exif_get_slong (const unsigned char *b, ExifByteOrder order)
|
||||
{
|
||||
if (!b) return 0;
|
||||
switch (order) {
|
||||
case EXIF_BYTE_ORDER_MOTOROLA:
|
||||
return ((b[0] << 24) | (b[1] << 16) | (b[2] << 8) | b[3]);
|
||||
case EXIF_BYTE_ORDER_INTEL:
|
||||
return ((b[3] << 24) | (b[2] << 16) | (b[1] << 8) | b[0]);
|
||||
}
|
||||
|
||||
/* Won't be reached */
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
exif_set_slong (unsigned char *b, ExifByteOrder order, ExifSLong value)
|
||||
{
|
||||
if (!b) return;
|
||||
switch (order) {
|
||||
case EXIF_BYTE_ORDER_MOTOROLA:
|
||||
b[0] = (unsigned char) (value >> 24);
|
||||
b[1] = (unsigned char) (value >> 16);
|
||||
b[2] = (unsigned char) (value >> 8);
|
||||
b[3] = (unsigned char) value;
|
||||
break;
|
||||
case EXIF_BYTE_ORDER_INTEL:
|
||||
b[3] = (unsigned char) (value >> 24);
|
||||
b[2] = (unsigned char) (value >> 16);
|
||||
b[1] = (unsigned char) (value >> 8);
|
||||
b[0] = (unsigned char) value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ExifLong
|
||||
exif_get_long (const unsigned char *buf, ExifByteOrder order)
|
||||
{
|
||||
return (exif_get_slong (buf, order) & 0xffffffff);
|
||||
}
|
||||
|
||||
void
|
||||
exif_set_long (unsigned char *b, ExifByteOrder order, ExifLong value)
|
||||
{
|
||||
exif_set_slong (b, order, value);
|
||||
}
|
||||
|
||||
ExifSRational
|
||||
exif_get_srational (const unsigned char *buf, ExifByteOrder order)
|
||||
{
|
||||
ExifSRational r;
|
||||
|
||||
r.numerator = buf ? exif_get_slong (buf, order) : 0;
|
||||
r.denominator = buf ? exif_get_slong (buf + 4, order) : 0;
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
ExifRational
|
||||
exif_get_rational (const unsigned char *buf, ExifByteOrder order)
|
||||
{
|
||||
ExifRational r;
|
||||
|
||||
r.numerator = buf ? exif_get_long (buf, order) : 0;
|
||||
r.denominator = buf ? exif_get_long (buf + 4, order) : 0;
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
void
|
||||
exif_set_rational (unsigned char *buf, ExifByteOrder order,
|
||||
ExifRational value)
|
||||
{
|
||||
if (!buf) return;
|
||||
exif_set_long (buf, order, value.numerator);
|
||||
exif_set_long (buf + 4, order, value.denominator);
|
||||
}
|
||||
|
||||
void
|
||||
exif_set_srational (unsigned char *buf, ExifByteOrder order,
|
||||
ExifSRational value)
|
||||
{
|
||||
if (!buf) return;
|
||||
exif_set_slong (buf, order, value.numerator);
|
||||
exif_set_slong (buf + 4, order, value.denominator);
|
||||
}
|
||||
|
||||
/*! This function converts rather UCS-2LE than UTF-16 to UTF-8.
|
||||
* It should really be replaced by iconv().
|
||||
*/
|
||||
void
|
||||
exif_convert_utf16_to_utf8 (char *out, const unsigned short *in, int maxlen)
|
||||
{
|
||||
if (maxlen <= 0) {
|
||||
return;
|
||||
}
|
||||
while (*in) {
|
||||
if (*in < 0x80) {
|
||||
if (maxlen > 1) {
|
||||
*out++ = (char)*in++;
|
||||
maxlen--;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else if (*in < 0x800) {
|
||||
if (maxlen > 2) {
|
||||
*out++ = ((*in >> 6) & 0x1F) | 0xC0;
|
||||
*out++ = (*in++ & 0x3F) | 0x80;
|
||||
maxlen -= 2;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (maxlen > 2) {
|
||||
*out++ = ((*in >> 12) & 0x0F) | 0xE0;
|
||||
*out++ = ((*in >> 6) & 0x3F) | 0x80;
|
||||
*out++ = (*in++ & 0x3F) | 0x80;
|
||||
maxlen -= 3;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
*out = 0;
|
||||
}
|
||||
349
libexifa/fuji/exif-mnote-data-fuji.c
Executable file
349
libexifa/fuji/exif-mnote-data-fuji.c
Executable file
@@ -0,0 +1,349 @@
|
||||
/* exif-mnote-data-fuji.c
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
|
||||
#include <config.h>
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-utils.h>
|
||||
|
||||
#include "exif-mnote-data-fuji.h"
|
||||
|
||||
struct _MNoteFujiDataPrivate {
|
||||
ExifByteOrder order;
|
||||
};
|
||||
|
||||
static void
|
||||
exif_mnote_data_fuji_clear (ExifMnoteDataFuji *n)
|
||||
{
|
||||
ExifMnoteData *d = (ExifMnoteData *) n;
|
||||
unsigned int i;
|
||||
|
||||
if (!n) return;
|
||||
|
||||
if (n->entries) {
|
||||
for (i = 0; i < n->count; i++)
|
||||
if (n->entries[i].data) {
|
||||
exif_mem_free (d->mem, n->entries[i].data);
|
||||
n->entries[i].data = NULL;
|
||||
}
|
||||
exif_mem_free (d->mem, n->entries);
|
||||
n->entries = NULL;
|
||||
n->count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_fuji_free (ExifMnoteData *n)
|
||||
{
|
||||
if (!n) return;
|
||||
|
||||
exif_mnote_data_fuji_clear ((ExifMnoteDataFuji *) n);
|
||||
}
|
||||
|
||||
static char *
|
||||
exif_mnote_data_fuji_get_value (ExifMnoteData *d, unsigned int i, char *val, unsigned int maxlen)
|
||||
{
|
||||
ExifMnoteDataFuji *n = (ExifMnoteDataFuji *) d;
|
||||
|
||||
if (!d || !val) return NULL;
|
||||
if (i > n->count -1) return NULL;
|
||||
/*
|
||||
exif_log (d->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataFuji",
|
||||
"Querying value for tag '%s'...",
|
||||
mnote_fuji_tag_get_name (n->entries[i].tag));
|
||||
*/
|
||||
return mnote_fuji_entry_get_value (&n->entries[i], val, maxlen);
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_fuji_save (ExifMnoteData *ne, unsigned char **buf,
|
||||
unsigned int *buf_size)
|
||||
{
|
||||
ExifMnoteDataFuji *n = (ExifMnoteDataFuji *) ne;
|
||||
size_t i, o, s, doff;
|
||||
unsigned char *t;
|
||||
size_t ts;
|
||||
|
||||
if (!n || !buf || !buf_size) return;
|
||||
|
||||
/*
|
||||
* Allocate enough memory for all entries and the number
|
||||
* of entries.
|
||||
*/
|
||||
*buf_size = 8 + 4 + 2 + n->count * 12 + 4;
|
||||
*buf = exif_mem_alloc (ne->mem, *buf_size);
|
||||
if (!*buf) {
|
||||
*buf_size = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Header: "FUJIFILM" and 4 bytes offset to the first entry.
|
||||
* As the first entry will start right thereafter, the offset is 12.
|
||||
*/
|
||||
memcpy (*buf, "FUJIFILM", 8);
|
||||
exif_set_long (*buf + 8, n->order, 12);
|
||||
|
||||
/* Save the number of entries */
|
||||
exif_set_short (*buf + 8 + 4, n->order, (ExifShort) n->count);
|
||||
|
||||
/* Save each entry */
|
||||
for (i = 0; i < n->count; i++) {
|
||||
o = 8 + 4 + 2 + i * 12;
|
||||
exif_set_short (*buf + o + 0, n->order, (ExifShort) n->entries[i].tag);
|
||||
exif_set_short (*buf + o + 2, n->order, (ExifShort) n->entries[i].format);
|
||||
exif_set_long (*buf + o + 4, n->order, n->entries[i].components);
|
||||
o += 8;
|
||||
s = exif_format_get_size (n->entries[i].format) *
|
||||
n->entries[i].components;
|
||||
if (s > 65536) {
|
||||
/* Corrupt data: EXIF data size is limited to the
|
||||
* maximum size of a JPEG segment (64 kb).
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
if (s > 4) {
|
||||
ts = *buf_size + s;
|
||||
|
||||
/* Ensure even offsets. Set padding bytes to 0. */
|
||||
if (s & 1) ts += 1;
|
||||
t = exif_mem_realloc (ne->mem, *buf, ts);
|
||||
if (!t) {
|
||||
return;
|
||||
}
|
||||
*buf = t;
|
||||
*buf_size = ts;
|
||||
doff = *buf_size - s;
|
||||
if (s & 1) { doff--; *(*buf + *buf_size - 1) = '\0'; }
|
||||
exif_set_long (*buf + o, n->order, doff);
|
||||
} else
|
||||
doff = o;
|
||||
|
||||
/*
|
||||
* Write the data. Fill unneeded bytes with 0. Do not
|
||||
* crash if data is NULL.
|
||||
*/
|
||||
if (!n->entries[i].data) memset (*buf + doff, 0, s);
|
||||
else memcpy (*buf + doff, n->entries[i].data, s);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_fuji_load (ExifMnoteData *en,
|
||||
const unsigned char *buf, unsigned int buf_size)
|
||||
{
|
||||
ExifMnoteDataFuji *n = (ExifMnoteDataFuji*) en;
|
||||
ExifLong c;
|
||||
size_t i, tcount, o, datao;
|
||||
|
||||
if (!n || !buf || !buf_size) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteDataFuji", "Short MakerNote");
|
||||
return;
|
||||
}
|
||||
datao = 6 + n->offset;
|
||||
if ((datao + 12 < datao) || (datao + 12 < 12) || (datao + 12 > buf_size)) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteDataFuji", "Short MakerNote");
|
||||
return;
|
||||
}
|
||||
|
||||
n->order = EXIF_BYTE_ORDER_INTEL;
|
||||
datao += exif_get_long (buf + datao + 8, EXIF_BYTE_ORDER_INTEL);
|
||||
if ((datao + 2 < datao) || (datao + 2 < 2) ||
|
||||
(datao + 2 > buf_size)) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteDataFuji", "Short MakerNote");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Read the number of tags */
|
||||
c = exif_get_short (buf + datao, EXIF_BYTE_ORDER_INTEL);
|
||||
datao += 2;
|
||||
|
||||
/* Remove any old entries */
|
||||
exif_mnote_data_fuji_clear (n);
|
||||
|
||||
/* Reserve enough space for all the possible MakerNote tags */
|
||||
n->entries = exif_mem_alloc (en->mem, sizeof (MnoteFujiEntry) * c);
|
||||
if (!n->entries) {
|
||||
EXIF_LOG_NO_MEMORY(en->log, "ExifMnoteDataFuji", sizeof (MnoteFujiEntry) * c);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Parse all c entries, storing ones that are successfully parsed */
|
||||
tcount = 0;
|
||||
for (i = c, o = datao; i; --i, o += 12) {
|
||||
size_t s;
|
||||
if ((o + 12 < o) || (o + 12 < 12) || (o + 12 > buf_size)) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteDataFuji", "Short MakerNote");
|
||||
break;
|
||||
}
|
||||
|
||||
n->entries[tcount].tag = exif_get_short (buf + o, n->order);
|
||||
n->entries[tcount].format = exif_get_short (buf + o + 2, n->order);
|
||||
n->entries[tcount].components = exif_get_long (buf + o + 4, n->order);
|
||||
n->entries[tcount].order = n->order;
|
||||
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataFuji",
|
||||
"Loading entry 0x%x ('%s')...", n->entries[tcount].tag,
|
||||
mnote_fuji_tag_get_name (n->entries[tcount].tag));
|
||||
|
||||
/*
|
||||
* Size? If bigger than 4 bytes, the actual data is not
|
||||
* in the entry but somewhere else (offset).
|
||||
*/
|
||||
s = exif_format_get_size (n->entries[tcount].format) * n->entries[tcount].components;
|
||||
n->entries[tcount].size = s;
|
||||
if (s) {
|
||||
size_t dataofs = o + 8;
|
||||
if (s > 4)
|
||||
/* The data in this case is merely a pointer */
|
||||
dataofs = exif_get_long (buf + dataofs, n->order) + 6 + n->offset;
|
||||
if ((dataofs + s < dataofs) || (dataofs + s < s) ||
|
||||
(dataofs + s >= buf_size)) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteDataFuji", "Tag data past end of "
|
||||
"buffer (%u >= %u)", dataofs + s, buf_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
n->entries[tcount].data = exif_mem_alloc (en->mem, s);
|
||||
if (!n->entries[tcount].data) {
|
||||
EXIF_LOG_NO_MEMORY(en->log, "ExifMnoteDataFuji", s);
|
||||
continue;
|
||||
}
|
||||
memcpy (n->entries[tcount].data, buf + dataofs, s);
|
||||
}
|
||||
|
||||
/* Tag was successfully parsed */
|
||||
++tcount;
|
||||
}
|
||||
/* Store the count of successfully parsed tags */
|
||||
n->count = tcount;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
exif_mnote_data_fuji_count (ExifMnoteData *n)
|
||||
{
|
||||
return n ? ((ExifMnoteDataFuji *) n)->count : 0;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
exif_mnote_data_fuji_get_id (ExifMnoteData *d, unsigned int n)
|
||||
{
|
||||
ExifMnoteDataFuji *note = (ExifMnoteDataFuji *) d;
|
||||
|
||||
if (!note) return 0;
|
||||
if (note->count <= n) return 0;
|
||||
return note->entries[n].tag;
|
||||
}
|
||||
|
||||
static const char *
|
||||
exif_mnote_data_fuji_get_name (ExifMnoteData *d, unsigned int i)
|
||||
{
|
||||
ExifMnoteDataFuji *n = (ExifMnoteDataFuji *) d;
|
||||
|
||||
if (!n) return NULL;
|
||||
if (i >= n->count) return NULL;
|
||||
return mnote_fuji_tag_get_name (n->entries[i].tag);
|
||||
}
|
||||
|
||||
static const char *
|
||||
exif_mnote_data_fuji_get_title (ExifMnoteData *d, unsigned int i)
|
||||
{
|
||||
ExifMnoteDataFuji *n = (ExifMnoteDataFuji *) d;
|
||||
|
||||
if (!n) return NULL;
|
||||
if (i >= n->count) return NULL;
|
||||
return mnote_fuji_tag_get_title (n->entries[i].tag);
|
||||
}
|
||||
|
||||
static const char *
|
||||
exif_mnote_data_fuji_get_description (ExifMnoteData *d, unsigned int i)
|
||||
{
|
||||
ExifMnoteDataFuji *n = (ExifMnoteDataFuji *) d;
|
||||
|
||||
if (!n) return NULL;
|
||||
if (i >= n->count) return NULL;
|
||||
return mnote_fuji_tag_get_description (n->entries[i].tag);
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_fuji_set_byte_order (ExifMnoteData *d, ExifByteOrder o)
|
||||
{
|
||||
ExifByteOrder o_orig;
|
||||
ExifMnoteDataFuji *n = (ExifMnoteDataFuji *) d;
|
||||
unsigned int i;
|
||||
|
||||
if (!n) return;
|
||||
|
||||
o_orig = n->order;
|
||||
n->order = o;
|
||||
for (i = 0; i < n->count; i++) {
|
||||
n->entries[i].order = o;
|
||||
exif_array_set_byte_order (n->entries[i].format, n->entries[i].data,
|
||||
n->entries[i].components, o_orig, o);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_fuji_set_offset (ExifMnoteData *n, unsigned int o)
|
||||
{
|
||||
if (n) ((ExifMnoteDataFuji *) n)->offset = o;
|
||||
}
|
||||
|
||||
int
|
||||
exif_mnote_data_fuji_identify (const ExifData *ed, const ExifEntry *e)
|
||||
{
|
||||
return ((e->size >= 12) && !memcmp (e->data, "FUJIFILM", 8));
|
||||
}
|
||||
|
||||
ExifMnoteData *
|
||||
exif_mnote_data_fuji_new (ExifMem *mem)
|
||||
{
|
||||
ExifMnoteData *d;
|
||||
|
||||
if (!mem) return NULL;
|
||||
|
||||
d = exif_mem_alloc (mem, sizeof (ExifMnoteDataFuji));
|
||||
if (!d) return NULL;
|
||||
|
||||
exif_mnote_data_construct (d, mem);
|
||||
|
||||
/* Set up function pointers */
|
||||
d->methods.free = exif_mnote_data_fuji_free;
|
||||
d->methods.set_byte_order = exif_mnote_data_fuji_set_byte_order;
|
||||
d->methods.set_offset = exif_mnote_data_fuji_set_offset;
|
||||
d->methods.load = exif_mnote_data_fuji_load;
|
||||
d->methods.save = exif_mnote_data_fuji_save;
|
||||
d->methods.count = exif_mnote_data_fuji_count;
|
||||
d->methods.get_id = exif_mnote_data_fuji_get_id;
|
||||
d->methods.get_name = exif_mnote_data_fuji_get_name;
|
||||
d->methods.get_title = exif_mnote_data_fuji_get_title;
|
||||
d->methods.get_description = exif_mnote_data_fuji_get_description;
|
||||
d->methods.get_value = exif_mnote_data_fuji_get_value;
|
||||
|
||||
return d;
|
||||
}
|
||||
306
libexifa/fuji/mnote-fuji-entry.c
Executable file
306
libexifa/fuji/mnote-fuji-entry.c
Executable file
@@ -0,0 +1,306 @@
|
||||
/* mnote-fuji-entry.c
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <config.h>
|
||||
|
||||
#include <libexif/i18n.h>
|
||||
|
||||
#include "mnote-fuji-entry.h"
|
||||
|
||||
#define CF(format,target,v,maxlen) \
|
||||
{ \
|
||||
if (format != target) { \
|
||||
snprintf (v, maxlen, \
|
||||
_("Invalid format '%s', " \
|
||||
"expected '%s'."), \
|
||||
exif_format_get_name (format), \
|
||||
exif_format_get_name (target)); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CC(number,target,v,maxlen) \
|
||||
{ \
|
||||
if (number != target) { \
|
||||
snprintf (v, maxlen, \
|
||||
_("Invalid number of components (%i, " \
|
||||
"expected %i)."), (int) number, (int) target); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
static const struct {
|
||||
ExifTag tag;
|
||||
struct {
|
||||
int index;
|
||||
const char *string;
|
||||
} elem[22];
|
||||
} items[] = {
|
||||
#ifndef NO_VERBOSE_TAG_DATA
|
||||
{ MNOTE_FUJI_TAG_SHARPNESS,
|
||||
{ {1, N_("Softest")},
|
||||
{2, N_("Soft")},
|
||||
{3, N_("Normal")},
|
||||
{4, N_("Hard")},
|
||||
{5, N_("Hardest")},
|
||||
{0x0082, N_("Medium soft")},
|
||||
{0x0084, N_("Medium hard")},
|
||||
{0x8000, N_("Film simulation mode")},
|
||||
{0xFFFF, N_("Off")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_WHITE_BALANCE,
|
||||
{ {0, N_("Auto")},
|
||||
{0x100, N_("Daylight")},
|
||||
{0x200, N_("Cloudy")},
|
||||
{0x300, N_("Daylight fluorescent")},
|
||||
{0x301, N_("Day white fluorescent")},
|
||||
{0x302, N_("White fluorescent")},
|
||||
{0x400, N_("Incandescent")},
|
||||
{0x500, N_("Flash")},
|
||||
{0xF00, N_("Custom")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_COLOR,
|
||||
{ {0, N_("Standard")},
|
||||
{0x0080, N_("Medium high")},
|
||||
{0x0100, N_("High")},
|
||||
{0x0180, N_("Medium low")},
|
||||
{0x0200, N_("Original")},
|
||||
{0x0300, N_("Black & white")},
|
||||
{0x8000, N_("Film simulation mode")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_TONE,
|
||||
{ {0, N_("Standard")},
|
||||
{0x0080, N_("Medium hard")},
|
||||
{0x0100, N_("Hard")},
|
||||
{0x0180, N_("Medium soft")},
|
||||
{0x0200, N_("Original")},
|
||||
{0x8000, N_("Film simulation mode")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_FLASH_MODE,
|
||||
{ {0, N_("Auto")},
|
||||
{1, N_("On")},
|
||||
{2, N_("Off")},
|
||||
{3, N_("Red-eye reduction")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_MACRO,
|
||||
{ {0, N_("Off")},
|
||||
{1, N_("On")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_FOCUS_MODE,
|
||||
{ {0, N_("Auto")},
|
||||
{1, N_("Manual")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_SLOW_SYNC,
|
||||
{ {0, N_("Off")},
|
||||
{1, N_("On")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_PICTURE_MODE,
|
||||
{ {0, N_("Auto")},
|
||||
{1, N_("Portrait")},
|
||||
{2, N_("Landscape")},
|
||||
{4, N_("Sports")},
|
||||
{5, N_("Night")},
|
||||
{6, N_("Program AE")},
|
||||
{7, N_("Natural photo")},
|
||||
{8, N_("Vibration reduction")},
|
||||
{0x000A, N_("Sunset")},
|
||||
{0x000B, N_("Museum")},
|
||||
{0x000C, N_("Party")},
|
||||
{0x000D, N_("Flower")},
|
||||
{0x000E, N_("Text")},
|
||||
{0x000F, N_("NP & flash")},
|
||||
{0x0010, N_("Beach")},
|
||||
{0x0011, N_("Snow")},
|
||||
{0x0012, N_("Fireworks")},
|
||||
{0x0013, N_("Underwater")},
|
||||
{0x0100, N_("Aperture priority AE")},
|
||||
{0x0200, N_("Shutter priority AE")},
|
||||
{0x0300, N_("Manual exposure")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_CONT_TAKING,
|
||||
{ {0, N_("Off")},
|
||||
{1, N_("On")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_FINEPIX_COLOR,
|
||||
{ {0x00, N_("F-Standard")},
|
||||
{0x10, N_("F-Chrome")},
|
||||
{0x30, N_("F-B&W")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_BLUR_CHECK,
|
||||
{ {0, N_("No blur")},
|
||||
{1, N_("Blur warning")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_FOCUS_CHECK,
|
||||
{ {0, N_("Focus good")},
|
||||
{1, N_("Out of focus")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_AUTO_EXPOSURE_CHECK,
|
||||
{ {0, N_("AE good")},
|
||||
{1, N_("Over exposed")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_DYNAMIC_RANGE,
|
||||
{ {1, N_("Standard")},
|
||||
{3, N_("Wide")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_FILM_MODE,
|
||||
{ {0, N_("F0/Standard")},
|
||||
{0x0100, N_("F1/Studio portrait")},
|
||||
{0x0110, N_("F1a/Professional portrait")},
|
||||
{0x0120, N_("F1b/Professional portrait")},
|
||||
{0x0130, N_("F1c/Professional portrait")},
|
||||
{0x0200, N_("F2/Fujichrome")},
|
||||
{0x0300, N_("F3/Studio portrait Ex")},
|
||||
{0x0400, N_("F4/Velvia")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_FUJI_TAG_DYNAMIC_RANGE_SETTING,
|
||||
{ {0, N_("Auto (100-400%)")},
|
||||
{1, N_("RAW")},
|
||||
{0x0100, N_("Standard (100%)")},
|
||||
{0x0200, N_("Wide1 (230%)")},
|
||||
{0x0201, N_("Wide2 (400%)")},
|
||||
{0x8000, N_("Film simulation mode")},
|
||||
{0, NULL}}},
|
||||
#endif
|
||||
{0, {{0, NULL}}}
|
||||
};
|
||||
|
||||
|
||||
char *
|
||||
mnote_fuji_entry_get_value (MnoteFujiEntry *entry,
|
||||
char *val, unsigned int maxlen)
|
||||
{
|
||||
ExifLong vl;
|
||||
ExifSLong vsl;
|
||||
ExifShort vs, vs2;
|
||||
ExifRational vr;
|
||||
ExifSRational vsr;
|
||||
int i, j;
|
||||
|
||||
if (!entry) return (NULL);
|
||||
|
||||
memset (val, 0, maxlen);
|
||||
maxlen--;
|
||||
|
||||
switch (entry->tag) {
|
||||
case MNOTE_FUJI_TAG_VERSION:
|
||||
CF (entry->format, EXIF_FORMAT_UNDEFINED, val, maxlen);
|
||||
CC (entry->components, 4, val, maxlen);
|
||||
memcpy (val, entry->data, MIN(maxlen, entry->size));
|
||||
break;
|
||||
case MNOTE_FUJI_TAG_SHARPNESS:
|
||||
case MNOTE_FUJI_TAG_WHITE_BALANCE:
|
||||
case MNOTE_FUJI_TAG_COLOR:
|
||||
case MNOTE_FUJI_TAG_TONE:
|
||||
case MNOTE_FUJI_TAG_FLASH_MODE:
|
||||
case MNOTE_FUJI_TAG_MACRO:
|
||||
case MNOTE_FUJI_TAG_FOCUS_MODE:
|
||||
case MNOTE_FUJI_TAG_SLOW_SYNC:
|
||||
case MNOTE_FUJI_TAG_PICTURE_MODE:
|
||||
case MNOTE_FUJI_TAG_CONT_TAKING:
|
||||
case MNOTE_FUJI_TAG_FINEPIX_COLOR:
|
||||
case MNOTE_FUJI_TAG_BLUR_CHECK:
|
||||
case MNOTE_FUJI_TAG_FOCUS_CHECK:
|
||||
case MNOTE_FUJI_TAG_AUTO_EXPOSURE_CHECK:
|
||||
case MNOTE_FUJI_TAG_DYNAMIC_RANGE:
|
||||
case MNOTE_FUJI_TAG_FILM_MODE:
|
||||
case MNOTE_FUJI_TAG_DYNAMIC_RANGE_SETTING:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
|
||||
CC (entry->components, 1, val, maxlen);
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
|
||||
/* search the tag */
|
||||
for (i = 0; (items[i].tag && items[i].tag != entry->tag); i++);
|
||||
if (!items[i].tag) {
|
||||
snprintf (val, maxlen,
|
||||
_("Internal error (unknown value %i)"), vs);
|
||||
break;
|
||||
}
|
||||
|
||||
/* find the value */
|
||||
for (j = 0; items[i].elem[j].string &&
|
||||
(items[i].elem[j].index < vs); j++);
|
||||
if (items[i].elem[j].index != vs) {
|
||||
snprintf (val, maxlen,
|
||||
_("Internal error (unknown value %i)"), vs);
|
||||
break;
|
||||
}
|
||||
strncpy (val, _(items[i].elem[j].string), maxlen);
|
||||
break;
|
||||
case MNOTE_FUJI_TAG_FOCUS_POINT:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
|
||||
CC (entry->components, 2, val, maxlen);
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
vs2 = exif_get_short (entry->data+2, entry->order);
|
||||
snprintf (val, maxlen, "%i, %i", vs, vs2);
|
||||
break;
|
||||
case MNOTE_FUJI_TAG_MIN_FOCAL_LENGTH:
|
||||
case MNOTE_FUJI_TAG_MAX_FOCAL_LENGTH:
|
||||
CF (entry->format, EXIF_FORMAT_RATIONAL, val, maxlen);
|
||||
CC (entry->components, 1, val, maxlen);
|
||||
vr = exif_get_rational (entry->data, entry->order);
|
||||
if (!vr.denominator) break;
|
||||
snprintf (val, maxlen, _("%2.2f mm"), (double) vr.numerator /
|
||||
vr.denominator);
|
||||
break;
|
||||
|
||||
default:
|
||||
switch (entry->format) {
|
||||
case EXIF_FORMAT_ASCII:
|
||||
strncpy (val, (char *)entry->data, MIN(maxlen, entry->size));
|
||||
break;
|
||||
case EXIF_FORMAT_SHORT:
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
snprintf (val, maxlen, "%i", vs);
|
||||
break;
|
||||
case EXIF_FORMAT_LONG:
|
||||
vl = exif_get_long (entry->data, entry->order);
|
||||
snprintf (val, maxlen, "%lu", (long unsigned) vl);
|
||||
break;
|
||||
case EXIF_FORMAT_SLONG:
|
||||
vsl = exif_get_slong (entry->data, entry->order);
|
||||
snprintf (val, maxlen, "%li", (long int) vsl);
|
||||
break;
|
||||
case EXIF_FORMAT_RATIONAL:
|
||||
vr = exif_get_rational (entry->data, entry->order);
|
||||
if (!vr.denominator) break;
|
||||
snprintf (val, maxlen, "%2.4f", (double) vr.numerator /
|
||||
vr.denominator);
|
||||
break;
|
||||
case EXIF_FORMAT_SRATIONAL:
|
||||
vsr = exif_get_srational (entry->data, entry->order);
|
||||
if (!vsr.denominator) break;
|
||||
snprintf (val, maxlen, "%2.4f", (double) vsr.numerator /
|
||||
vsr.denominator);
|
||||
break;
|
||||
case EXIF_FORMAT_UNDEFINED:
|
||||
default:
|
||||
snprintf (val, maxlen, _("%i bytes unknown data"),
|
||||
entry->size);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return (val);
|
||||
}
|
||||
105
libexifa/fuji/mnote-fuji-tag.c
Executable file
105
libexifa/fuji/mnote-fuji-tag.c
Executable file
@@ -0,0 +1,105 @@
|
||||
/* mnote-fuji-tag.c
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <config.h>
|
||||
#include <libexif/i18n.h>
|
||||
|
||||
#include "mnote-fuji-tag.h"
|
||||
|
||||
|
||||
static const struct {
|
||||
MnoteFujiTag tag;
|
||||
const char *name;
|
||||
const char *title;
|
||||
const char *description;
|
||||
} table[] = {
|
||||
#ifndef NO_VERBOSE_TAG_STRINGS
|
||||
{MNOTE_FUJI_TAG_VERSION, "Version", N_("Maker Note Version"), ""},
|
||||
{MNOTE_FUJI_TAG_SERIAL_NUMBER, "SerialNumber", N_("Serial Number"), N_("This number is unique and based on the date of manufacture.")},
|
||||
{MNOTE_FUJI_TAG_QUALITY, "Quality", N_("Quality"), ""},
|
||||
{MNOTE_FUJI_TAG_SHARPNESS, "Sharpness", N_("Sharpness"), ""},
|
||||
{MNOTE_FUJI_TAG_WHITE_BALANCE, "WhiteBalance", N_("White Balance"), ""},
|
||||
{MNOTE_FUJI_TAG_COLOR, "ChromaticitySaturation", N_("Chromaticity Saturation"), ""},
|
||||
{MNOTE_FUJI_TAG_TONE, "Contrast", N_("Contrast"), ""},
|
||||
{MNOTE_FUJI_TAG_FLASH_MODE, "FlashMode", N_("Flash Mode"), ""},
|
||||
{MNOTE_FUJI_TAG_FLASH_STRENGTH, "FlashStrength", N_("Flash Firing Strength Compensation"), ""},
|
||||
{MNOTE_FUJI_TAG_MACRO, "MacroMode", N_("Macro Mode"), ""},
|
||||
{MNOTE_FUJI_TAG_FOCUS_MODE, "FocusingMode", N_("Focusing Mode"), ""},
|
||||
{MNOTE_FUJI_TAG_FOCUS_POINT, "FocusPoint", N_("Focus Point"), ""},
|
||||
{MNOTE_FUJI_TAG_SLOW_SYNC, "SlowSynchro", N_("Slow Synchro Mode"), ""},
|
||||
{MNOTE_FUJI_TAG_PICTURE_MODE, "PictureMode", N_("Picture Mode"), ""},
|
||||
{MNOTE_FUJI_TAG_CONT_TAKING, "ContinuousTaking", N_("Continuous Taking"), ""},
|
||||
{MNOTE_FUJI_TAG_SEQUENCE_NUMBER, "ContinuousSequence", N_("Continuous Sequence Number"), ""},
|
||||
{MNOTE_FUJI_TAG_FINEPIX_COLOR, "FinePixColor", N_("FinePix Color"), ""},
|
||||
{MNOTE_FUJI_TAG_BLUR_CHECK, "BlurCheck", N_("Blur Check"), ""},
|
||||
{MNOTE_FUJI_TAG_FOCUS_CHECK, "AutoFocusCheck", N_("Auto Focus Check"), ""},
|
||||
{MNOTE_FUJI_TAG_AUTO_EXPOSURE_CHECK, "AutoExposureCheck", N_("Auto Exposure Check"), ""},
|
||||
{MNOTE_FUJI_TAG_DYNAMIC_RANGE, "DynamicRange", N_("Dynamic Range"), ""},
|
||||
{MNOTE_FUJI_TAG_FILM_MODE, "FilmMode", N_("Film Simulation Mode"), ""},
|
||||
{MNOTE_FUJI_TAG_DYNAMIC_RANGE_SETTING, "DRangeMode", N_("Dynamic Range Wide Mode"), ""},
|
||||
{MNOTE_FUJI_TAG_DEV_DYNAMIC_RANGE_SETTING, "DevDRangeMode", N_("Development Dynamic Range Wide Mode"), ""},
|
||||
{MNOTE_FUJI_TAG_MIN_FOCAL_LENGTH, "MinFocalLen", N_("Minimum Focal Length"), ""},
|
||||
{MNOTE_FUJI_TAG_MAX_FOCAL_LENGTH, "MaxFocalLen", N_("Maximum Focal Length"), ""},
|
||||
{MNOTE_FUJI_TAG_MAX_APERT_AT_MIN_FOC, "MaxApertAtMinFoc", N_("Maximum Aperture at Minimum Focal"), ""},
|
||||
{MNOTE_FUJI_TAG_MAX_APERT_AT_MAX_FOC, "MaxApertAtMaxFoc", N_("Maximum Aperture at Maximum Focal"), ""},
|
||||
{MNOTE_FUJI_TAG_FILE_SOURCE, "FileSource", N_("File Source"), ""},
|
||||
{MNOTE_FUJI_TAG_ORDER_NUMBER, "OrderNumber", N_("Order Number"), ""},
|
||||
{MNOTE_FUJI_TAG_FRAME_NUMBER, "FrameNumber", N_("Frame Number"), ""},
|
||||
#endif
|
||||
{0, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
const char *
|
||||
mnote_fuji_tag_get_name (MnoteFujiTag t)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
|
||||
if (table[i].tag == t) return (table[i].name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
mnote_fuji_tag_get_title (MnoteFujiTag t)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
|
||||
if (table[i].tag == t) return (_(table[i].title));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
mnote_fuji_tag_get_description (MnoteFujiTag t)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
|
||||
if (table[i].tag == t) {
|
||||
if (!*table[i].description)
|
||||
return "";
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
return _(table[i].description);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
2
libexifa/libexif/_stdint.h
Executable file
2
libexifa/libexif/_stdint.h
Executable file
@@ -0,0 +1,2 @@
|
||||
/* This file is generated automatically by configure */
|
||||
#include <stdint.h>
|
||||
58
libexifa/libexif/canon/exif-mnote-data-canon.h
Executable file
58
libexifa/libexif/canon/exif-mnote-data-canon.h
Executable file
@@ -0,0 +1,58 @@
|
||||
/* exif-mnote-data-canon.h
|
||||
*
|
||||
* Copyright (c) 2002, 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_MNOTE_DATA_CANON_H__
|
||||
#define __EXIF_MNOTE_DATA_CANON_H__
|
||||
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-mnote-data.h>
|
||||
#include <libexif/exif-mnote-data-priv.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
#include <libexif/exif-data.h>
|
||||
|
||||
typedef struct _ExifMnoteDataCanon ExifMnoteDataCanon;
|
||||
|
||||
#include <libexif/canon/mnote-canon-entry.h>
|
||||
|
||||
struct _ExifMnoteDataCanon {
|
||||
ExifMnoteData parent;
|
||||
|
||||
MnoteCanonEntry *entries;
|
||||
unsigned int count;
|
||||
|
||||
ExifByteOrder order;
|
||||
unsigned int offset;
|
||||
|
||||
ExifDataOption options;
|
||||
};
|
||||
|
||||
/*! Detect if MakerNote is recognized as one handled by the Canon module.
|
||||
*
|
||||
* \param[in] ed image #ExifData to identify as as a Canon type
|
||||
* \param[in] e #ExifEntry for EXIF_TAG_MAKER_NOTE, from within ed but
|
||||
* duplicated here for convenience
|
||||
* \return 0 if not recognized, nonzero if recognized. The specific nonzero
|
||||
* value returned may identify a subtype unique within this module.
|
||||
*/
|
||||
int exif_mnote_data_canon_identify (const ExifData *ed, const ExifEntry *e);
|
||||
|
||||
ExifMnoteData *exif_mnote_data_canon_new (ExifMem *mem, ExifDataOption o);
|
||||
|
||||
#endif /* __EXIF_MNOTE_DATA_CANON_H__ */
|
||||
44
libexifa/libexif/canon/mnote-canon-entry.h
Executable file
44
libexifa/libexif/canon/mnote-canon-entry.h
Executable file
@@ -0,0 +1,44 @@
|
||||
/* mnote-canon-entry.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_CANON_ENTRY_H__
|
||||
#define __MNOTE_CANON_ENTRY_H__
|
||||
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/canon/mnote-canon-tag.h>
|
||||
|
||||
typedef struct _MnoteCanonEntry MnoteCanonEntry;
|
||||
|
||||
struct _MnoteCanonEntry {
|
||||
MnoteCanonTag tag;
|
||||
ExifFormat format;
|
||||
unsigned long components;
|
||||
|
||||
unsigned char *data;
|
||||
unsigned int size;
|
||||
|
||||
ExifByteOrder order;
|
||||
};
|
||||
|
||||
unsigned int mnote_canon_entry_count_values (const MnoteCanonEntry *);
|
||||
char *mnote_canon_entry_get_value (const MnoteCanonEntry *, unsigned int t, char *val, unsigned int maxlen);
|
||||
|
||||
#endif /* __MNOTE_CANON_ENTRY_H__ */
|
||||
59
libexifa/libexif/canon/mnote-canon-tag.h
Executable file
59
libexifa/libexif/canon/mnote-canon-tag.h
Executable file
@@ -0,0 +1,59 @@
|
||||
/* mnote-canon-tag.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_CANON_TAG_H__
|
||||
#define __MNOTE_CANON_TAG_H__
|
||||
|
||||
#include <libexif/exif-data.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
enum _MnoteCanonTag {
|
||||
MNOTE_CANON_TAG_UNKNOWN_0 = 0x0,
|
||||
MNOTE_CANON_TAG_SETTINGS_1 = 0x1,
|
||||
MNOTE_CANON_TAG_FOCAL_LENGTH = 0x2,
|
||||
MNOTE_CANON_TAG_UNKNOWN_3 = 0x3,
|
||||
MNOTE_CANON_TAG_SETTINGS_2 = 0x4,
|
||||
MNOTE_CANON_TAG_PANORAMA = 0x5,
|
||||
MNOTE_CANON_TAG_IMAGE_TYPE = 0x6,
|
||||
MNOTE_CANON_TAG_FIRMWARE = 0x7,
|
||||
MNOTE_CANON_TAG_IMAGE_NUMBER = 0x8,
|
||||
MNOTE_CANON_TAG_OWNER = 0x9,
|
||||
MNOTE_CANON_TAG_UNKNOWN_10 = 0xa,
|
||||
MNOTE_CANON_TAG_SERIAL_NUMBER = 0xc,
|
||||
MNOTE_CANON_TAG_UNKNOWN_13 = 0xd,
|
||||
MNOTE_CANON_TAG_CUSTOM_FUNCS = 0xf,
|
||||
MNOTE_CANON_TAG_COLOR_INFORMATION = 0xa0
|
||||
};
|
||||
typedef enum _MnoteCanonTag MnoteCanonTag;
|
||||
|
||||
const char *mnote_canon_tag_get_name (MnoteCanonTag);
|
||||
const char *mnote_canon_tag_get_name_sub (MnoteCanonTag, unsigned int, ExifDataOption);
|
||||
const char *mnote_canon_tag_get_title (MnoteCanonTag);
|
||||
const char *mnote_canon_tag_get_title_sub (MnoteCanonTag, unsigned int, ExifDataOption);
|
||||
const char *mnote_canon_tag_get_description (MnoteCanonTag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MNOTE_CANON_TAG_H__ */
|
||||
92
libexifa/libexif/config.h
Executable file
92
libexifa/libexif/config.h
Executable file
@@ -0,0 +1,92 @@
|
||||
/* config.h. Generated from config.h.in by configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if translation of program messages to the user's native
|
||||
language is requested. */
|
||||
/* #undef ENABLE_NLS */
|
||||
|
||||
/* Define if the GNU dcgettext() function is already present or preinstalled.
|
||||
*/
|
||||
/* #undef HAVE_DCGETTEXT */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||
/* #undef HAVE_GETTEXT */
|
||||
|
||||
/* Define if you have the iconv() function. */
|
||||
/* #undef HAVE_ICONV */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the `localtime_r' function. */
|
||||
#define HAVE_LOCALTIME_R 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define as const if the declaration of iconv() needs const. */
|
||||
/* #undef ICONV_CONST */
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "libexif"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "libexif-devel@lists.sourceforge.net"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "EXIF library"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "EXIF library 0.6.20"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "libexif"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "0.6.20"
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "0.6.20"
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
/* #undef inline */
|
||||
#endif
|
||||
46
libexifa/libexif/exif-byte-order.h
Executable file
46
libexifa/libexif/exif-byte-order.h
Executable file
@@ -0,0 +1,46 @@
|
||||
/* exif-byte-order.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_BYTE_ORDER_H__
|
||||
#define __EXIF_BYTE_ORDER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! Which byte order to use */
|
||||
typedef enum {
|
||||
/*! Big-endian byte order */
|
||||
EXIF_BYTE_ORDER_MOTOROLA,
|
||||
/*! Little-endian byte order */
|
||||
EXIF_BYTE_ORDER_INTEL
|
||||
} ExifByteOrder;
|
||||
|
||||
/*! Return a short, localized, textual name for the given byte order.
|
||||
* \param[in] order byte order
|
||||
* \return localized textual name of the byte order
|
||||
*/
|
||||
const char *exif_byte_order_get_name (ExifByteOrder order);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_BYTE_ORDER_H__ */
|
||||
145
libexifa/libexif/exif-content.h
Executable file
145
libexifa/libexif/exif-content.h
Executable file
@@ -0,0 +1,145 @@
|
||||
/*! \file exif-content.h
|
||||
* \brief Handling EXIF IFDs
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_CONTENT_H__
|
||||
#define __EXIF_CONTENT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! Holds all EXIF tags in a single IFD */
|
||||
typedef struct _ExifContent ExifContent;
|
||||
typedef struct _ExifContentPrivate ExifContentPrivate;
|
||||
|
||||
#include <libexif/exif-tag.h>
|
||||
#include <libexif/exif-entry.h>
|
||||
#include <libexif/exif-data.h>
|
||||
#include <libexif/exif-log.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
struct _ExifContent
|
||||
{
|
||||
ExifEntry **entries;
|
||||
unsigned int count;
|
||||
|
||||
/*! Data containing this content */
|
||||
ExifData *parent;
|
||||
|
||||
ExifContentPrivate *priv;
|
||||
};
|
||||
|
||||
/* Lifecycle */
|
||||
ExifContent *exif_content_new (void);
|
||||
ExifContent *exif_content_new_mem (ExifMem *);
|
||||
void exif_content_ref (ExifContent *content);
|
||||
void exif_content_unref (ExifContent *content);
|
||||
void exif_content_free (ExifContent *content);
|
||||
|
||||
/*! Add an EXIF tag to an IFD.
|
||||
* If this tag already exists in the IFD, this function does nothing.
|
||||
* \pre The "tag" member of the entry must be set on entry.
|
||||
*
|
||||
* \param[out] c IFD
|
||||
* \param[in] entry EXIF entry to add
|
||||
*/
|
||||
void exif_content_add_entry (ExifContent *c, ExifEntry *entry);
|
||||
|
||||
/*! Remove an EXIF tag from an IFD.
|
||||
* If this tag does not exist in the IFD, this function does nothing.
|
||||
*
|
||||
* \param[out] c IFD
|
||||
* \param[in] e EXIF entry to remove
|
||||
*/
|
||||
void exif_content_remove_entry (ExifContent *c, ExifEntry *e);
|
||||
|
||||
/*! Return the #ExifEntry in this IFD corresponding to the given tag.
|
||||
* This is a pointer into a member of the #ExifContent array and must NOT be
|
||||
* freed or unrefed by the caller.
|
||||
*
|
||||
* \param[in] content EXIF content for an IFD
|
||||
* \param[in] tag EXIF tag to return
|
||||
* \return #ExifEntry of the tag, or NULL on error
|
||||
*/
|
||||
ExifEntry *exif_content_get_entry (ExifContent *content, ExifTag tag);
|
||||
|
||||
/*! Fix the IFD to bring it into specification. Call #exif_entry_fix on
|
||||
* each entry in this IFD to fix existing entries, create any new entries
|
||||
* that are mandatory in this IFD but do not yet exist, and remove any
|
||||
* entries that are not allowed in this IFD.
|
||||
*
|
||||
* \param[in,out] c EXIF content for an IFD
|
||||
*/
|
||||
void exif_content_fix (ExifContent *c);
|
||||
|
||||
typedef void (* ExifContentForeachEntryFunc) (ExifEntry *, void *user_data);
|
||||
|
||||
/*! Executes function on each EXIF tag in this IFD in turn.
|
||||
* The tags will not necessarily be visited in numerical order.
|
||||
*
|
||||
* \param[in,out] content IFD over which to iterate
|
||||
* \param[in] func function to call for each entry
|
||||
* \param[in] user_data data to pass into func on each call
|
||||
*/
|
||||
void exif_content_foreach_entry (ExifContent *content,
|
||||
ExifContentForeachEntryFunc func,
|
||||
void *user_data);
|
||||
|
||||
/*! Return the IFD number in which the given #ExifContent is found.
|
||||
*
|
||||
* \param[in] c an #ExifContent*
|
||||
* \return IFD number, or #EXIF_IFD_COUNT on error
|
||||
*/
|
||||
ExifIfd exif_content_get_ifd (ExifContent *c);
|
||||
|
||||
/*! Return a textual representation of the EXIF data for a tag.
|
||||
*
|
||||
* \param[in] c #ExifContent* for an IFD
|
||||
* \param[in] t #ExifTag to return
|
||||
* \param[out] v char* buffer in which to store value
|
||||
* \param[in] m unsigned int length of the buffer v
|
||||
* \return the v pointer, or NULL on error
|
||||
*/
|
||||
#define exif_content_get_value(c,t,v,m) \
|
||||
(exif_content_get_entry (c,t) ? \
|
||||
exif_entry_get_value (exif_content_get_entry (c,t),v,m) : NULL)
|
||||
|
||||
/*! Dump contents of the IFD to stdout.
|
||||
* This is intended for diagnostic purposes only.
|
||||
*
|
||||
* \param[in] content IFD data
|
||||
* \param[in] indent how many levels deep to indent the data
|
||||
*/
|
||||
void exif_content_dump (ExifContent *content, unsigned int indent);
|
||||
|
||||
/*! Set the log message object for this IFD.
|
||||
*
|
||||
* \param[in] content IFD
|
||||
* \param[in] log #ExifLog*
|
||||
*/
|
||||
void exif_content_log (ExifContent *content, ExifLog *log);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_CONTENT_H__ */
|
||||
46
libexifa/libexif/exif-data-type.h
Executable file
46
libexifa/libexif/exif-data-type.h
Executable file
@@ -0,0 +1,46 @@
|
||||
/* exif-data-tag.h
|
||||
*
|
||||
* Copyright (c) 2005 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_DATA_TYPE_H__
|
||||
#define __EXIF_DATA_TYPE_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! Represents the type of image data to which the EXIF data applies.
|
||||
* The EXIF tags have different constraints depending on the type of
|
||||
* image data.
|
||||
*/
|
||||
typedef enum {
|
||||
EXIF_DATA_TYPE_UNCOMPRESSED_CHUNKY = 0,
|
||||
EXIF_DATA_TYPE_UNCOMPRESSED_PLANAR,
|
||||
EXIF_DATA_TYPE_UNCOMPRESSED_YCC,
|
||||
EXIF_DATA_TYPE_COMPRESSED,
|
||||
EXIF_DATA_TYPE_COUNT,
|
||||
|
||||
EXIF_DATA_TYPE_UNKNOWN = EXIF_DATA_TYPE_COUNT
|
||||
} ExifDataType;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_TAG_H__ */
|
||||
264
libexifa/libexif/exif-data.h
Executable file
264
libexifa/libexif/exif-data.h
Executable file
@@ -0,0 +1,264 @@
|
||||
/*! \file exif-data.h
|
||||
* \brief Defines the ExifData type and the associated functions.
|
||||
*/
|
||||
/*
|
||||
* \author Lutz Mueller <lutz@users.sourceforge.net>
|
||||
* \date 2001-2005
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_DATA_H__
|
||||
#define __EXIF_DATA_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-data-type.h>
|
||||
#include <libexif/exif-ifd.h>
|
||||
#include <libexif/exif-log.h>
|
||||
#include <libexif/exif-tag.h>
|
||||
|
||||
/*! Represents the entire EXIF data found in an image */
|
||||
typedef struct _ExifData ExifData;
|
||||
typedef struct _ExifDataPrivate ExifDataPrivate;
|
||||
|
||||
#include <libexif/exif-content.h>
|
||||
#include <libexif/exif-mnote-data.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
/*! Represents the entire EXIF data found in an image */
|
||||
struct _ExifData
|
||||
{
|
||||
/*! Data for each IFD */
|
||||
ExifContent *ifd[EXIF_IFD_COUNT];
|
||||
|
||||
/*! Pointer to thumbnail image, or NULL if not available */
|
||||
unsigned char *data;
|
||||
|
||||
/*! Number of bytes in thumbnail image at \c data */
|
||||
unsigned int size;
|
||||
|
||||
ExifDataPrivate *priv;
|
||||
};
|
||||
|
||||
/*! Allocate a new #ExifData. The #ExifData contains an empty
|
||||
* #ExifContent for each IFD and the default set of options,
|
||||
* which has #EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS
|
||||
* and #EXIF_DATA_OPTION_FOLLOW_SPECIFICATION set.
|
||||
*
|
||||
* \return allocated #ExifData, or NULL on error
|
||||
*/
|
||||
ExifData *exif_data_new (void);
|
||||
|
||||
/*! Allocate a new #ExifData using the given memory allocator.
|
||||
* The #ExifData contains an empty #ExifContent for each IFD and the default
|
||||
* set of options, which has #EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS and
|
||||
* #EXIF_DATA_OPTION_FOLLOW_SPECIFICATION set.
|
||||
*
|
||||
* \return allocated #ExifData, or NULL on error
|
||||
*/
|
||||
ExifData *exif_data_new_mem (ExifMem *);
|
||||
|
||||
/*! Allocate a new #ExifData and load EXIF data from a JPEG file.
|
||||
* Uses an #ExifLoader internally to do the loading.
|
||||
*
|
||||
* \param[in] path filename including path
|
||||
* \return allocated #ExifData, or NULL on error
|
||||
*/
|
||||
ExifData *exif_data_new_from_file (const char *path);
|
||||
|
||||
/*! Allocate a new #ExifData and load EXIF data from a memory buffer.
|
||||
*
|
||||
* \param[in] data pointer to raw JPEG or EXIF data
|
||||
* \param[in] size number of bytes of data at data
|
||||
* \return allocated #ExifData, or NULL on error
|
||||
*/
|
||||
ExifData *exif_data_new_from_data (const unsigned char *data,
|
||||
unsigned int size);
|
||||
|
||||
/*! Load the #ExifData structure from the raw JPEG or EXIF data in the given
|
||||
* memory buffer. If the EXIF data contains a recognized MakerNote, it is
|
||||
* loaded and stored as well for later retrieval by #exif_data_get_mnote_data.
|
||||
* If the EXIF_DATA_OPTION_FOLLOW_SPECIFICATION has been set on this #ExifData,
|
||||
* then the tags are fixed after loading.
|
||||
*
|
||||
* \param[in,out] data EXIF data
|
||||
* \param[in] d pointer to raw JPEG or EXIF data
|
||||
* \param[in] size number of bytes of data at d
|
||||
*/
|
||||
void exif_data_load_data (ExifData *data, const unsigned char *d,
|
||||
unsigned int size);
|
||||
|
||||
/*! Store raw EXIF data representing the #ExifData structure into a memory
|
||||
* buffer. The buffer is allocated by this function and must subsequently be
|
||||
* freed by the caller using the matching free function as used by the #ExifMem
|
||||
* in use by this #ExifData.
|
||||
*
|
||||
* \param[in] data EXIF data
|
||||
* \param[out] d pointer to buffer pointer containing raw EXIF data on return
|
||||
* \param[out] ds pointer to variable to hold the number of bytes of
|
||||
* data at d, or set to 0 on error
|
||||
*/
|
||||
void exif_data_save_data (ExifData *data, unsigned char **d,
|
||||
unsigned int *ds);
|
||||
|
||||
void exif_data_ref (ExifData *data);
|
||||
void exif_data_unref (ExifData *data);
|
||||
void exif_data_free (ExifData *data);
|
||||
|
||||
/*! Return the byte order in use by this EXIF structure.
|
||||
*
|
||||
* \param[in] data EXIF data
|
||||
* \return byte order
|
||||
*/
|
||||
ExifByteOrder exif_data_get_byte_order (ExifData *data);
|
||||
|
||||
/*! Set the byte order to use for this EXIF data. If any tags already exist
|
||||
* (including MakerNote tags) they are are converted to the specified byte
|
||||
* order.
|
||||
*
|
||||
* \param[in,out] data EXIF data
|
||||
* \param[in] order byte order
|
||||
*/
|
||||
void exif_data_set_byte_order (ExifData *data, ExifByteOrder order);
|
||||
|
||||
/*! Return the MakerNote data out of the EXIF data. Only certain
|
||||
* MakerNote formats that are recognized by libexif are supported.
|
||||
* The pointer references a member of the #ExifData structure and must NOT be
|
||||
* freed by the caller.
|
||||
*
|
||||
* \param[in] d EXIF data
|
||||
* \return MakerNote data, or NULL if not found or not supported
|
||||
*/
|
||||
ExifMnoteData *exif_data_get_mnote_data (ExifData *d);
|
||||
|
||||
/*! Fix the EXIF data to bring it into specification. Call #exif_content_fix
|
||||
* on each IFD to fix existing entries, create any new entries that are
|
||||
* mandatory but do not yet exist, and remove any entries that are not
|
||||
* allowed.
|
||||
*
|
||||
* \param[in,out] d EXIF data
|
||||
*/
|
||||
void exif_data_fix (ExifData *d);
|
||||
|
||||
typedef void (* ExifDataForeachContentFunc) (ExifContent *, void *user_data);
|
||||
|
||||
/*! Execute a function on each IFD in turn.
|
||||
*
|
||||
* \param[in] data EXIF data over which to iterate
|
||||
* \param[in] func function to call for each entry
|
||||
* \param[in] user_data data to pass into func on each call
|
||||
*/
|
||||
void exif_data_foreach_content (ExifData *data,
|
||||
ExifDataForeachContentFunc func,
|
||||
void *user_data);
|
||||
|
||||
/*! Options to configure the behaviour of #ExifData */
|
||||
typedef enum {
|
||||
/*! Act as though unknown tags are not present */
|
||||
EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS = 1 << 0,
|
||||
|
||||
/*! Fix the EXIF tags to follow the spec */
|
||||
EXIF_DATA_OPTION_FOLLOW_SPECIFICATION = 1 << 1,
|
||||
|
||||
/*! Leave the MakerNote alone, which could cause it to be corrupted */
|
||||
EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE = 1 << 2
|
||||
} ExifDataOption;
|
||||
|
||||
/*! Return a short textual description of the given #ExifDataOption.
|
||||
*
|
||||
* \param[in] o option
|
||||
* \return localized textual description of the option
|
||||
*/
|
||||
const char *exif_data_option_get_name (ExifDataOption o);
|
||||
|
||||
/*! Return a verbose textual description of the given #ExifDataOption.
|
||||
*
|
||||
* \param[in] o option
|
||||
* \return verbose localized textual description of the option
|
||||
*/
|
||||
const char *exif_data_option_get_description (ExifDataOption o);
|
||||
|
||||
/*! Set the given option on the given #ExifData.
|
||||
*
|
||||
* \param[in] d EXIF data
|
||||
* \param[in] o option
|
||||
*/
|
||||
void exif_data_set_option (ExifData *d, ExifDataOption o);
|
||||
|
||||
/*! Clear the given option on the given #ExifData.
|
||||
*
|
||||
* \param[in] d EXIF data
|
||||
* \param[in] o option
|
||||
*/
|
||||
void exif_data_unset_option (ExifData *d, ExifDataOption o);
|
||||
|
||||
/*! Set the data type for the given #ExifData.
|
||||
*
|
||||
* \param[in] d EXIF data
|
||||
* \param[in] dt data type
|
||||
*/
|
||||
void exif_data_set_data_type (ExifData *d, ExifDataType dt);
|
||||
|
||||
/*! Return the data type for the given #ExifData.
|
||||
*
|
||||
* \param[in] d EXIF data
|
||||
* \return data type, or #EXIF_DATA_TYPE_UNKNOWN on error
|
||||
*/
|
||||
ExifDataType exif_data_get_data_type (ExifData *d);
|
||||
|
||||
/*! Dump all EXIF data to stdout.
|
||||
* This is intended for diagnostic purposes only.
|
||||
*
|
||||
* \param[in] data EXIF data
|
||||
*/
|
||||
void exif_data_dump (ExifData *data);
|
||||
|
||||
/*! Set the log message object for all IFDs.
|
||||
*
|
||||
* \param[in] data EXIF data
|
||||
* \param[in] log #ExifLog
|
||||
*/
|
||||
void exif_data_log (ExifData *data, ExifLog *log);
|
||||
|
||||
/*! Return an #ExifEntry for the given tag if found in any IFD.
|
||||
* Each IFD is searched in turn and the first containing a tag with
|
||||
* this number is returned.
|
||||
*
|
||||
* \param[in] d #ExifData
|
||||
* \param[in] t #ExifTag
|
||||
* \return #ExifEntry* if found, else NULL if not found
|
||||
*/
|
||||
#define exif_data_get_entry(d,t) \
|
||||
(exif_content_get_entry(d->ifd[EXIF_IFD_0],t) ? \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_0],t) : \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_1],t) ? \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_1],t) : \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) ? \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) : \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) ? \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) : \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) ? \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) : NULL)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_DATA_H__ */
|
||||
188
libexifa/libexif/exif-entry.h
Executable file
188
libexifa/libexif/exif-entry.h
Executable file
@@ -0,0 +1,188 @@
|
||||
/*! \file exif-entry.h
|
||||
* \brief Handling EXIF entries
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_ENTRY_H__
|
||||
#define __EXIF_ENTRY_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! Data found in one EXIF tag.
|
||||
* The #exif_entry_get_value function can provide access to the
|
||||
* formatted contents, or the struct members can be used directly to
|
||||
* access the raw contents.
|
||||
*/
|
||||
typedef struct _ExifEntry ExifEntry;
|
||||
typedef struct _ExifEntryPrivate ExifEntryPrivate;
|
||||
|
||||
#include <libexif/exif-content.h>
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/exif-utils.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
/*! Data found in one EXIF tag */
|
||||
struct _ExifEntry {
|
||||
/*! EXIF tag for this entry */
|
||||
/* ExifTag had been changed to ExifShort to enable writing of the GPS related tags.
|
||||
2011.03.01 - Samsung Electronics */
|
||||
ExifShort tag;
|
||||
|
||||
/*! Type of data in this entry */
|
||||
ExifFormat format;
|
||||
|
||||
/*! Number of elements in the array, if this is an array entry.
|
||||
* Contains 1 for non-array data types. */
|
||||
unsigned long components;
|
||||
|
||||
/*! Pointer to the raw EXIF data for this entry. It is allocated
|
||||
* by #exif_entry_initialize and is NULL beforehand. Data contained
|
||||
* here may be manipulated using the functions in exif-utils.h */
|
||||
unsigned char *data;
|
||||
|
||||
/*! Number of bytes in the buffer at \c data. This must be no less
|
||||
* than exif_format_get_size(format)*components */
|
||||
unsigned int size;
|
||||
|
||||
/*! #ExifContent containing this entry.
|
||||
* \see exif_entry_get_ifd */
|
||||
ExifContent *parent;
|
||||
|
||||
/*! Internal data to be used by libexif itself */
|
||||
ExifEntryPrivate *priv;
|
||||
};
|
||||
|
||||
/* Lifecycle */
|
||||
|
||||
/*! Reserve memory for and initialize a new #ExifEntry.
|
||||
* No memory is allocated for the \c data element of the returned #ExifEntry.
|
||||
*
|
||||
* \return new allocated #ExifEntry, or NULL on error
|
||||
*
|
||||
* \see exif_entry_new_mem, exif_entry_unref
|
||||
*/
|
||||
ExifEntry *exif_entry_new (void);
|
||||
|
||||
/*! Reserve memory for and initialize new #ExifEntry using the specified
|
||||
* memory allocator.
|
||||
* No memory is allocated for the \c data element of the returned #ExifEntry.
|
||||
*
|
||||
* \return new allocated #ExifEntry, or NULL on error
|
||||
*
|
||||
* \see exif_entry_new, exif_entry_unref
|
||||
*/
|
||||
ExifEntry *exif_entry_new_mem (ExifMem *);
|
||||
|
||||
/*! Increase reference counter for #ExifEntry.
|
||||
*
|
||||
* \param[in] entry #ExifEntry
|
||||
*
|
||||
* \see exif_entry_unref
|
||||
*/
|
||||
void exif_entry_ref (ExifEntry *entry);
|
||||
|
||||
/*! Decrease reference counter for #ExifEntry.
|
||||
* When the reference count drops to zero, free the entry.
|
||||
*
|
||||
* \param[in] entry #ExifEntry
|
||||
*/
|
||||
void exif_entry_unref (ExifEntry *entry);
|
||||
|
||||
/*! Actually free the #ExifEntry.
|
||||
*
|
||||
* \deprecated Should not be called directly. Use #exif_entry_ref and
|
||||
* #exif_entry_unref instead.
|
||||
*
|
||||
* \param[in] entry EXIF entry
|
||||
*/
|
||||
void exif_entry_free (ExifEntry *entry);
|
||||
|
||||
/*! Initialize an empty #ExifEntry with default data in the correct format
|
||||
* for the given tag. If the entry is already initialized, this function
|
||||
* does nothing.
|
||||
* This call allocates memory for the \c data element of the given #ExifEntry.
|
||||
* That memory is freed at the same time as the #ExifEntry.
|
||||
*
|
||||
* \param[out] e entry to initialize
|
||||
* \param[in] tag tag number to initialize as
|
||||
*/
|
||||
void exif_entry_initialize (ExifEntry *e, ExifTag tag);
|
||||
|
||||
/*! Fix the type or format of the given EXIF entry to bring it into spec.
|
||||
* If the data for this EXIF tag is in of the wrong type or is in an invalid
|
||||
* format according to the EXIF specification, then it is converted to make it
|
||||
* valid. This may involve, for example, converting an EXIF_FORMAT_LONG into a
|
||||
* EXIF_FORMAT_SHORT. If the tag is unknown, its value is untouched.
|
||||
*
|
||||
* \note Unfortunately, some conversions are to a type with a more restricted
|
||||
* range, which could have the side effect that the converted data becomes
|
||||
* invalid. This is unlikely as the range of each tag in the standard is
|
||||
* designed to encompass all likely data.
|
||||
*
|
||||
* \param[in,out] entry EXIF entry
|
||||
*/
|
||||
void exif_entry_fix (ExifEntry *entry);
|
||||
|
||||
|
||||
/* For your convenience */
|
||||
|
||||
/*! Return a localized textual representation of the value of the EXIF entry.
|
||||
* This is meant for display to the user. The format of each tag is subject
|
||||
* to change between locales and in newer versions of libexif. Users who
|
||||
* require the tag data in an unambiguous form should access the data members
|
||||
* of the #ExifEntry structure directly.
|
||||
*
|
||||
* \warning The character set of the returned string may be in
|
||||
* the encoding of the current locale or the native encoding
|
||||
* of the camera.
|
||||
* \bug The EXIF_TAG_XP_* tags are currently always returned in UTF-8,
|
||||
* regardless of locale, and code points above U+FFFF are not
|
||||
* supported.
|
||||
*
|
||||
* \param[in] entry EXIF entry
|
||||
* \param[out] val buffer in which to store value
|
||||
* \param[in] maxlen length of the buffer val
|
||||
* \return val pointer
|
||||
*/
|
||||
const char *exif_entry_get_value (ExifEntry *entry, char *val,
|
||||
unsigned int maxlen);
|
||||
|
||||
/*! Dump text representation of #ExifEntry to stdout.
|
||||
* This is intended for diagnostic purposes only.
|
||||
*
|
||||
* \param[in] entry EXIF tag data
|
||||
* \param[in] indent how many levels deep to indent the data
|
||||
*/
|
||||
void exif_entry_dump (ExifEntry *entry, unsigned int indent);
|
||||
|
||||
/*! Return the IFD number of the given #ExifEntry
|
||||
*
|
||||
* \param[in] e an #ExifEntry*
|
||||
* \return #ExifIfd, or #EXIF_IFD_COUNT on error
|
||||
*/
|
||||
#define exif_entry_get_ifd(e) ((e)?exif_content_get_ifd((e)->parent):EXIF_IFD_COUNT)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_ENTRY_H__ */
|
||||
65
libexifa/libexif/exif-format.h
Executable file
65
libexifa/libexif/exif-format.h
Executable file
@@ -0,0 +1,65 @@
|
||||
/*! \file exif-format.h
|
||||
* \brief Handling native EXIF data types
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_FORMAT_H__
|
||||
#define __EXIF_FORMAT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! EXIF tag data formats */
|
||||
typedef enum {
|
||||
EXIF_FORMAT_BYTE = 1,
|
||||
EXIF_FORMAT_ASCII = 2,
|
||||
EXIF_FORMAT_SHORT = 3,
|
||||
EXIF_FORMAT_LONG = 4,
|
||||
EXIF_FORMAT_RATIONAL = 5,
|
||||
EXIF_FORMAT_SBYTE = 6,
|
||||
EXIF_FORMAT_UNDEFINED = 7,
|
||||
EXIF_FORMAT_SSHORT = 8,
|
||||
EXIF_FORMAT_SLONG = 9,
|
||||
EXIF_FORMAT_SRATIONAL = 10,
|
||||
EXIF_FORMAT_FLOAT = 11,
|
||||
EXIF_FORMAT_DOUBLE = 12
|
||||
} ExifFormat;
|
||||
|
||||
/*! Return a textual representation of the given EXIF data type.
|
||||
*
|
||||
* \param[in] format EXIF data format
|
||||
* \return localized textual name
|
||||
*/
|
||||
const char *exif_format_get_name (ExifFormat format);
|
||||
|
||||
/*! Return the raw size of the given EXIF data type.
|
||||
*
|
||||
* \param[in] format EXIF data format
|
||||
* \return size in bytes
|
||||
*/
|
||||
unsigned char exif_format_get_size (ExifFormat format);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_FORMAT_H__ */
|
||||
43
libexifa/libexif/exif-ifd.h
Executable file
43
libexifa/libexif/exif-ifd.h
Executable file
@@ -0,0 +1,43 @@
|
||||
/* exif-ifd.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_IFD_H__
|
||||
#define __EXIF_IFD_H__
|
||||
|
||||
/*! Possible EXIF Image File Directories */
|
||||
typedef enum {
|
||||
EXIF_IFD_0 = 0, /*!< */
|
||||
EXIF_IFD_1, /*!< */
|
||||
EXIF_IFD_EXIF, /*!< */
|
||||
EXIF_IFD_GPS, /*!< */
|
||||
EXIF_IFD_INTEROPERABILITY, /*!< */
|
||||
EXIF_IFD_COUNT /*!< Not a real value, just (max_value + 1). */
|
||||
} ExifIfd;
|
||||
|
||||
/*! Return a textual name of the given IFD. The name is a short, unique,
|
||||
* non-localized text string containing only US-ASCII alphanumeric
|
||||
* characters.
|
||||
*
|
||||
* \param[in] ifd IFD
|
||||
* \return textual name of the IFD
|
||||
*/
|
||||
const char *exif_ifd_get_name (ExifIfd ifd);
|
||||
|
||||
#endif /* __EXIF_IFD_H__ */
|
||||
128
libexifa/libexif/exif-loader.h
Executable file
128
libexifa/libexif/exif-loader.h
Executable file
@@ -0,0 +1,128 @@
|
||||
/*! \file exif-loader.h
|
||||
* \brief Defines the ExifLoader type
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_LOADER_H__
|
||||
#define __EXIF_LOADER_H__
|
||||
|
||||
#include <libexif/exif-data.h>
|
||||
#include <libexif/exif-log.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! Data used by the loader interface */
|
||||
typedef struct _ExifLoader ExifLoader;
|
||||
|
||||
/*! Allocate a new #ExifLoader.
|
||||
*
|
||||
* \return allocated ExifLoader
|
||||
*/
|
||||
ExifLoader *exif_loader_new (void);
|
||||
|
||||
/*! Allocate a new #ExifLoader using the specified memory allocator.
|
||||
*
|
||||
* \param[in] mem the ExifMem
|
||||
* \return allocated ExifLoader
|
||||
*/
|
||||
ExifLoader *exif_loader_new_mem (ExifMem *mem);
|
||||
|
||||
/*! Increase the refcount of the #ExifLoader.
|
||||
*
|
||||
* \param[in] loader the ExifLoader to increase the refcount of.
|
||||
*/
|
||||
void exif_loader_ref (ExifLoader *loader);
|
||||
|
||||
/*! Decrease the refcount of the #ExifLoader.
|
||||
* If the refcount reaches 0, the loader is freed.
|
||||
*
|
||||
* \param[in] loader ExifLoader for which to decrease the refcount
|
||||
*/
|
||||
void exif_loader_unref (ExifLoader *loader);
|
||||
|
||||
/*! Load a file into the given #ExifLoader from the filesystem.
|
||||
* The relevant data is copied in raw form into the #ExifLoader.
|
||||
*
|
||||
* \param[in] loader loader to write to
|
||||
* \param[in] fname path to the file to read
|
||||
*/
|
||||
void exif_loader_write_file (ExifLoader *loader, const char *fname);
|
||||
|
||||
/*! Load a buffer into the #ExifLoader from a memory buffer.
|
||||
* The relevant data is copied in raw form into the #ExifLoader.
|
||||
*
|
||||
* \param[in] loader loader to write to
|
||||
* \param[in] buf buffer to read from
|
||||
* \param[in] sz size of the buffer
|
||||
* \return 1 while EXIF data is read (or while there is still hope that
|
||||
* there will be EXIF data later on), 0 otherwise.
|
||||
*/
|
||||
unsigned char exif_loader_write (ExifLoader *loader, unsigned char *buf, unsigned int sz);
|
||||
|
||||
/*! Free any data previously loaded and reset the #ExifLoader to its
|
||||
* newly-initialized state.
|
||||
*
|
||||
* \param[in] loader the loader
|
||||
*/
|
||||
void exif_loader_reset (ExifLoader *loader);
|
||||
|
||||
/*! Create an #ExifData from the data in the loader. The loader must
|
||||
* already contain data from a previous call to #exif_loader_write_file
|
||||
* or #exif_loader_write.
|
||||
*
|
||||
* \note The #ExifData returned is created using its default options, which
|
||||
* may take effect before the data is returned. If other options are desired,
|
||||
* an #ExifData must be created explicitly and data extracted from the loader
|
||||
* using #exif_loader_get_buf instead.
|
||||
*
|
||||
* \param[in] loader the loader
|
||||
* \return allocated ExifData
|
||||
*
|
||||
* \see exif_loader_get_buf
|
||||
*/
|
||||
ExifData *exif_loader_get_data (ExifLoader *loader);
|
||||
|
||||
/*! Return the raw data read by the loader. The returned pointer is only
|
||||
* guaranteed to be valid until the next call to a function modifying
|
||||
* this #ExifLoader. Either or both of buf and buf_size may be NULL on
|
||||
* entry, in which case that value is not returned.
|
||||
*
|
||||
* \param[in] loader the loader
|
||||
* \param[out] buf read-only pointer to the data read by the loader, or NULL
|
||||
* in case of error
|
||||
* \param[out] buf_size size of the data at buf, or 0 in case of error
|
||||
*/
|
||||
void exif_loader_get_buf (ExifLoader *loader, const unsigned char **buf,
|
||||
unsigned int *buf_size);
|
||||
|
||||
/*! Set the log message object used by this #ExifLoader.
|
||||
* \param[in] loader the loader
|
||||
* \param[in] log #ExifLog
|
||||
*/
|
||||
void exif_loader_log (ExifLoader *loader, ExifLog *log);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_LOADER_H__ */
|
||||
116
libexifa/libexif/exif-log.h
Executable file
116
libexifa/libexif/exif-log.h
Executable file
@@ -0,0 +1,116 @@
|
||||
/*! \file exif-log.h
|
||||
* \brief Log message infrastructure
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2004 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_LOG_H__
|
||||
#define __EXIF_LOG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-mem.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/*! State maintained by the logging interface */
|
||||
typedef struct _ExifLog ExifLog;
|
||||
|
||||
/*! Create a new logging instance.
|
||||
* \see exif_log_free
|
||||
*
|
||||
* \return new instance of #ExifLog
|
||||
*/
|
||||
ExifLog *exif_log_new (void);
|
||||
ExifLog *exif_log_new_mem (ExifMem *);
|
||||
void exif_log_ref (ExifLog *log);
|
||||
void exif_log_unref (ExifLog *log);
|
||||
|
||||
/*! Delete instance of #ExifLog.
|
||||
* \see exif_log_new
|
||||
*
|
||||
* \param[in] log #ExifLog
|
||||
* \return new instance of #ExifLog
|
||||
*/
|
||||
void exif_log_free (ExifLog *log);
|
||||
|
||||
typedef enum {
|
||||
EXIF_LOG_CODE_NONE,
|
||||
EXIF_LOG_CODE_DEBUG,
|
||||
EXIF_LOG_CODE_NO_MEMORY,
|
||||
EXIF_LOG_CODE_CORRUPT_DATA
|
||||
} ExifLogCode;
|
||||
|
||||
/*! Return a textual description of the given class of error log.
|
||||
*
|
||||
* \param[in] code logging message class
|
||||
* \return textual description of the log class
|
||||
*/
|
||||
const char *exif_log_code_get_title (ExifLogCode code);
|
||||
|
||||
/*! Return a verbose description of the given class of error log.
|
||||
*
|
||||
* \param[in] code logging message class
|
||||
* \return verbose description of the log class
|
||||
*/
|
||||
const char *exif_log_code_get_message (ExifLogCode code);
|
||||
|
||||
/*! Log callback function prototype.
|
||||
*/
|
||||
typedef void (* ExifLogFunc) (ExifLog *log, ExifLogCode, const char *domain,
|
||||
const char *format, va_list args, void *data);
|
||||
|
||||
/*! Register log callback function.
|
||||
* Calls to the log callback function are purely for diagnostic purposes.
|
||||
*
|
||||
* \param[in] log logging state variable
|
||||
* \param[in] func callback function to set
|
||||
* \param[in] data data to pass into callback function
|
||||
*/
|
||||
void exif_log_set_func (ExifLog *log, ExifLogFunc func, void *data);
|
||||
|
||||
#ifndef NO_VERBOSE_TAG_STRINGS
|
||||
void exif_log (ExifLog *log, ExifLogCode, const char *domain,
|
||||
const char *format, ...)
|
||||
#ifdef __GNUC__
|
||||
__attribute__((__format__(printf,4,5)))
|
||||
#endif
|
||||
;
|
||||
#else
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#define exif_log(...) do { } while (0)
|
||||
#elif defined(__GNUC__)
|
||||
#define exif_log(x...) do { } while (0)
|
||||
#else
|
||||
#define exif_log (void)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void exif_logv (ExifLog *log, ExifLogCode, const char *domain,
|
||||
const char *format, va_list args);
|
||||
|
||||
/* For your convenience */
|
||||
#define EXIF_LOG_NO_MEMORY(l,d,s) exif_log ((l), EXIF_LOG_CODE_NO_MEMORY, (d), "Could not allocate %lu byte(s).", (unsigned long)(s))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_LOG_H__ */
|
||||
90
libexifa/libexif/exif-mem.h
Executable file
90
libexifa/libexif/exif-mem.h
Executable file
@@ -0,0 +1,90 @@
|
||||
/*! \file exif-mem.h
|
||||
* \brief Define the ExifMem data type and the associated functions.
|
||||
* ExifMem defines the memory management functions used within libexif.
|
||||
*/
|
||||
/* exif-mem.h
|
||||
*
|
||||
* Copyright (c) 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_MEM_H__
|
||||
#define __EXIF_MEM_H__
|
||||
|
||||
#include <libexif/exif-utils.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! Should work like calloc()
|
||||
*
|
||||
* \param[in] s the size of the block to allocate.
|
||||
* \return the allocated memory and initialized.
|
||||
*/
|
||||
typedef void * (* ExifMemAllocFunc) (ExifLong s);
|
||||
|
||||
/*! Should work like realloc()
|
||||
*
|
||||
* \param[in] p the pointer to reallocate
|
||||
* \param[in] s the size of the reallocated block
|
||||
* \return allocated memory
|
||||
*/
|
||||
typedef void * (* ExifMemReallocFunc) (void *p, ExifLong s);
|
||||
|
||||
/*! Free method for ExifMem
|
||||
*
|
||||
* \param[in] p the pointer to free
|
||||
* \return the freed pointer
|
||||
*/
|
||||
typedef void (* ExifMemFreeFunc) (void *p);
|
||||
|
||||
/*! ExifMem define a memory allocator */
|
||||
typedef struct _ExifMem ExifMem;
|
||||
|
||||
/*! Create a new ExifMem
|
||||
*
|
||||
* \param[in] a the allocator function
|
||||
* \param[in] r the reallocator function
|
||||
* \param[in] f the free function
|
||||
*/
|
||||
ExifMem *exif_mem_new (ExifMemAllocFunc a, ExifMemReallocFunc r,
|
||||
ExifMemFreeFunc f);
|
||||
/*! Refcount an ExifMem
|
||||
*/
|
||||
void exif_mem_ref (ExifMem *);
|
||||
|
||||
/*! Unrefcount an ExifMem.
|
||||
* If the refcount reaches 0, the ExifMem is freed
|
||||
*/
|
||||
void exif_mem_unref (ExifMem *);
|
||||
|
||||
void *exif_mem_alloc (ExifMem *m, ExifLong s);
|
||||
void *exif_mem_realloc (ExifMem *m, void *p, ExifLong s);
|
||||
void exif_mem_free (ExifMem *m, void *p);
|
||||
|
||||
/*! Create a new ExifMem with default values for your convenience
|
||||
*
|
||||
* \return return a new default ExifMem
|
||||
*/
|
||||
ExifMem *exif_mem_new_default (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_MEM_H__ */
|
||||
86
libexifa/libexif/exif-mnote-data-priv.h
Executable file
86
libexifa/libexif/exif-mnote-data-priv.h
Executable file
@@ -0,0 +1,86 @@
|
||||
/* exif-mnote-data-priv.h
|
||||
*
|
||||
* Copyright (c) 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_MNOTE_DATA_PRIV_H__
|
||||
#define __EXIF_MNOTE_DATA_PRIV_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-mnote-data.h>
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-log.h>
|
||||
|
||||
/*! \internal */
|
||||
typedef struct _ExifMnoteDataMethods ExifMnoteDataMethods;
|
||||
|
||||
/*! \internal */
|
||||
struct _ExifMnoteDataMethods {
|
||||
|
||||
/* Life cycle */
|
||||
void (* free) (ExifMnoteData *);
|
||||
|
||||
/* Modification */
|
||||
void (* save) (ExifMnoteData *, unsigned char **, unsigned int *);
|
||||
void (* load) (ExifMnoteData *, const unsigned char *, unsigned int);
|
||||
void (* set_offset) (ExifMnoteData *, unsigned int);
|
||||
void (* set_byte_order) (ExifMnoteData *, ExifByteOrder);
|
||||
|
||||
/* Query */
|
||||
unsigned int (* count) (ExifMnoteData *);
|
||||
unsigned int (* get_id) (ExifMnoteData *, unsigned int);
|
||||
const char * (* get_name) (ExifMnoteData *, unsigned int);
|
||||
const char * (* get_title) (ExifMnoteData *, unsigned int);
|
||||
const char * (* get_description) (ExifMnoteData *, unsigned int);
|
||||
char * (* get_value) (ExifMnoteData *, unsigned int, char *val, unsigned int maxlen);
|
||||
};
|
||||
|
||||
/*! \internal */
|
||||
typedef struct _ExifMnoteDataPriv ExifMnoteDataPriv;
|
||||
|
||||
/*! \internal */
|
||||
struct _ExifMnoteData
|
||||
{
|
||||
ExifMnoteDataPriv *priv;
|
||||
|
||||
ExifMnoteDataMethods methods;
|
||||
|
||||
/* Logging */
|
||||
ExifLog *log;
|
||||
|
||||
/* Memory management */
|
||||
ExifMem *mem;
|
||||
};
|
||||
|
||||
/*! \internal */
|
||||
void exif_mnote_data_construct (ExifMnoteData *, ExifMem *mem);
|
||||
|
||||
/*! \internal */
|
||||
void exif_mnote_data_set_byte_order (ExifMnoteData *, ExifByteOrder);
|
||||
|
||||
/*! \internal */
|
||||
void exif_mnote_data_set_offset (ExifMnoteData *, unsigned int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_MNOTE_PRIV_H__ */
|
||||
122
libexifa/libexif/exif-mnote-data.h
Executable file
122
libexifa/libexif/exif-mnote-data.h
Executable file
@@ -0,0 +1,122 @@
|
||||
/*! \file exif-mnote-data.h
|
||||
* \brief Handling EXIF MakerNote tags
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_MNOTE_DATA_H__
|
||||
#define __EXIF_MNOTE_DATA_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-log.h>
|
||||
|
||||
/*! Data found in the MakerNote tag */
|
||||
typedef struct _ExifMnoteData ExifMnoteData;
|
||||
|
||||
void exif_mnote_data_ref (ExifMnoteData *);
|
||||
void exif_mnote_data_unref (ExifMnoteData *);
|
||||
|
||||
/*! Load the MakerNote data from a memory buffer.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \param[in] buf pointer to raw MakerNote tag data
|
||||
* \param[in] buf_siz number of bytes of data at buf
|
||||
*/
|
||||
void exif_mnote_data_load (ExifMnoteData *d, const unsigned char *buf,
|
||||
unsigned int buf_siz);
|
||||
|
||||
/*!
|
||||
* Save the raw MakerNote data into a memory buffer. The buffer is
|
||||
* allocated by this function and must subsequently be freed by the
|
||||
* caller.
|
||||
*
|
||||
* \param[in,out] d extract the data from this structure
|
||||
* \param[out] buf pointer to buffer pointer containing MakerNote data on return
|
||||
* \param[out] buf_siz pointer to the size of the buffer
|
||||
*/
|
||||
void exif_mnote_data_save (ExifMnoteData *d, unsigned char **buf,
|
||||
unsigned int *buf_siz);
|
||||
|
||||
/*! Return the number of tags in the MakerNote.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \return number of tags, or 0 if no MakerNote or the type is not supported
|
||||
*/
|
||||
unsigned int exif_mnote_data_count (ExifMnoteData *d);
|
||||
|
||||
/*! Return the MakerNote tag number for the tag at the specified index within
|
||||
* the MakerNote.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \param[in] n index of the entry within the MakerNote data
|
||||
* \return MakerNote tag number
|
||||
*/
|
||||
unsigned int exif_mnote_data_get_id (ExifMnoteData *d, unsigned int n);
|
||||
|
||||
/*! Returns textual name of the given MakerNote tag. The name is a short,
|
||||
* unique (within this type of MakerNote), non-localized text string
|
||||
* containing only US-ASCII alphanumeric characters.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \param[in] n index of the entry within the MakerNote data
|
||||
* \return textual name of the tag
|
||||
*/
|
||||
const char *exif_mnote_data_get_name (ExifMnoteData *d, unsigned int n);
|
||||
|
||||
/*! Returns textual title of the given MakerNote tag.
|
||||
* The title is a short, localized textual description of the tag.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \param[in] n index of the entry within the MakerNote data
|
||||
* \return textual name of the tag
|
||||
*/
|
||||
const char *exif_mnote_data_get_title (ExifMnoteData *d, unsigned int n);
|
||||
|
||||
/*! Returns verbose textual description of the given MakerNote tag.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \param[in] n index of the entry within the MakerNote data
|
||||
* \return textual description of the tag
|
||||
*/
|
||||
const char *exif_mnote_data_get_description (ExifMnoteData *d, unsigned int n);
|
||||
|
||||
/*! Return a textual representation of the value of the MakerNote entry.
|
||||
*
|
||||
* \warning The character set of the returned string may be in
|
||||
* the encoding of the current locale or the native encoding
|
||||
* of the camera.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \param[in] n index of the entry within the MakerNote data
|
||||
* \param[out] val buffer in which to store value
|
||||
* \param[in] maxlen length of the buffer val
|
||||
* \return val pointer, or NULL on error
|
||||
*/
|
||||
char *exif_mnote_data_get_value (ExifMnoteData *d, unsigned int n, char *val, unsigned int maxlen);
|
||||
|
||||
void exif_mnote_data_log (ExifMnoteData *, ExifLog *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_MNOTE_DATA_H__ */
|
||||
32
libexifa/libexif/exif-system.h
Executable file
32
libexifa/libexif/exif-system.h
Executable file
@@ -0,0 +1,32 @@
|
||||
/*! \file exif-system.h
|
||||
* \brief System specific definitions, not for installation!
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2007 Hans Ulrich Niedermann <gp@n-dimensional.de>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef EXIF_SYSTEM_H
|
||||
#define EXIF_SYSTEM_H
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 2)
|
||||
# define UNUSED(param) UNUSED_PARAM_##param __attribute__((unused))
|
||||
#else
|
||||
# define UNUSED(param) param
|
||||
#endif
|
||||
|
||||
#endif /* !defined(EXIF_SYSTEM_H) */
|
||||
287
libexifa/libexif/exif-tag.h
Executable file
287
libexifa/libexif/exif-tag.h
Executable file
@@ -0,0 +1,287 @@
|
||||
/*! \file exif-tag.h
|
||||
* \brief Handling EXIF tags
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_TAG_H__
|
||||
#define __EXIF_TAG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-ifd.h>
|
||||
#include <libexif/exif-data-type.h>
|
||||
|
||||
/*! EXIF tags */
|
||||
typedef enum {
|
||||
EXIF_TAG_INTEROPERABILITY_INDEX = 0x0001,
|
||||
EXIF_TAG_INTEROPERABILITY_VERSION = 0x0002,
|
||||
EXIF_TAG_NEW_SUBFILE_TYPE = 0x00fe,
|
||||
EXIF_TAG_IMAGE_WIDTH = 0x0100,
|
||||
EXIF_TAG_IMAGE_LENGTH = 0x0101,
|
||||
EXIF_TAG_BITS_PER_SAMPLE = 0x0102,
|
||||
EXIF_TAG_COMPRESSION = 0x0103,
|
||||
EXIF_TAG_PHOTOMETRIC_INTERPRETATION = 0x0106,
|
||||
EXIF_TAG_FILL_ORDER = 0x010a,
|
||||
EXIF_TAG_DOCUMENT_NAME = 0x010d,
|
||||
EXIF_TAG_IMAGE_DESCRIPTION = 0x010e,
|
||||
EXIF_TAG_MAKE = 0x010f,
|
||||
EXIF_TAG_MODEL = 0x0110,
|
||||
EXIF_TAG_STRIP_OFFSETS = 0x0111,
|
||||
EXIF_TAG_ORIENTATION = 0x0112,
|
||||
EXIF_TAG_SAMPLES_PER_PIXEL = 0x0115,
|
||||
EXIF_TAG_ROWS_PER_STRIP = 0x0116,
|
||||
EXIF_TAG_STRIP_BYTE_COUNTS = 0x0117,
|
||||
EXIF_TAG_X_RESOLUTION = 0x011a,
|
||||
EXIF_TAG_Y_RESOLUTION = 0x011b,
|
||||
EXIF_TAG_PLANAR_CONFIGURATION = 0x011c,
|
||||
EXIF_TAG_RESOLUTION_UNIT = 0x0128,
|
||||
EXIF_TAG_TRANSFER_FUNCTION = 0x012d,
|
||||
EXIF_TAG_SOFTWARE = 0x0131,
|
||||
EXIF_TAG_DATE_TIME = 0x0132,
|
||||
EXIF_TAG_ARTIST = 0x013b,
|
||||
EXIF_TAG_WHITE_POINT = 0x013e,
|
||||
EXIF_TAG_PRIMARY_CHROMATICITIES = 0x013f,
|
||||
EXIF_TAG_SUB_IFDS = 0x014a,
|
||||
EXIF_TAG_TRANSFER_RANGE = 0x0156,
|
||||
EXIF_TAG_JPEG_PROC = 0x0200,
|
||||
EXIF_TAG_JPEG_INTERCHANGE_FORMAT = 0x0201,
|
||||
EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH = 0x0202,
|
||||
EXIF_TAG_YCBCR_COEFFICIENTS = 0x0211,
|
||||
EXIF_TAG_YCBCR_SUB_SAMPLING = 0x0212,
|
||||
EXIF_TAG_YCBCR_POSITIONING = 0x0213,
|
||||
EXIF_TAG_REFERENCE_BLACK_WHITE = 0x0214,
|
||||
EXIF_TAG_XML_PACKET = 0x02bc,
|
||||
EXIF_TAG_RELATED_IMAGE_FILE_FORMAT = 0x1000,
|
||||
EXIF_TAG_RELATED_IMAGE_WIDTH = 0x1001,
|
||||
EXIF_TAG_RELATED_IMAGE_LENGTH = 0x1002,
|
||||
EXIF_TAG_CFA_REPEAT_PATTERN_DIM = 0x828d,
|
||||
EXIF_TAG_CFA_PATTERN = 0x828e,
|
||||
EXIF_TAG_BATTERY_LEVEL = 0x828f,
|
||||
EXIF_TAG_COPYRIGHT = 0x8298,
|
||||
EXIF_TAG_EXPOSURE_TIME = 0x829a,
|
||||
EXIF_TAG_FNUMBER = 0x829d,
|
||||
EXIF_TAG_IPTC_NAA = 0x83bb,
|
||||
EXIF_TAG_IMAGE_RESOURCES = 0x8649,
|
||||
EXIF_TAG_EXIF_IFD_POINTER = 0x8769,
|
||||
EXIF_TAG_INTER_COLOR_PROFILE = 0x8773,
|
||||
EXIF_TAG_EXPOSURE_PROGRAM = 0x8822,
|
||||
EXIF_TAG_SPECTRAL_SENSITIVITY = 0x8824,
|
||||
EXIF_TAG_GPS_INFO_IFD_POINTER = 0x8825,
|
||||
EXIF_TAG_ISO_SPEED_RATINGS = 0x8827,
|
||||
EXIF_TAG_OECF = 0x8828,
|
||||
EXIF_TAG_TIME_ZONE_OFFSET = 0x882a,
|
||||
EXIF_TAG_EXIF_VERSION = 0x9000,
|
||||
EXIF_TAG_DATE_TIME_ORIGINAL = 0x9003,
|
||||
EXIF_TAG_DATE_TIME_DIGITIZED = 0x9004,
|
||||
EXIF_TAG_COMPONENTS_CONFIGURATION = 0x9101,
|
||||
EXIF_TAG_COMPRESSED_BITS_PER_PIXEL = 0x9102,
|
||||
EXIF_TAG_SHUTTER_SPEED_VALUE = 0x9201,
|
||||
EXIF_TAG_APERTURE_VALUE = 0x9202,
|
||||
EXIF_TAG_BRIGHTNESS_VALUE = 0x9203,
|
||||
EXIF_TAG_EXPOSURE_BIAS_VALUE = 0x9204,
|
||||
EXIF_TAG_MAX_APERTURE_VALUE = 0x9205,
|
||||
EXIF_TAG_SUBJECT_DISTANCE = 0x9206,
|
||||
EXIF_TAG_METERING_MODE = 0x9207,
|
||||
EXIF_TAG_LIGHT_SOURCE = 0x9208,
|
||||
EXIF_TAG_FLASH = 0x9209,
|
||||
EXIF_TAG_FOCAL_LENGTH = 0x920a,
|
||||
EXIF_TAG_SUBJECT_AREA = 0x9214,
|
||||
EXIF_TAG_TIFF_EP_STANDARD_ID = 0x9216,
|
||||
EXIF_TAG_MAKER_NOTE = 0x927c,
|
||||
EXIF_TAG_USER_COMMENT = 0x9286,
|
||||
EXIF_TAG_SUB_SEC_TIME = 0x9290,
|
||||
EXIF_TAG_SUB_SEC_TIME_ORIGINAL = 0x9291,
|
||||
EXIF_TAG_SUB_SEC_TIME_DIGITIZED = 0x9292,
|
||||
EXIF_TAG_XP_TITLE = 0x9c9b,
|
||||
EXIF_TAG_XP_COMMENT = 0x9c9c,
|
||||
EXIF_TAG_XP_AUTHOR = 0x9c9d,
|
||||
EXIF_TAG_XP_KEYWORDS = 0x9c9e,
|
||||
EXIF_TAG_XP_SUBJECT = 0x9c9f,
|
||||
EXIF_TAG_FLASH_PIX_VERSION = 0xa000,
|
||||
EXIF_TAG_COLOR_SPACE = 0xa001,
|
||||
EXIF_TAG_PIXEL_X_DIMENSION = 0xa002,
|
||||
EXIF_TAG_PIXEL_Y_DIMENSION = 0xa003,
|
||||
EXIF_TAG_RELATED_SOUND_FILE = 0xa004,
|
||||
EXIF_TAG_INTEROPERABILITY_IFD_POINTER = 0xa005,
|
||||
EXIF_TAG_FLASH_ENERGY = 0xa20b,
|
||||
EXIF_TAG_SPATIAL_FREQUENCY_RESPONSE = 0xa20c,
|
||||
EXIF_TAG_FOCAL_PLANE_X_RESOLUTION = 0xa20e,
|
||||
EXIF_TAG_FOCAL_PLANE_Y_RESOLUTION = 0xa20f,
|
||||
EXIF_TAG_FOCAL_PLANE_RESOLUTION_UNIT = 0xa210,
|
||||
EXIF_TAG_SUBJECT_LOCATION = 0xa214,
|
||||
EXIF_TAG_EXPOSURE_INDEX = 0xa215,
|
||||
EXIF_TAG_SENSING_METHOD = 0xa217,
|
||||
EXIF_TAG_FILE_SOURCE = 0xa300,
|
||||
EXIF_TAG_SCENE_TYPE = 0xa301,
|
||||
EXIF_TAG_NEW_CFA_PATTERN = 0xa302,
|
||||
EXIF_TAG_CUSTOM_RENDERED = 0xa401,
|
||||
EXIF_TAG_EXPOSURE_MODE = 0xa402,
|
||||
EXIF_TAG_WHITE_BALANCE = 0xa403,
|
||||
EXIF_TAG_DIGITAL_ZOOM_RATIO = 0xa404,
|
||||
EXIF_TAG_FOCAL_LENGTH_IN_35MM_FILM = 0xa405,
|
||||
EXIF_TAG_SCENE_CAPTURE_TYPE = 0xa406,
|
||||
EXIF_TAG_GAIN_CONTROL = 0xa407,
|
||||
EXIF_TAG_CONTRAST = 0xa408,
|
||||
EXIF_TAG_SATURATION = 0xa409,
|
||||
EXIF_TAG_SHARPNESS = 0xa40a,
|
||||
EXIF_TAG_DEVICE_SETTING_DESCRIPTION = 0xa40b,
|
||||
EXIF_TAG_SUBJECT_DISTANCE_RANGE = 0xa40c,
|
||||
EXIF_TAG_IMAGE_UNIQUE_ID = 0xa420,
|
||||
EXIF_TAG_GAMMA = 0xa500,
|
||||
EXIF_TAG_PRINT_IMAGE_MATCHING = 0xc4a5,
|
||||
EXIF_TAG_PADDING = 0xea1c
|
||||
} ExifTag;
|
||||
|
||||
/* GPS tags overlap with above ones. */
|
||||
#define EXIF_TAG_GPS_VERSION_ID 0x0000
|
||||
#define EXIF_TAG_GPS_LATITUDE_REF 0x0001 /* INTEROPERABILITY_INDEX */
|
||||
#define EXIF_TAG_GPS_LATITUDE 0x0002 /* INTEROPERABILITY_VERSION */
|
||||
#define EXIF_TAG_GPS_LONGITUDE_REF 0x0003
|
||||
#define EXIF_TAG_GPS_LONGITUDE 0x0004
|
||||
#define EXIF_TAG_GPS_ALTITUDE_REF 0x0005
|
||||
#define EXIF_TAG_GPS_ALTITUDE 0x0006
|
||||
#define EXIF_TAG_GPS_TIME_STAMP 0x0007
|
||||
#define EXIF_TAG_GPS_SATELLITES 0x0008
|
||||
#define EXIF_TAG_GPS_STATUS 0x0009
|
||||
#define EXIF_TAG_GPS_MEASURE_MODE 0x000a
|
||||
#define EXIF_TAG_GPS_DOP 0x000b
|
||||
#define EXIF_TAG_GPS_SPEED_REF 0x000c
|
||||
#define EXIF_TAG_GPS_SPEED 0x000d
|
||||
#define EXIF_TAG_GPS_TRACK_REF 0x000e
|
||||
#define EXIF_TAG_GPS_TRACK 0x000f
|
||||
#define EXIF_TAG_GPS_IMG_DIRECTION_REF 0x0010
|
||||
#define EXIF_TAG_GPS_IMG_DIRECTION 0x0011
|
||||
#define EXIF_TAG_GPS_MAP_DATUM 0x0012
|
||||
#define EXIF_TAG_GPS_DEST_LATITUDE_REF 0x0013
|
||||
#define EXIF_TAG_GPS_DEST_LATITUDE 0x0014
|
||||
#define EXIF_TAG_GPS_DEST_LONGITUDE_REF 0x0015
|
||||
#define EXIF_TAG_GPS_DEST_LONGITUDE 0x0016
|
||||
#define EXIF_TAG_GPS_DEST_BEARING_REF 0x0017
|
||||
#define EXIF_TAG_GPS_DEST_BEARING 0x0018
|
||||
#define EXIF_TAG_GPS_DEST_DISTANCE_REF 0x0019
|
||||
#define EXIF_TAG_GPS_DEST_DISTANCE 0x001a
|
||||
#define EXIF_TAG_GPS_PROCESSING_METHOD 0x001b
|
||||
#define EXIF_TAG_GPS_AREA_INFORMATION 0x001c
|
||||
#define EXIF_TAG_GPS_DATE_STAMP 0x001d
|
||||
#define EXIF_TAG_GPS_DIFFERENTIAL 0x001e
|
||||
|
||||
/*! What level of support a tag enjoys in the EXIF standard */
|
||||
typedef enum {
|
||||
/*! The meaning of this tag is unknown */
|
||||
EXIF_SUPPORT_LEVEL_UNKNOWN = 0,
|
||||
|
||||
/*! This tag is not allowed in the given IFD */
|
||||
EXIF_SUPPORT_LEVEL_NOT_RECORDED,
|
||||
|
||||
/*! This tag is mandatory in the given IFD */
|
||||
EXIF_SUPPORT_LEVEL_MANDATORY,
|
||||
|
||||
/*! This tag is optional in the given IFD */
|
||||
EXIF_SUPPORT_LEVEL_OPTIONAL
|
||||
} ExifSupportLevel;
|
||||
|
||||
/*! Return the tag ID given its unique textual name.
|
||||
*
|
||||
* \param[in] name tag name
|
||||
* \return tag ID, or 0 if tag not found
|
||||
* \note The tag not found value cannot be distinguished from a legitimate
|
||||
* tag number 0.
|
||||
*/
|
||||
ExifTag exif_tag_from_name (const char *name);
|
||||
|
||||
/*! Return a textual name of the given tag when found in the given IFD. The
|
||||
* name is a short, unique, non-localized text string containing only
|
||||
* US-ASCII alphanumeric characters.
|
||||
*
|
||||
* \param[in] tag EXIF tag
|
||||
* \param[in] ifd IFD
|
||||
* \return textual name of the tag, or NULL if the tag is unknown
|
||||
*/
|
||||
const char *exif_tag_get_name_in_ifd (ExifTag tag, ExifIfd ifd);
|
||||
|
||||
/*! Return a textual title of the given tag when found in the given IFD.
|
||||
* The title is a short, localized description of the tag.
|
||||
*
|
||||
* \param[in] tag EXIF tag
|
||||
* \param[in] ifd IFD
|
||||
* \return textual title of the tag, or NULL if the tag is unknown
|
||||
*/
|
||||
const char *exif_tag_get_title_in_ifd (ExifTag tag, ExifIfd ifd);
|
||||
|
||||
/*! Return a verbose textual description of the given tag when found in the
|
||||
* given IFD. The description is a verbose, localized description of the tag.
|
||||
*
|
||||
* \param[in] tag EXIF tag
|
||||
* \param[in] ifd IFD
|
||||
* \return textual description of the tag, or NULL if the tag is unknown
|
||||
*/
|
||||
const char *exif_tag_get_description_in_ifd (ExifTag tag, ExifIfd ifd);
|
||||
|
||||
/*! Return whether the given tag is mandatory or not in the given IFD and
|
||||
* data type according to the EXIF specification. If the IFD given is
|
||||
* EXIF_IFD_COUNT, the result is EXIF_SUPPORT_LEVEL_UNKNOWN. If the data
|
||||
* type is EXIF_DATA_TYPE_UNKNOWN, the result is
|
||||
* EXIF_SUPPORT_LEVEL_UNKNOWN unless the support level is the same for
|
||||
* all data types.
|
||||
*
|
||||
* \param[in] tag EXIF tag
|
||||
* \param[in] ifd IFD or EXIF_IFD_COUNT
|
||||
* \param[in] t data type or EXIF_DATA_TYPE_UNKNOWN
|
||||
* \return the level of support for this tag
|
||||
*/
|
||||
ExifSupportLevel exif_tag_get_support_level_in_ifd (ExifTag tag, ExifIfd ifd,
|
||||
ExifDataType t);
|
||||
|
||||
/* Don't use these functions. They are here for compatibility only. */
|
||||
|
||||
/*! \deprecated Use #exif_tag_get_name_in_ifd instead */
|
||||
const char *exif_tag_get_name (ExifTag tag);
|
||||
|
||||
/*! \deprecated Use #exif_tag_get_title_in_ifd instead */
|
||||
const char *exif_tag_get_title (ExifTag tag);
|
||||
|
||||
/*! \deprecated Use #exif_tag_get_description_in_ifd instead */
|
||||
const char *exif_tag_get_description (ExifTag tag);
|
||||
|
||||
|
||||
/* For now, do not use these functions. */
|
||||
|
||||
/*! \internal */
|
||||
ExifTag exif_tag_table_get_tag (unsigned int n);
|
||||
|
||||
/*! \internal */
|
||||
const char *exif_tag_table_get_name (unsigned int n);
|
||||
|
||||
/*! \internal */
|
||||
unsigned int exif_tag_table_count (void);
|
||||
|
||||
|
||||
/* Don't use these definitions. They are here for compatibility only. */
|
||||
|
||||
/*! \deprecated Use EXIF_TAG_PRINT_IMAGE_MATCHING instead. */
|
||||
#define EXIF_TAG_UNKNOWN_C4A5 EXIF_TAG_PRINT_IMAGE_MATCHING
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_TAG_H__ */
|
||||
194
libexifa/libexif/exif-utils.h
Executable file
194
libexifa/libexif/exif-utils.h
Executable file
@@ -0,0 +1,194 @@
|
||||
/*! \file exif-utils.h
|
||||
* \brief EXIF data manipulation functions and types
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_UTILS_H__
|
||||
#define __EXIF_UTILS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/_stdint.h>
|
||||
|
||||
|
||||
/* If these definitions don't work for you, please let us fix the
|
||||
* macro generating _stdint.h */
|
||||
|
||||
/*! EXIF Unsigned Byte data type */
|
||||
typedef unsigned char ExifByte; /* 1 byte */
|
||||
|
||||
/*! EXIF Signed Byte data type */
|
||||
typedef signed char ExifSByte; /* 1 byte */
|
||||
|
||||
/*! EXIF Text String data type */
|
||||
typedef char * ExifAscii;
|
||||
|
||||
/*! EXIF Unsigned Short data type */
|
||||
typedef uint16_t ExifShort; /* 2 bytes */
|
||||
|
||||
/*! EXIF Signed Short data type */
|
||||
typedef int16_t ExifSShort; /* 2 bytes */
|
||||
|
||||
/*! EXIF Unsigned Long data type */
|
||||
typedef uint32_t ExifLong; /* 4 bytes */
|
||||
|
||||
/*! EXIF Signed Long data type */
|
||||
typedef int32_t ExifSLong; /* 4 bytes */
|
||||
|
||||
/*! EXIF Unsigned Rational data type */
|
||||
typedef struct {ExifLong numerator; ExifLong denominator;} ExifRational;
|
||||
|
||||
typedef char ExifUndefined; /* 1 byte */
|
||||
|
||||
/*! EXIF Signed Rational data type */
|
||||
typedef struct {ExifSLong numerator; ExifSLong denominator;} ExifSRational;
|
||||
|
||||
|
||||
/*! Retrieve an #ExifShort value from memory.
|
||||
*
|
||||
* \param[in] b pointer to raw EXIF value in memory
|
||||
* \param[in] order byte order of raw value
|
||||
* \return value
|
||||
*/
|
||||
ExifShort exif_get_short (const unsigned char *b, ExifByteOrder order);
|
||||
|
||||
/*! Retrieve an #ExifSShort value from memory.
|
||||
*
|
||||
* \param[in] b pointer to raw EXIF value in memory
|
||||
* \param[in] order byte order of raw value
|
||||
* \return value
|
||||
*/
|
||||
ExifSShort exif_get_sshort (const unsigned char *b, ExifByteOrder order);
|
||||
|
||||
/*! Retrieve an #ExifLong value from memory.
|
||||
*
|
||||
* \param[in] b pointer to raw EXIF value in memory
|
||||
* \param[in] order byte order of raw value
|
||||
* \return value
|
||||
*/
|
||||
ExifLong exif_get_long (const unsigned char *b, ExifByteOrder order);
|
||||
|
||||
/*! Retrieve an #ExifSLong value from memory.
|
||||
*
|
||||
* \param[in] b pointer to raw EXIF value in memory
|
||||
* \param[in] order byte order of raw value
|
||||
* \return value
|
||||
*/
|
||||
ExifSLong exif_get_slong (const unsigned char *b, ExifByteOrder order);
|
||||
|
||||
/*! Retrieve an #ExifRational value from memory.
|
||||
*
|
||||
* \param[in] b pointer to raw EXIF value in memory
|
||||
* \param[in] order byte order of raw value
|
||||
* \return value
|
||||
*/
|
||||
ExifRational exif_get_rational (const unsigned char *b, ExifByteOrder order);
|
||||
|
||||
/*! Retrieve an #ExifSRational value from memory.
|
||||
*
|
||||
* \param[in] b pointer to raw EXIF value in memory
|
||||
* \param[in] order byte order of raw value
|
||||
* \return value
|
||||
*/
|
||||
ExifSRational exif_get_srational (const unsigned char *b, ExifByteOrder order);
|
||||
|
||||
/*! Store an ExifShort value into memory in EXIF format.
|
||||
*
|
||||
* \param[out] b buffer in which to write raw value
|
||||
* \param[in] order byte order to use
|
||||
* \param[in] value data value to store
|
||||
*/
|
||||
void exif_set_short (unsigned char *b, ExifByteOrder order,
|
||||
ExifShort value);
|
||||
|
||||
/*! Store an ExifSShort value into memory in EXIF format.
|
||||
*
|
||||
* \param[out] b buffer in which to write raw value
|
||||
* \param[in] order byte order to use
|
||||
* \param[in] value data value to store
|
||||
*/
|
||||
void exif_set_sshort (unsigned char *b, ExifByteOrder order,
|
||||
ExifSShort value);
|
||||
|
||||
/*! Store an ExifLong value into memory in EXIF format.
|
||||
*
|
||||
* \param[out] b buffer in which to write raw value
|
||||
* \param[in] order byte order to use
|
||||
* \param[in] value data value to store
|
||||
*/
|
||||
void exif_set_long (unsigned char *b, ExifByteOrder order,
|
||||
ExifLong value);
|
||||
|
||||
/*! Store an ExifSLong value into memory in EXIF format.
|
||||
*
|
||||
* \param[out] b buffer in which to write raw value
|
||||
* \param[in] order byte order to use
|
||||
* \param[in] value data value to store
|
||||
*/
|
||||
void exif_set_slong (unsigned char *b, ExifByteOrder order,
|
||||
ExifSLong value);
|
||||
|
||||
/*! Store an ExifRational value into memory in EXIF format.
|
||||
*
|
||||
* \param[out] b buffer in which to write raw value
|
||||
* \param[in] order byte order to use
|
||||
* \param[in] value data value to store
|
||||
*/
|
||||
void exif_set_rational (unsigned char *b, ExifByteOrder order,
|
||||
ExifRational value);
|
||||
|
||||
/*! Store an ExifSRational value into memory in EXIF format.
|
||||
*
|
||||
* \param[out] b buffer in which to write raw value
|
||||
* \param[in] order byte order to use
|
||||
* \param[in] value data value to store
|
||||
*/
|
||||
void exif_set_srational (unsigned char *b, ExifByteOrder order,
|
||||
ExifSRational value);
|
||||
|
||||
/*! \internal */
|
||||
void exif_convert_utf16_to_utf8 (char *out, const unsigned short *in, int maxlen);
|
||||
|
||||
/* Please do not use this function outside of the library. */
|
||||
|
||||
/*! \internal */
|
||||
void exif_array_set_byte_order (ExifFormat, unsigned char *, unsigned int,
|
||||
ExifByteOrder o_orig, ExifByteOrder o_new);
|
||||
|
||||
#undef MIN
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
#undef MAX
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
/* For compatibility with older versions */
|
||||
|
||||
/*! \deprecated Use EXIF_TAG_SUB_SEC_TIME instead. */
|
||||
#define EXIF_TAG_SUBSEC_TIME EXIF_TAG_SUB_SEC_TIME
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_UTILS_H__ */
|
||||
87
libexifa/libexif/exif.h
Executable file
87
libexifa/libexif/exif.h
Executable file
@@ -0,0 +1,87 @@
|
||||
/*! \file exif.h exif/exif.h
|
||||
* \brief Dummy header file for documentation purposes
|
||||
* \date 2007
|
||||
* \author Hans Ulrich Niedermann, et. al.
|
||||
*
|
||||
* \mainpage The libexif library
|
||||
*
|
||||
* \section general_notes General Notes
|
||||
*
|
||||
* This documentation is work in progress, as is the code itself.
|
||||
*
|
||||
* \section using_libexif Using libexif
|
||||
*
|
||||
* \#include <libexif/exif-data.h>
|
||||
*
|
||||
* libexif provides a libexif.pc file for use with pkgconfig on the
|
||||
* libexif installation. If you are using libtool to build your
|
||||
* package, you can also make use of libexif-uninstalled.pc.
|
||||
*
|
||||
* An application using libexif would typically first create an #ExifLoader to
|
||||
* load EXIF data into memory. From there, it would extract that data as
|
||||
* an #ExifData to start manipulating it. Each IFD is represented by its own
|
||||
* #ExifContent within that #ExifData, which contains all the tag data in
|
||||
* #ExifEntry form. If the MakerNote data is required, an #ExifMnoteData
|
||||
* can be extracted from the #ExifData and manipulated with the MakerNote
|
||||
* functions.
|
||||
*
|
||||
* libexif is written in C using an object-based style that defines
|
||||
* sets of functions that operate on each data structure.
|
||||
*
|
||||
* \section data_structures Primary Data Structures
|
||||
*
|
||||
* #ExifLoader
|
||||
* State maintained by the loader interface while importing EXIF data
|
||||
* from an external file or memory
|
||||
*
|
||||
* #ExifData
|
||||
* The entirety of EXIF data found in an image
|
||||
*
|
||||
* #ExifContent
|
||||
* All EXIF tags in a single IFD
|
||||
*
|
||||
* #ExifEntry
|
||||
* Data found in a single EXIF tag
|
||||
*
|
||||
* #ExifMnoteData
|
||||
* All data found in the MakerNote tag
|
||||
*
|
||||
* #ExifLog
|
||||
* State maintained by the logging interface
|
||||
*
|
||||
* \section string_conventions String Conventions
|
||||
*
|
||||
* Strings are 8 bit characters ("char*"). When libexif is compiled with
|
||||
* NLS, character set and encoding are as set in the current locale,
|
||||
* except for strings that come directly from the data in EXIF
|
||||
* tags which are generally returned in raw form. Most EXIF strings are
|
||||
* defined to be plain 7-bit ASCII so this raw form should be acceptable in
|
||||
* any UNIX locale, but some software ignores the specification and
|
||||
* writes 8-bit characters. It is up to the application to detect this
|
||||
* and deal with it intelligently.
|
||||
*
|
||||
* \section memory_management Memory Management Patterns
|
||||
*
|
||||
* For pointers to data objects, libexif uses reference counting. The
|
||||
* pattern is to use the foo_new() function to create a data object,
|
||||
* foo_ref() to increase the reference counter, and foo_unref() to
|
||||
* decrease the reference counter and possibly free(3)ing the memory.
|
||||
*
|
||||
* Libexif by default relies on the calloc(3), realloc(3), and free(3)
|
||||
* functions, but the libexif user can tell libexif to use their
|
||||
* special memory management functions at runtime.
|
||||
*
|
||||
* \section thread_safety Thread Safety
|
||||
*
|
||||
* libexif is thread safe when the underlying C library is also thread safe.
|
||||
* Some C libraries may require defining a special macro (like _REENTRANT)
|
||||
* to ensure this, or may require linking to a special thread-safe version of
|
||||
* the library.
|
||||
*
|
||||
* The programmer must ensure that each object allocated by libexif is only
|
||||
* used in a single thread at once. For example, an ExifData* allocated
|
||||
* in one thread can't be used in a second thread if there is any chance
|
||||
* that the first thread could use it at the same time. Multiple threads
|
||||
* can use libexif without issues if they never share handles.
|
||||
*
|
||||
*/
|
||||
53
libexifa/libexif/fuji/exif-mnote-data-fuji.h
Executable file
53
libexifa/libexif/fuji/exif-mnote-data-fuji.h
Executable file
@@ -0,0 +1,53 @@
|
||||
/* exif-mnote-data-fuji.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_FUJI_CONTENT_H__
|
||||
#define __MNOTE_FUJI_CONTENT_H__
|
||||
|
||||
#include <libexif/exif-mnote-data.h>
|
||||
#include <libexif/exif-mnote-data-priv.h>
|
||||
#include <libexif/exif-data.h>
|
||||
#include <libexif/fuji/mnote-fuji-entry.h>
|
||||
|
||||
typedef struct _ExifMnoteDataFuji ExifMnoteDataFuji;
|
||||
|
||||
struct _ExifMnoteDataFuji {
|
||||
ExifMnoteData parent;
|
||||
|
||||
MnoteFujiEntry *entries;
|
||||
unsigned int count;
|
||||
|
||||
ExifByteOrder order;
|
||||
unsigned int offset;
|
||||
};
|
||||
|
||||
/*! Detect if MakerNote is recognized as one handled by the Fuji module.
|
||||
*
|
||||
* \param[in] ed image #ExifData to identify as as a Fuji type
|
||||
* \param[in] e #ExifEntry for EXIF_TAG_MAKER_NOTE, from within ed but
|
||||
* duplicated here for convenience
|
||||
* \return 0 if not recognized, nonzero if recognized. The specific nonzero
|
||||
* value returned may identify a subtype unique within this module.
|
||||
*/
|
||||
int exif_mnote_data_fuji_identify (const ExifData *ed, const ExifEntry *e);
|
||||
|
||||
ExifMnoteData *exif_mnote_data_fuji_new (ExifMem *);
|
||||
|
||||
#endif /* __MNOTE_FUJI_CONTENT_H__ */
|
||||
45
libexifa/libexif/fuji/mnote-fuji-entry.h
Executable file
45
libexifa/libexif/fuji/mnote-fuji-entry.h
Executable file
@@ -0,0 +1,45 @@
|
||||
/* mnote-fuji-entry.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_FUJI_ENTRY_H__
|
||||
#define __MNOTE_FUJI_ENTRY_H__
|
||||
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/fuji/mnote-fuji-tag.h>
|
||||
|
||||
typedef struct _MnoteFujiEntry MnoteFujiEntry;
|
||||
typedef struct _MnoteFujiEntryPrivate MnoteFujiEntryPrivate;
|
||||
|
||||
#include <libexif/fuji/exif-mnote-data-fuji.h>
|
||||
|
||||
struct _MnoteFujiEntry {
|
||||
MnoteFujiTag tag;
|
||||
ExifFormat format;
|
||||
unsigned long components;
|
||||
|
||||
unsigned char *data;
|
||||
unsigned int size;
|
||||
|
||||
ExifByteOrder order;
|
||||
};
|
||||
|
||||
char *mnote_fuji_entry_get_value (MnoteFujiEntry *entry, char *val, unsigned int maxlen);
|
||||
|
||||
#endif /* __MNOTE_FUJI_ENTRY_H__ */
|
||||
92
libexifa/libexif/fuji/mnote-fuji-tag.h
Executable file
92
libexifa/libexif/fuji/mnote-fuji-tag.h
Executable file
@@ -0,0 +1,92 @@
|
||||
/* mnote-fuji-tag.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_FUJI_TAG_H__
|
||||
#define __MNOTE_FUJI_TAG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-data.h>
|
||||
|
||||
enum _MnoteFujiTag {
|
||||
MNOTE_FUJI_TAG_VERSION = 0x0000,
|
||||
MNOTE_FUJI_TAG_SERIAL_NUMBER = 0x0010,
|
||||
MNOTE_FUJI_TAG_QUALITY = 0x1000,
|
||||
MNOTE_FUJI_TAG_SHARPNESS = 0x1001,
|
||||
MNOTE_FUJI_TAG_WHITE_BALANCE = 0x1002,
|
||||
MNOTE_FUJI_TAG_COLOR = 0x1003,
|
||||
MNOTE_FUJI_TAG_TONE = 0x1004,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1006 = 0x1006,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1007 = 0x1007,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1008 = 0x1008,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1009 = 0x1009,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_100A = 0x100A,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_100B = 0x100B,
|
||||
MNOTE_FUJI_TAG_FLASH_MODE = 0x1010,
|
||||
MNOTE_FUJI_TAG_FLASH_STRENGTH = 0x1011,
|
||||
MNOTE_FUJI_TAG_MACRO = 0x1020,
|
||||
MNOTE_FUJI_TAG_FOCUS_MODE = 0x1021,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1022 = 0x1022,
|
||||
MNOTE_FUJI_TAG_FOCUS_POINT = 0x1023,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1024 = 0x1024,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1025 = 0x1025,
|
||||
MNOTE_FUJI_TAG_SLOW_SYNC = 0x1030,
|
||||
MNOTE_FUJI_TAG_PICTURE_MODE = 0x1031,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1032 = 0x1032,
|
||||
MNOTE_FUJI_TAG_CONT_TAKING = 0x1100,
|
||||
MNOTE_FUJI_TAG_SEQUENCE_NUMBER = 0x1101,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1200 = 0x1200,
|
||||
MNOTE_FUJI_TAG_FINEPIX_COLOR = 0x1210,
|
||||
MNOTE_FUJI_TAG_BLUR_CHECK = 0x1300,
|
||||
MNOTE_FUJI_TAG_FOCUS_CHECK = 0x1301,
|
||||
MNOTE_FUJI_TAG_AUTO_EXPOSURE_CHECK = 0x1302,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1303 = 0x1303,
|
||||
MNOTE_FUJI_TAG_DYNAMIC_RANGE = 0x1400,
|
||||
MNOTE_FUJI_TAG_FILM_MODE = 0x1401,
|
||||
MNOTE_FUJI_TAG_DYNAMIC_RANGE_SETTING = 0x1402,
|
||||
MNOTE_FUJI_TAG_DEV_DYNAMIC_RANGE_SETTING= 0x1403,
|
||||
MNOTE_FUJI_TAG_MIN_FOCAL_LENGTH = 0x1404,
|
||||
MNOTE_FUJI_TAG_MAX_FOCAL_LENGTH = 0x1405,
|
||||
MNOTE_FUJI_TAG_MAX_APERT_AT_MIN_FOC = 0x1406,
|
||||
MNOTE_FUJI_TAG_MAX_APERT_AT_MAX_FOC = 0x1407,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1408 = 0x1408,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1409 = 0x1409,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_140A = 0x140A,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1410 = 0x1410,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1421 = 0x1421,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_4100 = 0x4100,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_4800 = 0x4800,
|
||||
MNOTE_FUJI_TAG_FILE_SOURCE = 0x8000,
|
||||
MNOTE_FUJI_TAG_ORDER_NUMBER = 0x8002,
|
||||
MNOTE_FUJI_TAG_FRAME_NUMBER = 0x8003,
|
||||
};
|
||||
typedef enum _MnoteFujiTag MnoteFujiTag;
|
||||
|
||||
const char *mnote_fuji_tag_get_name (MnoteFujiTag tag);
|
||||
const char *mnote_fuji_tag_get_title (MnoteFujiTag tag);
|
||||
const char *mnote_fuji_tag_get_description (MnoteFujiTag tag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MNOTE_FUJI_TAG_H__ */
|
||||
52
libexifa/libexif/i18n.h
Executable file
52
libexifa/libexif/i18n.h
Executable file
@@ -0,0 +1,52 @@
|
||||
/* i18n.h
|
||||
*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __I18N_H__
|
||||
#define __I18N_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# undef _
|
||||
# define _(String) dgettext (GETTEXT_PACKAGE, String)
|
||||
# ifdef gettext_noop
|
||||
# define N_(String) gettext_noop (String)
|
||||
# else
|
||||
# define N_(String) (String)
|
||||
# endif
|
||||
#else
|
||||
# define textdomain(String) (String)
|
||||
# define gettext(String) (String)
|
||||
# define ngettext(String1,String2,Count) (Count==1?String1:String2)
|
||||
# define dgettext(Domain,Message) (Message)
|
||||
# define dcgettext(Domain,Message,Type) (Message)
|
||||
#ifdef __WATCOMC__
|
||||
# define bind_textdomain_codeset(Domain,Codeset)
|
||||
# define bindtextdomain(Domain,Directory)
|
||||
#else
|
||||
# define bind_textdomain_codeset(Domain,Codeset)
|
||||
# define bindtextdomain(Domain,Directory)
|
||||
#endif
|
||||
# define _(String) (String)
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
#endif /* __I18N_H__ */
|
||||
67
libexifa/libexif/olympus/exif-mnote-data-olympus.h
Executable file
67
libexifa/libexif/olympus/exif-mnote-data-olympus.h
Executable file
@@ -0,0 +1,67 @@
|
||||
/* mnote-olympus-data.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_OLYMPUS_CONTENT_H__
|
||||
#define __MNOTE_OLYMPUS_CONTENT_H__
|
||||
|
||||
#include <libexif/exif-mnote-data-priv.h>
|
||||
#include <libexif/olympus/mnote-olympus-entry.h>
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-data.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
enum OlympusVersion {
|
||||
unrecognized = 0,
|
||||
nikonV1 = 1,
|
||||
nikonV2 = 2,
|
||||
olympusV1 = 3,
|
||||
olympusV2 = 4,
|
||||
sanyoV1 = 5,
|
||||
epsonV1 = 6,
|
||||
nikonV0 = 7
|
||||
};
|
||||
|
||||
|
||||
typedef struct _ExifMnoteDataOlympus ExifMnoteDataOlympus;
|
||||
|
||||
struct _ExifMnoteDataOlympus {
|
||||
ExifMnoteData parent;
|
||||
|
||||
MnoteOlympusEntry *entries;
|
||||
unsigned int count;
|
||||
|
||||
ExifByteOrder order;
|
||||
unsigned int offset;
|
||||
enum OlympusVersion version;
|
||||
};
|
||||
|
||||
/*! Detect if MakerNote is recognized as one handled by the Olympus module.
|
||||
*
|
||||
* \param[in] ed image #ExifData to identify as as an Olympus type
|
||||
* \param[in] e #ExifEntry for EXIF_TAG_MAKER_NOTE, from within ed but
|
||||
* duplicated here for convenience
|
||||
* \return 0 if not recognized, nonzero if recognized. The specific nonzero
|
||||
* value returned may identify a subtype unique within this module.
|
||||
*/
|
||||
int exif_mnote_data_olympus_identify (const ExifData *ed, const ExifEntry *e);
|
||||
|
||||
ExifMnoteData *exif_mnote_data_olympus_new (ExifMem *);
|
||||
|
||||
#endif /* __MNOTE_OLYMPUS_CONTENT_H__ */
|
||||
43
libexifa/libexif/olympus/mnote-olympus-entry.h
Executable file
43
libexifa/libexif/olympus/mnote-olympus-entry.h
Executable file
@@ -0,0 +1,43 @@
|
||||
/* mnote-olympus-entry.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_OLYMPUS_ENTRY_H__
|
||||
#define __MNOTE_OLYMPUS_ENTRY_H__
|
||||
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/olympus/mnote-olympus-tag.h>
|
||||
|
||||
typedef struct _MnoteOlympusEntry MnoteOlympusEntry;
|
||||
|
||||
struct _MnoteOlympusEntry {
|
||||
MnoteOlympusTag tag;
|
||||
ExifFormat format;
|
||||
unsigned long components;
|
||||
|
||||
unsigned char *data;
|
||||
unsigned int size;
|
||||
|
||||
ExifByteOrder order;
|
||||
};
|
||||
|
||||
char *mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *val, unsigned int maxlen);
|
||||
|
||||
#endif /* __MNOTE_OLYMPUS_ENTRY_H__ */
|
||||
229
libexifa/libexif/olympus/mnote-olympus-tag.h
Executable file
229
libexifa/libexif/olympus/mnote-olympus-tag.h
Executable file
@@ -0,0 +1,229 @@
|
||||
/* mnote-olympus-tag.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_OLYMPUS_TAG_H__
|
||||
#define __MNOTE_OLYMPUS_TAG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
enum _MnoteOlympusTag {
|
||||
|
||||
/* Nikon v.2 */
|
||||
MNOTE_NIKON_TAG_FIRMWARE = 0x0001,
|
||||
MNOTE_NIKON_TAG_ISO = 0x0002,
|
||||
MNOTE_NIKON_TAG_COLORMODE1 = 0x0003,
|
||||
MNOTE_NIKON_TAG_QUALITY = 0x0004,
|
||||
MNOTE_NIKON_TAG_WHITEBALANCE = 0x0005,
|
||||
MNOTE_NIKON_TAG_SHARPENING = 0x0006,
|
||||
MNOTE_NIKON_TAG_FOCUSMODE = 0x0007,
|
||||
MNOTE_NIKON_TAG_FLASHSETTING = 0x0008,
|
||||
MNOTE_NIKON_TAG_FLASHMODE = 0x0009,
|
||||
MNOTE_NIKON_TAG_WHITEBALANCEFINE = 0x000b,
|
||||
MNOTE_NIKON_TAG_WHITEBALANCERB = 0x000c,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X000D = 0x000d,
|
||||
MNOTE_NIKON_TAG_EXPOSUREDIFF = 0x000e,
|
||||
MNOTE_NIKON_TAG_ISOSELECTION = 0x000f,
|
||||
MNOTE_NIKON_TAG_PREVIEWIMAGE_IFD_POINTER= 0x0011,
|
||||
MNOTE_NIKON_TAG_FLASHEXPCOMPENSATION = 0x0012,
|
||||
MNOTE_NIKON_TAG_ISO2 = 0x0013,
|
||||
MNOTE_NIKON_TAG_IMAGEBOUNDARY = 0x0016,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X0017 = 0x0017,
|
||||
MNOTE_NIKON_TAG_FLASHEXPOSUREBRACKETVAL = 0x0018,
|
||||
MNOTE_NIKON_TAG_EXPOSUREBRACKETVAL = 0x0019,
|
||||
MNOTE_NIKON_TAG_IMAGEADJUSTMENT = 0x0080,
|
||||
MNOTE_NIKON_TAG_TONECOMPENSATION = 0x0081,
|
||||
MNOTE_NIKON_TAG_ADAPTER = 0x0082,
|
||||
MNOTE_NIKON_TAG_LENSTYPE = 0x0083,
|
||||
MNOTE_NIKON_TAG_LENS = 0x0084,
|
||||
MNOTE_NIKON_TAG_MANUALFOCUSDISTANCE = 0x0085,
|
||||
MNOTE_NIKON_TAG_DIGITALZOOM = 0x0086,
|
||||
MNOTE_NIKON_TAG_FLASHUSED = 0x0087,
|
||||
MNOTE_NIKON_TAG_AFFOCUSPOSITION = 0x0088,
|
||||
MNOTE_NIKON_TAG_BRACKETING = 0x0089,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X008A = 0x008a,
|
||||
MNOTE_NIKON_TAG_LENS_FSTOPS = 0x008b,
|
||||
MNOTE_NIKON_TAG_CURVE = 0x008c,
|
||||
MNOTE_NIKON_TAG_COLORMODE = 0x008d,
|
||||
MNOTE_NIKON_TAG_LIGHTTYPE = 0x0090,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X0091 = 0x0091,
|
||||
MNOTE_NIKON_TAG_HUE = 0x0092,
|
||||
MNOTE_NIKON_TAG_SATURATION = 0x0094,
|
||||
MNOTE_NIKON_TAG_NOISEREDUCTION = 0x0095,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X0097 = 0x0097,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X0098 = 0x0098,
|
||||
MNOTE_NIKON_TAG_SENSORPIXELSIZE = 0x009a,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X009B = 0x009b,
|
||||
MNOTE_NIKON_TAG_SERIALNUMBER = 0x00a0,
|
||||
MNOTE_NIKON_TAG_IMAGE_DATASIZE = 0x00a2,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X00A3 = 0x00a3,
|
||||
MNOTE_NIKON_TAG_TOTALPICTURES = 0x00a7,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X00A8 = 0x00a8,
|
||||
MNOTE_NIKON_TAG_OPTIMIZATION = 0x00a9,
|
||||
MNOTE_NIKON_TAG_SATURATION2 = 0x00aa,
|
||||
MNOTE_NIKON_TAG_VARIPROGRAM = 0x00ab,
|
||||
MNOTE_NIKON_TAG_CAPTUREEDITORDATA = 0x0e01,
|
||||
MNOTE_NIKON_TAG_CAPTUREEDITORVER = 0x0e09,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X0E0E = 0x0e0e,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X0E10 = 0x0e10,
|
||||
|
||||
/* Nikon v1: real values + our proprietary base to distinguish from v2 */
|
||||
MNOTE_NIKON1_TAG_BASE = 0x8000,
|
||||
MNOTE_NIKON1_TAG_UNKNOWN_0X0002 = 0x0002 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_QUALITY = 0x0003 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_COLORMODE = 0x0004 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_IMAGEADJUSTMENT = 0x0005 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_CCDSENSITIVITY = 0x0006 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_WHITEBALANCE = 0x0007 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_FOCUS = 0x0008 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_UNKNOWN_0X0009 = 0x0009 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_DIGITALZOOM = 0x000a + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_CONVERTER = 0x000b + MNOTE_NIKON1_TAG_BASE,
|
||||
|
||||
/* Olympus and some Sanyo */
|
||||
MNOTE_OLYMPUS_TAG_THUMBNAILIMAGE = 0x0100,
|
||||
MNOTE_OLYMPUS_TAG_MODE = 0x0200,
|
||||
MNOTE_OLYMPUS_TAG_QUALITY = 0x0201,
|
||||
MNOTE_OLYMPUS_TAG_MACRO = 0x0202,
|
||||
MNOTE_OLYMPUS_TAG_BWMODE = 0x0203,
|
||||
MNOTE_OLYMPUS_TAG_DIGIZOOM = 0x0204,
|
||||
MNOTE_OLYMPUS_TAG_FOCALPLANEDIAGONAL = 0x0205,
|
||||
MNOTE_OLYMPUS_TAG_LENSDISTORTION = 0x0206,
|
||||
MNOTE_OLYMPUS_TAG_VERSION = 0x0207,
|
||||
MNOTE_OLYMPUS_TAG_INFO = 0x0208,
|
||||
MNOTE_OLYMPUS_TAG_ID = 0x0209,
|
||||
MNOTE_OLYMPUS_TAG_PRECAPTUREFRAMES = 0x0300,
|
||||
MNOTE_OLYMPUS_TAG_WHITEBOARD = 0x0301,
|
||||
MNOTE_OLYMPUS_TAG_ONETOUCHWB = 0x0302,
|
||||
MNOTE_OLYMPUS_TAG_WHITEBALANCEBRACKET = 0x0303,
|
||||
MNOTE_OLYMPUS_TAG_WHITEBALANCEBIAS = 0x0304,
|
||||
MNOTE_OLYMPUS_TAG_DATADUMP = 0x0f00,
|
||||
MNOTE_OLYMPUS_TAG_UNKNOWN_4 = 0x0f04,
|
||||
MNOTE_OLYMPUS_TAG_SHUTTERSPEED = 0x1000,
|
||||
MNOTE_OLYMPUS_TAG_ISOVALUE = 0x1001,
|
||||
MNOTE_OLYMPUS_TAG_APERTUREVALUE = 0x1002,
|
||||
MNOTE_OLYMPUS_TAG_BRIGHTNESSVALUE = 0x1003,
|
||||
MNOTE_OLYMPUS_TAG_FLASHMODE = 0x1004,
|
||||
MNOTE_OLYMPUS_TAG_FLASHDEVICE = 0x1005,
|
||||
MNOTE_OLYMPUS_TAG_EXPOSURECOMP = 0x1006,
|
||||
MNOTE_OLYMPUS_TAG_SENSORTEMPERATURE = 0x1007,
|
||||
MNOTE_OLYMPUS_TAG_LENSTEMPERATURE = 0x1008,
|
||||
MNOTE_OLYMPUS_TAG_LIGHTCONDITION = 0x1009,
|
||||
MNOTE_OLYMPUS_TAG_FOCUSRANGE = 0x100a,
|
||||
MNOTE_OLYMPUS_TAG_MANFOCUS = 0x100b,
|
||||
MNOTE_OLYMPUS_TAG_FOCUSDIST = 0x100c,
|
||||
MNOTE_OLYMPUS_TAG_ZOOMSTEPCOUNT = 0x100d,
|
||||
MNOTE_OLYMPUS_TAG_FOCUSSTEPCOUNT = 0x100e,
|
||||
MNOTE_OLYMPUS_TAG_SHARPNESS = 0x100f,
|
||||
MNOTE_OLYMPUS_TAG_FLASHCHARGELEVEL = 0x1010,
|
||||
MNOTE_OLYMPUS_TAG_COLORMATRIX = 0x1011,
|
||||
MNOTE_OLYMPUS_TAG_BLACKLEVEL = 0x1012,
|
||||
MNOTE_OLYMPUS_TAG_WBALANCE = 0x1015,
|
||||
MNOTE_OLYMPUS_TAG_REDBALANCE = 0x1017,
|
||||
MNOTE_OLYMPUS_TAG_BLUEBALANCE = 0x1018,
|
||||
MNOTE_OLYMPUS_TAG_COLORMATRIXNUMBER = 0x1019,
|
||||
MNOTE_OLYMPUS_TAG_SERIALNUMBER2 = 0x101a,
|
||||
MNOTE_OLYMPUS_TAG_FLASHEXPOSURECOMP = 0x1023,
|
||||
MNOTE_OLYMPUS_TAG_INTERNALFLASHTABLE = 0x1024,
|
||||
MNOTE_OLYMPUS_TAG_EXTERNALFLASHGVALUE = 0x1025,
|
||||
MNOTE_OLYMPUS_TAG_EXTERNALFLASHBOUNCE = 0x1026,
|
||||
MNOTE_OLYMPUS_TAG_EXTERNALFLASHZOOM = 0x1027,
|
||||
MNOTE_OLYMPUS_TAG_EXTERNALFLASHMODE = 0x1028,
|
||||
MNOTE_OLYMPUS_TAG_CONTRAST = 0x1029,
|
||||
MNOTE_OLYMPUS_TAG_SHARPNESSFACTOR = 0x102a,
|
||||
MNOTE_OLYMPUS_TAG_COLORCONTROL = 0x102b,
|
||||
MNOTE_OLYMPUS_TAG_IMAGEWIDTH = 0x102e,
|
||||
MNOTE_OLYMPUS_TAG_IMAGEHEIGHT = 0x102f,
|
||||
MNOTE_OLYMPUS_TAG_SCENEDETECT = 0x1030,
|
||||
MNOTE_OLYMPUS_TAG_COMPRESSIONRATIO = 0x1034,
|
||||
MNOTE_OLYMPUS_TAG_PREVIEWIMAGEVALID = 0x1035,
|
||||
MNOTE_OLYMPUS_TAG_AFRESULT = 0x1038,
|
||||
MNOTE_OLYMPUS_TAG_CCDSCANMODE = 0x1039,
|
||||
MNOTE_OLYMPUS_TAG_NOISEREDUCTION = 0x103a,
|
||||
MNOTE_OLYMPUS_TAG_INFINITYLENSSTEP = 0x103b,
|
||||
MNOTE_OLYMPUS_TAG_NEARLENSSTEP = 0x103c,
|
||||
MNOTE_OLYMPUS_TAG_LIGHTVALUECENTER = 0x103d,
|
||||
MNOTE_OLYMPUS_TAG_LIGHTVALUEPERIPHERY = 0x103e,
|
||||
|
||||
/* Epson */
|
||||
MNOTE_EPSON_TAG_IMAGE_WIDTH = 0x020b,
|
||||
MNOTE_EPSON_TAG_IMAGE_HEIGHT = 0x020c,
|
||||
MNOTE_EPSON_TAG_SOFTWARE = 0x020d,
|
||||
|
||||
/* Sanyo */
|
||||
MNOTE_SANYO_TAG_SEQUENTIALSHOT = 0x020e,
|
||||
MNOTE_SANYO_TAG_WIDERANGE = 0x020f,
|
||||
MNOTE_SANYO_TAG_COLORADJUSTMENTMODE = 0x0210,
|
||||
MNOTE_SANYO_TAG_FOCUSMODE = 0x0212,
|
||||
MNOTE_SANYO_TAG_QUICKSHOT = 0x0213,
|
||||
MNOTE_SANYO_TAG_SELFTIMER = 0x0214,
|
||||
MNOTE_SANYO_TAG_VOICEMEMO = 0x0216,
|
||||
MNOTE_SANYO_TAG_RECORDSHUTTERRELEASE = 0x0217,
|
||||
MNOTE_SANYO_TAG_FLICKERREDUCE = 0x0218,
|
||||
MNOTE_SANYO_TAG_OPTICALZOOM = 0x0219,
|
||||
MNOTE_SANYO_TAG_CCDSENSITIVITY = 0x021a,
|
||||
MNOTE_SANYO_TAG_DIGITALZOOM = 0x021b,
|
||||
MNOTE_SANYO_TAG_LIGHTSOURCESPECIAL = 0x021d,
|
||||
MNOTE_SANYO_TAG_RESAVED = 0x021e,
|
||||
MNOTE_SANYO_TAG_SCENESELECT = 0x021f,
|
||||
MNOTE_SANYO_TAG_MANUALFOCUSDISTANCE = 0x0223,
|
||||
MNOTE_SANYO_TAG_SEQUENCESHOTINTERVAL = 0x0224,
|
||||
};
|
||||
typedef enum _MnoteOlympusTag MnoteOlympusTag;
|
||||
|
||||
/* Don't use these definitions. They are here for compatibility only. */
|
||||
#define MNOTE_OLYMPUS_TAG_UNKNOWN_1 MNOTE_OLYMPUS_TAG_BWMODE
|
||||
#define MNOTE_OLYMPUS_TAG_UNKNOWN_2 MNOTE_OLYMPUS_TAG_FOCALPLANEDIAGONAL
|
||||
#define MNOTE_OLYMPUS_TAG_UNKNOWN_3 MNOTE_OLYMPUS_TAG_LENSDISTORTION
|
||||
#define MNOTE_OLYMPUS_TAG_UNKNOWN_5 MNOTE_OLYMPUS_TAG_DATADUMP
|
||||
#define MNOTE_NIKON_TAG_PREVIEWIMAGE MNOTE_NIKON_TAG_PREVIEWIMAGE_IFD_POINTER
|
||||
|
||||
/*! Return a textual name of the given tag within the Olympus-style MakerNote.
|
||||
* The name is a short, unique, non-localized text string containing only
|
||||
* US-ASCII alphanumeric characters.
|
||||
*
|
||||
* \param[in] tag Olympus-style MakerNote tag
|
||||
* \return textual name of the tag, or NULL if the tag is unknown
|
||||
*/
|
||||
const char *mnote_olympus_tag_get_name (MnoteOlympusTag tag);
|
||||
|
||||
/*! Return a textual title of the given tag within the Olympus-style MakerNote.
|
||||
* The title is a short, localized description of the tag.
|
||||
*
|
||||
* \param[in] tag Olympus-style MakerNote tag
|
||||
* \return textual title of the tag, or NULL if the tag is unknown
|
||||
*/
|
||||
const char *mnote_olympus_tag_get_title (MnoteOlympusTag tag);
|
||||
|
||||
/*! Return a verbose textual description of the given tag within the
|
||||
* Olympus-style MakerNote.
|
||||
* The description is a verbose, localized description of the tag.
|
||||
*
|
||||
* \param[in] tag EXIF tag
|
||||
* \return textual description of the tag, or NULL if the tag is unknown
|
||||
*/
|
||||
const char *mnote_olympus_tag_get_description (MnoteOlympusTag tag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MNOTE_OLYMPUS_TAG_H__ */
|
||||
59
libexifa/libexif/pentax/exif-mnote-data-pentax.h
Executable file
59
libexifa/libexif/pentax/exif-mnote-data-pentax.h
Executable file
@@ -0,0 +1,59 @@
|
||||
/* exif-mnote-data-pentax.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_MNOTE_DATA_PENTAX_H__
|
||||
#define __EXIF_MNOTE_DATA_PENTAX_H__
|
||||
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-mnote-data.h>
|
||||
#include <libexif/exif-mnote-data-priv.h>
|
||||
#include <libexif/pentax/mnote-pentax-entry.h>
|
||||
#include <libexif/exif-data.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
enum PentaxVersion {pentaxV1 = 1, pentaxV2 = 2, pentaxV3 = 3, casioV2 = 4 };
|
||||
|
||||
typedef struct _ExifMnoteDataPentax ExifMnoteDataPentax;
|
||||
|
||||
struct _ExifMnoteDataPentax {
|
||||
ExifMnoteData parent;
|
||||
|
||||
MnotePentaxEntry *entries;
|
||||
unsigned int count;
|
||||
|
||||
ExifByteOrder order;
|
||||
unsigned int offset;
|
||||
|
||||
enum PentaxVersion version;
|
||||
};
|
||||
|
||||
/*! Detect if MakerNote is recognized as one handled by the Pentax module.
|
||||
*
|
||||
* \param[in] ed image #ExifData to identify as as a Pentax type
|
||||
* \param[in] e #ExifEntry for EXIF_TAG_MAKER_NOTE, from within ed but
|
||||
* duplicated here for convenience
|
||||
* \return 0 if not recognized, nonzero if recognized. The specific nonzero
|
||||
* value returned may identify a subtype unique within this module.
|
||||
*/
|
||||
int exif_mnote_data_pentax_identify (const ExifData *ed, const ExifEntry *e);
|
||||
|
||||
ExifMnoteData *exif_mnote_data_pentax_new (ExifMem *);
|
||||
|
||||
#endif /* __EXIF_MNOTE_DATA_PENTAX_H__ */
|
||||
43
libexifa/libexif/pentax/mnote-pentax-entry.h
Executable file
43
libexifa/libexif/pentax/mnote-pentax-entry.h
Executable file
@@ -0,0 +1,43 @@
|
||||
/* mnote-pentax-entry.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_PENTAX_ENTRY_H__
|
||||
#define __MNOTE_PENTAX_ENTRY_H__
|
||||
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/pentax/mnote-pentax-tag.h>
|
||||
|
||||
typedef struct _MnotePentaxEntry MnotePentaxEntry;
|
||||
|
||||
struct _MnotePentaxEntry {
|
||||
MnotePentaxTag tag;
|
||||
ExifFormat format;
|
||||
unsigned long components;
|
||||
|
||||
unsigned char *data;
|
||||
unsigned int size;
|
||||
|
||||
ExifByteOrder order;
|
||||
};
|
||||
|
||||
char *mnote_pentax_entry_get_value (MnotePentaxEntry *entry, char *val, unsigned int maxlen);
|
||||
|
||||
#endif /* __MNOTE_PENTAX_ENTRY_H__ */
|
||||
153
libexifa/libexif/pentax/mnote-pentax-tag.h
Executable file
153
libexifa/libexif/pentax/mnote-pentax-tag.h
Executable file
@@ -0,0 +1,153 @@
|
||||
/* mnote-pentax-tag.h
|
||||
*
|
||||
* Copyright (c) 2002, 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_PENTAX_TAG_H__
|
||||
#define __MNOTE_PENTAX_TAG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Missing features which are probably in the unknowns somewhere ...
|
||||
* 1/ AF Area (Wide, Spot, Free)
|
||||
* 2/ AE Metering (Multi segment, Centre-weighted, Spot)
|
||||
* 3/
|
||||
*/
|
||||
|
||||
enum _MnotePentaxTag {
|
||||
MNOTE_PENTAX_TAG_MODE = 0x0001,
|
||||
MNOTE_PENTAX_TAG_QUALITY = 0x0002,
|
||||
MNOTE_PENTAX_TAG_FOCUS = 0x0003,
|
||||
MNOTE_PENTAX_TAG_FLASH = 0x0004,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_05 = 0x0005,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_06 = 0x0006,
|
||||
MNOTE_PENTAX_TAG_WHITE_BALANCE = 0x0007,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_08 = 0x0008,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_09 = 0x0009,
|
||||
MNOTE_PENTAX_TAG_ZOOM = 0x000a,
|
||||
MNOTE_PENTAX_TAG_SHARPNESS = 0x000b,
|
||||
MNOTE_PENTAX_TAG_CONTRAST = 0x000c,
|
||||
MNOTE_PENTAX_TAG_SATURATION = 0x000d,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_14 = 0x000e,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_15 = 0x000f,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_16 = 0x0010,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_17 = 0x0011,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_18 = 0x0012,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_19 = 0x0013,
|
||||
MNOTE_PENTAX_TAG_ISO_SPEED = 0x0014,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_21 = 0x0015,
|
||||
MNOTE_PENTAX_TAG_COLOR = 0x0017,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_24 = 0x0018,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_25 = 0x0019,
|
||||
MNOTE_PENTAX_TAG_PRINTIM = 0x0e00,
|
||||
MNOTE_PENTAX_TAG_TZ_CITY = 0x1000,
|
||||
MNOTE_PENTAX_TAG_TZ_DST = 0x1001,
|
||||
|
||||
/* Pentax v2, v3: real values + our proprietary base to distinguish from v1 */
|
||||
MNOTE_PENTAX2_TAG_BASE = 0x4000,
|
||||
MNOTE_PENTAX2_TAG_MODE = 0x0001 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_PREVIEW_SIZE = 0x0002 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_PREVIEW_LENGTH = 0x0003 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_PREVIEW_START = 0x0004 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_MODEL_ID = 0x0005 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_DATE = 0x0006 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_TIME = 0x0007 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_QUALITY = 0x0008 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_IMAGE_SIZE = 0x0009 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_PICTURE_MODE = 0x000b + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FLASH_MODE = 0x000c + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FOCUS_MODE = 0x000d + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_AFPOINT_SELECTED = 0x000e + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_AUTO_AFPOINT = 0x000f + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FOCUS_POSITION = 0x0010 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_EXPOSURE_TIME = 0x0012 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FNUMBER = 0x0013 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_ISO = 0x0014 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_EXPOSURE_COMPENSATION = 0x0016 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_METERING_MODE = 0x0017 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_AUTO_BRACKETING = 0x0018 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_WHITE_BALANCE = 0x0019 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_WHITE_BALANCE_MODE= 0x001a + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_BLUE_BALANCE = 0x001b + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_RED_BALANCE = 0x001c + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FOCAL_LENGTH = 0x001d + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_DIGITAL_ZOOM = 0x001e + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_SATURATION = 0x001f + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_CONTRAST = 0x0020 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_SHARPNESS = 0x0021 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_WORLDTIME_LOCATION = 0x0022 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_HOMETOWN_CITY = 0x0023 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_DESTINATION_CITY = 0x0024 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_HOMETOWN_DST = 0x0025 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_DESTINATION_DST = 0x0026 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FRAME_NUMBER = 0x0029 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_IMAGE_PROCESSING = 0x0032 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_PICTURE_MODE2 = 0x0033 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_DRIVE_MODE = 0x0034 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_COLOR_SPACE = 0x0037 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_IMAGE_AREA_OFFSET = 0x0038 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_RAW_IMAGE_SIZE = 0x0039 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_AFPOINTS_USED = 0x003c + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_LENS_TYPE = 0x003f + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_CAMERA_TEMPERATURE = 0x0047 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_NOISE_REDUCTION = 0x0049 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FLASH_EXPOSURE_COMP = 0x004d + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_IMAGE_TONE = 0x004f + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_SHAKE_REDUCTION_INFO = 0x005c + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_BLACK_POINT = 0x0200 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_WHITE_POINT = 0x0201 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_AE_INFO = 0x0206 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_LENS_INFO = 0x0207 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FLASH_INFO = 0x0208 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_CAMERA_INFO = 0x0215 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_BATTERY_INFO = 0x0216 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_HOMETOWN_CITY_CODE = 0x1000 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_DESTINATION_CITY_CODE = 0x1001 + MNOTE_PENTAX2_TAG_BASE,
|
||||
|
||||
/* Casio v2: some Casio v2 tags match Pentax v2 tags */
|
||||
MNOTE_CASIO2_TAG_BASE = MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_PREVIEW_START = 0x2000 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_WHITE_BALANCE_BIAS = 0x2011 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_WHITE_BALANCE = 0x2012 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_OBJECT_DISTANCE = 0x2022 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_FLASH_DISTANCE = 0x2034 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_RECORD_MODE = 0x3000 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_SELF_TIMER = 0x3001 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_QUALITY = 0x3002 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_FOCUS_MODE = 0x3003 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_TIME_ZONE = 0x3006 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_BESTSHOT_MODE = 0x3007 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_CCS_ISO_SENSITIVITY = 0x3014 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_COLOR_MODE = 0x3015 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_ENHANCEMENT = 0x3016 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_FINER = 0x3017 + MNOTE_CASIO2_TAG_BASE
|
||||
};
|
||||
typedef enum _MnotePentaxTag MnotePentaxTag;
|
||||
|
||||
const char *mnote_pentax_tag_get_name (MnotePentaxTag tag);
|
||||
const char *mnote_pentax_tag_get_title (MnotePentaxTag tag);
|
||||
const char *mnote_pentax_tag_get_description (MnotePentaxTag tag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MNOTE_PENTAX_TAG_H__ */
|
||||
659
libexifa/olympus/exif-mnote-data-olympus.c
Executable file
659
libexifa/olympus/exif-mnote-data-olympus.c
Executable file
@@ -0,0 +1,659 @@
|
||||
/* exif-mnote-data-olympus.c
|
||||
*
|
||||
* Copyright (c) 2002, 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "exif-mnote-data-olympus.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <libexif/exif-utils.h>
|
||||
#include <libexif/exif-data.h>
|
||||
|
||||
#define DEBUG
|
||||
|
||||
/* Uncomment this to fix a problem with Sanyo MakerNotes. It's probably best
|
||||
* not to in most cases because it seems to only affect the thumbnail tag
|
||||
* which is duplicated in IFD 1, and fixing the offset could actually cause
|
||||
* problems with other software that expects the broken form.
|
||||
*/
|
||||
/*#define EXIF_OVERCOME_SANYO_OFFSET_BUG */
|
||||
|
||||
static enum OlympusVersion
|
||||
exif_mnote_data_olympus_identify_variant (const unsigned char *buf,
|
||||
unsigned int buf_size);
|
||||
|
||||
|
||||
static void
|
||||
exif_mnote_data_olympus_clear (ExifMnoteDataOlympus *n)
|
||||
{
|
||||
ExifMnoteData *d = (ExifMnoteData *) n;
|
||||
unsigned int i;
|
||||
|
||||
if (!n) return;
|
||||
|
||||
if (n->entries) {
|
||||
for (i = 0; i < n->count; i++)
|
||||
if (n->entries[i].data) {
|
||||
exif_mem_free (d->mem, n->entries[i].data);
|
||||
n->entries[i].data = NULL;
|
||||
}
|
||||
exif_mem_free (d->mem, n->entries);
|
||||
n->entries = NULL;
|
||||
n->count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_olympus_free (ExifMnoteData *n)
|
||||
{
|
||||
if (!n) return;
|
||||
|
||||
exif_mnote_data_olympus_clear ((ExifMnoteDataOlympus *) n);
|
||||
}
|
||||
|
||||
static char *
|
||||
exif_mnote_data_olympus_get_value (ExifMnoteData *d, unsigned int i, char *val, unsigned int maxlen)
|
||||
{
|
||||
ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) d;
|
||||
|
||||
if (!d || !val) return NULL;
|
||||
if (i > n->count -1) return NULL;
|
||||
/*
|
||||
exif_log (d->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
|
||||
"Querying value for tag '%s'...",
|
||||
mnote_olympus_tag_get_name (n->entries[i].tag));
|
||||
*/
|
||||
return mnote_olympus_entry_get_value (&n->entries[i], val, maxlen);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @brief save the MnoteData from ne to buf
|
||||
*
|
||||
* @param ne extract the data from this structure
|
||||
* @param *buf write the mnoteData to this buffer (buffer will be allocated)
|
||||
* @param buf_size the size of the buffer
|
||||
*/
|
||||
static void
|
||||
exif_mnote_data_olympus_save (ExifMnoteData *ne,
|
||||
unsigned char **buf, unsigned int *buf_size)
|
||||
{
|
||||
ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) ne;
|
||||
size_t i, o, s, doff, base = 0, o2 = 6 + 2;
|
||||
size_t datao = 0;
|
||||
unsigned char *t;
|
||||
size_t ts;
|
||||
|
||||
if (!n || !buf || !buf_size) return;
|
||||
|
||||
/*
|
||||
* Allocate enough memory for all entries and the number of entries.
|
||||
*/
|
||||
*buf_size = 6 + 2 + 2 + n->count * 12;
|
||||
switch (n->version) {
|
||||
case olympusV1:
|
||||
case sanyoV1:
|
||||
case epsonV1:
|
||||
*buf = exif_mem_alloc (ne->mem, *buf_size);
|
||||
if (!*buf) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteDataOlympus", *buf_size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write the header and the number of entries. */
|
||||
strcpy ((char *)*buf, n->version==sanyoV1?"SANYO":
|
||||
(n->version==epsonV1?"EPSON":"OLYMP"));
|
||||
exif_set_short (*buf + 6, n->order, (ExifShort) 1);
|
||||
datao = n->offset;
|
||||
break;
|
||||
|
||||
case olympusV2:
|
||||
*buf_size += 8-6 + 4;
|
||||
*buf = exif_mem_alloc (ne->mem, *buf_size);
|
||||
if (!*buf) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteDataOlympus", *buf_size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write the header and the number of entries. */
|
||||
strcpy ((char *)*buf, "OLYMPUS");
|
||||
exif_set_short (*buf + 8, n->order, (ExifShort) (
|
||||
(n->order == EXIF_BYTE_ORDER_INTEL) ?
|
||||
('I' << 8) | 'I' :
|
||||
('M' << 8) | 'M'));
|
||||
exif_set_short (*buf + 10, n->order, (ExifShort) 3);
|
||||
o2 += 4;
|
||||
break;
|
||||
|
||||
case nikonV1:
|
||||
base = MNOTE_NIKON1_TAG_BASE;
|
||||
|
||||
/* v1 has offsets based to main IFD, not makernote IFD */
|
||||
datao += n->offset + 10;
|
||||
/* subtract the size here, so the increment in the next case will not harm us */
|
||||
*buf_size -= 8 + 2;
|
||||
/* Fall through to nikonV2 handler */
|
||||
case nikonV2:
|
||||
/* Write out V0 files in V2 format */
|
||||
case nikonV0:
|
||||
*buf_size += 8 + 2;
|
||||
*buf_size += 4; /* Next IFD pointer */
|
||||
*buf = exif_mem_alloc (ne->mem, *buf_size);
|
||||
if (!*buf) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteDataOlympus", *buf_size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write the header and the number of entries. */
|
||||
strcpy ((char *)*buf, "Nikon");
|
||||
(*buf)[6] = n->version;
|
||||
|
||||
if (n->version != nikonV1) {
|
||||
exif_set_short (*buf + 10, n->order, (ExifShort) (
|
||||
(n->order == EXIF_BYTE_ORDER_INTEL) ?
|
||||
('I' << 8) | 'I' :
|
||||
('M' << 8) | 'M'));
|
||||
exif_set_short (*buf + 12, n->order, (ExifShort) 0x2A);
|
||||
exif_set_long (*buf + 14, n->order, (ExifShort) 8);
|
||||
o2 += 2 + 8;
|
||||
}
|
||||
datao -= 10;
|
||||
/* Reset next IFD pointer */
|
||||
exif_set_long (*buf + o2 + 2 + n->count * 12, n->order, 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
|
||||
exif_set_short (*buf + o2, n->order, (ExifShort) n->count);
|
||||
o2 += 2;
|
||||
|
||||
/* Save each entry */
|
||||
for (i = 0; i < n->count; i++) {
|
||||
o = o2 + i * 12;
|
||||
exif_set_short (*buf + o + 0, n->order,
|
||||
(ExifShort) (n->entries[i].tag - base));
|
||||
exif_set_short (*buf + o + 2, n->order,
|
||||
(ExifShort) n->entries[i].format);
|
||||
exif_set_long (*buf + o + 4, n->order,
|
||||
n->entries[i].components);
|
||||
o += 8;
|
||||
s = exif_format_get_size (n->entries[i].format) *
|
||||
n->entries[i].components;
|
||||
if (s > 65536) {
|
||||
/* Corrupt data: EXIF data size is limited to the
|
||||
* maximum size of a JPEG segment (64 kb).
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
if (s > 4) {
|
||||
doff = *buf_size;
|
||||
ts = *buf_size + s;
|
||||
t = exif_mem_realloc (ne->mem, *buf,
|
||||
sizeof (char) * ts);
|
||||
if (!t) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteDataOlympus", ts);
|
||||
return;
|
||||
}
|
||||
*buf = t;
|
||||
*buf_size = ts;
|
||||
exif_set_long (*buf + o, n->order, datao + doff);
|
||||
} else
|
||||
doff = o;
|
||||
|
||||
/* Write the data. */
|
||||
if (n->entries[i].data) {
|
||||
memcpy (*buf + doff, n->entries[i].data, s);
|
||||
} else {
|
||||
/* Most certainly damaged input file */
|
||||
memset (*buf + doff, 0, s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_olympus_load (ExifMnoteData *en,
|
||||
const unsigned char *buf, unsigned int buf_size)
|
||||
{
|
||||
ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) en;
|
||||
ExifShort c;
|
||||
size_t i, tcount, o, o2, datao = 6, base = 0;
|
||||
|
||||
if (!n || !buf || !buf_size) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteDataOlympus", "Short MakerNote");
|
||||
return;
|
||||
}
|
||||
o2 = 6 + n->offset; /* Start of interesting data */
|
||||
if ((o2 + 10 < o2) || (o2 + 10 < 10) || (o2 + 10 > buf_size)) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteDataOlympus", "Short MakerNote");
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Olympus headers start with "OLYMP" and need to have at least
|
||||
* a size of 22 bytes (6 for 'OLYMP', 2 other bytes, 2 for the
|
||||
* number of entries, and 12 for one entry.
|
||||
*
|
||||
* Sanyo format is identical and uses identical tags except that
|
||||
* header starts with "SANYO".
|
||||
*
|
||||
* Epson format is identical and uses identical tags except that
|
||||
* header starts with "EPSON".
|
||||
*
|
||||
* Nikon headers start with "Nikon" (6 bytes including '\0'),
|
||||
* version number (1 or 2).
|
||||
*
|
||||
* Version 1 continues with 0, 1, 0, number_of_tags,
|
||||
* or just with number_of_tags (models D1H, D1X...).
|
||||
*
|
||||
* Version 2 continues with an unknown byte (0 or 10),
|
||||
* two unknown bytes (0), "MM" or "II", another byte 0 and
|
||||
* lastly 0x2A.
|
||||
*/
|
||||
n->version = exif_mnote_data_olympus_identify_variant(buf+o2, buf_size-o2);
|
||||
switch (n->version) {
|
||||
case olympusV1:
|
||||
case sanyoV1:
|
||||
case epsonV1:
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
|
||||
"Parsing Olympus/Sanyo/Epson maker note v1...");
|
||||
|
||||
/* The number of entries is at position 8. */
|
||||
if (buf[o2 + 6] == 1)
|
||||
n->order = EXIF_BYTE_ORDER_INTEL;
|
||||
else if (buf[o2 + 6 + 1] == 1)
|
||||
n->order = EXIF_BYTE_ORDER_MOTOROLA;
|
||||
o2 += 8;
|
||||
if (o2 + 2 > buf_size) return;
|
||||
c = exif_get_short (buf + o2, n->order);
|
||||
if ((!(c & 0xFF)) && (c > 0x500)) {
|
||||
if (n->order == EXIF_BYTE_ORDER_INTEL) {
|
||||
n->order = EXIF_BYTE_ORDER_MOTOROLA;
|
||||
} else {
|
||||
n->order = EXIF_BYTE_ORDER_INTEL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case olympusV2:
|
||||
/* Olympus S760, S770 */
|
||||
datao = o2;
|
||||
o2 += 8;
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
|
||||
"Parsing Olympus maker note v2 (0x%02x, %02x, %02x, %02x)...",
|
||||
buf[o2], buf[o2 + 1], buf[o2 + 2], buf[o2 + 3]);
|
||||
|
||||
if ((buf[o2] == 'I') && (buf[o2 + 1] == 'I'))
|
||||
n->order = EXIF_BYTE_ORDER_INTEL;
|
||||
else if ((buf[o2] == 'M') && (buf[o2 + 1] == 'M'))
|
||||
n->order = EXIF_BYTE_ORDER_MOTOROLA;
|
||||
|
||||
/* The number of entries is at position 8+4. */
|
||||
o2 += 4;
|
||||
break;
|
||||
|
||||
case nikonV1:
|
||||
o2 += 6;
|
||||
if (o2 >= buf_size) return;
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
|
||||
"Parsing Nikon maker note v1 (0x%02x, %02x, %02x, "
|
||||
"%02x, %02x, %02x, %02x, %02x)...",
|
||||
buf[o2 + 0], buf[o2 + 1], buf[o2 + 2], buf[o2 + 3],
|
||||
buf[o2 + 4], buf[o2 + 5], buf[o2 + 6], buf[o2 + 7]);
|
||||
|
||||
/* Skip version number */
|
||||
o2 += 1;
|
||||
|
||||
/* Skip an unknown byte (00 or 0A). */
|
||||
o2 += 1;
|
||||
|
||||
base = MNOTE_NIKON1_TAG_BASE;
|
||||
/* Fix endianness, if needed */
|
||||
if (o2 + 2 > buf_size) return;
|
||||
c = exif_get_short (buf + o2, n->order);
|
||||
if ((!(c & 0xFF)) && (c > 0x500)) {
|
||||
if (n->order == EXIF_BYTE_ORDER_INTEL) {
|
||||
n->order = EXIF_BYTE_ORDER_MOTOROLA;
|
||||
} else {
|
||||
n->order = EXIF_BYTE_ORDER_INTEL;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case nikonV2:
|
||||
o2 += 6;
|
||||
if (o2 >= buf_size) return;
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
|
||||
"Parsing Nikon maker note v2 (0x%02x, %02x, %02x, "
|
||||
"%02x, %02x, %02x, %02x, %02x)...",
|
||||
buf[o2 + 0], buf[o2 + 1], buf[o2 + 2], buf[o2 + 3],
|
||||
buf[o2 + 4], buf[o2 + 5], buf[o2 + 6], buf[o2 + 7]);
|
||||
|
||||
/* Skip version number */
|
||||
o2 += 1;
|
||||
|
||||
/* Skip an unknown byte (00 or 0A). */
|
||||
o2 += 1;
|
||||
|
||||
/* Skip 2 unknown bytes (00 00). */
|
||||
o2 += 2;
|
||||
|
||||
/*
|
||||
* Byte order. From here the data offset
|
||||
* gets calculated.
|
||||
*/
|
||||
datao = o2;
|
||||
if (o2 >= buf_size) return;
|
||||
if (!strncmp ((char *)&buf[o2], "II", 2))
|
||||
n->order = EXIF_BYTE_ORDER_INTEL;
|
||||
else if (!strncmp ((char *)&buf[o2], "MM", 2))
|
||||
n->order = EXIF_BYTE_ORDER_MOTOROLA;
|
||||
else {
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG,
|
||||
"ExifMnoteDataOlympus", "Unknown "
|
||||
"byte order '%c%c'", buf[o2],
|
||||
buf[o2 + 1]);
|
||||
return;
|
||||
}
|
||||
o2 += 2;
|
||||
|
||||
/* Skip 2 unknown bytes (00 2A). */
|
||||
o2 += 2;
|
||||
|
||||
/* Go to where the number of entries is. */
|
||||
if (o2 + 4 > buf_size) return;
|
||||
o2 = datao + exif_get_long (buf + o2, n->order);
|
||||
break;
|
||||
|
||||
case nikonV0:
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
|
||||
"Parsing Nikon maker note v0 (0x%02x, %02x, %02x, "
|
||||
"%02x, %02x, %02x, %02x, %02x)...",
|
||||
buf[o2 + 0], buf[o2 + 1], buf[o2 + 2], buf[o2 + 3],
|
||||
buf[o2 + 4], buf[o2 + 5], buf[o2 + 6], buf[o2 + 7]);
|
||||
/* 00 1b is # of entries in Motorola order - the rest should also be in MM order */
|
||||
n->order = EXIF_BYTE_ORDER_MOTOROLA;
|
||||
break;
|
||||
|
||||
default:
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataOlympus",
|
||||
"Unknown Olympus variant %i.", n->version);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Sanity check the offset */
|
||||
if ((o2 + 2 < o2) || (o2 + 2 < 2) || (o2 + 2 > buf_size)) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteOlympus", "Short MakerNote");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Read the number of tags */
|
||||
c = exif_get_short (buf + o2, n->order);
|
||||
o2 += 2;
|
||||
|
||||
/* Remove any old entries */
|
||||
exif_mnote_data_olympus_clear (n);
|
||||
|
||||
/* Reserve enough space for all the possible MakerNote tags */
|
||||
n->entries = exif_mem_alloc (en->mem, sizeof (MnoteOlympusEntry) * c);
|
||||
if (!n->entries) {
|
||||
EXIF_LOG_NO_MEMORY(en->log, "ExifMnoteOlympus", sizeof (MnoteOlympusEntry) * c);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Parse all c entries, storing ones that are successfully parsed */
|
||||
tcount = 0;
|
||||
for (i = c, o = o2; i; --i, o += 12) {
|
||||
size_t s;
|
||||
if ((o + 12 < o) || (o + 12 < 12) || (o + 12 > buf_size)) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteOlympus", "Short MakerNote");
|
||||
break;
|
||||
}
|
||||
|
||||
n->entries[tcount].tag = exif_get_short (buf + o, n->order) + base;
|
||||
n->entries[tcount].format = exif_get_short (buf + o + 2, n->order);
|
||||
n->entries[tcount].components = exif_get_long (buf + o + 4, n->order);
|
||||
n->entries[tcount].order = n->order;
|
||||
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteOlympus",
|
||||
"Loading entry 0x%x ('%s')...", n->entries[tcount].tag,
|
||||
mnote_olympus_tag_get_name (n->entries[tcount].tag));
|
||||
/* exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteOlympus",
|
||||
"0x%x %d %ld*(%d)",
|
||||
n->entries[tcount].tag,
|
||||
n->entries[tcount].format,
|
||||
n->entries[tcount].components,
|
||||
(int)exif_format_get_size(n->entries[tcount].format)); */
|
||||
|
||||
/*
|
||||
* Size? If bigger than 4 bytes, the actual data is not
|
||||
* in the entry but somewhere else (offset).
|
||||
*/
|
||||
s = exif_format_get_size (n->entries[tcount].format) *
|
||||
n->entries[tcount].components;
|
||||
n->entries[tcount].size = s;
|
||||
if (s) {
|
||||
size_t dataofs = o + 8;
|
||||
if (s > 4) {
|
||||
/* The data in this case is merely a pointer */
|
||||
dataofs = exif_get_long (buf + dataofs, n->order) + datao;
|
||||
#ifdef EXIF_OVERCOME_SANYO_OFFSET_BUG
|
||||
/* Some Sanyo models (e.g. VPC-C5, C40) suffer from a bug when
|
||||
* writing the offset for the MNOTE_OLYMPUS_TAG_THUMBNAILIMAGE
|
||||
* tag in its MakerNote. The offset is actually the absolute
|
||||
* position in the file instead of the position within the IFD.
|
||||
*/
|
||||
if (dataofs + s > buf_size && n->version == sanyoV1) {
|
||||
/* fix pointer */
|
||||
dataofs -= datao + 6;
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG,
|
||||
"ExifMnoteOlympus",
|
||||
"Inconsistent thumbnail tag offset; attempting to recover");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
if ((dataofs + s < dataofs) || (dataofs + s < s) ||
|
||||
(dataofs + s > buf_size)) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG,
|
||||
"ExifMnoteOlympus",
|
||||
"Tag data past end of buffer (%u > %u)",
|
||||
dataofs + s, buf_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
n->entries[tcount].data = exif_mem_alloc (en->mem, s);
|
||||
if (!n->entries[tcount].data) {
|
||||
EXIF_LOG_NO_MEMORY(en->log, "ExifMnoteOlympus", s);
|
||||
continue;
|
||||
}
|
||||
memcpy (n->entries[tcount].data, buf + dataofs, s);
|
||||
}
|
||||
|
||||
/* Tag was successfully parsed */
|
||||
++tcount;
|
||||
}
|
||||
/* Store the count of successfully parsed tags */
|
||||
n->count = tcount;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
exif_mnote_data_olympus_count (ExifMnoteData *n)
|
||||
{
|
||||
return n ? ((ExifMnoteDataOlympus *) n)->count : 0;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
exif_mnote_data_olympus_get_id (ExifMnoteData *d, unsigned int n)
|
||||
{
|
||||
ExifMnoteDataOlympus *note = (ExifMnoteDataOlympus *) d;
|
||||
|
||||
if (!note) return 0;
|
||||
if (note->count <= n) return 0;
|
||||
return note->entries[n].tag;
|
||||
}
|
||||
|
||||
static const char *
|
||||
exif_mnote_data_olympus_get_name (ExifMnoteData *d, unsigned int i)
|
||||
{
|
||||
ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) d;
|
||||
|
||||
if (!n) return NULL;
|
||||
if (i >= n->count) return NULL;
|
||||
return mnote_olympus_tag_get_name (n->entries[i].tag);
|
||||
}
|
||||
|
||||
static const char *
|
||||
exif_mnote_data_olympus_get_title (ExifMnoteData *d, unsigned int i)
|
||||
{
|
||||
ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) d;
|
||||
|
||||
if (!n) return NULL;
|
||||
if (i >= n->count) return NULL;
|
||||
return mnote_olympus_tag_get_title (n->entries[i].tag);
|
||||
}
|
||||
|
||||
static const char *
|
||||
exif_mnote_data_olympus_get_description (ExifMnoteData *d, unsigned int i)
|
||||
{
|
||||
ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) d;
|
||||
|
||||
if (!n) return NULL;
|
||||
if (i >= n->count) return NULL;
|
||||
return mnote_olympus_tag_get_description (n->entries[i].tag);
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_olympus_set_byte_order (ExifMnoteData *d, ExifByteOrder o)
|
||||
{
|
||||
ExifByteOrder o_orig;
|
||||
ExifMnoteDataOlympus *n = (ExifMnoteDataOlympus *) d;
|
||||
unsigned int i;
|
||||
|
||||
if (!n) return;
|
||||
|
||||
o_orig = n->order;
|
||||
n->order = o;
|
||||
for (i = 0; i < n->count; i++) {
|
||||
n->entries[i].order = o;
|
||||
exif_array_set_byte_order (n->entries[i].format, n->entries[i].data,
|
||||
n->entries[i].components, o_orig, o);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_olympus_set_offset (ExifMnoteData *n, unsigned int o)
|
||||
{
|
||||
if (n) ((ExifMnoteDataOlympus *) n)->offset = o;
|
||||
}
|
||||
|
||||
static enum OlympusVersion
|
||||
exif_mnote_data_olympus_identify_variant (const unsigned char *buf,
|
||||
unsigned int buf_size)
|
||||
{
|
||||
/* Olympus, Nikon, Sanyo, Epson */
|
||||
if (buf_size >= 8) {
|
||||
/* Match the terminating NUL character, too */
|
||||
if (!memcmp (buf, "OLYMPUS", 8))
|
||||
return olympusV2;
|
||||
else if (!memcmp (buf, "OLYMP", 6))
|
||||
return olympusV1;
|
||||
else if (!memcmp (buf, "SANYO", 6))
|
||||
return sanyoV1;
|
||||
else if (!memcmp (buf, "EPSON", 6))
|
||||
return epsonV1;
|
||||
else if (!memcmp (buf, "Nikon", 6)) {
|
||||
switch (buf[6]) {
|
||||
case 1: return nikonV1;
|
||||
case 2: return nikonV2;
|
||||
default: return 0; /* Unrecognized Nikon variant */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Another variant of Nikon */
|
||||
if ((buf_size >= 2) && (buf[0] == 0x00) && (buf[1] == 0x1b)) {
|
||||
return nikonV0;
|
||||
}
|
||||
|
||||
return unrecognized;
|
||||
}
|
||||
|
||||
int
|
||||
exif_mnote_data_olympus_identify (const ExifData *ed, const ExifEntry *e)
|
||||
{
|
||||
int variant = exif_mnote_data_olympus_identify_variant(e->data, e->size);
|
||||
|
||||
if (variant == nikonV0) {
|
||||
/* This variant needs some extra checking with the Make */
|
||||
char value[5];
|
||||
ExifEntry *em = exif_data_get_entry (ed, EXIF_TAG_MAKE);
|
||||
variant = unrecognized;
|
||||
|
||||
if (em) {
|
||||
const char *v = exif_entry_get_value (em, value, sizeof(value));
|
||||
if (v && (!strncmp (v, "Nikon", sizeof(value)) ||
|
||||
!strncmp (v, "NIKON", sizeof(value)) ))
|
||||
/* When saved, this variant will be written out like the
|
||||
* alternative nikonV2 form above instead
|
||||
*/
|
||||
variant = nikonV0;
|
||||
}
|
||||
}
|
||||
|
||||
return variant;
|
||||
}
|
||||
|
||||
|
||||
ExifMnoteData *
|
||||
exif_mnote_data_olympus_new (ExifMem *mem)
|
||||
{
|
||||
ExifMnoteData *d;
|
||||
|
||||
if (!mem) return NULL;
|
||||
|
||||
d = exif_mem_alloc (mem, sizeof (ExifMnoteDataOlympus));
|
||||
if (!d) return NULL;
|
||||
|
||||
exif_mnote_data_construct (d, mem);
|
||||
|
||||
/* Set up function pointers */
|
||||
d->methods.free = exif_mnote_data_olympus_free;
|
||||
d->methods.set_byte_order = exif_mnote_data_olympus_set_byte_order;
|
||||
d->methods.set_offset = exif_mnote_data_olympus_set_offset;
|
||||
d->methods.load = exif_mnote_data_olympus_load;
|
||||
d->methods.save = exif_mnote_data_olympus_save;
|
||||
d->methods.count = exif_mnote_data_olympus_count;
|
||||
d->methods.get_id = exif_mnote_data_olympus_get_id;
|
||||
d->methods.get_name = exif_mnote_data_olympus_get_name;
|
||||
d->methods.get_title = exif_mnote_data_olympus_get_title;
|
||||
d->methods.get_description = exif_mnote_data_olympus_get_description;
|
||||
d->methods.get_value = exif_mnote_data_olympus_get_value;
|
||||
|
||||
return d;
|
||||
}
|
||||
821
libexifa/olympus/mnote-olympus-entry.c
Executable file
821
libexifa/olympus/mnote-olympus-entry.c
Executable file
@@ -0,0 +1,821 @@
|
||||
/* mnote-olympus-entry.c
|
||||
*
|
||||
* Copyright (c) 2002-2009 Lutz Mueller <lutz@users.sourceforge.net> et. al.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "mnote-olympus-entry.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/exif-utils.h>
|
||||
#include <libexif/exif-entry.h>
|
||||
#include <libexif/i18n.h>
|
||||
|
||||
#define CF(format,target,v,maxlen) \
|
||||
{ \
|
||||
if (format != target) { \
|
||||
snprintf (v, maxlen, \
|
||||
_("Invalid format '%s', " \
|
||||
"expected '%s'."), \
|
||||
exif_format_get_name (format), \
|
||||
exif_format_get_name (target)); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CF2(format,target1,target2,v,maxlen) \
|
||||
{ \
|
||||
if ((format != target1) && (format != target2)) { \
|
||||
snprintf (v, maxlen, \
|
||||
_("Invalid format '%s', " \
|
||||
"expected '%s' or '%s'."), \
|
||||
exif_format_get_name (format), \
|
||||
exif_format_get_name (target1), \
|
||||
exif_format_get_name (target2)); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CC(number,target,v,maxlen) \
|
||||
{ \
|
||||
if (number != target) { \
|
||||
snprintf (v, maxlen, \
|
||||
_("Invalid number of components (%i, " \
|
||||
"expected %i)."), (int) number, (int) target); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CC2(number,t1,t2,v,maxlen) \
|
||||
{ \
|
||||
if ((number < t1) || (number > t2)) { \
|
||||
snprintf (v, maxlen, \
|
||||
_("Invalid number of components (%i, " \
|
||||
"expected %i or %i)."), (int) number, \
|
||||
(int) t1, (int) t2); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
static const struct {
|
||||
ExifTag tag;
|
||||
ExifFormat fmt;
|
||||
struct {
|
||||
int index;
|
||||
const char *string;
|
||||
} elem[24];
|
||||
} items[] = {
|
||||
#ifndef NO_VERBOSE_TAG_DATA
|
||||
{ MNOTE_NIKON_TAG_LENSTYPE, EXIF_FORMAT_BYTE,
|
||||
{ {0, N_("AF non D lens")},
|
||||
{1, N_("Manual")},
|
||||
{2, N_("AF-D or AF-S lens")},
|
||||
{6, N_("AF-D G lens")},
|
||||
{10, N_("AF-D VR lens")},
|
||||
{14, N_("AF-D G VR lens")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_NIKON_TAG_FLASHUSED, EXIF_FORMAT_BYTE,
|
||||
{ {0, N_("Flash did not fire")},
|
||||
{4, N_("Flash unit unknown")},
|
||||
{7, N_("Flash is external")},
|
||||
{9, N_("Flash is on camera")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_NIKON1_TAG_QUALITY, EXIF_FORMAT_SHORT,
|
||||
{ {1, N_("VGA basic")},
|
||||
{2, N_("VGA normal")},
|
||||
{3, N_("VGA fine")},
|
||||
{4, N_("SXGA basic")},
|
||||
{5, N_("SXGA normal")},
|
||||
{6, N_("SXGA fine")},
|
||||
{10, N_("2 Mpixel basic")},
|
||||
{11, N_("2 Mpixel normal")},
|
||||
{12, N_("2 Mpixel fine")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_NIKON1_TAG_COLORMODE, EXIF_FORMAT_SHORT,
|
||||
{ {1, N_("Color")},
|
||||
{2, N_("Monochrome")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_NIKON1_TAG_IMAGEADJUSTMENT, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("Normal")},
|
||||
{1, N_("Bright+")},
|
||||
{2, N_("Bright-")},
|
||||
{3, N_("Contrast+")},
|
||||
{4, N_("Contrast-")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_NIKON1_TAG_CCDSENSITIVITY, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("ISO 80")},
|
||||
{2, N_("ISO 160")},
|
||||
{4, N_("ISO 320")},
|
||||
{5, N_("ISO 100")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_NIKON1_TAG_WHITEBALANCE, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("Auto")},
|
||||
{1, N_("Preset")},
|
||||
{2, N_("Daylight")},
|
||||
{3, N_("Incandescence")},
|
||||
{4, N_("Fluorescence")},
|
||||
{5, N_("Cloudy")},
|
||||
{6, N_("SpeedLight")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_NIKON1_TAG_CONVERTER, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("No fisheye")},
|
||||
{1, N_("Fisheye on")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_QUALITY, EXIF_FORMAT_SHORT,
|
||||
{ {1, N_("Normal, SQ")},
|
||||
{2, N_("Normal, HQ")},
|
||||
{3, N_("Normal, SHQ")},
|
||||
{4, N_("Normal, RAW")},
|
||||
{5, N_("Normal, SQ1")},
|
||||
{6, N_("Normal, SQ2")},
|
||||
{7, N_("Normal, super high")},
|
||||
{17, N_("Normal, standard")},
|
||||
{0x101, N_("Fine, SQ")},
|
||||
{0x102, N_("Fine, HQ")},
|
||||
{0x103, N_("Fine, SHQ")},
|
||||
{0x104, N_("Fine, RAW")},
|
||||
{0x105, N_("Fine, SQ1")},
|
||||
{0x106, N_("Fine, SQ2")},
|
||||
{0x107, N_("Fine, super high")},
|
||||
{0x201, N_("Super fine, SQ")},
|
||||
{0x202, N_("Super fine, HQ")},
|
||||
{0x203, N_("Super fine, SHQ")},
|
||||
{0x204, N_("Super fine, RAW")},
|
||||
{0x205, N_("Super fine, SQ1")},
|
||||
{0x206, N_("Super fine, SQ2")},
|
||||
{0x207, N_("Super fine, super high")},
|
||||
{0x211, N_("Super fine, high")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_MACRO, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("No")},
|
||||
{1, N_("Yes")},
|
||||
{2, N_("Super macro")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_BWMODE, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("No")},
|
||||
{1, N_("Yes")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_ONETOUCHWB, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("Off")},
|
||||
{1, N_("On")},
|
||||
{2, N_("On (Preset)")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_FLASHMODE, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("Auto")},
|
||||
{1, N_("Red-eye reduction")},
|
||||
{2, N_("Fill")},
|
||||
{3, N_("Off")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_FLASHDEVICE, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("None")},
|
||||
{1, N_("Internal")},
|
||||
{4, N_("External")},
|
||||
{5, N_("Internal + external")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_FOCUSRANGE, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("Normal")},
|
||||
{1, N_("Macro")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_MANFOCUS, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("Auto")},
|
||||
{1, N_("Manual")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_SHARPNESS, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("Normal")},
|
||||
{1, N_("Hard")},
|
||||
{2, N_("Soft")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_EXTERNALFLASHBOUNCE, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("No")},
|
||||
{1, N_("Yes")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_CONTRAST, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("Hard")},
|
||||
{1, N_("Normal")},
|
||||
{2, N_("Soft")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_PREVIEWIMAGEVALID, EXIF_FORMAT_LONG,
|
||||
{ {0, N_("No")},
|
||||
{1, N_("Yes")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_OLYMPUS_TAG_CCDSCANMODE, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("Interlaced")},
|
||||
{1, N_("Progressive")},
|
||||
{0, NULL}}},
|
||||
|
||||
{ MNOTE_SANYO_TAG_SEQUENTIALSHOT, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("None")},
|
||||
{1, N_("Standard")},
|
||||
{2, N_("Best")},
|
||||
{3, N_("Adjust exposure")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_SANYO_TAG_FOCUSMODE, EXIF_FORMAT_SHORT,
|
||||
{ {1, N_("Spot focus")},
|
||||
{2, N_("Normal focus")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_SANYO_TAG_RECORDSHUTTERRELEASE, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("Record while down")},
|
||||
{1, N_("Press start, press stop")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_SANYO_TAG_RESAVED, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("No")},
|
||||
{1, N_("Yes")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_SANYO_TAG_CCDSENSITIVITY, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("Auto")},
|
||||
{1, N_("ISO 50")},
|
||||
{3, N_("ISO 100")},
|
||||
{4, N_("ISO 200")},
|
||||
{5, N_("ISO 400")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_SANYO_TAG_SCENESELECT, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("Off")},
|
||||
{1, N_("Sport")},
|
||||
{2, N_("TV")},
|
||||
{3, N_("Night")},
|
||||
{4, N_("User 1")},
|
||||
{5, N_("User 2")},
|
||||
{6, N_("Lamp")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_SANYO_TAG_SEQUENCESHOTINTERVAL, EXIF_FORMAT_SHORT,
|
||||
{ {0, N_("5 frames/sec")},
|
||||
{1, N_("10 frames/sec")},
|
||||
{2, N_("15 frames/sec")},
|
||||
{3, N_("20 frames/sec")},
|
||||
{0, NULL}}},
|
||||
#endif
|
||||
{ 0, 0, { { 0, NULL } } }
|
||||
};
|
||||
|
||||
char *
|
||||
mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *v, unsigned int maxlen)
|
||||
{
|
||||
char buf[30];
|
||||
ExifLong vl;
|
||||
ExifShort vs = 0;
|
||||
ExifSShort vss = 0;
|
||||
ExifRational vr, vr2;
|
||||
ExifSRational vsr;
|
||||
int i, j;
|
||||
double r, b;
|
||||
|
||||
if (!entry)
|
||||
return (NULL);
|
||||
|
||||
memset (v, 0, maxlen);
|
||||
maxlen--;
|
||||
|
||||
if ((!entry->data) && (entry->components > 0))
|
||||
return (v);
|
||||
|
||||
switch (entry->tag) {
|
||||
|
||||
/* Nikon */
|
||||
case MNOTE_NIKON_TAG_FIRMWARE:
|
||||
CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen);
|
||||
CC (entry->components, 4, v, maxlen);
|
||||
vl = exif_get_long (entry->data, entry->order);
|
||||
if ((vl & 0xF0F0F0F0) == 0x30303030) {
|
||||
memcpy (v, entry->data, MIN (maxlen, 4));
|
||||
} else {
|
||||
snprintf (v, maxlen, "%04lx", (long unsigned int) vl);
|
||||
}
|
||||
break;
|
||||
case MNOTE_NIKON_TAG_ISO:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
|
||||
CC (entry->components, 2, v, maxlen);
|
||||
/*vs = exif_get_short (entry->data, entry->order);*/
|
||||
vs = exif_get_short (entry->data + 2, entry->order);
|
||||
snprintf (v, maxlen, "ISO %hd", vs);
|
||||
break;
|
||||
case MNOTE_NIKON_TAG_ISO2:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
|
||||
CC (entry->components, 2, v, maxlen);
|
||||
/*vs = exif_get_short (entry->data, entry->order);*/
|
||||
vs = exif_get_short (entry->data + 2, entry->order);
|
||||
snprintf (v, maxlen, "ISO2 %hd", vs);
|
||||
break;
|
||||
case MNOTE_NIKON_TAG_QUALITY:
|
||||
case MNOTE_NIKON_TAG_COLORMODE:
|
||||
case MNOTE_NIKON_TAG_COLORMODE1:
|
||||
case MNOTE_NIKON_TAG_WHITEBALANCE:
|
||||
case MNOTE_NIKON_TAG_SHARPENING:
|
||||
case MNOTE_NIKON_TAG_FOCUSMODE:
|
||||
case MNOTE_NIKON_TAG_FLASHSETTING:
|
||||
case MNOTE_NIKON_TAG_ISOSELECTION:
|
||||
case MNOTE_NIKON_TAG_FLASHMODE:
|
||||
case MNOTE_NIKON_TAG_IMAGEADJUSTMENT:
|
||||
case MNOTE_NIKON_TAG_ADAPTER:
|
||||
case MNOTE_NIKON_TAG_SATURATION2:
|
||||
case MNOTE_EPSON_TAG_SOFTWARE:
|
||||
CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen);
|
||||
memcpy(v, entry->data, MIN (maxlen, entry->size));
|
||||
break;
|
||||
case MNOTE_NIKON_TAG_TOTALPICTURES:
|
||||
case MNOTE_EPSON_TAG_IMAGE_WIDTH:
|
||||
case MNOTE_EPSON_TAG_IMAGE_HEIGHT:
|
||||
CF (entry->format, EXIF_FORMAT_LONG, v, maxlen);
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
vl = exif_get_long (entry->data, entry->order);
|
||||
snprintf (v, maxlen, "%lu", (long unsigned int) vl );
|
||||
break;
|
||||
case MNOTE_NIKON_TAG_LENS_FSTOPS:
|
||||
case MNOTE_NIKON_TAG_EXPOSUREDIFF: {
|
||||
unsigned char a,b,c,d;
|
||||
CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen);
|
||||
CC (entry->components, 4, v, maxlen);
|
||||
vl = exif_get_long (entry->data, entry->order);
|
||||
a = (vl>>24)&0xff; b = (vl>>16)&0xff; c = (vl>>8)&0xff; d = (vl)&0xff;
|
||||
snprintf (v, maxlen, "%.1f", c?(float)a*((float)b/(float)c):0 );
|
||||
break;
|
||||
}
|
||||
case MNOTE_NIKON_TAG_FLASHEXPCOMPENSATION:
|
||||
case MNOTE_NIKON_TAG_FLASHEXPOSUREBRACKETVAL:
|
||||
CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen);
|
||||
CC (entry->components, 4, v, maxlen);
|
||||
vl = exif_get_long (entry->data, entry->order);
|
||||
snprintf (v, maxlen, "%.1f", ((long unsigned int) vl>>24)/6.0 );
|
||||
break;
|
||||
case MNOTE_NIKON_TAG_SATURATION:
|
||||
case MNOTE_NIKON_TAG_WHITEBALANCEFINE:
|
||||
case MNOTE_NIKON_TAG_HUE:
|
||||
case MNOTE_OLYMPUS_TAG_SENSORTEMPERATURE:
|
||||
case MNOTE_OLYMPUS_TAG_LENSTEMPERATURE:
|
||||
CF (entry->format, EXIF_FORMAT_SSHORT, v, maxlen);
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
snprintf (v, maxlen, "%hd", vs);
|
||||
break;
|
||||
case MNOTE_NIKON_TAG_WHITEBALANCERB:
|
||||
CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
|
||||
CC (entry->components, 4, v, maxlen);
|
||||
vr = exif_get_rational (entry->data, entry->order);
|
||||
r = (double)vr.numerator / vr.denominator;
|
||||
vr = exif_get_rational (entry->data+8, entry->order);
|
||||
b = (double)vr.numerator / vr.denominator;
|
||||
snprintf (v, maxlen, _("Red Correction %f, blue Correction %f"), r,b);
|
||||
break;
|
||||
case MNOTE_NIKON_TAG_MANUALFOCUSDISTANCE:
|
||||
CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
vr = exif_get_rational (entry->data, entry->order);
|
||||
if (vr.numerator) {
|
||||
r = (double)vr.numerator / vr.denominator;
|
||||
snprintf (v, maxlen, _("%2.2f meters"), r);
|
||||
} else {
|
||||
strncpy (v, _("No manual focus selection"), maxlen);
|
||||
}
|
||||
break;
|
||||
case MNOTE_NIKON_TAG_SENSORPIXELSIZE:
|
||||
CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
|
||||
CC (entry->components, 2, v, maxlen);
|
||||
vr = exif_get_rational (entry->data, entry->order);
|
||||
vr2 = exif_get_rational (entry->data+8, entry->order);
|
||||
r = (double)vr.numerator / vr.denominator;
|
||||
b = (double)vr2.numerator / vr2.denominator;
|
||||
snprintf (v, maxlen, "%2.2f x %2.2f um", r, b);
|
||||
break;
|
||||
case MNOTE_NIKON_TAG_BRACKETING:
|
||||
CF2 (entry->format, EXIF_FORMAT_BYTE, EXIF_FORMAT_SHORT, v, maxlen);
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
if (EXIF_FORMAT_SHORT == entry->format) {
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
} else {
|
||||
vs = entry->data[0];
|
||||
}
|
||||
snprintf (v, maxlen, "%hd", vs);
|
||||
break;
|
||||
case MNOTE_NIKON_TAG_AFFOCUSPOSITION:
|
||||
CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen);
|
||||
CC (entry->components, 4, v, maxlen);
|
||||
switch ( *( entry->data+1) ) {
|
||||
case 0: strncpy (v, _("AF position: center"), maxlen); break;
|
||||
case 1: strncpy (v, _("AF position: top"), maxlen); break;
|
||||
case 2: strncpy (v, _("AF position: bottom"), maxlen); break;
|
||||
case 3: strncpy (v, _("AF position: left"), maxlen); break;
|
||||
case 4: strncpy (v, _("AF position: right"), maxlen); break;
|
||||
case 5: strncpy (v, _("AF position: upper-left"), maxlen); break;
|
||||
case 6: strncpy (v, _("AF position: upper-right"), maxlen); break;
|
||||
case 7: strncpy (v, _("AF position: lower-left"), maxlen); break;
|
||||
case 8: strncpy (v, _("AF position: lower-right"), maxlen); break;
|
||||
case 9: strncpy (v, _("AF position: far left"), maxlen); break;
|
||||
case 10: strncpy (v, _("AF position: far right"), maxlen); break;
|
||||
default: strncpy (v, _("Unknown AF position"), maxlen);
|
||||
}
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_FLASHDEVICE:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
|
||||
CC (entry->components, 2, v, maxlen);
|
||||
vs = exif_get_short(entry->data, entry->order);
|
||||
/* search for the tag */
|
||||
for (i = 0; (items[i].tag && items[i].tag != entry->tag); i++)
|
||||
;
|
||||
if (!items[i].tag) {
|
||||
snprintf (v, maxlen, _("Internal error (unknown value %hi)"), vs);
|
||||
break;
|
||||
}
|
||||
CF (entry->format, items[i].fmt, v, maxlen);
|
||||
/* find the value */
|
||||
for (j = 0; items[i].elem[j].string &&
|
||||
(items[i].elem[j].index < vs); j++);
|
||||
if (items[i].elem[j].index != vs) {
|
||||
snprintf (v, maxlen, _("Unknown value %hi"), vs);
|
||||
break;
|
||||
}
|
||||
strncpy (v, _(items[i].elem[j].string), maxlen);
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_DIGIZOOM:
|
||||
if (entry->format == EXIF_FORMAT_RATIONAL) {
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
vr = exif_get_rational (entry->data, entry->order);
|
||||
if (!vr.numerator) {
|
||||
strncpy (v, _("None"), maxlen);
|
||||
} else {
|
||||
r = (double)vr.numerator / vr.denominator;
|
||||
snprintf (v, maxlen, "%2.2f", r);
|
||||
}
|
||||
break;
|
||||
}
|
||||
/* fall through to handle SHORT version of this tag */
|
||||
case MNOTE_NIKON_TAG_LENSTYPE:
|
||||
case MNOTE_NIKON_TAG_FLASHUSED:
|
||||
case MNOTE_NIKON1_TAG_QUALITY:
|
||||
case MNOTE_NIKON1_TAG_COLORMODE:
|
||||
case MNOTE_NIKON1_TAG_IMAGEADJUSTMENT:
|
||||
case MNOTE_NIKON1_TAG_CCDSENSITIVITY:
|
||||
case MNOTE_NIKON1_TAG_WHITEBALANCE:
|
||||
case MNOTE_NIKON1_TAG_CONVERTER:
|
||||
case MNOTE_OLYMPUS_TAG_QUALITY:
|
||||
case MNOTE_OLYMPUS_TAG_MACRO:
|
||||
case MNOTE_OLYMPUS_TAG_BWMODE:
|
||||
case MNOTE_OLYMPUS_TAG_ONETOUCHWB:
|
||||
case MNOTE_OLYMPUS_TAG_FLASHMODE:
|
||||
case MNOTE_OLYMPUS_TAG_FOCUSRANGE:
|
||||
case MNOTE_OLYMPUS_TAG_MANFOCUS:
|
||||
case MNOTE_OLYMPUS_TAG_SHARPNESS:
|
||||
case MNOTE_OLYMPUS_TAG_EXTERNALFLASHBOUNCE:
|
||||
case MNOTE_OLYMPUS_TAG_CONTRAST:
|
||||
case MNOTE_OLYMPUS_TAG_PREVIEWIMAGEVALID:
|
||||
case MNOTE_OLYMPUS_TAG_CCDSCANMODE:
|
||||
case MNOTE_SANYO_TAG_SEQUENTIALSHOT:
|
||||
case MNOTE_SANYO_TAG_FOCUSMODE:
|
||||
case MNOTE_SANYO_TAG_RECORDSHUTTERRELEASE:
|
||||
case MNOTE_SANYO_TAG_RESAVED:
|
||||
case MNOTE_SANYO_TAG_CCDSENSITIVITY:
|
||||
case MNOTE_SANYO_TAG_SCENESELECT:
|
||||
case MNOTE_SANYO_TAG_SEQUENCESHOTINTERVAL:
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
switch (entry->format) {
|
||||
case EXIF_FORMAT_BYTE:
|
||||
case EXIF_FORMAT_UNDEFINED:
|
||||
vs = entry->data[0];
|
||||
break;
|
||||
case EXIF_FORMAT_SHORT:
|
||||
vs = exif_get_short(entry->data, entry->order);
|
||||
break;
|
||||
default:
|
||||
vs = 0;
|
||||
break;
|
||||
}
|
||||
/* search for the tag */
|
||||
for (i = 0; (items[i].tag && items[i].tag != entry->tag); i++)
|
||||
;
|
||||
if (!items[i].tag) {
|
||||
snprintf (v, maxlen, _("Internal error (unknown value %hi)"), vs);
|
||||
break;
|
||||
}
|
||||
CF (entry->format, items[i].fmt, v, maxlen);
|
||||
/* find the value */
|
||||
for (j = 0; items[i].elem[j].string &&
|
||||
(items[i].elem[j].index < vs); j++);
|
||||
if (items[i].elem[j].index != vs) {
|
||||
snprintf (v, maxlen, _("Unknown value %hi"), vs);
|
||||
break;
|
||||
}
|
||||
strncpy (v, _(items[i].elem[j].string), maxlen);
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_NOISEREDUCTION:
|
||||
case MNOTE_SANYO_TAG_WIDERANGE:
|
||||
case MNOTE_SANYO_TAG_COLORADJUSTMENTMODE:
|
||||
case MNOTE_SANYO_TAG_QUICKSHOT:
|
||||
case MNOTE_SANYO_TAG_VOICEMEMO:
|
||||
case MNOTE_SANYO_TAG_FLICKERREDUCE:
|
||||
case MNOTE_SANYO_TAG_OPTICALZOOM:
|
||||
case MNOTE_SANYO_TAG_DIGITALZOOM:
|
||||
case MNOTE_SANYO_TAG_LIGHTSOURCESPECIAL:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
switch (vs) {
|
||||
case 0:
|
||||
strncpy (v, _("Off"), maxlen);
|
||||
break;
|
||||
case 1:
|
||||
strncpy (v, _("On"), maxlen);
|
||||
break;
|
||||
default:
|
||||
sprintf (buf, _("Unknown %hu"), vs);
|
||||
strncat (v, buf, maxlen - strlen (v));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MNOTE_SANYO_TAG_SELFTIMER:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
switch (vs) {
|
||||
case 0:
|
||||
strncpy (v, _("Off"), maxlen);
|
||||
break;
|
||||
case 1:
|
||||
strncpy (v, _("On"), maxlen);
|
||||
break;
|
||||
case 2:
|
||||
strncpy (v, _("2 sec."), maxlen);
|
||||
break;
|
||||
default:
|
||||
sprintf (buf, _("Unknown %hu"), vs);
|
||||
strncat (v, buf, maxlen - strlen (v));
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MNOTE_NIKON_TAG_LENS:
|
||||
CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
|
||||
CC (entry->components, 4, v, maxlen);
|
||||
{
|
||||
double c,d;
|
||||
unsigned long a,b;
|
||||
vr = exif_get_rational (entry->data, entry->order);
|
||||
a = vr.numerator / vr.denominator;
|
||||
vr = exif_get_rational (entry->data+8, entry->order);
|
||||
b = vr.numerator / vr.denominator;
|
||||
vr = exif_get_rational (entry->data+16, entry->order);
|
||||
c = (double)vr.numerator / vr.denominator;
|
||||
vr = exif_get_rational (entry->data+24, entry->order);
|
||||
d = (double)vr.numerator / vr.denominator;
|
||||
snprintf (v, maxlen, "%ld-%ldmm 1:%3.1f - %3.1f",a,b,c,d);
|
||||
}
|
||||
break;
|
||||
|
||||
/* Olympus */
|
||||
case MNOTE_OLYMPUS_TAG_MODE:
|
||||
CF (entry->format, EXIF_FORMAT_LONG, v, maxlen);
|
||||
CC (entry->components, 3, v, maxlen);
|
||||
vl = exif_get_long (entry->data, entry->order);
|
||||
switch (vl) {
|
||||
case 0:
|
||||
strncpy (v, _("Normal"), maxlen);
|
||||
break;
|
||||
case 1:
|
||||
strncpy (v, _("Unknown"), maxlen);
|
||||
break;
|
||||
case 2:
|
||||
strncpy (v, _("Fast"), maxlen);
|
||||
break;
|
||||
case 3:
|
||||
strncpy (v, _("Panorama"), maxlen);
|
||||
break;
|
||||
default:
|
||||
snprintf (v, maxlen, "%li", (long int) vl);
|
||||
}
|
||||
vl = exif_get_long (entry->data + 4, entry->order);
|
||||
snprintf (buf, sizeof (buf), "/%li/", (long int) vl);
|
||||
strncat (v, buf, maxlen - strlen (v));
|
||||
vl = exif_get_long (entry->data + 8, entry->order);
|
||||
switch (vl) {
|
||||
case 1:
|
||||
strncat (v, _("Left to right"), maxlen - strlen (v));
|
||||
break;
|
||||
case 2:
|
||||
strncat (v, _("Right to left"), maxlen - strlen (v));
|
||||
break;
|
||||
case 3:
|
||||
strncat (v, _("Bottom to top"), maxlen - strlen (v));
|
||||
break;
|
||||
case 4:
|
||||
strncat (v, _("Top to bottom"), maxlen - strlen (v));
|
||||
break;
|
||||
default:
|
||||
snprintf (buf, sizeof (buf), "%li",
|
||||
(long int) vl);
|
||||
strncat (v, buf, maxlen - strlen (v));
|
||||
}
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_LENSDISTORTION:
|
||||
if (entry->format == EXIF_FORMAT_SHORT) {
|
||||
/* Epson uses a single SHORT here */
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
sprintf (buf, "%hu", vs);
|
||||
strncat (v, buf, maxlen - strlen (v));
|
||||
} else {
|
||||
/* Others use an array of SSHORT here */
|
||||
CC (entry->components, 6, v, maxlen);
|
||||
CF (entry->format, EXIF_FORMAT_SSHORT, v, maxlen);
|
||||
for (i=0; i < (int)entry->components; ++i) {
|
||||
vss = exif_get_sshort (entry->data+2*i, entry->order);
|
||||
sprintf (buf, "%hd ", vss);
|
||||
strncat (v, buf, maxlen - strlen (v));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_COLORCONTROL:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
|
||||
CC (entry->components, 6, v, maxlen);
|
||||
for (i=0; i < (int)entry->components; ++i) {
|
||||
vs = exif_get_short (entry->data+2*i, entry->order);
|
||||
sprintf (buf, "%hu ", vs);
|
||||
strncat (v, buf, maxlen - strlen (v));
|
||||
}
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_VERSION:
|
||||
CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen);
|
||||
CC2 (entry->components, 5, 8, v, maxlen);
|
||||
strncpy (v, (char *)entry->data, MIN (maxlen, entry->size));
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_SERIALNUMBER2:
|
||||
CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen);
|
||||
strncpy (v, (char *)entry->data, MIN (maxlen, entry->size));
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_INFO:
|
||||
CF (entry->format, EXIF_FORMAT_ASCII, v, maxlen);
|
||||
CC2 (entry->components, 52, 60, v, maxlen);
|
||||
strncpy (v, (char *)entry->data, MIN (maxlen, entry->size));
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_ID:
|
||||
CF (entry->format, EXIF_FORMAT_UNDEFINED, v, maxlen);
|
||||
CC (entry->components, 32, v, maxlen);
|
||||
strncpy (v, (char *)entry->data, MIN (maxlen, entry->size));
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_UNKNOWN_4:
|
||||
CF (entry->format, EXIF_FORMAT_LONG, v, maxlen);
|
||||
CC (entry->components, 30, v, maxlen);
|
||||
for (i=0; i < (int)entry->components; ++i) {
|
||||
vl = exif_get_long (entry->data+4*i, entry->order);
|
||||
sprintf (buf, "%lu ", (unsigned long)vl);
|
||||
strncat (v, buf, maxlen - strlen (v));
|
||||
}
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_FOCUSDIST:
|
||||
CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
vr = exif_get_rational (entry->data, entry->order);
|
||||
if (vr.numerator == 0) {
|
||||
strncpy (v, _("Unknown"), maxlen);
|
||||
}
|
||||
else {
|
||||
unsigned long tmp = vr.numerator / vr.denominator;
|
||||
snprintf (v, maxlen, "%li mm", tmp);
|
||||
}
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_WBALANCE:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
|
||||
CC (entry->components, 2, v, maxlen);
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
switch (vs) {
|
||||
case 1:
|
||||
strncpy (v, _("Automatic"), maxlen);
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
ExifShort v2 = exif_get_short (entry->data + 2, entry->order);
|
||||
unsigned long colorTemp = 0;
|
||||
switch (v2) {
|
||||
case 2:
|
||||
colorTemp = 3000;
|
||||
break;
|
||||
case 3:
|
||||
colorTemp = 3700;
|
||||
break;
|
||||
case 4:
|
||||
colorTemp = 4000;
|
||||
break;
|
||||
case 5:
|
||||
colorTemp = 4500;
|
||||
break;
|
||||
case 6:
|
||||
colorTemp = 5500;
|
||||
break;
|
||||
case 7:
|
||||
colorTemp = 6500;
|
||||
break;
|
||||
case 9:
|
||||
colorTemp = 7500;
|
||||
break;
|
||||
}
|
||||
if (colorTemp) {
|
||||
snprintf (v, maxlen, _("Manual: %liK"), colorTemp);
|
||||
}
|
||||
else {
|
||||
strncpy (v, _("Manual: unknown"), maxlen);
|
||||
}
|
||||
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
strncpy (v, _("One-touch"), maxlen);
|
||||
break;
|
||||
default:
|
||||
strncpy (v, _("Unknown"), maxlen);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_REDBALANCE:
|
||||
case MNOTE_OLYMPUS_TAG_BLUEBALANCE:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
|
||||
CC (entry->components, 2, v, maxlen);
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
snprintf (v, maxlen, "%hu ", vs);
|
||||
vs = exif_get_short (entry->data + 2, entry->order);
|
||||
sprintf (buf, "%hu", vs);
|
||||
strncat (v, buf, maxlen - strlen (v));
|
||||
break;
|
||||
case MNOTE_OLYMPUS_TAG_BLACKLEVEL:
|
||||
case MNOTE_NIKON_TAG_IMAGEBOUNDARY:
|
||||
CC (entry->components, 4, v, maxlen);
|
||||
/* Fall through to COLORMATRIX */
|
||||
case MNOTE_OLYMPUS_TAG_COLORMATRIX:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, v, maxlen);
|
||||
if (entry->tag == MNOTE_OLYMPUS_TAG_COLORMATRIX)
|
||||
CC (entry->components, 9, v, maxlen);
|
||||
for (i=0; i < (int)entry->components; ++i) {
|
||||
vs = exif_get_short (entry->data+2*i, entry->order);
|
||||
sprintf (buf, "%hu ", vs);
|
||||
strncat (v, buf, maxlen - strlen (v));
|
||||
}
|
||||
break;
|
||||
case MNOTE_NIKON1_TAG_FOCUS:
|
||||
case MNOTE_NIKON_TAG_DIGITALZOOM:
|
||||
case MNOTE_NIKON1_TAG_DIGITALZOOM:
|
||||
case MNOTE_OLYMPUS_TAG_FOCALPLANEDIAGONAL:
|
||||
CF (entry->format, EXIF_FORMAT_RATIONAL, v, maxlen);
|
||||
/* Fall through to default handler for display */
|
||||
default:
|
||||
switch (entry->format) {
|
||||
case EXIF_FORMAT_ASCII:
|
||||
strncpy (v, (char *)entry->data, MIN (maxlen, entry->size));
|
||||
break;
|
||||
case EXIF_FORMAT_SHORT:
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
snprintf (v, maxlen, "%hu", vs);
|
||||
break;
|
||||
case EXIF_FORMAT_LONG:
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
vl = exif_get_long (entry->data, entry->order);
|
||||
snprintf (v, maxlen, "%li", (long int) vl);
|
||||
break;
|
||||
case EXIF_FORMAT_RATIONAL:
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
vr = exif_get_rational (entry->data, entry->order);
|
||||
if (!vr.denominator) {
|
||||
strncpy (v, _("Infinite"), maxlen);
|
||||
} else {
|
||||
r = (double)vr.numerator / vr.denominator;
|
||||
snprintf (v, maxlen, "%2.3f", r);
|
||||
}
|
||||
break;
|
||||
case EXIF_FORMAT_SRATIONAL:
|
||||
CC (entry->components, 1, v, maxlen);
|
||||
vsr = exif_get_srational (entry->data, entry->order);
|
||||
if (!vsr.denominator) {
|
||||
strncpy (v, _("Infinite"), maxlen);
|
||||
} else {
|
||||
r = (double)vsr.numerator / vsr.denominator;
|
||||
snprintf (v, maxlen, "%2.3f", r);
|
||||
}
|
||||
break;
|
||||
case EXIF_FORMAT_UNDEFINED:
|
||||
default:
|
||||
snprintf (v, maxlen, _("%i bytes unknown data: "),
|
||||
entry->size);
|
||||
for (i = 0; i < (int)entry->size; i++) {
|
||||
sprintf (buf, "%02x", entry->data[i]);
|
||||
strncat (v, buf, maxlen - strlen (v));
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return (v);
|
||||
}
|
||||
230
libexifa/olympus/mnote-olympus-tag.c
Executable file
230
libexifa/olympus/mnote-olympus-tag.c
Executable file
@@ -0,0 +1,230 @@
|
||||
/* mnote-olympus-tag.c:
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "mnote-olympus-tag.h"
|
||||
|
||||
#include <libexif/i18n.h>
|
||||
#include <libexif/exif-utils.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
static const struct {
|
||||
MnoteOlympusTag tag;
|
||||
const char *name;
|
||||
const char *title;
|
||||
const char *description;
|
||||
} table[] = {
|
||||
#ifndef NO_VERBOSE_TAG_STRINGS
|
||||
/* Nikon v2 */
|
||||
{MNOTE_NIKON_TAG_FIRMWARE, "Firmware", N_("Firmware Version"), ""},
|
||||
{MNOTE_NIKON_TAG_ISO, "ISO", N_("ISO Setting"), ""},
|
||||
{MNOTE_NIKON_TAG_COLORMODE1, "ColorMode1", N_("Color Mode (?)"), ""},
|
||||
{MNOTE_NIKON_TAG_QUALITY, "Quality", N_("Quality"), ""},
|
||||
{MNOTE_NIKON_TAG_WHITEBALANCE, "WhiteBalance", N_("White Balance"), ""},
|
||||
{MNOTE_NIKON_TAG_SHARPENING, "Sharpening", N_("Image Sharpening"), ""},
|
||||
{MNOTE_NIKON_TAG_FOCUSMODE, "FocusMode", N_("Focus Mode"), ""},
|
||||
{MNOTE_NIKON_TAG_FLASHSETTING, "FlashSetting", N_("Flash Setting"), ""},
|
||||
{MNOTE_NIKON_TAG_FLASHMODE, "FlashMode", N_("Flash Mode"), ""},
|
||||
{MNOTE_NIKON_TAG_WHITEBALANCEFINE,"WhiteBalanceFine",N_("White Balance Fine Adjustment"), ""},
|
||||
{MNOTE_NIKON_TAG_WHITEBALANCERB, "WhiteBalanceRB", N_("White Balance RB"), ""},
|
||||
{MNOTE_NIKON_TAG_UNKNOWN_0X000D, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON_TAG_ISOSELECTION, "ISOSelection", N_("ISO Selection"), ""},
|
||||
{MNOTE_NIKON_TAG_PREVIEWIMAGE_IFD_POINTER, "PreviewImage", N_("Preview Image IFD"), N_("Offset of the preview image directory (IFD) inside the file.")},
|
||||
{MNOTE_NIKON_TAG_EXPOSUREDIFF, "ExposureDiff", N_("Exposurediff ?"), ""},
|
||||
{MNOTE_NIKON_TAG_FLASHEXPCOMPENSATION, "FlashExpCompensation", N_("Flash Exposure Compensation"), ""},
|
||||
{MNOTE_NIKON_TAG_ISO2, "ISO", N_("ISO Setting"), ""},
|
||||
{MNOTE_NIKON_TAG_IMAGEBOUNDARY, "ImageBoundary", N_("Image Boundary"), ""},
|
||||
{MNOTE_NIKON_TAG_UNKNOWN_0X0017, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON_TAG_FLASHEXPOSUREBRACKETVAL, "FlashExposureBracketVal", N_("Flash Exposure Bracket Value"), ""},
|
||||
{MNOTE_NIKON_TAG_EXPOSUREBRACKETVAL, "ExposureBracketVal", N_("Exposure Bracket Value"), ""},
|
||||
{MNOTE_NIKON_TAG_IMAGEADJUSTMENT, "ImageAdjustment", N_("Image Adjustment"), ""},
|
||||
{MNOTE_NIKON_TAG_TONECOMPENSATION, "ToneCompensation", N_("Tone Compensation"), ""},
|
||||
{MNOTE_NIKON_TAG_ADAPTER, "Adapter", N_("Adapter"), ""},
|
||||
{MNOTE_NIKON_TAG_LENSTYPE, "LensType", N_("Lens Type"), ""},
|
||||
{MNOTE_NIKON_TAG_LENS, "Lens", N_("Lens"), ""},
|
||||
{MNOTE_NIKON_TAG_MANUALFOCUSDISTANCE, "ManualFocusDistance", N_("Manual Focus Distance"), ""},
|
||||
{MNOTE_NIKON_TAG_DIGITALZOOM, "DigitalZoom", N_("Digital Zoom"), ""},
|
||||
{MNOTE_NIKON_TAG_FLASHUSED, "FlashUsed", N_("Flash Used"), ""},
|
||||
{MNOTE_NIKON_TAG_AFFOCUSPOSITION, "AFFocusPosition", N_("AF Focus Position"), ""},
|
||||
{MNOTE_NIKON_TAG_BRACKETING, "Bracketing", N_("Bracketing"), ""},
|
||||
{MNOTE_NIKON_TAG_UNKNOWN_0X008A, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON_TAG_LENS_FSTOPS, "LensFStops", N_("Lens F Stops"), ""},
|
||||
{MNOTE_NIKON_TAG_CURVE, "Curve,", N_("Contrast Curve"), ""},
|
||||
{MNOTE_NIKON_TAG_COLORMODE, "ColorMode,", N_("Color Mode"), ""},
|
||||
{MNOTE_NIKON_TAG_LIGHTTYPE, "LightType,", N_("Light Type"), ""},
|
||||
{MNOTE_NIKON_TAG_UNKNOWN_0X0091, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON_TAG_HUE, "Hue", N_("Hue Adjustment"), ""},
|
||||
{MNOTE_NIKON_TAG_SATURATION, "Saturation", N_("Saturation"), ""},
|
||||
{MNOTE_NIKON_TAG_NOISEREDUCTION, "NoiseReduction,", N_("Noise Reduction"), ""},
|
||||
{MNOTE_NIKON_TAG_UNKNOWN_0X0097, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON_TAG_UNKNOWN_0X0098, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON_TAG_SENSORPIXELSIZE, "SensorPixelSize", N_("Sensor Pixel Size"), ""},
|
||||
{MNOTE_NIKON_TAG_UNKNOWN_0X009B, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON_TAG_SERIALNUMBER, "SerialNumber", N_("Serial Number"), ""},
|
||||
{MNOTE_NIKON_TAG_IMAGE_DATASIZE, "ImageDataSize", N_("Image Data Size"), N_("Size of compressed image data in bytes.")},
|
||||
{MNOTE_NIKON_TAG_UNKNOWN_0X00A3, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON_TAG_TOTALPICTURES, "TotalPictures,", N_("Total Number of Pictures Taken"), ""},
|
||||
{MNOTE_NIKON_TAG_UNKNOWN_0X00A8, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON_TAG_OPTIMIZATION, "Optimization,", N_("Optimize Image"), ""},
|
||||
{MNOTE_NIKON_TAG_SATURATION, "Saturation", N_("Saturation"), ""},
|
||||
{MNOTE_NIKON_TAG_VARIPROGRAM, "VariProgram", N_("Vari Program"), ""},
|
||||
{MNOTE_NIKON_TAG_CAPTUREEDITORDATA, "CaptureEditorData", N_("Capture Editor Data"), ""},
|
||||
{MNOTE_NIKON_TAG_CAPTUREEDITORVER, "CaptureEditorVer", N_("Capture Editor Version"), ""},
|
||||
{MNOTE_NIKON_TAG_UNKNOWN_0X0E0E, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON_TAG_UNKNOWN_0X0E10, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON1_TAG_UNKNOWN_0X0002, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON1_TAG_QUALITY, "Quality", N_("Quality"), ""},
|
||||
{MNOTE_NIKON1_TAG_COLORMODE, "ColorMode,", N_("Color Mode"), ""},
|
||||
{MNOTE_NIKON1_TAG_IMAGEADJUSTMENT, "ImageAdjustment", N_("Image Adjustment"), ""},
|
||||
{MNOTE_NIKON1_TAG_CCDSENSITIVITY, "CCDSensitivity", N_("CCD Sensitivity"), ""},
|
||||
{MNOTE_NIKON1_TAG_WHITEBALANCE, "WhiteBalance", N_("White Balance"), ""},
|
||||
{MNOTE_NIKON1_TAG_FOCUS, "Focus", N_("Focus"), ""},
|
||||
{MNOTE_NIKON1_TAG_UNKNOWN_0X0009, NULL, NULL, NULL},
|
||||
{MNOTE_NIKON1_TAG_DIGITALZOOM, "DigitalZoom", N_("Digital Zoom"), ""},
|
||||
{MNOTE_NIKON1_TAG_CONVERTER, "Converter", N_("Converter"), ""},
|
||||
|
||||
/* Olympus & some Sanyo */
|
||||
{MNOTE_OLYMPUS_TAG_THUMBNAILIMAGE, "ThumbnailImage", N_("Thumbnail Image"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_MODE, "Mode", N_("Speed/Sequence/Panorama Direction"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_QUALITY, "Quality", N_("Quality"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_MACRO, "Macro", N_("Macro"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_BWMODE, "BWMode", N_("Black & White Mode"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_DIGIZOOM, "DigiZoom", N_("Digital Zoom"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_FOCALPLANEDIAGONAL, "FocalPlaneDiagonal", N_("Focal Plane Diagonal"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_LENSDISTORTION, "LensDistortionParams", N_("Lens Distortion Parameters"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_VERSION, "FirmwareVersion", N_("Firmware Version"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_INFO, "Info", N_("Info"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_ID, "CameraID", N_("Camera ID"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_PRECAPTUREFRAMES, "PreCaptureFrames", N_("Precapture Frames"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_WHITEBOARD, "WhiteBoard", N_("White Board"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_ONETOUCHWB, "OneTouchWB", N_("One Touch White Balance"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_WHITEBALANCEBRACKET, "WhiteBalanceBracket", N_("White Balance Bracket"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_WHITEBALANCEBIAS, "WhiteBalanceBias", N_("White Balance Bias"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_DATADUMP, "DataDump", N_("Data Dump"), NULL},
|
||||
{MNOTE_OLYMPUS_TAG_UNKNOWN_4, NULL, NULL, NULL},
|
||||
{MNOTE_OLYMPUS_TAG_SHUTTERSPEED, "ShutterSpeed", N_("Shutter Speed"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_ISOVALUE, "ISOValue", N_("ISO Value"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_APERTUREVALUE, "ApertureValue", N_("Aperture Value"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_BRIGHTNESSVALUE, "BrightnessValue", N_("Brightness Value"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_FLASHMODE, "FlashMode", N_("Flash Mode"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_FLASHDEVICE, "FlashDevice", N_("Flash Device"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_EXPOSURECOMP, "ExposureCompensation", N_("Exposure Compensation"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_SENSORTEMPERATURE, "SensorTemperature", N_("Sensor Temperature"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_LENSTEMPERATURE, "LensTemperature", N_("Lens Temperature"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_LIGHTCONDITION, "LightCondition", N_("Light Condition"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_FOCUSRANGE, "FocusRange", N_("Focus Range"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_MANFOCUS, "FocusMode", N_("Focus Mode"), "Automatic or manual focusing mode"},
|
||||
{MNOTE_OLYMPUS_TAG_FOCUSDIST, "ManualFocusDistance", N_("Manual Focus Distance"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_ZOOMSTEPCOUNT, "ZoomStepCount", N_("Zoom Step Count"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_FOCUSSTEPCOUNT, "FocusStepCount", N_("Focus Step Count"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_SHARPNESS, "Sharpness", N_("Sharpness Setting"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_FLASHCHARGELEVEL, "FlashChargeLevel", N_("Flash Charge Level"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_COLORMATRIX, "ColorMatrix", N_("Color Matrix"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_BLACKLEVEL, "BlackLevel", N_("Black Level"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_WBALANCE, "WhiteBalance", N_("White Balance Setting"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_REDBALANCE, "RedBalance", N_("Red Balance"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_BLUEBALANCE, "BlueBalance", N_("Blue Balance"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_COLORMATRIXNUMBER, "ColorMatrixNumber", N_("Color Matrix Number"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_SERIALNUMBER2, "SerialNumber", N_("Serial Number"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_FLASHEXPOSURECOMP, "FlashExposureComp", N_("Flash Exposure Comp"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_INTERNALFLASHTABLE, "InternalFlashTable", N_("Internal Flash Table"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_EXTERNALFLASHGVALUE, "ExternalFlashGValue", N_("External Flash G Value"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_EXTERNALFLASHBOUNCE, "ExternalFlashBounce", N_("External Flash Bounce"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_EXTERNALFLASHZOOM, "ExternalFlashZoom", N_("External Flash Zoom"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_EXTERNALFLASHMODE, "ExternalFlashMode", N_("External Flash Mode"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_CONTRAST, "Contrast", N_("Contrast Setting"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_SHARPNESSFACTOR, "SharpnessFactor", N_("Sharpness Factor"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_COLORCONTROL, "ColorControl", N_("Color Control"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_IMAGEWIDTH, "OlympusImageWidth", N_("Olympus Image Width"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_IMAGEHEIGHT, "OlympusImageHeight", N_("Olympus Image Height"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_SCENEDETECT, "SceneDetect", N_("Scene Detect"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_COMPRESSIONRATIO, "CompressionRatio", N_("Compression Ratio"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_PREVIEWIMAGEVALID, "PreviewImageValid", N_("Preview Image Valid"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_AFRESULT, "AFResult", N_("AF Result"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_CCDSCANMODE, "CCDScanMode", N_("CCD Scan Mode"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_NOISEREDUCTION, "NoiseReduction", N_("Noise Reduction"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_INFINITYLENSSTEP, "InfinityLensStep", N_("Infinity Lens Step"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_NEARLENSSTEP, "NearLensStep", N_("Near Lens Step"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_LIGHTVALUECENTER, "LightValueCenter", N_("Light Value Center"), ""},
|
||||
{MNOTE_OLYMPUS_TAG_LIGHTVALUEPERIPHERY, "LightValuePeriphery", N_("Light Value Periphery"), ""},
|
||||
|
||||
/* Sanyo */
|
||||
{MNOTE_SANYO_TAG_SEQUENTIALSHOT, "SequentialShot", N_("Sequential Shot"), ""},
|
||||
{MNOTE_SANYO_TAG_WIDERANGE, "WideRange", N_("Wide Range"), ""},
|
||||
{MNOTE_SANYO_TAG_COLORADJUSTMENTMODE, "ColorAdjustmentMode", N_("Color Adjustment Mode"), ""},
|
||||
{MNOTE_SANYO_TAG_FOCUSMODE, "FocusMode", N_("Focus Mode"), ""},
|
||||
{MNOTE_SANYO_TAG_QUICKSHOT, "QuickShot", N_("Quick Shot"), ""},
|
||||
{MNOTE_SANYO_TAG_SELFTIMER, "SelfTimer", N_("Self-timer"), ""},
|
||||
{MNOTE_SANYO_TAG_VOICEMEMO, "VoiceMemo", N_("Voice Memo"), ""},
|
||||
{MNOTE_SANYO_TAG_RECORDSHUTTERRELEASE, "RecordShutterRelease", N_("Record Shutter Release"), ""},
|
||||
{MNOTE_SANYO_TAG_FLICKERREDUCE, "FlickerReduce", N_("Flicker Reduce"), ""},
|
||||
{MNOTE_SANYO_TAG_OPTICALZOOM, "OpticalZoom", N_("Optical Zoom"), ""},
|
||||
{MNOTE_SANYO_TAG_DIGITALZOOM, "DigitalZoom", N_("Digital Zoom"), ""},
|
||||
{MNOTE_SANYO_TAG_LIGHTSOURCESPECIAL, "LightSourceSpecial", N_("Light Source Special"), ""},
|
||||
{MNOTE_SANYO_TAG_RESAVED, "Resaved", N_("Resaved"), ""},
|
||||
{MNOTE_SANYO_TAG_CCDSENSITIVITY, "CCDSensitivity", N_("CCD Sensitivity"), ""},
|
||||
{MNOTE_SANYO_TAG_SCENESELECT, "SceneSelect", N_("Scene Select"), ""},
|
||||
{MNOTE_SANYO_TAG_MANUALFOCUSDISTANCE, "ManualFocusDistance", N_("Manual Focus Distance"), ""},
|
||||
{MNOTE_SANYO_TAG_SEQUENCESHOTINTERVAL, "SequenceShotInterval", N_("Sequence Shot Interval"), ""},
|
||||
|
||||
/* Epson */
|
||||
{MNOTE_EPSON_TAG_IMAGE_WIDTH, "EpsonImageWidth", N_("Epson Image Width"), ""},
|
||||
{MNOTE_EPSON_TAG_IMAGE_HEIGHT, "EpsonImageHeight", N_("Epson Image Height"), ""},
|
||||
{MNOTE_EPSON_TAG_SOFTWARE, "EpsonSoftware", N_("Epson Software Version"), ""},
|
||||
#endif
|
||||
{0, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
const char *
|
||||
mnote_olympus_tag_get_name (MnoteOlympusTag t)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
|
||||
if (table[i].tag == t) return (table[i].name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
mnote_olympus_tag_get_title (MnoteOlympusTag t)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
|
||||
if (table[i].tag == t) return (_(table[i].title));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
mnote_olympus_tag_get_description (MnoteOlympusTag t)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
|
||||
if (table[i].tag == t) {
|
||||
if (!table[i].description || !*table[i].description)
|
||||
return "";
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
return _(table[i].description);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
449
libexifa/pentax/exif-mnote-data-pentax.c
Executable file
449
libexifa/pentax/exif-mnote-data-pentax.c
Executable file
@@ -0,0 +1,449 @@
|
||||
/* exif-mnote-data-pentax.c
|
||||
*
|
||||
* Copyright (c) 2002, 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "exif-mnote-data-pentax.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-utils.h>
|
||||
|
||||
static void
|
||||
exif_mnote_data_pentax_clear (ExifMnoteDataPentax *n)
|
||||
{
|
||||
ExifMnoteData *d = (ExifMnoteData *) n;
|
||||
unsigned int i;
|
||||
|
||||
if (!n) return;
|
||||
|
||||
if (n->entries) {
|
||||
for (i = 0; i < n->count; i++)
|
||||
if (n->entries[i].data) {
|
||||
exif_mem_free (d->mem, n->entries[i].data);
|
||||
n->entries[i].data = NULL;
|
||||
}
|
||||
exif_mem_free (d->mem, n->entries);
|
||||
n->entries = NULL;
|
||||
n->count = 0;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_pentax_free (ExifMnoteData *n)
|
||||
{
|
||||
if (!n) return;
|
||||
|
||||
exif_mnote_data_pentax_clear ((ExifMnoteDataPentax *) n);
|
||||
}
|
||||
|
||||
static char *
|
||||
exif_mnote_data_pentax_get_value (ExifMnoteData *d, unsigned int i, char *val, unsigned int maxlen)
|
||||
{
|
||||
ExifMnoteDataPentax *n = (ExifMnoteDataPentax *) d;
|
||||
|
||||
if (!n) return NULL;
|
||||
if (n->count <= i) return NULL;
|
||||
return mnote_pentax_entry_get_value (&n->entries[i], val, maxlen);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief save the MnoteData from ne to buf
|
||||
*
|
||||
* @param ne extract the data from this structure
|
||||
* @param *buf write the mnoteData to this buffer (buffer will be allocated)
|
||||
* @param buf_size the final size of the buffer
|
||||
*/
|
||||
static void
|
||||
exif_mnote_data_pentax_save (ExifMnoteData *ne,
|
||||
unsigned char **buf, unsigned int *buf_size)
|
||||
{
|
||||
ExifMnoteDataPentax *n = (ExifMnoteDataPentax *) ne;
|
||||
size_t i,
|
||||
base = 0, /* internal MakerNote tag number offset */
|
||||
o2 = 4 + 2; /* offset to first tag entry, past header */
|
||||
size_t datao = n->offset; /* this MakerNote style uses offsets
|
||||
based on main IFD, not makernote IFD */
|
||||
|
||||
if (!n || !buf || !buf_size) return;
|
||||
|
||||
/*
|
||||
* Allocate enough memory for header, the number of entries, entries,
|
||||
* and next IFD pointer
|
||||
*/
|
||||
*buf_size = o2 + 2 + n->count * 12 + 4;
|
||||
switch (n->version) {
|
||||
case casioV2:
|
||||
base = MNOTE_PENTAX2_TAG_BASE;
|
||||
*buf = exif_mem_alloc (ne->mem, *buf_size);
|
||||
if (!*buf) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteDataPentax", *buf_size);
|
||||
return;
|
||||
}
|
||||
/* Write the magic header */
|
||||
strcpy ((char *)*buf, "QVC");
|
||||
exif_set_short (*buf + 4, n->order, (ExifShort) 0);
|
||||
|
||||
break;
|
||||
|
||||
case pentaxV3:
|
||||
base = MNOTE_PENTAX2_TAG_BASE;
|
||||
*buf = exif_mem_alloc (ne->mem, *buf_size);
|
||||
if (!*buf) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteDataPentax", *buf_size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write the magic header */
|
||||
strcpy ((char *)*buf, "AOC");
|
||||
exif_set_short (*buf + 4, n->order, (ExifShort) (
|
||||
(n->order == EXIF_BYTE_ORDER_INTEL) ?
|
||||
('I' << 8) | 'I' :
|
||||
('M' << 8) | 'M'));
|
||||
break;
|
||||
|
||||
case pentaxV2:
|
||||
base = MNOTE_PENTAX2_TAG_BASE;
|
||||
*buf = exif_mem_alloc (ne->mem, *buf_size);
|
||||
if (!*buf) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteDataPentax", *buf_size);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write the magic header */
|
||||
strcpy ((char *)*buf, "AOC");
|
||||
exif_set_short (*buf + 4, n->order, (ExifShort) 0);
|
||||
break;
|
||||
|
||||
case pentaxV1:
|
||||
/* It looks like this format doesn't have a magic header as
|
||||
* such, just has a fixed number of entries equal to 0x001b */
|
||||
*buf_size -= 6;
|
||||
o2 -= 6;
|
||||
*buf = exif_mem_alloc (ne->mem, *buf_size);
|
||||
if (!*buf) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteDataPentax", *buf_size);
|
||||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* internal error */
|
||||
return;
|
||||
}
|
||||
|
||||
/* Write the number of entries. */
|
||||
exif_set_short (*buf + o2, n->order, (ExifShort) n->count);
|
||||
o2 += 2;
|
||||
|
||||
/* Save each entry */
|
||||
for (i = 0; i < n->count; i++) {
|
||||
size_t doff; /* offset to current data portion of tag */
|
||||
size_t s;
|
||||
unsigned char *t;
|
||||
size_t o = o2 + i * 12; /* current offset into output buffer */
|
||||
exif_set_short (*buf + o + 0, n->order,
|
||||
(ExifShort) (n->entries[i].tag - base));
|
||||
exif_set_short (*buf + o + 2, n->order,
|
||||
(ExifShort) n->entries[i].format);
|
||||
exif_set_long (*buf + o + 4, n->order,
|
||||
n->entries[i].components);
|
||||
o += 8;
|
||||
s = exif_format_get_size (n->entries[i].format) *
|
||||
n->entries[i].components;
|
||||
if (s > 65536) {
|
||||
/* Corrupt data: EXIF data size is limited to the
|
||||
* maximum size of a JPEG segment (64 kb).
|
||||
*/
|
||||
continue;
|
||||
}
|
||||
if (s > 4) {
|
||||
size_t ts = *buf_size + s;
|
||||
doff = *buf_size;
|
||||
t = exif_mem_realloc (ne->mem, *buf,
|
||||
sizeof (char) * ts);
|
||||
if (!t) {
|
||||
EXIF_LOG_NO_MEMORY(ne->log, "ExifMnoteDataPentax", ts);
|
||||
return;
|
||||
}
|
||||
*buf = t;
|
||||
*buf_size = ts;
|
||||
exif_set_long (*buf + o, n->order, datao + doff);
|
||||
} else
|
||||
doff = o;
|
||||
|
||||
/* Write the data. */
|
||||
if (n->entries[i].data) {
|
||||
memcpy (*buf + doff, n->entries[i].data, s);
|
||||
} else {
|
||||
/* Most certainly damaged input file */
|
||||
memset (*buf + doff, 0, s);
|
||||
}
|
||||
}
|
||||
|
||||
/* Sanity check the buffer size */
|
||||
if (*buf_size < (o2 + n->count * 12 + 4)) {
|
||||
exif_log (ne->log, EXIF_LOG_CODE_CORRUPT_DATA, "ExifMnoteDataPentax",
|
||||
"Buffer overflow");
|
||||
}
|
||||
|
||||
/* Reset next IFD pointer */
|
||||
exif_set_long (*buf + o2 + n->count * 12, n->order, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_pentax_load (ExifMnoteData *en,
|
||||
const unsigned char *buf, unsigned int buf_size)
|
||||
{
|
||||
ExifMnoteDataPentax *n = (ExifMnoteDataPentax *) en;
|
||||
size_t i, tcount, o, datao, base = 0;
|
||||
ExifShort c;
|
||||
|
||||
if (!n || !buf || !buf_size) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteDataPentax", "Short MakerNote");
|
||||
return;
|
||||
}
|
||||
datao = 6 + n->offset;
|
||||
if ((datao + 8 < datao) || (datao + 8 < 8) || (datao + 8 > buf_size)) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteDataPentax", "Short MakerNote");
|
||||
return;
|
||||
}
|
||||
|
||||
/* Detect variant of Pentax/Casio MakerNote found */
|
||||
if (!memcmp(buf + datao, "AOC", 4)) {
|
||||
if ((buf[datao + 4] == 'I') && (buf[datao + 5] == 'I')) {
|
||||
n->version = pentaxV3;
|
||||
n->order = EXIF_BYTE_ORDER_INTEL;
|
||||
} else if ((buf[datao + 4] == 'M') && (buf[datao + 5] == 'M')) {
|
||||
n->version = pentaxV3;
|
||||
n->order = EXIF_BYTE_ORDER_MOTOROLA;
|
||||
} else {
|
||||
/* Uses Casio v2 tags */
|
||||
n->version = pentaxV2;
|
||||
}
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataPentax",
|
||||
"Parsing Pentax maker note v%d...", (int)n->version);
|
||||
datao += 4 + 2;
|
||||
base = MNOTE_PENTAX2_TAG_BASE;
|
||||
} else if (!memcmp(buf + datao, "QVC", 4)) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataPentax",
|
||||
"Parsing Casio maker note v2...");
|
||||
n->version = casioV2;
|
||||
base = MNOTE_CASIO2_TAG_BASE;
|
||||
datao += 4 + 2;
|
||||
} else {
|
||||
/* probably assert(!memcmp(buf + datao, "\x00\x1b", 2)) */
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnoteDataPentax",
|
||||
"Parsing Pentax maker note v1...");
|
||||
n->version = pentaxV1;
|
||||
}
|
||||
|
||||
/* Read the number of tags */
|
||||
c = exif_get_short (buf + datao, n->order);
|
||||
datao += 2;
|
||||
|
||||
/* Remove any old entries */
|
||||
exif_mnote_data_pentax_clear (n);
|
||||
|
||||
/* Reserve enough space for all the possible MakerNote tags */
|
||||
n->entries = exif_mem_alloc (en->mem, sizeof (MnotePentaxEntry) * c);
|
||||
if (!n->entries) {
|
||||
EXIF_LOG_NO_MEMORY(en->log, "ExifMnoteDataPentax", sizeof (MnotePentaxEntry) * c);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Parse all c entries, storing ones that are successfully parsed */
|
||||
tcount = 0;
|
||||
for (i = c, o = datao; i; --i, o += 12) {
|
||||
size_t s;
|
||||
if ((o + 12 < o) || (o + 12 < 12) || (o + 12 > buf_size)) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
|
||||
"ExifMnoteDataPentax", "Short MakerNote");
|
||||
break;
|
||||
}
|
||||
|
||||
n->entries[tcount].tag = exif_get_short (buf + o + 0, n->order) + base;
|
||||
n->entries[tcount].format = exif_get_short (buf + o + 2, n->order);
|
||||
n->entries[tcount].components = exif_get_long (buf + o + 4, n->order);
|
||||
n->entries[tcount].order = n->order;
|
||||
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG, "ExifMnotePentax",
|
||||
"Loading entry 0x%x ('%s')...", n->entries[tcount].tag,
|
||||
mnote_pentax_tag_get_name (n->entries[tcount].tag));
|
||||
|
||||
/*
|
||||
* Size? If bigger than 4 bytes, the actual data is not
|
||||
* in the entry but somewhere else (offset).
|
||||
*/
|
||||
s = exif_format_get_size (n->entries[tcount].format) *
|
||||
n->entries[tcount].components;
|
||||
n->entries[tcount].size = s;
|
||||
if (s) {
|
||||
size_t dataofs = o + 8;
|
||||
if (s > 4)
|
||||
/* The data in this case is merely a pointer */
|
||||
dataofs = exif_get_long (buf + dataofs, n->order) + 6;
|
||||
if ((dataofs + s < dataofs) || (dataofs + s < s) ||
|
||||
(dataofs + s > buf_size)) {
|
||||
exif_log (en->log, EXIF_LOG_CODE_DEBUG,
|
||||
"ExifMnoteDataPentax", "Tag data past end "
|
||||
"of buffer (%u > %u)", dataofs + s, buf_size);
|
||||
continue;
|
||||
}
|
||||
|
||||
n->entries[tcount].data = exif_mem_alloc (en->mem, s);
|
||||
if (!n->entries[tcount].data) {
|
||||
EXIF_LOG_NO_MEMORY(en->log, "ExifMnoteDataPentax", s);
|
||||
continue;
|
||||
}
|
||||
memcpy (n->entries[tcount].data, buf + dataofs, s);
|
||||
}
|
||||
|
||||
/* Tag was successfully parsed */
|
||||
++tcount;
|
||||
}
|
||||
/* Store the count of successfully parsed tags */
|
||||
n->count = tcount;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
exif_mnote_data_pentax_count (ExifMnoteData *n)
|
||||
{
|
||||
return n ? ((ExifMnoteDataPentax *) n)->count : 0;
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
exif_mnote_data_pentax_get_id (ExifMnoteData *d, unsigned int n)
|
||||
{
|
||||
ExifMnoteDataPentax *note = (ExifMnoteDataPentax *) d;
|
||||
|
||||
if (!note) return 0;
|
||||
if (note->count <= n) return 0;
|
||||
return note->entries[n].tag;
|
||||
}
|
||||
|
||||
static const char *
|
||||
exif_mnote_data_pentax_get_name (ExifMnoteData *d, unsigned int n)
|
||||
{
|
||||
ExifMnoteDataPentax *note = (ExifMnoteDataPentax *) d;
|
||||
|
||||
if (!note) return NULL;
|
||||
if (note->count <= n) return NULL;
|
||||
return mnote_pentax_tag_get_name (note->entries[n].tag);
|
||||
}
|
||||
|
||||
static const char *
|
||||
exif_mnote_data_pentax_get_title (ExifMnoteData *d, unsigned int n)
|
||||
{
|
||||
ExifMnoteDataPentax *note = (ExifMnoteDataPentax *) d;
|
||||
|
||||
if (!note) return NULL;
|
||||
if (note->count <= n) return NULL;
|
||||
return mnote_pentax_tag_get_title (note->entries[n].tag);
|
||||
}
|
||||
|
||||
static const char *
|
||||
exif_mnote_data_pentax_get_description (ExifMnoteData *d, unsigned int n)
|
||||
{
|
||||
ExifMnoteDataPentax *note = (ExifMnoteDataPentax *) d;
|
||||
|
||||
if (!note) return NULL;
|
||||
if (note->count <= n) return NULL;
|
||||
return mnote_pentax_tag_get_description (note->entries[n].tag);
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_pentax_set_offset (ExifMnoteData *d, unsigned int o)
|
||||
{
|
||||
if (d) ((ExifMnoteDataPentax *) d)->offset = o;
|
||||
}
|
||||
|
||||
static void
|
||||
exif_mnote_data_pentax_set_byte_order (ExifMnoteData *d, ExifByteOrder o)
|
||||
{
|
||||
ExifByteOrder o_orig;
|
||||
ExifMnoteDataPentax *n = (ExifMnoteDataPentax *) d;
|
||||
unsigned int i;
|
||||
|
||||
if (!n) return;
|
||||
|
||||
o_orig = n->order;
|
||||
n->order = o;
|
||||
for (i = 0; i < n->count; i++) {
|
||||
n->entries[i].order = o;
|
||||
exif_array_set_byte_order (n->entries[i].format, n->entries[i].data,
|
||||
n->entries[i].components, o_orig, o);
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
exif_mnote_data_pentax_identify (const ExifData *ed, const ExifEntry *e)
|
||||
{
|
||||
if ((e->size >= 8) && !memcmp (e->data, "AOC", 4)) {
|
||||
if (((e->data[4] == 'I') && (e->data[5] == 'I')) ||
|
||||
((e->data[4] == 'M') && (e->data[5] == 'M')))
|
||||
return pentaxV3;
|
||||
else
|
||||
/* Uses Casio v2 tags */
|
||||
return pentaxV2;
|
||||
}
|
||||
|
||||
if ((e->size >= 8) && !memcmp (e->data, "QVC", 4))
|
||||
return casioV2;
|
||||
|
||||
/* This isn't a very robust test, so make sure it's done last */
|
||||
/* Maybe we should additionally check for a make of Asahi or Pentax */
|
||||
if ((e->size >= 2) && (e->data[0] == 0x00) && (e->data[1] == 0x1b))
|
||||
return pentaxV1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
ExifMnoteData *
|
||||
exif_mnote_data_pentax_new (ExifMem *mem)
|
||||
{
|
||||
ExifMnoteData *d;
|
||||
|
||||
if (!mem) return NULL;
|
||||
|
||||
d = exif_mem_alloc (mem, sizeof (ExifMnoteDataPentax));
|
||||
if (!d) return NULL;
|
||||
|
||||
exif_mnote_data_construct (d, mem);
|
||||
|
||||
/* Set up function pointers */
|
||||
d->methods.free = exif_mnote_data_pentax_free;
|
||||
d->methods.set_byte_order = exif_mnote_data_pentax_set_byte_order;
|
||||
d->methods.set_offset = exif_mnote_data_pentax_set_offset;
|
||||
d->methods.load = exif_mnote_data_pentax_load;
|
||||
d->methods.save = exif_mnote_data_pentax_save;
|
||||
d->methods.count = exif_mnote_data_pentax_count;
|
||||
d->methods.get_id = exif_mnote_data_pentax_get_id;
|
||||
d->methods.get_name = exif_mnote_data_pentax_get_name;
|
||||
d->methods.get_title = exif_mnote_data_pentax_get_title;
|
||||
d->methods.get_description = exif_mnote_data_pentax_get_description;
|
||||
d->methods.get_value = exif_mnote_data_pentax_get_value;
|
||||
|
||||
return d;
|
||||
}
|
||||
59
libexifa/pentax/exif-mnote-data-pentax.h
Executable file
59
libexifa/pentax/exif-mnote-data-pentax.h
Executable file
@@ -0,0 +1,59 @@
|
||||
/* exif-mnote-data-pentax.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_MNOTE_DATA_PENTAX_H__
|
||||
#define __EXIF_MNOTE_DATA_PENTAX_H__
|
||||
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-mnote-data.h>
|
||||
#include <libexif/exif-mnote-data-priv.h>
|
||||
#include <libexif/pentax/mnote-pentax-entry.h>
|
||||
#include <libexif/exif-data.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
enum PentaxVersion {pentaxV1 = 1, pentaxV2 = 2, pentaxV3 = 3, casioV2 = 4 };
|
||||
|
||||
typedef struct _ExifMnoteDataPentax ExifMnoteDataPentax;
|
||||
|
||||
struct _ExifMnoteDataPentax {
|
||||
ExifMnoteData parent;
|
||||
|
||||
MnotePentaxEntry *entries;
|
||||
unsigned int count;
|
||||
|
||||
ExifByteOrder order;
|
||||
unsigned int offset;
|
||||
|
||||
enum PentaxVersion version;
|
||||
};
|
||||
|
||||
/*! Detect if MakerNote is recognized as one handled by the Pentax module.
|
||||
*
|
||||
* \param[in] ed image #ExifData to identify as as a Pentax type
|
||||
* \param[in] e #ExifEntry for EXIF_TAG_MAKER_NOTE, from within ed but
|
||||
* duplicated here for convenience
|
||||
* \return 0 if not recognized, nonzero if recognized. The specific nonzero
|
||||
* value returned may identify a subtype unique within this module.
|
||||
*/
|
||||
int exif_mnote_data_pentax_identify (const ExifData *ed, const ExifEntry *e);
|
||||
|
||||
ExifMnoteData *exif_mnote_data_pentax_new (ExifMem *);
|
||||
|
||||
#endif /* __EXIF_MNOTE_DATA_PENTAX_H__ */
|
||||
459
libexifa/pentax/mnote-pentax-entry.c
Executable file
459
libexifa/pentax/mnote-pentax-entry.c
Executable file
@@ -0,0 +1,459 @@
|
||||
/* mnote-pentax-entry.c
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "mnote-pentax-entry.h"
|
||||
|
||||
#include <libexif/i18n.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/exif-utils.h>
|
||||
#include <libexif/exif-entry.h>
|
||||
|
||||
|
||||
#define CF(format,target,v,maxlen) \
|
||||
{ \
|
||||
if (format != target) { \
|
||||
snprintf (v, maxlen, \
|
||||
_("Invalid format '%s', " \
|
||||
"expected '%s'."), \
|
||||
exif_format_get_name (format), \
|
||||
exif_format_get_name (target)); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CC(number,target,v,maxlen) \
|
||||
{ \
|
||||
if (number != target) { \
|
||||
snprintf (v, maxlen, \
|
||||
_("Invalid number of components (%i, " \
|
||||
"expected %i)."), (int) number, (int) target); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
#define CC2(number,t1,t2,v,maxlen) \
|
||||
{ \
|
||||
if ((number != t1) && (number != t2)) { \
|
||||
snprintf (v, maxlen, \
|
||||
_("Invalid number of components (%i, " \
|
||||
"expected %i or %i)."), (int) number, \
|
||||
(int) t1, (int) t2); \
|
||||
break; \
|
||||
} \
|
||||
}
|
||||
|
||||
static const struct {
|
||||
ExifTag tag;
|
||||
struct {
|
||||
int index;
|
||||
const char *string;
|
||||
} elem[33];
|
||||
} items[] = {
|
||||
#ifndef NO_VERBOSE_TAG_DATA
|
||||
{ MNOTE_PENTAX_TAG_MODE,
|
||||
{ {0, N_("Auto")},
|
||||
{1, N_("Night scene")},
|
||||
{2, N_("Manual")},
|
||||
{4, N_("Multi-exposure")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX_TAG_QUALITY,
|
||||
{ {0, N_("Good")},
|
||||
{1, N_("Better")},
|
||||
{2, N_("Best")},{0,NULL}}},
|
||||
{ MNOTE_PENTAX_TAG_FOCUS,
|
||||
{ {2, N_("Custom")},
|
||||
{3, N_("Auto")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX_TAG_FLASH,
|
||||
{ {1, N_("Auto")},
|
||||
{2, N_("Flash on")},
|
||||
{4, N_("Flash off")},
|
||||
{6, N_("Red-eye reduction")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX_TAG_WHITE_BALANCE,
|
||||
{ {0, N_("Auto")},
|
||||
{1, N_("Daylight")},
|
||||
{2, N_("Shade")},
|
||||
{3, N_("Tungsten")},
|
||||
{4, N_("Fluorescent")},
|
||||
{5, N_("Manual")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX_TAG_SHARPNESS,
|
||||
{ {0, N_("Normal")},
|
||||
{1, N_("Soft")},
|
||||
{2, N_("Hard")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX_TAG_CONTRAST,
|
||||
{ {0, N_("Normal")},
|
||||
{1, N_("Low")},
|
||||
{2, N_("High")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX_TAG_SATURATION,
|
||||
{ {0, N_("Normal")},
|
||||
{1, N_("Low")},
|
||||
{2, N_("High")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX_TAG_ISO_SPEED,
|
||||
{ {10, N_("100")},
|
||||
{16, N_("200")},
|
||||
{100, N_("100")},
|
||||
{200, N_("200")},
|
||||
{ 0, NULL}}},
|
||||
{ MNOTE_PENTAX_TAG_COLOR,
|
||||
{ {1, N_("Full")},
|
||||
{2, N_("Black & white")},
|
||||
{3, N_("Sepia")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX2_TAG_MODE,
|
||||
{ {0, N_("Auto")},
|
||||
{1, N_("Night scene")},
|
||||
{2, N_("Manual")},
|
||||
{4, N_("Multi-exposure")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX2_TAG_QUALITY,
|
||||
{ {0, N_("Good")},
|
||||
{1, N_("Better")},
|
||||
{2, N_("Best")},
|
||||
{3, N_("TIFF")},
|
||||
{4, N_("RAW")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX2_TAG_IMAGE_SIZE,
|
||||
{ {0, "640x480"},
|
||||
{1, N_("Full")},
|
||||
{2, "1024x768"},
|
||||
{3, "1280x960"},
|
||||
{4, "1600x1200"},
|
||||
{5, "2048x1536"},
|
||||
{8, N_("2560x1920 or 2304x1728")},
|
||||
{9, "3072x2304"},
|
||||
{10, "3264x2448"},
|
||||
{19, "320x240"},
|
||||
{20, "2288x1712"},
|
||||
{21, "2592x1944"},
|
||||
{22, N_("2304x1728 or 2592x1944")},
|
||||
{23, "3056x2296"},
|
||||
{25, N_("2816x2212 or 2816x2112")},
|
||||
{27, "3648x2736"},
|
||||
{36, "3008x2008"},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX2_TAG_PICTURE_MODE,
|
||||
{ {0, N_("Program")},
|
||||
{2, N_("Program AE")},
|
||||
{3, N_("Manual")},
|
||||
{5, N_("Portrait")},
|
||||
{6, N_("Landscape")},
|
||||
{8, N_("Sport")},
|
||||
{9, N_("Night scene")},
|
||||
{11, N_("Soft")},
|
||||
{12, N_("Surf & snow")},
|
||||
{13, N_("Sunset or candlelight")},
|
||||
{14, N_("Autumn")},
|
||||
{15, N_("Macro")},
|
||||
{17, N_("Fireworks")},
|
||||
{18, N_("Text")},
|
||||
{19, N_("Panorama")},
|
||||
{30, N_("Self portrait")},
|
||||
{31, N_("Illustrations")},
|
||||
{33, N_("Digital filter")},
|
||||
{37, N_("Museum")},
|
||||
{38, N_("Food")},
|
||||
{40, N_("Green mode")},
|
||||
{49, N_("Light pet")},
|
||||
{50, N_("Dark pet")},
|
||||
{51, N_("Medium pet")},
|
||||
{53, N_("Underwater")},
|
||||
{54, N_("Candlelight")},
|
||||
{55, N_("Natural skin tone")},
|
||||
{56, N_("Synchro sound record")},
|
||||
{58, N_("Frame composite")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX2_TAG_FLASH_MODE,
|
||||
{ {0x0000, N_("Auto, did not fire")},
|
||||
{0x0001, N_("Off")},
|
||||
{0x0003, N_("Auto, did not fire, red-eye reduction")},
|
||||
{0x0100, N_("Auto, fired")},
|
||||
{0x0102, N_("On")},
|
||||
{0x0103, N_("Auto, fired, red-eye reduction")},
|
||||
{0x0104, N_("On, red-eye reduction")},
|
||||
{0x0105, N_("On, wireless")},
|
||||
{0x0108, N_("On, soft")},
|
||||
{0x0109, N_("On, slow-sync")},
|
||||
{0x010a, N_("On, slow-sync, red-eye reduction")},
|
||||
{0x010b, N_("On, trailing-curtain sync")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX2_TAG_FOCUS_MODE,
|
||||
{ {0, N_("Normal")},
|
||||
{1, N_("Macro")},
|
||||
{2, N_("Infinity")},
|
||||
{3, N_("Manual")},
|
||||
{5, N_("Pan focus")},
|
||||
{16, N_("AF-S")},
|
||||
{17, N_("AF-C")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX2_TAG_AFPOINT_SELECTED,
|
||||
{ {1, N_("Upper-left")},
|
||||
{2, N_("Top")},
|
||||
{3, N_("Upper-right")},
|
||||
{4, N_("Left")},
|
||||
{5, N_("Mid-left")},
|
||||
{6, N_("Center")},
|
||||
{7, N_("Mid-right")},
|
||||
{8, N_("Right")},
|
||||
{9, N_("Lower-left")},
|
||||
{10, N_("Bottom")},
|
||||
{11, N_("Lower-right")},
|
||||
{0xfffe, N_("Fixed center")},
|
||||
{0xffff, N_("Auto")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX2_TAG_AUTO_AFPOINT,
|
||||
{ {0, N_("Multiple")},
|
||||
{1, N_("Top-left")},
|
||||
{2, N_("Top-center")},
|
||||
{3, N_("Top-right")},
|
||||
{4, N_("Left")},
|
||||
{5, N_("Center")},
|
||||
{6, N_("Right")},
|
||||
{7, N_("Bottom-left")},
|
||||
{8, N_("Bottom-center")},
|
||||
{9, N_("Bottom-right")},
|
||||
{0xffff, N_("None")},
|
||||
{0, NULL}}},
|
||||
{ MNOTE_PENTAX2_TAG_WHITE_BALANCE,
|
||||
{ {0, N_("Auto")},
|
||||
{1, N_("Daylight")},
|
||||
{2, N_("Shade")},
|
||||
{3, N_("Fluorescent")},
|
||||
{4, N_("Tungsten")},
|
||||
{5, N_("Manual")},
|
||||
{6, N_("Daylight fluorescent")},
|
||||
{7, N_("Day white fluorescent")},
|
||||
{8, N_("White fluorescent")},
|
||||
{9, N_("Flash")},
|
||||
{10, N_("Cloudy")},
|
||||
{0xfffe, N_("Unknown")},
|
||||
{0xffff, N_("User selected")},
|
||||
{0, NULL}}},
|
||||
{MNOTE_CASIO2_TAG_BESTSHOT_MODE,
|
||||
{ {0, N_("Off")},
|
||||
{1, N_("On")},
|
||||
{0, NULL}}},
|
||||
#endif
|
||||
{0, {{0, NULL}}}
|
||||
};
|
||||
|
||||
/* Two-component values */
|
||||
static const struct {
|
||||
ExifTag tag;
|
||||
struct {
|
||||
int index1, index2;
|
||||
const char *string;
|
||||
} elem[39];
|
||||
} items2[] = {
|
||||
#ifndef NO_VERBOSE_TAG_DATA
|
||||
{ MNOTE_PENTAX2_TAG_IMAGE_SIZE,
|
||||
{ {0, 0, "2304x1728"},
|
||||
{4, 0, "1600x1200"},
|
||||
{5, 0, "2048x1536"},
|
||||
{8, 0, "2560x1920"},
|
||||
{34, 0, "1536x1024"},
|
||||
{36, 0, N_("3008x2008 or 3040x2024")},
|
||||
{37, 0, "3008x2000"},
|
||||
{35, 1, "2400x1600"},
|
||||
{32, 2, "960x480"},
|
||||
{33, 2, "1152x768"},
|
||||
{34, 2, "1536x1024"},
|
||||
{0, 0, NULL}}},
|
||||
{ MNOTE_PENTAX2_TAG_PICTURE_MODE,
|
||||
{ {0, 0, N_("Auto")},
|
||||
{5, 0, N_("Portrait")},
|
||||
{53, 0, N_("Underwater")},
|
||||
{255, 0, N_("Digital filter?")},
|
||||
{5, 1, N_("Portrait")},
|
||||
{9, 1, N_("Night scene")},
|
||||
{13, 1, N_("Candlelight")},
|
||||
{15, 1, N_("Macro")},
|
||||
{53, 1, N_("Underwater")},
|
||||
{0, 2, N_("Program AE")},
|
||||
{5, 2, N_("Portrait")},
|
||||
{6, 2, N_("Landscape")},
|
||||
{0, 0, NULL}}},
|
||||
#endif
|
||||
{0, {{0, 0, NULL}}}
|
||||
};
|
||||
|
||||
char *
|
||||
mnote_pentax_entry_get_value (MnotePentaxEntry *entry,
|
||||
char *val, unsigned int maxlen)
|
||||
{
|
||||
ExifLong vl;
|
||||
ExifShort vs, vs2;
|
||||
int i = 0, j = 0;
|
||||
|
||||
if (!entry) return (NULL);
|
||||
|
||||
memset (val, 0, maxlen);
|
||||
maxlen--;
|
||||
|
||||
switch (entry->tag) {
|
||||
case MNOTE_PENTAX_TAG_MODE:
|
||||
case MNOTE_PENTAX_TAG_QUALITY:
|
||||
case MNOTE_PENTAX_TAG_FOCUS:
|
||||
case MNOTE_PENTAX_TAG_FLASH:
|
||||
case MNOTE_PENTAX_TAG_WHITE_BALANCE:
|
||||
case MNOTE_PENTAX_TAG_SHARPNESS:
|
||||
case MNOTE_PENTAX_TAG_CONTRAST:
|
||||
case MNOTE_PENTAX_TAG_SATURATION:
|
||||
case MNOTE_PENTAX_TAG_ISO_SPEED:
|
||||
case MNOTE_PENTAX_TAG_COLOR:
|
||||
case MNOTE_PENTAX2_TAG_MODE:
|
||||
case MNOTE_PENTAX2_TAG_QUALITY:
|
||||
case MNOTE_PENTAX2_TAG_FLASH_MODE:
|
||||
case MNOTE_PENTAX2_TAG_FOCUS_MODE:
|
||||
case MNOTE_PENTAX2_TAG_AFPOINT_SELECTED:
|
||||
case MNOTE_PENTAX2_TAG_AUTO_AFPOINT:
|
||||
case MNOTE_PENTAX2_TAG_WHITE_BALANCE:
|
||||
case MNOTE_PENTAX2_TAG_PICTURE_MODE:
|
||||
case MNOTE_PENTAX2_TAG_IMAGE_SIZE:
|
||||
case MNOTE_CASIO2_TAG_BESTSHOT_MODE:
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
|
||||
CC2 (entry->components, 1, 2, val, maxlen);
|
||||
if (entry->components == 1) {
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
|
||||
/* search the tag */
|
||||
for (i = 0; (items[i].tag && items[i].tag != entry->tag); i++);
|
||||
if (!items[i].tag) {
|
||||
snprintf (val, maxlen,
|
||||
_("Internal error (unknown value %i)"), vs);
|
||||
break;
|
||||
}
|
||||
|
||||
/* find the value */
|
||||
for (j = 0; items[i].elem[j].string &&
|
||||
(items[i].elem[j].index < vs); j++);
|
||||
if (items[i].elem[j].index != vs) {
|
||||
snprintf (val, maxlen,
|
||||
_("Internal error (unknown value %i)"), vs);
|
||||
break;
|
||||
}
|
||||
strncpy (val, _(items[i].elem[j].string), maxlen);
|
||||
} else {
|
||||
/* Two-component values */
|
||||
CF (entry->format, EXIF_FORMAT_SHORT, val, maxlen);
|
||||
CC2 (entry->components, 1, 2, val, maxlen);
|
||||
vs = exif_get_short (entry->data, entry->order);
|
||||
vs2 = exif_get_short (entry->data+2, entry->order) << 16;
|
||||
|
||||
/* search the tag */
|
||||
for (i = 0; (items2[i].tag && items2[i].tag != entry->tag); i++);
|
||||
if (!items2[i].tag) {
|
||||
snprintf (val, maxlen,
|
||||
_("Internal error (unknown value %i %i)"), vs, vs2);
|
||||
break;
|
||||
}
|
||||
|
||||
/* find the value */
|
||||
for (j = 0; items2[i].elem[j].string && ((items2[i].elem[j].index2 < vs2)
|
||||
|| ((items2[i].elem[j].index2 == vs2) && (items2[i].elem[j].index1 < vs))); j++);
|
||||
if ((items2[i].elem[j].index1 != vs) || (items2[i].elem[j].index2 != vs2)) {
|
||||
snprintf (val, maxlen,
|
||||
_("Internal error (unknown value %i %i)"), vs, vs2);
|
||||
break;
|
||||
}
|
||||
strncpy (val, _(items2[i].elem[j].string), maxlen);
|
||||
}
|
||||
break;
|
||||
|
||||
case MNOTE_PENTAX_TAG_ZOOM:
|
||||
CF (entry->format, EXIF_FORMAT_LONG, val, maxlen);
|
||||
CC (entry->components, 1, val, maxlen);
|
||||
vl = exif_get_long (entry->data, entry->order);
|
||||
snprintf (val, maxlen, "%li", (long int) vl);
|
||||
break;
|
||||
case MNOTE_PENTAX_TAG_PRINTIM:
|
||||
CF (entry->format, EXIF_FORMAT_UNDEFINED, val, maxlen);
|
||||
CC (entry->components, 124, val, maxlen);
|
||||
snprintf (val, maxlen, _("%i bytes unknown data"),
|
||||
entry->size);
|
||||
break;
|
||||
case MNOTE_PENTAX_TAG_TZ_CITY:
|
||||
case MNOTE_PENTAX_TAG_TZ_DST:
|
||||
CF (entry->format, EXIF_FORMAT_UNDEFINED, val, maxlen);
|
||||
CC (entry->components, 4, val, maxlen);
|
||||
strncpy (val, (char*)entry->data, MIN(maxlen, entry->size));
|
||||
break;
|
||||
case MNOTE_PENTAX2_TAG_DATE:
|
||||
CF (entry->format, EXIF_FORMAT_UNDEFINED, val, maxlen);
|
||||
CC (entry->components, 4, val, maxlen);
|
||||
/* Note: format is UNDEFINED, not SHORT -> order is fixed: MOTOROLA */
|
||||
vs = exif_get_short (entry->data, EXIF_BYTE_ORDER_MOTOROLA);
|
||||
snprintf (val, maxlen, "%i:%02i:%02i", vs, entry->data[2], entry->data[3]);
|
||||
break;
|
||||
case MNOTE_PENTAX2_TAG_TIME:
|
||||
CF (entry->format, EXIF_FORMAT_UNDEFINED, val, maxlen);
|
||||
CC2 (entry->components, 3, 4, val, maxlen);
|
||||
snprintf (val, maxlen, "%02i:%02i:%02i", entry->data[0], entry->data[1], entry->data[2]);
|
||||
break;
|
||||
default:
|
||||
switch (entry->format) {
|
||||
case EXIF_FORMAT_ASCII:
|
||||
strncpy (val, (char *)entry->data, MIN(maxlen, entry->size));
|
||||
break;
|
||||
case EXIF_FORMAT_SHORT:
|
||||
{
|
||||
const unsigned char *data = entry->data;
|
||||
size_t k, len = strlen(val);
|
||||
for(k=0; k<entry->components; k++) {
|
||||
vs = exif_get_short (data, entry->order);
|
||||
snprintf (val+len, maxlen-len, "%i ", vs);
|
||||
len = strlen(val);
|
||||
data += 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EXIF_FORMAT_LONG:
|
||||
{
|
||||
const unsigned char *data = entry->data;
|
||||
size_t k, len = strlen(val);
|
||||
for(k=0; k<entry->components; k++) {
|
||||
vl = exif_get_long (data, entry->order);
|
||||
snprintf (val+len, maxlen-len, "%li", (long int) vl);
|
||||
len = strlen(val);
|
||||
data += 4;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case EXIF_FORMAT_UNDEFINED:
|
||||
default:
|
||||
snprintf (val, maxlen, _("%i bytes unknown data"),
|
||||
entry->size);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return (val);
|
||||
}
|
||||
43
libexifa/pentax/mnote-pentax-entry.h
Executable file
43
libexifa/pentax/mnote-pentax-entry.h
Executable file
@@ -0,0 +1,43 @@
|
||||
/* mnote-pentax-entry.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_PENTAX_ENTRY_H__
|
||||
#define __MNOTE_PENTAX_ENTRY_H__
|
||||
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/pentax/mnote-pentax-tag.h>
|
||||
|
||||
typedef struct _MnotePentaxEntry MnotePentaxEntry;
|
||||
|
||||
struct _MnotePentaxEntry {
|
||||
MnotePentaxTag tag;
|
||||
ExifFormat format;
|
||||
unsigned long components;
|
||||
|
||||
unsigned char *data;
|
||||
unsigned int size;
|
||||
|
||||
ExifByteOrder order;
|
||||
};
|
||||
|
||||
char *mnote_pentax_entry_get_value (MnotePentaxEntry *entry, char *val, unsigned int maxlen);
|
||||
|
||||
#endif /* __MNOTE_PENTAX_ENTRY_H__ */
|
||||
175
libexifa/pentax/mnote-pentax-tag.c
Executable file
175
libexifa/pentax/mnote-pentax-tag.c
Executable file
@@ -0,0 +1,175 @@
|
||||
/* mnote-pentax-tag.c:
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include "mnote-pentax-tag.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <libexif/i18n.h>
|
||||
|
||||
static const struct {
|
||||
MnotePentaxTag tag;
|
||||
const char *name;
|
||||
const char *title;
|
||||
const char *description;
|
||||
} table[] = {
|
||||
#ifndef NO_VERBOSE_TAG_STRINGS
|
||||
{MNOTE_PENTAX_TAG_MODE, "Mode", N_("Capture Mode"), ""},
|
||||
{MNOTE_PENTAX_TAG_QUALITY, "Quality", N_("Quality Level"), ""},
|
||||
{MNOTE_PENTAX_TAG_FOCUS, "Focus", N_("Focus Mode"), ""},
|
||||
{MNOTE_PENTAX_TAG_FLASH, "Flash", N_("Flash Mode"), ""},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_05, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_06, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_WHITE_BALANCE, "WhiteBalance", N_("White Balance"), ""},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_08, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_09, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_ZOOM, "Zoom", N_("Zoom"), NULL},
|
||||
{MNOTE_PENTAX_TAG_SHARPNESS, "Sharpness", N_("Sharpness"), ""},
|
||||
{MNOTE_PENTAX_TAG_CONTRAST, "Contrast", N_("Contrast"), ""},
|
||||
{MNOTE_PENTAX_TAG_SATURATION, "Saturation", N_("Saturation"), ""},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_14, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_15, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_16, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_17, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_18, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_19, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_ISO_SPEED, "ISOSpeed", N_("ISO Speed"), ""},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_21, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_COLOR, "Color", N_("Colors"), ""},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_24, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_UNKNOWN_25, NULL, NULL, NULL},
|
||||
{MNOTE_PENTAX_TAG_PRINTIM, "PrintIM", N_("PrintIM Settings"), ""},
|
||||
{MNOTE_PENTAX_TAG_TZ_CITY, "TimeZone", N_("Time Zone"), ""},
|
||||
{MNOTE_PENTAX_TAG_TZ_DST, "DaylightSavings", N_("Daylight Savings"), ""},
|
||||
|
||||
{MNOTE_PENTAX2_TAG_MODE, "Mode", N_("Capture Mode"), ""},
|
||||
{MNOTE_PENTAX2_TAG_PREVIEW_SIZE, "PentaxPreviewSize", N_("Preview Size"), ""},
|
||||
{MNOTE_PENTAX2_TAG_PREVIEW_LENGTH, "PentaxPreviewLength", N_("Preview Length"), ""},
|
||||
{MNOTE_PENTAX2_TAG_PREVIEW_START, "PentaxPreviewStart", N_("Preview Start"), ""},
|
||||
{MNOTE_PENTAX2_TAG_MODEL_ID, "ModelID", N_("Model Identification"), ""},
|
||||
{MNOTE_PENTAX2_TAG_DATE, "Date", N_("Date"), ""},
|
||||
{MNOTE_PENTAX2_TAG_TIME, "Time", N_("Time"), ""},
|
||||
{MNOTE_PENTAX2_TAG_QUALITY, "Quality", N_("Quality Level"), ""},
|
||||
{MNOTE_PENTAX2_TAG_IMAGE_SIZE, "ImageSize", N_("Image Size"), ""},
|
||||
{MNOTE_PENTAX2_TAG_PICTURE_MODE, "PictureMode", N_("Picture Mode"), ""},
|
||||
{MNOTE_PENTAX2_TAG_FLASH_MODE, "FlashMode", N_("Flash Mode"), ""},
|
||||
{MNOTE_PENTAX2_TAG_FOCUS_MODE, "FocusMode", N_("Focus Mode"), ""},
|
||||
{MNOTE_PENTAX2_TAG_AFPOINT_SELECTED, "AFPointSelected", N_("AF Point Selected"), ""},
|
||||
{MNOTE_PENTAX2_TAG_AUTO_AFPOINT, "AutoAFPoint", N_("Auto AF Point"), ""},
|
||||
{MNOTE_PENTAX2_TAG_FOCUS_POSITION, "FocusPosition", N_("Focus Position"), ""},
|
||||
{MNOTE_PENTAX2_TAG_EXPOSURE_TIME, "ExposureTime", N_("Exposure Time"), ""},
|
||||
{MNOTE_PENTAX2_TAG_FNUMBER, "FNumber", N_("F-Number"), ""},
|
||||
{MNOTE_PENTAX2_TAG_ISO, "ISO", N_("ISO Number"), ""},
|
||||
{MNOTE_PENTAX2_TAG_EXPOSURE_COMPENSATION, "ExposureCompensation", N_("Exposure Compensation"), ""},
|
||||
{MNOTE_PENTAX2_TAG_METERING_MODE, "MeteringMode", N_("Metering Mode"), ""},
|
||||
{MNOTE_PENTAX2_TAG_AUTO_BRACKETING, "AutoBracketing", N_("Auto Bracketing"), ""},
|
||||
{MNOTE_PENTAX2_TAG_WHITE_BALANCE, "WhiteBalance", N_("White Balance"), ""},
|
||||
{MNOTE_PENTAX2_TAG_WHITE_BALANCE_MODE, "WhiteBalanceMode", N_("White Balance Mode"), ""},
|
||||
{MNOTE_PENTAX2_TAG_BLUE_BALANCE, "BlueBalance", N_("Blue Balance"), ""},
|
||||
{MNOTE_PENTAX2_TAG_RED_BALANCE, "RedBalance", N_("Red Balance"), ""},
|
||||
{MNOTE_PENTAX2_TAG_FOCAL_LENGTH, "FocalLength", N_("Focal Length"), ""},
|
||||
{MNOTE_PENTAX2_TAG_DIGITAL_ZOOM, "DigitalZoom", N_("Digital Zoom"), ""},
|
||||
{MNOTE_PENTAX2_TAG_SATURATION, "Saturation", N_("Saturation"), ""},
|
||||
{MNOTE_PENTAX2_TAG_CONTRAST, "Contrast", N_("Contrast"), ""},
|
||||
{MNOTE_PENTAX2_TAG_SHARPNESS, "Sharpness", N_("Sharpness"), ""},
|
||||
{MNOTE_PENTAX2_TAG_WORLDTIME_LOCATION, "WorldTimeLocation", N_("World Time Location"), ""},
|
||||
{MNOTE_PENTAX2_TAG_HOMETOWN_CITY, "HometownCity", N_("Hometown City"), ""},
|
||||
{MNOTE_PENTAX2_TAG_DESTINATION_CITY, "DestinationCity", N_("Destination City"), ""},
|
||||
{MNOTE_PENTAX2_TAG_HOMETOWN_DST, "HometownDST,", N_("Hometown DST"), N_("Home Daylight Savings Time")},
|
||||
{MNOTE_PENTAX2_TAG_DESTINATION_DST, "DestinationDST", N_("Destination DST"), N_("Destination Daylight Savings Time")},
|
||||
{MNOTE_PENTAX2_TAG_FRAME_NUMBER, "FrameNumber", N_("Frame Number"), ""},
|
||||
{MNOTE_PENTAX2_TAG_IMAGE_PROCESSING, "ImageProcessing", N_("Image Processing"), ""},
|
||||
{MNOTE_PENTAX2_TAG_PICTURE_MODE2, "PictureMode2", N_("Picture Mode (2)"), ""},
|
||||
{MNOTE_PENTAX2_TAG_DRIVE_MODE, "DriveMode", N_("Drive Mode"), ""},
|
||||
{MNOTE_PENTAX2_TAG_COLOR_SPACE, "ColorSpace", N_("Color Space"), ""},
|
||||
{MNOTE_PENTAX2_TAG_IMAGE_AREA_OFFSET, "ImageAreaOffset", N_("Image Area Offset"), ""},
|
||||
{MNOTE_PENTAX2_TAG_RAW_IMAGE_SIZE, "RawImageSize", N_("Raw Image Size"), ""},
|
||||
{MNOTE_PENTAX2_TAG_AFPOINTS_USED, "AfPointsUsed,", N_("Autofocus Points Used"), ""},
|
||||
{MNOTE_PENTAX2_TAG_LENS_TYPE, "LensType", N_("Lens Type"), ""},
|
||||
{MNOTE_PENTAX2_TAG_CAMERA_TEMPERATURE, "CameraTemperature", N_("Camera Temperature"), ""},
|
||||
{MNOTE_PENTAX2_TAG_NOISE_REDUCTION, "NoiseReduction", N_("Noise Reduction"), ""},
|
||||
{MNOTE_PENTAX2_TAG_FLASH_EXPOSURE_COMP, "FlashExposureComp", N_("Flash Exposure Compensation"), ""},
|
||||
{MNOTE_PENTAX2_TAG_IMAGE_TONE, "ImageTone", N_("Image Tone"), ""},
|
||||
{MNOTE_PENTAX2_TAG_SHAKE_REDUCTION_INFO, "ShakeReductionInfo,", N_("Shake Reduction Info"), ""},
|
||||
{MNOTE_PENTAX2_TAG_BLACK_POINT, "BlackPoint", N_("Black Point"), ""},
|
||||
{MNOTE_PENTAX2_TAG_WHITE_POINT, "WhitePoint", N_("White Point"), ""},
|
||||
{MNOTE_PENTAX2_TAG_AE_INFO, "AEInfo", N_("AE Info"), ""},
|
||||
{MNOTE_PENTAX2_TAG_LENS_INFO, "LensInfo", N_("Lens Info"), ""},
|
||||
{MNOTE_PENTAX2_TAG_FLASH_INFO, "FlashInfo", N_("Flash Info"), ""},
|
||||
{MNOTE_PENTAX2_TAG_CAMERA_INFO, "CameraInfo", N_("Camera Info"), ""},
|
||||
{MNOTE_PENTAX2_TAG_BATTERY_INFO, "BatteryInfo", N_("Battery Info"), ""},
|
||||
{MNOTE_PENTAX2_TAG_HOMETOWN_CITY_CODE, "HometownCityCode", N_("Hometown City Code"), ""},
|
||||
{MNOTE_PENTAX2_TAG_DESTINATION_CITY_CODE, "DestinationCityCode", N_("Destination City Code"), ""},
|
||||
|
||||
{MNOTE_CASIO2_TAG_PREVIEW_START, "CasioPreviewStart", N_("Preview Start"), ""},
|
||||
{MNOTE_CASIO2_TAG_WHITE_BALANCE_BIAS, "WhiteBalanceBias", N_("White Balance Bias"), ""},
|
||||
{MNOTE_CASIO2_TAG_WHITE_BALANCE, "WhiteBalance", N_("White Balance"), ""},
|
||||
{MNOTE_CASIO2_TAG_OBJECT_DISTANCE, "ObjectDistance", N_("Object Distance"), N_("Distance of photographed object in millimeters.")},
|
||||
{MNOTE_CASIO2_TAG_FLASH_DISTANCE, "FlashDistance", N_("Flash Distance"), ""},
|
||||
{MNOTE_CASIO2_TAG_RECORD_MODE, "RecordMode", N_("Record Mode"), ""},
|
||||
{MNOTE_CASIO2_TAG_SELF_TIMER, "SelfTimer", N_("Self-timer"), ""},
|
||||
{MNOTE_CASIO2_TAG_QUALITY, "CasioQuality", N_("Quality Level"), ""},
|
||||
{MNOTE_CASIO2_TAG_FOCUS_MODE, "CasioFocusMode", N_("Focus Mode"), ""},
|
||||
{MNOTE_CASIO2_TAG_TIME_ZONE, "TimeZone", N_("Time Zone"), ""},
|
||||
{MNOTE_CASIO2_TAG_BESTSHOT_MODE, "BestshotMode", N_("Bestshot Mode"), ""},
|
||||
{MNOTE_CASIO2_TAG_CCS_ISO_SENSITIVITY, "CCSISOSensitivity", N_("CCS ISO Sensitivity"), ""},
|
||||
{MNOTE_CASIO2_TAG_COLOR_MODE, "ColorMode", N_("Color Mode"), ""},
|
||||
{MNOTE_CASIO2_TAG_ENHANCEMENT, "Enhancement", N_("Enhancement"), ""},
|
||||
{MNOTE_CASIO2_TAG_FINER, "Finer", N_("Finer"), ""},
|
||||
#endif
|
||||
{0, NULL, NULL, NULL}
|
||||
};
|
||||
|
||||
const char *
|
||||
mnote_pentax_tag_get_name (MnotePentaxTag t)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
|
||||
if (table[i].tag == t) return (table[i].name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
mnote_pentax_tag_get_title (MnotePentaxTag t)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
|
||||
if (table[i].tag == t) return (_(table[i].title));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
const char *
|
||||
mnote_pentax_tag_get_description (MnotePentaxTag t)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < sizeof (table) / sizeof (table[0]); i++)
|
||||
if (table[i].tag == t) {
|
||||
if (!table[i].description || !*table[i].description)
|
||||
return "";
|
||||
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
|
||||
return _(table[i].description);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
153
libexifa/pentax/mnote-pentax-tag.h
Executable file
153
libexifa/pentax/mnote-pentax-tag.h
Executable file
@@ -0,0 +1,153 @@
|
||||
/* mnote-pentax-tag.h
|
||||
*
|
||||
* Copyright (c) 2002, 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_PENTAX_TAG_H__
|
||||
#define __MNOTE_PENTAX_TAG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*
|
||||
* Missing features which are probably in the unknowns somewhere ...
|
||||
* 1/ AF Area (Wide, Spot, Free)
|
||||
* 2/ AE Metering (Multi segment, Centre-weighted, Spot)
|
||||
* 3/
|
||||
*/
|
||||
|
||||
enum _MnotePentaxTag {
|
||||
MNOTE_PENTAX_TAG_MODE = 0x0001,
|
||||
MNOTE_PENTAX_TAG_QUALITY = 0x0002,
|
||||
MNOTE_PENTAX_TAG_FOCUS = 0x0003,
|
||||
MNOTE_PENTAX_TAG_FLASH = 0x0004,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_05 = 0x0005,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_06 = 0x0006,
|
||||
MNOTE_PENTAX_TAG_WHITE_BALANCE = 0x0007,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_08 = 0x0008,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_09 = 0x0009,
|
||||
MNOTE_PENTAX_TAG_ZOOM = 0x000a,
|
||||
MNOTE_PENTAX_TAG_SHARPNESS = 0x000b,
|
||||
MNOTE_PENTAX_TAG_CONTRAST = 0x000c,
|
||||
MNOTE_PENTAX_TAG_SATURATION = 0x000d,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_14 = 0x000e,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_15 = 0x000f,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_16 = 0x0010,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_17 = 0x0011,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_18 = 0x0012,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_19 = 0x0013,
|
||||
MNOTE_PENTAX_TAG_ISO_SPEED = 0x0014,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_21 = 0x0015,
|
||||
MNOTE_PENTAX_TAG_COLOR = 0x0017,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_24 = 0x0018,
|
||||
MNOTE_PENTAX_TAG_UNKNOWN_25 = 0x0019,
|
||||
MNOTE_PENTAX_TAG_PRINTIM = 0x0e00,
|
||||
MNOTE_PENTAX_TAG_TZ_CITY = 0x1000,
|
||||
MNOTE_PENTAX_TAG_TZ_DST = 0x1001,
|
||||
|
||||
/* Pentax v2, v3: real values + our proprietary base to distinguish from v1 */
|
||||
MNOTE_PENTAX2_TAG_BASE = 0x4000,
|
||||
MNOTE_PENTAX2_TAG_MODE = 0x0001 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_PREVIEW_SIZE = 0x0002 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_PREVIEW_LENGTH = 0x0003 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_PREVIEW_START = 0x0004 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_MODEL_ID = 0x0005 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_DATE = 0x0006 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_TIME = 0x0007 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_QUALITY = 0x0008 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_IMAGE_SIZE = 0x0009 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_PICTURE_MODE = 0x000b + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FLASH_MODE = 0x000c + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FOCUS_MODE = 0x000d + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_AFPOINT_SELECTED = 0x000e + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_AUTO_AFPOINT = 0x000f + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FOCUS_POSITION = 0x0010 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_EXPOSURE_TIME = 0x0012 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FNUMBER = 0x0013 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_ISO = 0x0014 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_EXPOSURE_COMPENSATION = 0x0016 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_METERING_MODE = 0x0017 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_AUTO_BRACKETING = 0x0018 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_WHITE_BALANCE = 0x0019 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_WHITE_BALANCE_MODE= 0x001a + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_BLUE_BALANCE = 0x001b + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_RED_BALANCE = 0x001c + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FOCAL_LENGTH = 0x001d + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_DIGITAL_ZOOM = 0x001e + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_SATURATION = 0x001f + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_CONTRAST = 0x0020 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_SHARPNESS = 0x0021 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_WORLDTIME_LOCATION = 0x0022 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_HOMETOWN_CITY = 0x0023 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_DESTINATION_CITY = 0x0024 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_HOMETOWN_DST = 0x0025 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_DESTINATION_DST = 0x0026 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FRAME_NUMBER = 0x0029 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_IMAGE_PROCESSING = 0x0032 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_PICTURE_MODE2 = 0x0033 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_DRIVE_MODE = 0x0034 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_COLOR_SPACE = 0x0037 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_IMAGE_AREA_OFFSET = 0x0038 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_RAW_IMAGE_SIZE = 0x0039 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_AFPOINTS_USED = 0x003c + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_LENS_TYPE = 0x003f + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_CAMERA_TEMPERATURE = 0x0047 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_NOISE_REDUCTION = 0x0049 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FLASH_EXPOSURE_COMP = 0x004d + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_IMAGE_TONE = 0x004f + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_SHAKE_REDUCTION_INFO = 0x005c + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_BLACK_POINT = 0x0200 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_WHITE_POINT = 0x0201 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_AE_INFO = 0x0206 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_LENS_INFO = 0x0207 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_FLASH_INFO = 0x0208 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_CAMERA_INFO = 0x0215 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_BATTERY_INFO = 0x0216 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_HOMETOWN_CITY_CODE = 0x1000 + MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_PENTAX2_TAG_DESTINATION_CITY_CODE = 0x1001 + MNOTE_PENTAX2_TAG_BASE,
|
||||
|
||||
/* Casio v2: some Casio v2 tags match Pentax v2 tags */
|
||||
MNOTE_CASIO2_TAG_BASE = MNOTE_PENTAX2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_PREVIEW_START = 0x2000 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_WHITE_BALANCE_BIAS = 0x2011 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_WHITE_BALANCE = 0x2012 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_OBJECT_DISTANCE = 0x2022 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_FLASH_DISTANCE = 0x2034 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_RECORD_MODE = 0x3000 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_SELF_TIMER = 0x3001 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_QUALITY = 0x3002 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_FOCUS_MODE = 0x3003 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_TIME_ZONE = 0x3006 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_BESTSHOT_MODE = 0x3007 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_CCS_ISO_SENSITIVITY = 0x3014 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_COLOR_MODE = 0x3015 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_ENHANCEMENT = 0x3016 + MNOTE_CASIO2_TAG_BASE,
|
||||
MNOTE_CASIO2_TAG_FINER = 0x3017 + MNOTE_CASIO2_TAG_BASE
|
||||
};
|
||||
typedef enum _MnotePentaxTag MnotePentaxTag;
|
||||
|
||||
const char *mnote_pentax_tag_get_name (MnotePentaxTag tag);
|
||||
const char *mnote_pentax_tag_get_title (MnotePentaxTag tag);
|
||||
const char *mnote_pentax_tag_get_description (MnotePentaxTag tag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MNOTE_PENTAX_TAG_H__ */
|
||||
29
libjpega/Android.mk
Executable file
29
libjpega/Android.mk
Executable file
@@ -0,0 +1,29 @@
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_PRELINK_MODULE:=false
|
||||
|
||||
LOCAL_C_INCLUDES += $(LOCAL_PATH)\
|
||||
$(LOCAL_PATH)/libjpeg/\
|
||||
$(LOCAL_PATH)/libexif/\
|
||||
$(LOCAL_PATH)/libexif/canon/\
|
||||
$(LOCAL_PATH)/libexif/fuji/\
|
||||
$(LOCAL_PATH)/libexif/olympus/\
|
||||
$(LOCAL_PATH)/libexif/pentax/
|
||||
|
||||
LOCAL_SHARED_LIBRARIES:= \
|
||||
libexifa
|
||||
|
||||
LOCAL_SRC_FILES:=\
|
||||
jpeg-data.c\
|
||||
jpeg-marker.c\
|
||||
exif-i18n
|
||||
|
||||
#LOCAL_CFLAGS:=-O2 -g
|
||||
#LOCAL_CFLAGS+=-DHAVE_CONFIG_H -D_U_="__attribute__((unused))" -Dlinux -D__GLIBC__ -D_GNU_SOURCE
|
||||
|
||||
LOCAL_MODULE_TAGS := optional
|
||||
|
||||
LOCAL_MODULE:= libjpega
|
||||
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
0
libjpega/MODULE_LICENSE_LGPL
Executable file
0
libjpega/MODULE_LICENSE_LGPL
Executable file
504
libjpega/NOTICE
Executable file
504
libjpega/NOTICE
Executable file
@@ -0,0 +1,504 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 2.1, February 1999
|
||||
|
||||
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
[This is the first released version of the Lesser GPL. It also counts
|
||||
as the successor of the GNU Library Public License, version 2, hence
|
||||
the version number 2.1.]
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
Licenses are intended to guarantee your freedom to share and change
|
||||
free software--to make sure the software is free for all its users.
|
||||
|
||||
This license, the Lesser General Public License, applies to some
|
||||
specially designated software packages--typically libraries--of the
|
||||
Free Software Foundation and other authors who decide to use it. You
|
||||
can use it too, but we suggest you first think carefully about whether
|
||||
this license or the ordinary General Public License is the better
|
||||
strategy to use in any particular case, based on the explanations below.
|
||||
|
||||
When we speak of free software, we are referring to freedom of use,
|
||||
not price. Our General Public Licenses are designed to make sure that
|
||||
you have the freedom to distribute copies of free software (and charge
|
||||
for this service if you wish); that you receive source code or can get
|
||||
it if you want it; that you can change the software and use pieces of
|
||||
it in new free programs; and that you are informed that you can do
|
||||
these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
distributors to deny you these rights or to ask you to surrender these
|
||||
rights. These restrictions translate to certain responsibilities for
|
||||
you if you distribute copies of the library or if you modify it.
|
||||
|
||||
For example, if you distribute copies of the library, whether gratis
|
||||
or for a fee, you must give the recipients all the rights that we gave
|
||||
you. You must make sure that they, too, receive or can get the source
|
||||
code. If you link other code with the library, you must provide
|
||||
complete object files to the recipients, so that they can relink them
|
||||
with the library after making changes to the library and recompiling
|
||||
it. And you must show them these terms so they know their rights.
|
||||
|
||||
We protect your rights with a two-step method: (1) we copyright the
|
||||
library, and (2) we offer you this license, which gives you legal
|
||||
permission to copy, distribute and/or modify the library.
|
||||
|
||||
To protect each distributor, we want to make it very clear that
|
||||
there is no warranty for the free library. Also, if the library is
|
||||
modified by someone else and passed on, the recipients should know
|
||||
that what they have is not the original version, so that the original
|
||||
author's reputation will not be affected by problems that might be
|
||||
introduced by others.
|
||||
|
||||
Finally, software patents pose a constant threat to the existence of
|
||||
any free program. We wish to make sure that a company cannot
|
||||
effectively restrict the users of a free program by obtaining a
|
||||
restrictive license from a patent holder. Therefore, we insist that
|
||||
any patent license obtained for a version of the library must be
|
||||
consistent with the full freedom of use specified in this license.
|
||||
|
||||
Most GNU software, including some libraries, is covered by the
|
||||
ordinary GNU General Public License. This license, the GNU Lesser
|
||||
General Public License, applies to certain designated libraries, and
|
||||
is quite different from the ordinary General Public License. We use
|
||||
this license for certain libraries in order to permit linking those
|
||||
libraries into non-free programs.
|
||||
|
||||
When a program is linked with a library, whether statically or using
|
||||
a shared library, the combination of the two is legally speaking a
|
||||
combined work, a derivative of the original library. The ordinary
|
||||
General Public License therefore permits such linking only if the
|
||||
entire combination fits its criteria of freedom. The Lesser General
|
||||
Public License permits more lax criteria for linking other code with
|
||||
the library.
|
||||
|
||||
We call this license the "Lesser" General Public License because it
|
||||
does Less to protect the user's freedom than the ordinary General
|
||||
Public License. It also provides other free software developers Less
|
||||
of an advantage over competing non-free programs. These disadvantages
|
||||
are the reason we use the ordinary General Public License for many
|
||||
libraries. However, the Lesser license provides advantages in certain
|
||||
special circumstances.
|
||||
|
||||
For example, on rare occasions, there may be a special need to
|
||||
encourage the widest possible use of a certain library, so that it becomes
|
||||
a de-facto standard. To achieve this, non-free programs must be
|
||||
allowed to use the library. A more frequent case is that a free
|
||||
library does the same job as widely used non-free libraries. In this
|
||||
case, there is little to gain by limiting the free library to free
|
||||
software only, so we use the Lesser General Public License.
|
||||
|
||||
In other cases, permission to use a particular library in non-free
|
||||
programs enables a greater number of people to use a large body of
|
||||
free software. For example, permission to use the GNU C Library in
|
||||
non-free programs enables many more people to use the whole GNU
|
||||
operating system, as well as its variant, the GNU/Linux operating
|
||||
system.
|
||||
|
||||
Although the Lesser General Public License is Less protective of the
|
||||
users' freedom, it does ensure that the user of a program that is
|
||||
linked with the Library has the freedom and the wherewithal to run
|
||||
that program using a modified version of the Library.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow. Pay close attention to the difference between a
|
||||
"work based on the library" and a "work that uses the library". The
|
||||
former contains code derived from the library, whereas the latter must
|
||||
be combined with the library in order to run.
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License Agreement applies to any software library or other
|
||||
program which contains a notice placed by the copyright holder or
|
||||
other authorized party saying it may be distributed under the terms of
|
||||
this Lesser General Public License (also called "this License").
|
||||
Each licensee is addressed as "you".
|
||||
|
||||
A "library" means a collection of software functions and/or data
|
||||
prepared so as to be conveniently linked with application programs
|
||||
(which use some of those functions and data) to form executables.
|
||||
|
||||
The "Library", below, refers to any such software library or work
|
||||
which has been distributed under these terms. A "work based on the
|
||||
Library" means either the Library or any derivative work under
|
||||
copyright law: that is to say, a work containing the Library or a
|
||||
portion of it, either verbatim or with modifications and/or translated
|
||||
straightforwardly into another language. (Hereinafter, translation is
|
||||
included without limitation in the term "modification".)
|
||||
|
||||
"Source code" for a work means the preferred form of the work for
|
||||
making modifications to it. For a library, complete source code means
|
||||
all the source code for all modules it contains, plus any associated
|
||||
interface definition files, plus the scripts used to control compilation
|
||||
and installation of the library.
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running a program using the Library is not restricted, and output from
|
||||
such a program is covered only if its contents constitute a work based
|
||||
on the Library (independent of the use of the Library in a tool for
|
||||
writing it). Whether that is true depends on what the Library does
|
||||
and what the program that uses the Library does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Library's
|
||||
complete source code as you receive it, in any medium, provided that
|
||||
you conspicuously and appropriately publish on each copy an
|
||||
appropriate copyright notice and disclaimer of warranty; keep intact
|
||||
all the notices that refer to this License and to the absence of any
|
||||
warranty; and distribute a copy of this License along with the
|
||||
Library.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy,
|
||||
and you may at your option offer warranty protection in exchange for a
|
||||
fee.
|
||||
|
||||
2. You may modify your copy or copies of the Library or any portion
|
||||
of it, thus forming a work based on the Library, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) The modified work must itself be a software library.
|
||||
|
||||
b) You must cause the files modified to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
c) You must cause the whole of the work to be licensed at no
|
||||
charge to all third parties under the terms of this License.
|
||||
|
||||
d) If a facility in the modified Library refers to a function or a
|
||||
table of data to be supplied by an application program that uses
|
||||
the facility, other than as an argument passed when the facility
|
||||
is invoked, then you must make a good faith effort to ensure that,
|
||||
in the event an application does not supply such function or
|
||||
table, the facility still operates, and performs whatever part of
|
||||
its purpose remains meaningful.
|
||||
|
||||
(For example, a function in a library to compute square roots has
|
||||
a purpose that is entirely well-defined independent of the
|
||||
application. Therefore, Subsection 2d requires that any
|
||||
application-supplied function or table used by this function must
|
||||
be optional: if the application does not supply it, the square
|
||||
root function must still compute square roots.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Library,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Library, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote
|
||||
it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Library.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Library
|
||||
with the Library (or with a work based on the Library) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may opt to apply the terms of the ordinary GNU General Public
|
||||
License instead of this License to a given copy of the Library. To do
|
||||
this, you must alter all the notices that refer to this License, so
|
||||
that they refer to the ordinary GNU General Public License, version 2,
|
||||
instead of to this License. (If a newer version than version 2 of the
|
||||
ordinary GNU General Public License has appeared, then you can specify
|
||||
that version instead if you wish.) Do not make any other change in
|
||||
these notices.
|
||||
|
||||
Once this change is made in a given copy, it is irreversible for
|
||||
that copy, so the ordinary GNU General Public License applies to all
|
||||
subsequent copies and derivative works made from that copy.
|
||||
|
||||
This option is useful when you wish to copy part of the code of
|
||||
the Library into a program that is not a library.
|
||||
|
||||
4. You may copy and distribute the Library (or a portion or
|
||||
derivative of it, under Section 2) in object code or executable form
|
||||
under the terms of Sections 1 and 2 above provided that you accompany
|
||||
it with the complete corresponding machine-readable source code, which
|
||||
must be distributed under the terms of Sections 1 and 2 above on a
|
||||
medium customarily used for software interchange.
|
||||
|
||||
If distribution of object code is made by offering access to copy
|
||||
from a designated place, then offering equivalent access to copy the
|
||||
source code from the same place satisfies the requirement to
|
||||
distribute the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
5. A program that contains no derivative of any portion of the
|
||||
Library, but is designed to work with the Library by being compiled or
|
||||
linked with it, is called a "work that uses the Library". Such a
|
||||
work, in isolation, is not a derivative work of the Library, and
|
||||
therefore falls outside the scope of this License.
|
||||
|
||||
However, linking a "work that uses the Library" with the Library
|
||||
creates an executable that is a derivative of the Library (because it
|
||||
contains portions of the Library), rather than a "work that uses the
|
||||
library". The executable is therefore covered by this License.
|
||||
Section 6 states terms for distribution of such executables.
|
||||
|
||||
When a "work that uses the Library" uses material from a header file
|
||||
that is part of the Library, the object code for the work may be a
|
||||
derivative work of the Library even though the source code is not.
|
||||
Whether this is true is especially significant if the work can be
|
||||
linked without the Library, or if the work is itself a library. The
|
||||
threshold for this to be true is not precisely defined by law.
|
||||
|
||||
If such an object file uses only numerical parameters, data
|
||||
structure layouts and accessors, and small macros and small inline
|
||||
functions (ten lines or less in length), then the use of the object
|
||||
file is unrestricted, regardless of whether it is legally a derivative
|
||||
work. (Executables containing this object code plus portions of the
|
||||
Library will still fall under Section 6.)
|
||||
|
||||
Otherwise, if the work is a derivative of the Library, you may
|
||||
distribute the object code for the work under the terms of Section 6.
|
||||
Any executables containing that work also fall under Section 6,
|
||||
whether or not they are linked directly with the Library itself.
|
||||
|
||||
6. As an exception to the Sections above, you may also combine or
|
||||
link a "work that uses the Library" with the Library to produce a
|
||||
work containing portions of the Library, and distribute that work
|
||||
under terms of your choice, provided that the terms permit
|
||||
modification of the work for the customer's own use and reverse
|
||||
engineering for debugging such modifications.
|
||||
|
||||
You must give prominent notice with each copy of the work that the
|
||||
Library is used in it and that the Library and its use are covered by
|
||||
this License. You must supply a copy of this License. If the work
|
||||
during execution displays copyright notices, you must include the
|
||||
copyright notice for the Library among them, as well as a reference
|
||||
directing the user to the copy of this License. Also, you must do one
|
||||
of these things:
|
||||
|
||||
a) Accompany the work with the complete corresponding
|
||||
machine-readable source code for the Library including whatever
|
||||
changes were used in the work (which must be distributed under
|
||||
Sections 1 and 2 above); and, if the work is an executable linked
|
||||
with the Library, with the complete machine-readable "work that
|
||||
uses the Library", as object code and/or source code, so that the
|
||||
user can modify the Library and then relink to produce a modified
|
||||
executable containing the modified Library. (It is understood
|
||||
that the user who changes the contents of definitions files in the
|
||||
Library will not necessarily be able to recompile the application
|
||||
to use the modified definitions.)
|
||||
|
||||
b) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (1) uses at run time a
|
||||
copy of the library already present on the user's computer system,
|
||||
rather than copying library functions into the executable, and (2)
|
||||
will operate properly with a modified version of the library, if
|
||||
the user installs one, as long as the modified version is
|
||||
interface-compatible with the version that the work was made with.
|
||||
|
||||
c) Accompany the work with a written offer, valid for at
|
||||
least three years, to give the same user the materials
|
||||
specified in Subsection 6a, above, for a charge no more
|
||||
than the cost of performing this distribution.
|
||||
|
||||
d) If distribution of the work is made by offering access to copy
|
||||
from a designated place, offer equivalent access to copy the above
|
||||
specified materials from the same place.
|
||||
|
||||
e) Verify that the user has already received a copy of these
|
||||
materials or that you have already sent this user a copy.
|
||||
|
||||
For an executable, the required form of the "work that uses the
|
||||
Library" must include any data and utility programs needed for
|
||||
reproducing the executable from it. However, as a special exception,
|
||||
the materials to be distributed need not include anything that is
|
||||
normally distributed (in either source or binary form) with the major
|
||||
components (compiler, kernel, and so on) of the operating system on
|
||||
which the executable runs, unless that component itself accompanies
|
||||
the executable.
|
||||
|
||||
It may happen that this requirement contradicts the license
|
||||
restrictions of other proprietary libraries that do not normally
|
||||
accompany the operating system. Such a contradiction means you cannot
|
||||
use both them and the Library together in an executable that you
|
||||
distribute.
|
||||
|
||||
7. You may place library facilities that are a work based on the
|
||||
Library side-by-side in a single library together with other library
|
||||
facilities not covered by this License, and distribute such a combined
|
||||
library, provided that the separate distribution of the work based on
|
||||
the Library and of the other library facilities is otherwise
|
||||
permitted, and provided that you do these two things:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work
|
||||
based on the Library, uncombined with any other library
|
||||
facilities. This must be distributed under the terms of the
|
||||
Sections above.
|
||||
|
||||
b) Give prominent notice with the combined library of the fact
|
||||
that part of it is a work based on the Library, and explaining
|
||||
where to find the accompanying uncombined form of the same work.
|
||||
|
||||
8. You may not copy, modify, sublicense, link with, or distribute
|
||||
the Library except as expressly provided under this License. Any
|
||||
attempt otherwise to copy, modify, sublicense, link with, or
|
||||
distribute the Library is void, and will automatically terminate your
|
||||
rights under this License. However, parties who have received copies,
|
||||
or rights, from you under this License will not have their licenses
|
||||
terminated so long as such parties remain in full compliance.
|
||||
|
||||
9. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Library or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Library (or any work based on the
|
||||
Library), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Library or works based on it.
|
||||
|
||||
10. Each time you redistribute the Library (or any work based on the
|
||||
Library), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute, link with or modify the Library
|
||||
subject to these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties with
|
||||
this License.
|
||||
|
||||
11. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Library at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Library by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Library.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under any
|
||||
particular circumstance, the balance of the section is intended to apply,
|
||||
and the section as a whole is intended to apply in other circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
12. If the distribution and/or use of the Library is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Library under this License may add
|
||||
an explicit geographical distribution limitation excluding those countries,
|
||||
so that distribution is permitted only in or among countries not thus
|
||||
excluded. In such case, this License incorporates the limitation as if
|
||||
written in the body of this License.
|
||||
|
||||
13. The Free Software Foundation may publish revised and/or new
|
||||
versions of the Lesser General Public License from time to time.
|
||||
Such new versions will be similar in spirit to the present version,
|
||||
but may differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Library
|
||||
specifies a version number of this License which applies to it and
|
||||
"any later version", you have the option of following the terms and
|
||||
conditions either of that version or of any later version published by
|
||||
the Free Software Foundation. If the Library does not specify a
|
||||
license version number, you may choose any version ever published by
|
||||
the Free Software Foundation.
|
||||
|
||||
14. If you wish to incorporate parts of the Library into other free
|
||||
programs whose distribution conditions are incompatible with these,
|
||||
write to the author to ask for permission. For software which is
|
||||
copyrighted by the Free Software Foundation, write to the Free
|
||||
Software Foundation; we sometimes make exceptions for this. Our
|
||||
decision will be guided by the two goals of preserving the free status
|
||||
of all derivatives of our free software and of promoting the sharing
|
||||
and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
|
||||
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
|
||||
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
|
||||
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
|
||||
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
|
||||
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
|
||||
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
|
||||
|
||||
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
|
||||
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
|
||||
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
|
||||
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
|
||||
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
|
||||
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
|
||||
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
|
||||
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
|
||||
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
|
||||
DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Libraries
|
||||
|
||||
If you develop a new library, and you want it to be of the greatest
|
||||
possible use to the public, we recommend making it free software that
|
||||
everyone can redistribute and change. You can do so by permitting
|
||||
redistribution under these terms (or, alternatively, under the terms of the
|
||||
ordinary General Public License).
|
||||
|
||||
To apply these terms, attach the following notices to the library. It is
|
||||
safest to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least the
|
||||
"copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the library's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Lesser General Public
|
||||
License as published by the Free Software Foundation; either
|
||||
version 2.1 of the License, or (at your option) any later version.
|
||||
|
||||
This library is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this library; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the library, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the
|
||||
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1990
|
||||
Ty Coon, President of Vice
|
||||
|
||||
That's all there is to it!
|
||||
|
||||
|
||||
42
libjpega/exif-i18n.c
Executable file
42
libjpega/exif-i18n.c
Executable file
@@ -0,0 +1,42 @@
|
||||
#include <config.h>
|
||||
#include "exif-i18n.h"
|
||||
|
||||
#ifdef HAVE_ICONV
|
||||
# include <iconv.h>
|
||||
# include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#undef MIN
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
const char *
|
||||
exif_i18n_convert_utf8_to_locale (const char *in)
|
||||
{
|
||||
#if defined(ENABLE_GETTEXT_ICONV) && defined(HAVE_ICONV)
|
||||
/* If gettext() doesn't convert the message texts into the proper
|
||||
* encoding for the current locale, then it's broken (because there's
|
||||
* no way for the app to know the encoding of the translated text).
|
||||
* In this case, assume the translated text is in UTF-8 (which could
|
||||
* be wrong) and use iconv to convert to the proper encoding.
|
||||
* This is only an issue with really old gettext versions (< 0.10.36)
|
||||
*/
|
||||
static iconv_t tr = 0;
|
||||
size_t t = (in ? strlen (in) : 0);
|
||||
static char buf[2048];
|
||||
size_t buf_size = sizeof (buf);
|
||||
char *out = buf;
|
||||
|
||||
if (!in) return "";
|
||||
|
||||
memset (buf, 0, sizeof (buf));
|
||||
if (!tr) tr = iconv_open (nl_langinfo (CODESET), "UTF-8");
|
||||
iconv (tr, (char **) &in, &t, (char **) &out, &buf_size);
|
||||
return buf;
|
||||
#else
|
||||
if (!in) return "";
|
||||
return in;
|
||||
#endif
|
||||
}
|
||||
537
libjpega/jpeg-data.c
Executable file
537
libjpega/jpeg-data.c
Executable file
@@ -0,0 +1,537 @@
|
||||
/* jpeg-data.c
|
||||
*
|
||||
* Copyright ?2001 Lutz M?ler <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#include "config.h"
|
||||
#include "jpeg-data.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
/* This refers to the exif-i18n.h file from the "exif" package and is
|
||||
* NOT to be confused with the libexif/i18n.h file.
|
||||
*/
|
||||
#include "exif-i18n.h"
|
||||
|
||||
/* realloc that cleans up on memory failure and returns to caller */
|
||||
#define CLEANUP_REALLOC(p,s) { \
|
||||
unsigned char *cleanup_ptr = realloc((p),(s)); \
|
||||
if (!cleanup_ptr) { free(p); (p) = NULL; return; } \
|
||||
(p) = cleanup_ptr; \
|
||||
}
|
||||
|
||||
struct _JPEGDataPrivate
|
||||
{
|
||||
unsigned int ref_count;
|
||||
|
||||
ExifLog *log;
|
||||
};
|
||||
|
||||
JPEGData *
|
||||
jpeg_data_new (void)
|
||||
{
|
||||
JPEGData *data;
|
||||
|
||||
data = malloc (sizeof (JPEGData));
|
||||
if (!data)
|
||||
return (NULL);
|
||||
memset (data, 0, sizeof (JPEGData));
|
||||
data->priv = malloc (sizeof (JPEGDataPrivate));
|
||||
if (!data->priv) {
|
||||
free (data);
|
||||
return (NULL);
|
||||
}
|
||||
memset (data->priv, 0, sizeof (JPEGDataPrivate));
|
||||
data->priv->ref_count = 1;
|
||||
|
||||
return (data);
|
||||
}
|
||||
|
||||
void
|
||||
jpeg_data_append_section (JPEGData *data)
|
||||
{
|
||||
JPEGSection *s;
|
||||
|
||||
if (!data) return;
|
||||
|
||||
if (!data->count)
|
||||
s = malloc (sizeof (JPEGSection));
|
||||
else
|
||||
s = realloc (data->sections,
|
||||
sizeof (JPEGSection) * (data->count + 1));
|
||||
if (!s) {
|
||||
EXIF_LOG_NO_MEMORY (data->priv->log, "jpeg-data",
|
||||
sizeof (JPEGSection) * (data->count + 1));
|
||||
return;
|
||||
}
|
||||
memset(s + data->count, 0, sizeof (JPEGSection));
|
||||
data->sections = s;
|
||||
data->count++;
|
||||
}
|
||||
|
||||
/*! jpeg_data_save_file returns 1 on success, 0 on failure */
|
||||
int
|
||||
jpeg_data_save_file (JPEGData *data, const char *path)
|
||||
{
|
||||
FILE *f;
|
||||
unsigned char *d = NULL;
|
||||
unsigned int size = 0, written;
|
||||
|
||||
jpeg_data_save_data (data, &d, &size);
|
||||
if (!d)
|
||||
return 0;
|
||||
|
||||
remove (path);
|
||||
f = fopen (path, "wb");
|
||||
if (!f) {
|
||||
free (d);
|
||||
return 0;
|
||||
}
|
||||
written = fwrite (d, 1, size, f);
|
||||
fclose (f);
|
||||
free (d);
|
||||
if (written == size) {
|
||||
return 1;
|
||||
}
|
||||
remove(path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
jpeg_data_save_data (JPEGData *data, unsigned char **d, unsigned int *ds)
|
||||
{
|
||||
unsigned int i, eds = 0;
|
||||
JPEGSection s;
|
||||
unsigned char *ed = NULL;
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
if (!d)
|
||||
return;
|
||||
if (!ds)
|
||||
return;
|
||||
|
||||
for (*ds = i = 0; i < data->count; i++) {
|
||||
s = data->sections[i];
|
||||
|
||||
/* Write the marker */
|
||||
CLEANUP_REALLOC (*d, sizeof (char) * (*ds + 2));
|
||||
(*d)[*ds + 0] = 0xff;
|
||||
(*d)[*ds + 1] = s.marker;
|
||||
*ds += 2;
|
||||
|
||||
switch (s.marker) {
|
||||
case JPEG_MARKER_SOI:
|
||||
case JPEG_MARKER_EOI:
|
||||
break;
|
||||
case JPEG_MARKER_APP1:
|
||||
exif_data_save_data (s.content.app1, &ed, &eds);
|
||||
if (!ed) break;
|
||||
CLEANUP_REALLOC (*d, sizeof (char) * (*ds + 2));
|
||||
(*d)[*ds + 0] = (eds + 2) >> 8;
|
||||
(*d)[*ds + 1] = (eds + 2) >> 0;
|
||||
*ds += 2;
|
||||
CLEANUP_REALLOC (*d, sizeof (char) * (*ds + eds));
|
||||
memcpy (*d + *ds, ed, eds);
|
||||
*ds += eds;
|
||||
free (ed);
|
||||
break;
|
||||
default:
|
||||
CLEANUP_REALLOC (*d, sizeof (char) *
|
||||
(*ds + s.content.generic.size + 2));
|
||||
(*d)[*ds + 0] = (s.content.generic.size + 2) >> 8;
|
||||
(*d)[*ds + 1] = (s.content.generic.size + 2) >> 0;
|
||||
*ds += 2;
|
||||
memcpy (*d + *ds, s.content.generic.data,
|
||||
s.content.generic.size);
|
||||
*ds += s.content.generic.size;
|
||||
|
||||
/* In case of SOS, we need to write the data. */
|
||||
if (s.marker == JPEG_MARKER_SOS) {
|
||||
CLEANUP_REALLOC (*d, *ds + data->size);
|
||||
memcpy (*d + *ds, data->data, data->size);
|
||||
*ds += data->size;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void jpeg_data_save_data_no_copy(JPEGData *data, unsigned char *d, unsigned int *ds)
|
||||
{
|
||||
unsigned int i, eds = 0;
|
||||
JPEGSection s;
|
||||
unsigned char *ed = NULL;
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
if (!d)
|
||||
return;
|
||||
if (!ds)
|
||||
return;
|
||||
|
||||
for (*ds = i = 0; i < data->count; i++) {
|
||||
s = data->sections[i];
|
||||
|
||||
/* Write the marker */
|
||||
//CLEANUP_REALLOC (*d, sizeof (char) * (*ds + 2));
|
||||
d[*ds + 0] = 0xff;
|
||||
d[*ds + 1] = s.marker;
|
||||
*ds += 2;
|
||||
|
||||
switch (s.marker) {
|
||||
case JPEG_MARKER_SOI:
|
||||
case JPEG_MARKER_EOI:
|
||||
break;
|
||||
case JPEG_MARKER_APP1:
|
||||
exif_data_save_data (s.content.app1, &ed, &eds);
|
||||
if (!ed) break;
|
||||
//CLEANUP_REALLOC (*d, sizeof (char) * (*ds + 2));
|
||||
d[*ds + 0] = (eds + 2) >> 8;
|
||||
d[*ds + 1] = (eds + 2) >> 0;
|
||||
*ds += 2;
|
||||
//CLEANUP_REALLOC (*d, sizeof (char) * (*ds + eds));
|
||||
memcpy (d + *ds, ed, eds);
|
||||
*ds += eds;
|
||||
free (ed);
|
||||
break;
|
||||
default:
|
||||
/*CLEANUP_REALLOC (*d, sizeof (char) *
|
||||
(*ds + s.content.generic.size + 2));*/
|
||||
d[*ds + 0] = (s.content.generic.size + 2) >> 8;
|
||||
d[*ds + 1] = (s.content.generic.size + 2) >> 0;
|
||||
*ds += 2;
|
||||
memcpy (d + *ds, s.content.generic.data,
|
||||
s.content.generic.size);
|
||||
*ds += s.content.generic.size;
|
||||
|
||||
/* In case of SOS, we need to write the data. */
|
||||
if (s.marker == JPEG_MARKER_SOS) {
|
||||
//CLEANUP_REALLOC (*d, *ds + data->size);
|
||||
memcpy (d + *ds, data->data, data->size);
|
||||
*ds += data->size;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JPEGData *
|
||||
jpeg_data_new_from_data (const unsigned char *d,
|
||||
unsigned int size)
|
||||
{
|
||||
JPEGData *data;
|
||||
|
||||
data = jpeg_data_new ();
|
||||
jpeg_data_load_data (data, d, size);
|
||||
return (data);
|
||||
}
|
||||
|
||||
void
|
||||
jpeg_data_load_data (JPEGData *data, const unsigned char *d,
|
||||
unsigned int size)
|
||||
{
|
||||
unsigned int i, o, len;
|
||||
JPEGSection *s;
|
||||
JPEGMarker marker;
|
||||
|
||||
if (!data) return;
|
||||
if (!d) return;
|
||||
|
||||
for (o = 0; o < size;) {
|
||||
|
||||
/*
|
||||
* JPEG sections start with 0xff. The first byte that is
|
||||
* not 0xff is a marker (hopefully).
|
||||
*/
|
||||
for (i = 0; i < MIN(7, size - o); i++)
|
||||
if (d[o + i] != 0xff)
|
||||
break;
|
||||
if (!JPEG_IS_MARKER (d[o + i])) {
|
||||
exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "jpeg-data",
|
||||
_("Data does not follow JPEG specification."));
|
||||
return;
|
||||
}
|
||||
marker = d[o + i];
|
||||
|
||||
/* Append this section */
|
||||
jpeg_data_append_section (data);
|
||||
if (!data->count) return;
|
||||
s = &data->sections[data->count - 1];
|
||||
s->marker = marker;
|
||||
o += i + 1;
|
||||
|
||||
switch (s->marker) {
|
||||
case JPEG_MARKER_SOI:
|
||||
case JPEG_MARKER_EOI:
|
||||
break;
|
||||
default:
|
||||
|
||||
/* Read the length of the section */
|
||||
len = ((d[o] << 8) | d[o + 1]) - 2;
|
||||
if (len > size) { o = size; break; }
|
||||
o += 2;
|
||||
if (o + len > size) { o = size; break; }
|
||||
|
||||
switch (s->marker) {
|
||||
case JPEG_MARKER_APP1:
|
||||
s->content.app1 = exif_data_new_from_data (
|
||||
d + o - 4, len + 4);
|
||||
break;
|
||||
default:
|
||||
s->content.generic.data =
|
||||
malloc (sizeof (char) * len);
|
||||
if (!s->content.generic.data) return;
|
||||
s->content.generic.size = len;
|
||||
memcpy (s->content.generic.data, &d[o], len);
|
||||
|
||||
/* In case of SOS, image data will follow. */
|
||||
if (s->marker == JPEG_MARKER_SOS) {
|
||||
/* -2 means 'take all but the last 2 bytes which are hoped to be JPEG_MARKER_EOI */
|
||||
data->size = size - 2 - o - len;
|
||||
if (d[o + len + data->size] != 0xFF) {
|
||||
/* A truncated file (i.e. w/o JPEG_MARKER_EOI at the end).
|
||||
Instead of trying to use the last two bytes as marker,
|
||||
touching memory beyond allocated memory and posssibly saving
|
||||
back screwed file, we rather take the rest of the file. */
|
||||
data->size += 2;
|
||||
}
|
||||
data->data = malloc (
|
||||
sizeof (char) * data->size);
|
||||
if (!data->data) return;
|
||||
memcpy (data->data, d + o + len,
|
||||
data->size);
|
||||
o += data->size;
|
||||
}
|
||||
break;
|
||||
}
|
||||
o += len;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JPEGData *
|
||||
jpeg_data_new_from_file (const char *path)
|
||||
{
|
||||
JPEGData *data;
|
||||
|
||||
data = jpeg_data_new ();
|
||||
jpeg_data_load_file (data, path);
|
||||
return (data);
|
||||
}
|
||||
|
||||
void
|
||||
jpeg_data_load_file (JPEGData *data, const char *path)
|
||||
{
|
||||
FILE *f;
|
||||
unsigned char *d;
|
||||
unsigned int size;
|
||||
|
||||
if (!data) return;
|
||||
if (!path) return;
|
||||
|
||||
f = fopen (path, "rb");
|
||||
if (!f) {
|
||||
exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "jpeg-data",
|
||||
_("Path '%s' invalid."), path);
|
||||
return;
|
||||
}
|
||||
|
||||
/* For now, we read the data into memory. Patches welcome... */
|
||||
fseek (f, 0, SEEK_END);
|
||||
size = ftell (f);
|
||||
fseek (f, 0, SEEK_SET);
|
||||
d = malloc (size);
|
||||
if (!d) {
|
||||
EXIF_LOG_NO_MEMORY (data->priv->log, "jpeg-data", size);
|
||||
fclose (f);
|
||||
return;
|
||||
}
|
||||
if (fread (d, 1, size, f) != size) {
|
||||
free (d);
|
||||
fclose (f);
|
||||
exif_log (data->priv->log, EXIF_LOG_CODE_CORRUPT_DATA, "jpeg-data",
|
||||
_("Could not read '%s'."), path);
|
||||
return;
|
||||
}
|
||||
fclose (f);
|
||||
|
||||
jpeg_data_load_data (data, d, size);
|
||||
free (d);
|
||||
}
|
||||
|
||||
void
|
||||
jpeg_data_ref (JPEGData *data)
|
||||
{
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
data->priv->ref_count++;
|
||||
}
|
||||
|
||||
void
|
||||
jpeg_data_unref (JPEGData *data)
|
||||
{
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
if (data->priv) {
|
||||
data->priv->ref_count--;
|
||||
if (!data->priv->ref_count)
|
||||
jpeg_data_free (data);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
jpeg_data_free (JPEGData *data)
|
||||
{
|
||||
unsigned int i;
|
||||
JPEGSection s;
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
if (data->count) {
|
||||
for (i = 0; i < data->count; i++) {
|
||||
s = data->sections[i];
|
||||
switch (s.marker) {
|
||||
case JPEG_MARKER_SOI:
|
||||
case JPEG_MARKER_EOI:
|
||||
break;
|
||||
case JPEG_MARKER_APP1:
|
||||
exif_data_unref (s.content.app1);
|
||||
break;
|
||||
default:
|
||||
free (s.content.generic.data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
free (data->sections);
|
||||
}
|
||||
|
||||
if (data->data)
|
||||
free (data->data);
|
||||
|
||||
if (data->priv) {
|
||||
if (data->priv->log) {
|
||||
exif_log_unref (data->priv->log);
|
||||
data->priv->log = NULL;
|
||||
}
|
||||
free (data->priv);
|
||||
}
|
||||
|
||||
free (data);
|
||||
}
|
||||
|
||||
void
|
||||
jpeg_data_dump (JPEGData *data)
|
||||
{
|
||||
unsigned int i;
|
||||
JPEGContent content;
|
||||
JPEGMarker marker;
|
||||
|
||||
if (!data)
|
||||
return;
|
||||
|
||||
printf ("Dumping JPEG data (%i bytes of data)...\n", data->size);
|
||||
for (i = 0; i < data->count; i++) {
|
||||
marker = data->sections[i].marker;
|
||||
content = data->sections[i].content;
|
||||
printf ("Section %i (marker 0x%x - %s):\n", i, marker,
|
||||
jpeg_marker_get_name (marker));
|
||||
printf (" Description: %s\n",
|
||||
jpeg_marker_get_description (marker));
|
||||
switch (marker) {
|
||||
case JPEG_MARKER_SOI:
|
||||
case JPEG_MARKER_EOI:
|
||||
break;
|
||||
case JPEG_MARKER_APP1:
|
||||
exif_data_dump (content.app1);
|
||||
break;
|
||||
default:
|
||||
printf (" Size: %i\n", content.generic.size);
|
||||
printf (" Unknown content.\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static JPEGSection *
|
||||
jpeg_data_get_section (JPEGData *data, JPEGMarker marker)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
if (!data)
|
||||
return (NULL);
|
||||
|
||||
for (i = 0; i < data->count; i++)
|
||||
if (data->sections[i].marker == marker)
|
||||
return (&data->sections[i]);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
ExifData *
|
||||
jpeg_data_get_exif_data (JPEGData *data)
|
||||
{
|
||||
JPEGSection *section;
|
||||
|
||||
if (!data)
|
||||
return NULL;
|
||||
|
||||
section = jpeg_data_get_section (data, JPEG_MARKER_APP1);
|
||||
if (section) {
|
||||
exif_data_ref (section->content.app1);
|
||||
return (section->content.app1);
|
||||
}
|
||||
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
jpeg_data_set_exif_data (JPEGData *data, ExifData *exif_data)
|
||||
{
|
||||
JPEGSection *section;
|
||||
|
||||
if (!data) return;
|
||||
|
||||
section = jpeg_data_get_section (data, JPEG_MARKER_APP1);
|
||||
if (!section) {
|
||||
jpeg_data_append_section (data);
|
||||
if (data->count < 2) return;
|
||||
memmove (&data->sections[2], &data->sections[1],
|
||||
sizeof (JPEGSection) * (data->count - 2));
|
||||
section = &data->sections[1];
|
||||
} else {
|
||||
exif_data_unref (section->content.app1);
|
||||
}
|
||||
section->marker = JPEG_MARKER_APP1;
|
||||
section->content.app1 = exif_data;
|
||||
exif_data_ref (exif_data);
|
||||
}
|
||||
|
||||
void
|
||||
jpeg_data_log (JPEGData *data, ExifLog *log)
|
||||
{
|
||||
if (!data || !data->priv) return;
|
||||
if (data->priv->log) exif_log_unref (data->priv->log);
|
||||
data->priv->log = log;
|
||||
exif_log_ref (log);
|
||||
}
|
||||
122
libjpega/jpeg-marker.c
Executable file
122
libjpega/jpeg-marker.c
Executable file
@@ -0,0 +1,122 @@
|
||||
/* jpeg-marker.c
|
||||
*
|
||||
* Copyright <20> 2001-2008 Lutz M<>ller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
#include "config.h"
|
||||
#include "jpeg-marker.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
static const struct {
|
||||
JPEGMarker marker;
|
||||
const char *name;
|
||||
const char *description;
|
||||
} JPEGMarkerTable[] = {
|
||||
{JPEG_MARKER_SOF0, "SOF0", "Encoding (baseline)"},
|
||||
{JPEG_MARKER_SOF1, "SOF1", "Encoding (extended sequential)"},
|
||||
{JPEG_MARKER_SOF2, "SOF2", "Encoding (progressive)"},
|
||||
{JPEG_MARKER_SOF3, "SOF3", "Encoding (lossless)"},
|
||||
{JPEG_MARKER_SOF5, "SOF5", "Encoding (differential sequential)"},
|
||||
{JPEG_MARKER_SOF6, "SOF6", "Encoding (differential progressive)"},
|
||||
{JPEG_MARKER_SOF7, "SOF7", "Encoding (differential lossless)"},
|
||||
{JPEG_MARKER_SOF9, "SOF9",
|
||||
"Encoding (extended sequential, arithmetic)"},
|
||||
{JPEG_MARKER_SOF10, "SOF10", "Encoding (progressive, arithmetic)"},
|
||||
{JPEG_MARKER_SOF11, "SOF11", "Encoding (lossless, arithmetic)"},
|
||||
{JPEG_MARKER_SOF13, "SOF13",
|
||||
"Encoding (differential sequential, arithmetic)"},
|
||||
{JPEG_MARKER_SOF14, "SOF14",
|
||||
"Encoding (differential progressive, arithmetic)"},
|
||||
{JPEG_MARKER_SOF15, "SOF15",
|
||||
"Encoding (differential lossless, arithmetic)"},
|
||||
{JPEG_MARKER_SOI, "SOI", "Start of image"},
|
||||
{JPEG_MARKER_EOI, "EOI", "End of image"},
|
||||
{JPEG_MARKER_SOS, "SOS", "Start of scan"},
|
||||
{JPEG_MARKER_COM, "COM", "Comment"},
|
||||
{JPEG_MARKER_DHT, "DHT", "Define Huffman table"},
|
||||
{JPEG_MARKER_JPG, "JPG", "Extension"},
|
||||
{JPEG_MARKER_DAC, "DAC", "Define arithmetic coding conditioning"},
|
||||
{JPEG_MARKER_RST1, "RST1", "Restart 1"},
|
||||
{JPEG_MARKER_RST2, "RST2", "Restart 2"},
|
||||
{JPEG_MARKER_RST3, "RST3", "Restart 3"},
|
||||
{JPEG_MARKER_RST4, "RST4", "Restart 4"},
|
||||
{JPEG_MARKER_RST5, "RST5", "Restart 5"},
|
||||
{JPEG_MARKER_RST6, "RST6", "Restart 6"},
|
||||
{JPEG_MARKER_RST7, "RST7", "Restart 7"},
|
||||
{JPEG_MARKER_DQT, "DQT", "Define quantization table"},
|
||||
{JPEG_MARKER_DNL, "DNL", "Define number of lines"},
|
||||
{JPEG_MARKER_DRI, "DRI", "Define restart interval"},
|
||||
{JPEG_MARKER_DHP, "DHP", "Define hierarchical progression"},
|
||||
{JPEG_MARKER_EXP, "EXP", "Expand reference component"},
|
||||
{JPEG_MARKER_APP0, "APP0", "Application segment 0"},
|
||||
{JPEG_MARKER_APP1, "APP1", "Application segment 1"},
|
||||
{JPEG_MARKER_APP2, "APP2", "Application segment 2"},
|
||||
{JPEG_MARKER_APP3, "APP3", "Application segment 3"},
|
||||
{JPEG_MARKER_APP4, "APP4", "Application segment 4"},
|
||||
{JPEG_MARKER_APP5, "APP5", "Application segment 5"},
|
||||
{JPEG_MARKER_APP6, "APP6", "Application segment 6"},
|
||||
{JPEG_MARKER_APP7, "APP7", "Application segment 7"},
|
||||
{JPEG_MARKER_APP8, "APP8", "Application segment 8"},
|
||||
{JPEG_MARKER_APP9, "APP9", "Application segment 9"},
|
||||
{JPEG_MARKER_APP10, "APP10", "Application segment 10"},
|
||||
{JPEG_MARKER_APP11, "APP11", "Application segment 11"},
|
||||
{JPEG_MARKER_APP12, "APP12", "Application segment 12"},
|
||||
{JPEG_MARKER_APP13, "APP13", "Application segment 13"},
|
||||
{JPEG_MARKER_APP14, "APP14", "Application segment 14"},
|
||||
{JPEG_MARKER_APP15, "APP15", "Application segment 15"},
|
||||
{JPEG_MARKER_JPG0, "JPG0", "Extension 0"},
|
||||
{JPEG_MARKER_JPG1, "JPG1", "Extension 1"},
|
||||
{JPEG_MARKER_JPG2, "JPG2", "Extension 2"},
|
||||
{JPEG_MARKER_JPG3, "JPG3", "Extension 3"},
|
||||
{JPEG_MARKER_JPG4, "JPG4", "Extension 4"},
|
||||
{JPEG_MARKER_JPG5, "JPG5", "Extension 5"},
|
||||
{JPEG_MARKER_JPG6, "JPG6", "Extension 6"},
|
||||
{JPEG_MARKER_JPG7, "JPG7", "Extension 7"},
|
||||
{JPEG_MARKER_JPG8, "JPG8", "Extension 8"},
|
||||
{JPEG_MARKER_JPG9, "JPG9", "Extension 9"},
|
||||
{JPEG_MARKER_JPG10, "JPG10", "Extension 10"},
|
||||
{JPEG_MARKER_JPG11, "JPG11", "Extension 11"},
|
||||
{JPEG_MARKER_JPG12, "JPG12", "Extension 12"},
|
||||
{JPEG_MARKER_JPG13, "JPG13", "Extension 13"},
|
||||
{0, NULL, NULL}
|
||||
};
|
||||
|
||||
const char *
|
||||
jpeg_marker_get_name (JPEGMarker marker)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; JPEGMarkerTable[i].name; i++)
|
||||
if (JPEGMarkerTable[i].marker == marker)
|
||||
break;
|
||||
|
||||
return (JPEGMarkerTable[i].name);
|
||||
}
|
||||
|
||||
const char *
|
||||
jpeg_marker_get_description (JPEGMarker marker)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; JPEGMarkerTable[i].description; i++)
|
||||
if (JPEGMarkerTable[i].marker == marker)
|
||||
break;
|
||||
|
||||
return (JPEGMarkerTable[i].description);
|
||||
}
|
||||
|
||||
2
libjpega/libexif/_stdint.h
Executable file
2
libjpega/libexif/_stdint.h
Executable file
@@ -0,0 +1,2 @@
|
||||
/* This file is generated automatically by configure */
|
||||
#include <stdint.h>
|
||||
58
libjpega/libexif/canon/exif-mnote-data-canon.h
Executable file
58
libjpega/libexif/canon/exif-mnote-data-canon.h
Executable file
@@ -0,0 +1,58 @@
|
||||
/* exif-mnote-data-canon.h
|
||||
*
|
||||
* Copyright (c) 2002, 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_MNOTE_DATA_CANON_H__
|
||||
#define __EXIF_MNOTE_DATA_CANON_H__
|
||||
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-mnote-data.h>
|
||||
#include <libexif/exif-mnote-data-priv.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
#include <libexif/exif-data.h>
|
||||
|
||||
typedef struct _ExifMnoteDataCanon ExifMnoteDataCanon;
|
||||
|
||||
#include <libexif/canon/mnote-canon-entry.h>
|
||||
|
||||
struct _ExifMnoteDataCanon {
|
||||
ExifMnoteData parent;
|
||||
|
||||
MnoteCanonEntry *entries;
|
||||
unsigned int count;
|
||||
|
||||
ExifByteOrder order;
|
||||
unsigned int offset;
|
||||
|
||||
ExifDataOption options;
|
||||
};
|
||||
|
||||
/*! Detect if MakerNote is recognized as one handled by the Canon module.
|
||||
*
|
||||
* \param[in] ed image #ExifData to identify as as a Canon type
|
||||
* \param[in] e #ExifEntry for EXIF_TAG_MAKER_NOTE, from within ed but
|
||||
* duplicated here for convenience
|
||||
* \return 0 if not recognized, nonzero if recognized. The specific nonzero
|
||||
* value returned may identify a subtype unique within this module.
|
||||
*/
|
||||
int exif_mnote_data_canon_identify (const ExifData *ed, const ExifEntry *e);
|
||||
|
||||
ExifMnoteData *exif_mnote_data_canon_new (ExifMem *mem, ExifDataOption o);
|
||||
|
||||
#endif /* __EXIF_MNOTE_DATA_CANON_H__ */
|
||||
44
libjpega/libexif/canon/mnote-canon-entry.h
Executable file
44
libjpega/libexif/canon/mnote-canon-entry.h
Executable file
@@ -0,0 +1,44 @@
|
||||
/* mnote-canon-entry.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_CANON_ENTRY_H__
|
||||
#define __MNOTE_CANON_ENTRY_H__
|
||||
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/canon/mnote-canon-tag.h>
|
||||
|
||||
typedef struct _MnoteCanonEntry MnoteCanonEntry;
|
||||
|
||||
struct _MnoteCanonEntry {
|
||||
MnoteCanonTag tag;
|
||||
ExifFormat format;
|
||||
unsigned long components;
|
||||
|
||||
unsigned char *data;
|
||||
unsigned int size;
|
||||
|
||||
ExifByteOrder order;
|
||||
};
|
||||
|
||||
unsigned int mnote_canon_entry_count_values (const MnoteCanonEntry *);
|
||||
char *mnote_canon_entry_get_value (const MnoteCanonEntry *, unsigned int t, char *val, unsigned int maxlen);
|
||||
|
||||
#endif /* __MNOTE_CANON_ENTRY_H__ */
|
||||
59
libjpega/libexif/canon/mnote-canon-tag.h
Executable file
59
libjpega/libexif/canon/mnote-canon-tag.h
Executable file
@@ -0,0 +1,59 @@
|
||||
/* mnote-canon-tag.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_CANON_TAG_H__
|
||||
#define __MNOTE_CANON_TAG_H__
|
||||
|
||||
#include <libexif/exif-data.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
enum _MnoteCanonTag {
|
||||
MNOTE_CANON_TAG_UNKNOWN_0 = 0x0,
|
||||
MNOTE_CANON_TAG_SETTINGS_1 = 0x1,
|
||||
MNOTE_CANON_TAG_FOCAL_LENGTH = 0x2,
|
||||
MNOTE_CANON_TAG_UNKNOWN_3 = 0x3,
|
||||
MNOTE_CANON_TAG_SETTINGS_2 = 0x4,
|
||||
MNOTE_CANON_TAG_PANORAMA = 0x5,
|
||||
MNOTE_CANON_TAG_IMAGE_TYPE = 0x6,
|
||||
MNOTE_CANON_TAG_FIRMWARE = 0x7,
|
||||
MNOTE_CANON_TAG_IMAGE_NUMBER = 0x8,
|
||||
MNOTE_CANON_TAG_OWNER = 0x9,
|
||||
MNOTE_CANON_TAG_UNKNOWN_10 = 0xa,
|
||||
MNOTE_CANON_TAG_SERIAL_NUMBER = 0xc,
|
||||
MNOTE_CANON_TAG_UNKNOWN_13 = 0xd,
|
||||
MNOTE_CANON_TAG_CUSTOM_FUNCS = 0xf,
|
||||
MNOTE_CANON_TAG_COLOR_INFORMATION = 0xa0
|
||||
};
|
||||
typedef enum _MnoteCanonTag MnoteCanonTag;
|
||||
|
||||
const char *mnote_canon_tag_get_name (MnoteCanonTag);
|
||||
const char *mnote_canon_tag_get_name_sub (MnoteCanonTag, unsigned int, ExifDataOption);
|
||||
const char *mnote_canon_tag_get_title (MnoteCanonTag);
|
||||
const char *mnote_canon_tag_get_title_sub (MnoteCanonTag, unsigned int, ExifDataOption);
|
||||
const char *mnote_canon_tag_get_description (MnoteCanonTag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MNOTE_CANON_TAG_H__ */
|
||||
92
libjpega/libexif/config.h
Executable file
92
libjpega/libexif/config.h
Executable file
@@ -0,0 +1,92 @@
|
||||
/* config.h. Generated from config.h.in by configure. */
|
||||
/* config.h.in. Generated from configure.ac by autoheader. */
|
||||
|
||||
/* Define to 1 if translation of program messages to the user's native
|
||||
language is requested. */
|
||||
/* #undef ENABLE_NLS */
|
||||
|
||||
/* Define if the GNU dcgettext() function is already present or preinstalled.
|
||||
*/
|
||||
/* #undef HAVE_DCGETTEXT */
|
||||
|
||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
||||
#define HAVE_DLFCN_H 1
|
||||
|
||||
/* Define if the GNU gettext() function is already present or preinstalled. */
|
||||
/* #undef HAVE_GETTEXT */
|
||||
|
||||
/* Define if you have the iconv() function. */
|
||||
/* #undef HAVE_ICONV */
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#define HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the `localtime_r' function. */
|
||||
#define HAVE_LOCALTIME_R 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#define HAVE_MEMORY_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#define HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#define HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#define HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#define HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#define HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#define HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#define HAVE_UNISTD_H 1
|
||||
|
||||
/* Define as const if the declaration of iconv() needs const. */
|
||||
/* #undef ICONV_CONST */
|
||||
|
||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
||||
*/
|
||||
#define LT_OBJDIR ".libs/"
|
||||
|
||||
/* Name of package */
|
||||
#define PACKAGE "libexif"
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#define PACKAGE_BUGREPORT "libexif-devel@lists.sourceforge.net"
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#define PACKAGE_NAME "EXIF library"
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#define PACKAGE_STRING "EXIF library 0.6.20"
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#define PACKAGE_TARNAME "libexif"
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#define PACKAGE_URL ""
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#define PACKAGE_VERSION "0.6.20"
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#define STDC_HEADERS 1
|
||||
|
||||
/* Version number of package */
|
||||
#define VERSION "0.6.20"
|
||||
|
||||
/* Define to empty if `const' does not conform to ANSI C. */
|
||||
/* #undef const */
|
||||
|
||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
||||
#ifndef __cplusplus
|
||||
/* #undef inline */
|
||||
#endif
|
||||
46
libjpega/libexif/exif-byte-order.h
Executable file
46
libjpega/libexif/exif-byte-order.h
Executable file
@@ -0,0 +1,46 @@
|
||||
/* exif-byte-order.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_BYTE_ORDER_H__
|
||||
#define __EXIF_BYTE_ORDER_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! Which byte order to use */
|
||||
typedef enum {
|
||||
/*! Big-endian byte order */
|
||||
EXIF_BYTE_ORDER_MOTOROLA,
|
||||
/*! Little-endian byte order */
|
||||
EXIF_BYTE_ORDER_INTEL
|
||||
} ExifByteOrder;
|
||||
|
||||
/*! Return a short, localized, textual name for the given byte order.
|
||||
* \param[in] order byte order
|
||||
* \return localized textual name of the byte order
|
||||
*/
|
||||
const char *exif_byte_order_get_name (ExifByteOrder order);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_BYTE_ORDER_H__ */
|
||||
145
libjpega/libexif/exif-content.h
Executable file
145
libjpega/libexif/exif-content.h
Executable file
@@ -0,0 +1,145 @@
|
||||
/*! \file exif-content.h
|
||||
* \brief Handling EXIF IFDs
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_CONTENT_H__
|
||||
#define __EXIF_CONTENT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! Holds all EXIF tags in a single IFD */
|
||||
typedef struct _ExifContent ExifContent;
|
||||
typedef struct _ExifContentPrivate ExifContentPrivate;
|
||||
|
||||
#include <libexif/exif-tag.h>
|
||||
#include <libexif/exif-entry.h>
|
||||
#include <libexif/exif-data.h>
|
||||
#include <libexif/exif-log.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
struct _ExifContent
|
||||
{
|
||||
ExifEntry **entries;
|
||||
unsigned int count;
|
||||
|
||||
/*! Data containing this content */
|
||||
ExifData *parent;
|
||||
|
||||
ExifContentPrivate *priv;
|
||||
};
|
||||
|
||||
/* Lifecycle */
|
||||
ExifContent *exif_content_new (void);
|
||||
ExifContent *exif_content_new_mem (ExifMem *);
|
||||
void exif_content_ref (ExifContent *content);
|
||||
void exif_content_unref (ExifContent *content);
|
||||
void exif_content_free (ExifContent *content);
|
||||
|
||||
/*! Add an EXIF tag to an IFD.
|
||||
* If this tag already exists in the IFD, this function does nothing.
|
||||
* \pre The "tag" member of the entry must be set on entry.
|
||||
*
|
||||
* \param[out] c IFD
|
||||
* \param[in] entry EXIF entry to add
|
||||
*/
|
||||
void exif_content_add_entry (ExifContent *c, ExifEntry *entry);
|
||||
|
||||
/*! Remove an EXIF tag from an IFD.
|
||||
* If this tag does not exist in the IFD, this function does nothing.
|
||||
*
|
||||
* \param[out] c IFD
|
||||
* \param[in] e EXIF entry to remove
|
||||
*/
|
||||
void exif_content_remove_entry (ExifContent *c, ExifEntry *e);
|
||||
|
||||
/*! Return the #ExifEntry in this IFD corresponding to the given tag.
|
||||
* This is a pointer into a member of the #ExifContent array and must NOT be
|
||||
* freed or unrefed by the caller.
|
||||
*
|
||||
* \param[in] content EXIF content for an IFD
|
||||
* \param[in] tag EXIF tag to return
|
||||
* \return #ExifEntry of the tag, or NULL on error
|
||||
*/
|
||||
ExifEntry *exif_content_get_entry (ExifContent *content, ExifTag tag);
|
||||
|
||||
/*! Fix the IFD to bring it into specification. Call #exif_entry_fix on
|
||||
* each entry in this IFD to fix existing entries, create any new entries
|
||||
* that are mandatory in this IFD but do not yet exist, and remove any
|
||||
* entries that are not allowed in this IFD.
|
||||
*
|
||||
* \param[in,out] c EXIF content for an IFD
|
||||
*/
|
||||
void exif_content_fix (ExifContent *c);
|
||||
|
||||
typedef void (* ExifContentForeachEntryFunc) (ExifEntry *, void *user_data);
|
||||
|
||||
/*! Executes function on each EXIF tag in this IFD in turn.
|
||||
* The tags will not necessarily be visited in numerical order.
|
||||
*
|
||||
* \param[in,out] content IFD over which to iterate
|
||||
* \param[in] func function to call for each entry
|
||||
* \param[in] user_data data to pass into func on each call
|
||||
*/
|
||||
void exif_content_foreach_entry (ExifContent *content,
|
||||
ExifContentForeachEntryFunc func,
|
||||
void *user_data);
|
||||
|
||||
/*! Return the IFD number in which the given #ExifContent is found.
|
||||
*
|
||||
* \param[in] c an #ExifContent*
|
||||
* \return IFD number, or #EXIF_IFD_COUNT on error
|
||||
*/
|
||||
ExifIfd exif_content_get_ifd (ExifContent *c);
|
||||
|
||||
/*! Return a textual representation of the EXIF data for a tag.
|
||||
*
|
||||
* \param[in] c #ExifContent* for an IFD
|
||||
* \param[in] t #ExifTag to return
|
||||
* \param[out] v char* buffer in which to store value
|
||||
* \param[in] m unsigned int length of the buffer v
|
||||
* \return the v pointer, or NULL on error
|
||||
*/
|
||||
#define exif_content_get_value(c,t,v,m) \
|
||||
(exif_content_get_entry (c,t) ? \
|
||||
exif_entry_get_value (exif_content_get_entry (c,t),v,m) : NULL)
|
||||
|
||||
/*! Dump contents of the IFD to stdout.
|
||||
* This is intended for diagnostic purposes only.
|
||||
*
|
||||
* \param[in] content IFD data
|
||||
* \param[in] indent how many levels deep to indent the data
|
||||
*/
|
||||
void exif_content_dump (ExifContent *content, unsigned int indent);
|
||||
|
||||
/*! Set the log message object for this IFD.
|
||||
*
|
||||
* \param[in] content IFD
|
||||
* \param[in] log #ExifLog*
|
||||
*/
|
||||
void exif_content_log (ExifContent *content, ExifLog *log);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_CONTENT_H__ */
|
||||
46
libjpega/libexif/exif-data-type.h
Executable file
46
libjpega/libexif/exif-data-type.h
Executable file
@@ -0,0 +1,46 @@
|
||||
/* exif-data-tag.h
|
||||
*
|
||||
* Copyright (c) 2005 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_DATA_TYPE_H__
|
||||
#define __EXIF_DATA_TYPE_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! Represents the type of image data to which the EXIF data applies.
|
||||
* The EXIF tags have different constraints depending on the type of
|
||||
* image data.
|
||||
*/
|
||||
typedef enum {
|
||||
EXIF_DATA_TYPE_UNCOMPRESSED_CHUNKY = 0,
|
||||
EXIF_DATA_TYPE_UNCOMPRESSED_PLANAR,
|
||||
EXIF_DATA_TYPE_UNCOMPRESSED_YCC,
|
||||
EXIF_DATA_TYPE_COMPRESSED,
|
||||
EXIF_DATA_TYPE_COUNT,
|
||||
|
||||
EXIF_DATA_TYPE_UNKNOWN = EXIF_DATA_TYPE_COUNT
|
||||
} ExifDataType;
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_TAG_H__ */
|
||||
264
libjpega/libexif/exif-data.h
Executable file
264
libjpega/libexif/exif-data.h
Executable file
@@ -0,0 +1,264 @@
|
||||
/*! \file exif-data.h
|
||||
* \brief Defines the ExifData type and the associated functions.
|
||||
*/
|
||||
/*
|
||||
* \author Lutz Mueller <lutz@users.sourceforge.net>
|
||||
* \date 2001-2005
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_DATA_H__
|
||||
#define __EXIF_DATA_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-data-type.h>
|
||||
#include <libexif/exif-ifd.h>
|
||||
#include <libexif/exif-log.h>
|
||||
#include <libexif/exif-tag.h>
|
||||
|
||||
/*! Represents the entire EXIF data found in an image */
|
||||
typedef struct _ExifData ExifData;
|
||||
typedef struct _ExifDataPrivate ExifDataPrivate;
|
||||
|
||||
#include <libexif/exif-content.h>
|
||||
#include <libexif/exif-mnote-data.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
/*! Represents the entire EXIF data found in an image */
|
||||
struct _ExifData
|
||||
{
|
||||
/*! Data for each IFD */
|
||||
ExifContent *ifd[EXIF_IFD_COUNT];
|
||||
|
||||
/*! Pointer to thumbnail image, or NULL if not available */
|
||||
unsigned char *data;
|
||||
|
||||
/*! Number of bytes in thumbnail image at \c data */
|
||||
unsigned int size;
|
||||
|
||||
ExifDataPrivate *priv;
|
||||
};
|
||||
|
||||
/*! Allocate a new #ExifData. The #ExifData contains an empty
|
||||
* #ExifContent for each IFD and the default set of options,
|
||||
* which has #EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS
|
||||
* and #EXIF_DATA_OPTION_FOLLOW_SPECIFICATION set.
|
||||
*
|
||||
* \return allocated #ExifData, or NULL on error
|
||||
*/
|
||||
ExifData *exif_data_new (void);
|
||||
|
||||
/*! Allocate a new #ExifData using the given memory allocator.
|
||||
* The #ExifData contains an empty #ExifContent for each IFD and the default
|
||||
* set of options, which has #EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS and
|
||||
* #EXIF_DATA_OPTION_FOLLOW_SPECIFICATION set.
|
||||
*
|
||||
* \return allocated #ExifData, or NULL on error
|
||||
*/
|
||||
ExifData *exif_data_new_mem (ExifMem *);
|
||||
|
||||
/*! Allocate a new #ExifData and load EXIF data from a JPEG file.
|
||||
* Uses an #ExifLoader internally to do the loading.
|
||||
*
|
||||
* \param[in] path filename including path
|
||||
* \return allocated #ExifData, or NULL on error
|
||||
*/
|
||||
ExifData *exif_data_new_from_file (const char *path);
|
||||
|
||||
/*! Allocate a new #ExifData and load EXIF data from a memory buffer.
|
||||
*
|
||||
* \param[in] data pointer to raw JPEG or EXIF data
|
||||
* \param[in] size number of bytes of data at data
|
||||
* \return allocated #ExifData, or NULL on error
|
||||
*/
|
||||
ExifData *exif_data_new_from_data (const unsigned char *data,
|
||||
unsigned int size);
|
||||
|
||||
/*! Load the #ExifData structure from the raw JPEG or EXIF data in the given
|
||||
* memory buffer. If the EXIF data contains a recognized MakerNote, it is
|
||||
* loaded and stored as well for later retrieval by #exif_data_get_mnote_data.
|
||||
* If the EXIF_DATA_OPTION_FOLLOW_SPECIFICATION has been set on this #ExifData,
|
||||
* then the tags are fixed after loading.
|
||||
*
|
||||
* \param[in,out] data EXIF data
|
||||
* \param[in] d pointer to raw JPEG or EXIF data
|
||||
* \param[in] size number of bytes of data at d
|
||||
*/
|
||||
void exif_data_load_data (ExifData *data, const unsigned char *d,
|
||||
unsigned int size);
|
||||
|
||||
/*! Store raw EXIF data representing the #ExifData structure into a memory
|
||||
* buffer. The buffer is allocated by this function and must subsequently be
|
||||
* freed by the caller using the matching free function as used by the #ExifMem
|
||||
* in use by this #ExifData.
|
||||
*
|
||||
* \param[in] data EXIF data
|
||||
* \param[out] d pointer to buffer pointer containing raw EXIF data on return
|
||||
* \param[out] ds pointer to variable to hold the number of bytes of
|
||||
* data at d, or set to 0 on error
|
||||
*/
|
||||
void exif_data_save_data (ExifData *data, unsigned char **d,
|
||||
unsigned int *ds);
|
||||
|
||||
void exif_data_ref (ExifData *data);
|
||||
void exif_data_unref (ExifData *data);
|
||||
void exif_data_free (ExifData *data);
|
||||
|
||||
/*! Return the byte order in use by this EXIF structure.
|
||||
*
|
||||
* \param[in] data EXIF data
|
||||
* \return byte order
|
||||
*/
|
||||
ExifByteOrder exif_data_get_byte_order (ExifData *data);
|
||||
|
||||
/*! Set the byte order to use for this EXIF data. If any tags already exist
|
||||
* (including MakerNote tags) they are are converted to the specified byte
|
||||
* order.
|
||||
*
|
||||
* \param[in,out] data EXIF data
|
||||
* \param[in] order byte order
|
||||
*/
|
||||
void exif_data_set_byte_order (ExifData *data, ExifByteOrder order);
|
||||
|
||||
/*! Return the MakerNote data out of the EXIF data. Only certain
|
||||
* MakerNote formats that are recognized by libexif are supported.
|
||||
* The pointer references a member of the #ExifData structure and must NOT be
|
||||
* freed by the caller.
|
||||
*
|
||||
* \param[in] d EXIF data
|
||||
* \return MakerNote data, or NULL if not found or not supported
|
||||
*/
|
||||
ExifMnoteData *exif_data_get_mnote_data (ExifData *d);
|
||||
|
||||
/*! Fix the EXIF data to bring it into specification. Call #exif_content_fix
|
||||
* on each IFD to fix existing entries, create any new entries that are
|
||||
* mandatory but do not yet exist, and remove any entries that are not
|
||||
* allowed.
|
||||
*
|
||||
* \param[in,out] d EXIF data
|
||||
*/
|
||||
void exif_data_fix (ExifData *d);
|
||||
|
||||
typedef void (* ExifDataForeachContentFunc) (ExifContent *, void *user_data);
|
||||
|
||||
/*! Execute a function on each IFD in turn.
|
||||
*
|
||||
* \param[in] data EXIF data over which to iterate
|
||||
* \param[in] func function to call for each entry
|
||||
* \param[in] user_data data to pass into func on each call
|
||||
*/
|
||||
void exif_data_foreach_content (ExifData *data,
|
||||
ExifDataForeachContentFunc func,
|
||||
void *user_data);
|
||||
|
||||
/*! Options to configure the behaviour of #ExifData */
|
||||
typedef enum {
|
||||
/*! Act as though unknown tags are not present */
|
||||
EXIF_DATA_OPTION_IGNORE_UNKNOWN_TAGS = 1 << 0,
|
||||
|
||||
/*! Fix the EXIF tags to follow the spec */
|
||||
EXIF_DATA_OPTION_FOLLOW_SPECIFICATION = 1 << 1,
|
||||
|
||||
/*! Leave the MakerNote alone, which could cause it to be corrupted */
|
||||
EXIF_DATA_OPTION_DONT_CHANGE_MAKER_NOTE = 1 << 2
|
||||
} ExifDataOption;
|
||||
|
||||
/*! Return a short textual description of the given #ExifDataOption.
|
||||
*
|
||||
* \param[in] o option
|
||||
* \return localized textual description of the option
|
||||
*/
|
||||
const char *exif_data_option_get_name (ExifDataOption o);
|
||||
|
||||
/*! Return a verbose textual description of the given #ExifDataOption.
|
||||
*
|
||||
* \param[in] o option
|
||||
* \return verbose localized textual description of the option
|
||||
*/
|
||||
const char *exif_data_option_get_description (ExifDataOption o);
|
||||
|
||||
/*! Set the given option on the given #ExifData.
|
||||
*
|
||||
* \param[in] d EXIF data
|
||||
* \param[in] o option
|
||||
*/
|
||||
void exif_data_set_option (ExifData *d, ExifDataOption o);
|
||||
|
||||
/*! Clear the given option on the given #ExifData.
|
||||
*
|
||||
* \param[in] d EXIF data
|
||||
* \param[in] o option
|
||||
*/
|
||||
void exif_data_unset_option (ExifData *d, ExifDataOption o);
|
||||
|
||||
/*! Set the data type for the given #ExifData.
|
||||
*
|
||||
* \param[in] d EXIF data
|
||||
* \param[in] dt data type
|
||||
*/
|
||||
void exif_data_set_data_type (ExifData *d, ExifDataType dt);
|
||||
|
||||
/*! Return the data type for the given #ExifData.
|
||||
*
|
||||
* \param[in] d EXIF data
|
||||
* \return data type, or #EXIF_DATA_TYPE_UNKNOWN on error
|
||||
*/
|
||||
ExifDataType exif_data_get_data_type (ExifData *d);
|
||||
|
||||
/*! Dump all EXIF data to stdout.
|
||||
* This is intended for diagnostic purposes only.
|
||||
*
|
||||
* \param[in] data EXIF data
|
||||
*/
|
||||
void exif_data_dump (ExifData *data);
|
||||
|
||||
/*! Set the log message object for all IFDs.
|
||||
*
|
||||
* \param[in] data EXIF data
|
||||
* \param[in] log #ExifLog
|
||||
*/
|
||||
void exif_data_log (ExifData *data, ExifLog *log);
|
||||
|
||||
/*! Return an #ExifEntry for the given tag if found in any IFD.
|
||||
* Each IFD is searched in turn and the first containing a tag with
|
||||
* this number is returned.
|
||||
*
|
||||
* \param[in] d #ExifData
|
||||
* \param[in] t #ExifTag
|
||||
* \return #ExifEntry* if found, else NULL if not found
|
||||
*/
|
||||
#define exif_data_get_entry(d,t) \
|
||||
(exif_content_get_entry(d->ifd[EXIF_IFD_0],t) ? \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_0],t) : \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_1],t) ? \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_1],t) : \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) ? \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_EXIF],t) : \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) ? \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_GPS],t) : \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) ? \
|
||||
exif_content_get_entry(d->ifd[EXIF_IFD_INTEROPERABILITY],t) : NULL)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_DATA_H__ */
|
||||
188
libjpega/libexif/exif-entry.h
Executable file
188
libjpega/libexif/exif-entry.h
Executable file
@@ -0,0 +1,188 @@
|
||||
/*! \file exif-entry.h
|
||||
* \brief Handling EXIF entries
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_ENTRY_H__
|
||||
#define __EXIF_ENTRY_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! Data found in one EXIF tag.
|
||||
* The #exif_entry_get_value function can provide access to the
|
||||
* formatted contents, or the struct members can be used directly to
|
||||
* access the raw contents.
|
||||
*/
|
||||
typedef struct _ExifEntry ExifEntry;
|
||||
typedef struct _ExifEntryPrivate ExifEntryPrivate;
|
||||
|
||||
#include <libexif/exif-content.h>
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/exif-utils.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
/*! Data found in one EXIF tag */
|
||||
struct _ExifEntry {
|
||||
/*! EXIF tag for this entry */
|
||||
/* ExifTag had been changed to ExifShort to enable writing of the GPS related tags.
|
||||
2011.03.01 - Samsung Electronics */
|
||||
ExifShort tag;
|
||||
|
||||
/*! Type of data in this entry */
|
||||
ExifFormat format;
|
||||
|
||||
/*! Number of elements in the array, if this is an array entry.
|
||||
* Contains 1 for non-array data types. */
|
||||
unsigned long components;
|
||||
|
||||
/*! Pointer to the raw EXIF data for this entry. It is allocated
|
||||
* by #exif_entry_initialize and is NULL beforehand. Data contained
|
||||
* here may be manipulated using the functions in exif-utils.h */
|
||||
unsigned char *data;
|
||||
|
||||
/*! Number of bytes in the buffer at \c data. This must be no less
|
||||
* than exif_format_get_size(format)*components */
|
||||
unsigned int size;
|
||||
|
||||
/*! #ExifContent containing this entry.
|
||||
* \see exif_entry_get_ifd */
|
||||
ExifContent *parent;
|
||||
|
||||
/*! Internal data to be used by libexif itself */
|
||||
ExifEntryPrivate *priv;
|
||||
};
|
||||
|
||||
/* Lifecycle */
|
||||
|
||||
/*! Reserve memory for and initialize a new #ExifEntry.
|
||||
* No memory is allocated for the \c data element of the returned #ExifEntry.
|
||||
*
|
||||
* \return new allocated #ExifEntry, or NULL on error
|
||||
*
|
||||
* \see exif_entry_new_mem, exif_entry_unref
|
||||
*/
|
||||
ExifEntry *exif_entry_new (void);
|
||||
|
||||
/*! Reserve memory for and initialize new #ExifEntry using the specified
|
||||
* memory allocator.
|
||||
* No memory is allocated for the \c data element of the returned #ExifEntry.
|
||||
*
|
||||
* \return new allocated #ExifEntry, or NULL on error
|
||||
*
|
||||
* \see exif_entry_new, exif_entry_unref
|
||||
*/
|
||||
ExifEntry *exif_entry_new_mem (ExifMem *);
|
||||
|
||||
/*! Increase reference counter for #ExifEntry.
|
||||
*
|
||||
* \param[in] entry #ExifEntry
|
||||
*
|
||||
* \see exif_entry_unref
|
||||
*/
|
||||
void exif_entry_ref (ExifEntry *entry);
|
||||
|
||||
/*! Decrease reference counter for #ExifEntry.
|
||||
* When the reference count drops to zero, free the entry.
|
||||
*
|
||||
* \param[in] entry #ExifEntry
|
||||
*/
|
||||
void exif_entry_unref (ExifEntry *entry);
|
||||
|
||||
/*! Actually free the #ExifEntry.
|
||||
*
|
||||
* \deprecated Should not be called directly. Use #exif_entry_ref and
|
||||
* #exif_entry_unref instead.
|
||||
*
|
||||
* \param[in] entry EXIF entry
|
||||
*/
|
||||
void exif_entry_free (ExifEntry *entry);
|
||||
|
||||
/*! Initialize an empty #ExifEntry with default data in the correct format
|
||||
* for the given tag. If the entry is already initialized, this function
|
||||
* does nothing.
|
||||
* This call allocates memory for the \c data element of the given #ExifEntry.
|
||||
* That memory is freed at the same time as the #ExifEntry.
|
||||
*
|
||||
* \param[out] e entry to initialize
|
||||
* \param[in] tag tag number to initialize as
|
||||
*/
|
||||
void exif_entry_initialize (ExifEntry *e, ExifTag tag);
|
||||
|
||||
/*! Fix the type or format of the given EXIF entry to bring it into spec.
|
||||
* If the data for this EXIF tag is in of the wrong type or is in an invalid
|
||||
* format according to the EXIF specification, then it is converted to make it
|
||||
* valid. This may involve, for example, converting an EXIF_FORMAT_LONG into a
|
||||
* EXIF_FORMAT_SHORT. If the tag is unknown, its value is untouched.
|
||||
*
|
||||
* \note Unfortunately, some conversions are to a type with a more restricted
|
||||
* range, which could have the side effect that the converted data becomes
|
||||
* invalid. This is unlikely as the range of each tag in the standard is
|
||||
* designed to encompass all likely data.
|
||||
*
|
||||
* \param[in,out] entry EXIF entry
|
||||
*/
|
||||
void exif_entry_fix (ExifEntry *entry);
|
||||
|
||||
|
||||
/* For your convenience */
|
||||
|
||||
/*! Return a localized textual representation of the value of the EXIF entry.
|
||||
* This is meant for display to the user. The format of each tag is subject
|
||||
* to change between locales and in newer versions of libexif. Users who
|
||||
* require the tag data in an unambiguous form should access the data members
|
||||
* of the #ExifEntry structure directly.
|
||||
*
|
||||
* \warning The character set of the returned string may be in
|
||||
* the encoding of the current locale or the native encoding
|
||||
* of the camera.
|
||||
* \bug The EXIF_TAG_XP_* tags are currently always returned in UTF-8,
|
||||
* regardless of locale, and code points above U+FFFF are not
|
||||
* supported.
|
||||
*
|
||||
* \param[in] entry EXIF entry
|
||||
* \param[out] val buffer in which to store value
|
||||
* \param[in] maxlen length of the buffer val
|
||||
* \return val pointer
|
||||
*/
|
||||
const char *exif_entry_get_value (ExifEntry *entry, char *val,
|
||||
unsigned int maxlen);
|
||||
|
||||
/*! Dump text representation of #ExifEntry to stdout.
|
||||
* This is intended for diagnostic purposes only.
|
||||
*
|
||||
* \param[in] entry EXIF tag data
|
||||
* \param[in] indent how many levels deep to indent the data
|
||||
*/
|
||||
void exif_entry_dump (ExifEntry *entry, unsigned int indent);
|
||||
|
||||
/*! Return the IFD number of the given #ExifEntry
|
||||
*
|
||||
* \param[in] e an #ExifEntry*
|
||||
* \return #ExifIfd, or #EXIF_IFD_COUNT on error
|
||||
*/
|
||||
#define exif_entry_get_ifd(e) ((e)?exif_content_get_ifd((e)->parent):EXIF_IFD_COUNT)
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_ENTRY_H__ */
|
||||
65
libjpega/libexif/exif-format.h
Executable file
65
libjpega/libexif/exif-format.h
Executable file
@@ -0,0 +1,65 @@
|
||||
/*! \file exif-format.h
|
||||
* \brief Handling native EXIF data types
|
||||
*/
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_FORMAT_H__
|
||||
#define __EXIF_FORMAT_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! EXIF tag data formats */
|
||||
typedef enum {
|
||||
EXIF_FORMAT_BYTE = 1,
|
||||
EXIF_FORMAT_ASCII = 2,
|
||||
EXIF_FORMAT_SHORT = 3,
|
||||
EXIF_FORMAT_LONG = 4,
|
||||
EXIF_FORMAT_RATIONAL = 5,
|
||||
EXIF_FORMAT_SBYTE = 6,
|
||||
EXIF_FORMAT_UNDEFINED = 7,
|
||||
EXIF_FORMAT_SSHORT = 8,
|
||||
EXIF_FORMAT_SLONG = 9,
|
||||
EXIF_FORMAT_SRATIONAL = 10,
|
||||
EXIF_FORMAT_FLOAT = 11,
|
||||
EXIF_FORMAT_DOUBLE = 12
|
||||
} ExifFormat;
|
||||
|
||||
/*! Return a textual representation of the given EXIF data type.
|
||||
*
|
||||
* \param[in] format EXIF data format
|
||||
* \return localized textual name
|
||||
*/
|
||||
const char *exif_format_get_name (ExifFormat format);
|
||||
|
||||
/*! Return the raw size of the given EXIF data type.
|
||||
*
|
||||
* \param[in] format EXIF data format
|
||||
* \return size in bytes
|
||||
*/
|
||||
unsigned char exif_format_get_size (ExifFormat format);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_FORMAT_H__ */
|
||||
43
libjpega/libexif/exif-ifd.h
Executable file
43
libjpega/libexif/exif-ifd.h
Executable file
@@ -0,0 +1,43 @@
|
||||
/* exif-ifd.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_IFD_H__
|
||||
#define __EXIF_IFD_H__
|
||||
|
||||
/*! Possible EXIF Image File Directories */
|
||||
typedef enum {
|
||||
EXIF_IFD_0 = 0, /*!< */
|
||||
EXIF_IFD_1, /*!< */
|
||||
EXIF_IFD_EXIF, /*!< */
|
||||
EXIF_IFD_GPS, /*!< */
|
||||
EXIF_IFD_INTEROPERABILITY, /*!< */
|
||||
EXIF_IFD_COUNT /*!< Not a real value, just (max_value + 1). */
|
||||
} ExifIfd;
|
||||
|
||||
/*! Return a textual name of the given IFD. The name is a short, unique,
|
||||
* non-localized text string containing only US-ASCII alphanumeric
|
||||
* characters.
|
||||
*
|
||||
* \param[in] ifd IFD
|
||||
* \return textual name of the IFD
|
||||
*/
|
||||
const char *exif_ifd_get_name (ExifIfd ifd);
|
||||
|
||||
#endif /* __EXIF_IFD_H__ */
|
||||
128
libjpega/libexif/exif-loader.h
Executable file
128
libjpega/libexif/exif-loader.h
Executable file
@@ -0,0 +1,128 @@
|
||||
/*! \file exif-loader.h
|
||||
* \brief Defines the ExifLoader type
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_LOADER_H__
|
||||
#define __EXIF_LOADER_H__
|
||||
|
||||
#include <libexif/exif-data.h>
|
||||
#include <libexif/exif-log.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! Data used by the loader interface */
|
||||
typedef struct _ExifLoader ExifLoader;
|
||||
|
||||
/*! Allocate a new #ExifLoader.
|
||||
*
|
||||
* \return allocated ExifLoader
|
||||
*/
|
||||
ExifLoader *exif_loader_new (void);
|
||||
|
||||
/*! Allocate a new #ExifLoader using the specified memory allocator.
|
||||
*
|
||||
* \param[in] mem the ExifMem
|
||||
* \return allocated ExifLoader
|
||||
*/
|
||||
ExifLoader *exif_loader_new_mem (ExifMem *mem);
|
||||
|
||||
/*! Increase the refcount of the #ExifLoader.
|
||||
*
|
||||
* \param[in] loader the ExifLoader to increase the refcount of.
|
||||
*/
|
||||
void exif_loader_ref (ExifLoader *loader);
|
||||
|
||||
/*! Decrease the refcount of the #ExifLoader.
|
||||
* If the refcount reaches 0, the loader is freed.
|
||||
*
|
||||
* \param[in] loader ExifLoader for which to decrease the refcount
|
||||
*/
|
||||
void exif_loader_unref (ExifLoader *loader);
|
||||
|
||||
/*! Load a file into the given #ExifLoader from the filesystem.
|
||||
* The relevant data is copied in raw form into the #ExifLoader.
|
||||
*
|
||||
* \param[in] loader loader to write to
|
||||
* \param[in] fname path to the file to read
|
||||
*/
|
||||
void exif_loader_write_file (ExifLoader *loader, const char *fname);
|
||||
|
||||
/*! Load a buffer into the #ExifLoader from a memory buffer.
|
||||
* The relevant data is copied in raw form into the #ExifLoader.
|
||||
*
|
||||
* \param[in] loader loader to write to
|
||||
* \param[in] buf buffer to read from
|
||||
* \param[in] sz size of the buffer
|
||||
* \return 1 while EXIF data is read (or while there is still hope that
|
||||
* there will be EXIF data later on), 0 otherwise.
|
||||
*/
|
||||
unsigned char exif_loader_write (ExifLoader *loader, unsigned char *buf, unsigned int sz);
|
||||
|
||||
/*! Free any data previously loaded and reset the #ExifLoader to its
|
||||
* newly-initialized state.
|
||||
*
|
||||
* \param[in] loader the loader
|
||||
*/
|
||||
void exif_loader_reset (ExifLoader *loader);
|
||||
|
||||
/*! Create an #ExifData from the data in the loader. The loader must
|
||||
* already contain data from a previous call to #exif_loader_write_file
|
||||
* or #exif_loader_write.
|
||||
*
|
||||
* \note The #ExifData returned is created using its default options, which
|
||||
* may take effect before the data is returned. If other options are desired,
|
||||
* an #ExifData must be created explicitly and data extracted from the loader
|
||||
* using #exif_loader_get_buf instead.
|
||||
*
|
||||
* \param[in] loader the loader
|
||||
* \return allocated ExifData
|
||||
*
|
||||
* \see exif_loader_get_buf
|
||||
*/
|
||||
ExifData *exif_loader_get_data (ExifLoader *loader);
|
||||
|
||||
/*! Return the raw data read by the loader. The returned pointer is only
|
||||
* guaranteed to be valid until the next call to a function modifying
|
||||
* this #ExifLoader. Either or both of buf and buf_size may be NULL on
|
||||
* entry, in which case that value is not returned.
|
||||
*
|
||||
* \param[in] loader the loader
|
||||
* \param[out] buf read-only pointer to the data read by the loader, or NULL
|
||||
* in case of error
|
||||
* \param[out] buf_size size of the data at buf, or 0 in case of error
|
||||
*/
|
||||
void exif_loader_get_buf (ExifLoader *loader, const unsigned char **buf,
|
||||
unsigned int *buf_size);
|
||||
|
||||
/*! Set the log message object used by this #ExifLoader.
|
||||
* \param[in] loader the loader
|
||||
* \param[in] log #ExifLog
|
||||
*/
|
||||
void exif_loader_log (ExifLoader *loader, ExifLog *log);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_LOADER_H__ */
|
||||
116
libjpega/libexif/exif-log.h
Executable file
116
libjpega/libexif/exif-log.h
Executable file
@@ -0,0 +1,116 @@
|
||||
/*! \file exif-log.h
|
||||
* \brief Log message infrastructure
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2004 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_LOG_H__
|
||||
#define __EXIF_LOG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-mem.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
/*! State maintained by the logging interface */
|
||||
typedef struct _ExifLog ExifLog;
|
||||
|
||||
/*! Create a new logging instance.
|
||||
* \see exif_log_free
|
||||
*
|
||||
* \return new instance of #ExifLog
|
||||
*/
|
||||
ExifLog *exif_log_new (void);
|
||||
ExifLog *exif_log_new_mem (ExifMem *);
|
||||
void exif_log_ref (ExifLog *log);
|
||||
void exif_log_unref (ExifLog *log);
|
||||
|
||||
/*! Delete instance of #ExifLog.
|
||||
* \see exif_log_new
|
||||
*
|
||||
* \param[in] log #ExifLog
|
||||
* \return new instance of #ExifLog
|
||||
*/
|
||||
void exif_log_free (ExifLog *log);
|
||||
|
||||
typedef enum {
|
||||
EXIF_LOG_CODE_NONE,
|
||||
EXIF_LOG_CODE_DEBUG,
|
||||
EXIF_LOG_CODE_NO_MEMORY,
|
||||
EXIF_LOG_CODE_CORRUPT_DATA
|
||||
} ExifLogCode;
|
||||
|
||||
/*! Return a textual description of the given class of error log.
|
||||
*
|
||||
* \param[in] code logging message class
|
||||
* \return textual description of the log class
|
||||
*/
|
||||
const char *exif_log_code_get_title (ExifLogCode code);
|
||||
|
||||
/*! Return a verbose description of the given class of error log.
|
||||
*
|
||||
* \param[in] code logging message class
|
||||
* \return verbose description of the log class
|
||||
*/
|
||||
const char *exif_log_code_get_message (ExifLogCode code);
|
||||
|
||||
/*! Log callback function prototype.
|
||||
*/
|
||||
typedef void (* ExifLogFunc) (ExifLog *log, ExifLogCode, const char *domain,
|
||||
const char *format, va_list args, void *data);
|
||||
|
||||
/*! Register log callback function.
|
||||
* Calls to the log callback function are purely for diagnostic purposes.
|
||||
*
|
||||
* \param[in] log logging state variable
|
||||
* \param[in] func callback function to set
|
||||
* \param[in] data data to pass into callback function
|
||||
*/
|
||||
void exif_log_set_func (ExifLog *log, ExifLogFunc func, void *data);
|
||||
|
||||
#ifndef NO_VERBOSE_TAG_STRINGS
|
||||
void exif_log (ExifLog *log, ExifLogCode, const char *domain,
|
||||
const char *format, ...)
|
||||
#ifdef __GNUC__
|
||||
__attribute__((__format__(printf,4,5)))
|
||||
#endif
|
||||
;
|
||||
#else
|
||||
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
||||
#define exif_log(...) do { } while (0)
|
||||
#elif defined(__GNUC__)
|
||||
#define exif_log(x...) do { } while (0)
|
||||
#else
|
||||
#define exif_log (void)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void exif_logv (ExifLog *log, ExifLogCode, const char *domain,
|
||||
const char *format, va_list args);
|
||||
|
||||
/* For your convenience */
|
||||
#define EXIF_LOG_NO_MEMORY(l,d,s) exif_log ((l), EXIF_LOG_CODE_NO_MEMORY, (d), "Could not allocate %lu byte(s).", (unsigned long)(s))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_LOG_H__ */
|
||||
90
libjpega/libexif/exif-mem.h
Executable file
90
libjpega/libexif/exif-mem.h
Executable file
@@ -0,0 +1,90 @@
|
||||
/*! \file exif-mem.h
|
||||
* \brief Define the ExifMem data type and the associated functions.
|
||||
* ExifMem defines the memory management functions used within libexif.
|
||||
*/
|
||||
/* exif-mem.h
|
||||
*
|
||||
* Copyright (c) 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_MEM_H__
|
||||
#define __EXIF_MEM_H__
|
||||
|
||||
#include <libexif/exif-utils.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
/*! Should work like calloc()
|
||||
*
|
||||
* \param[in] s the size of the block to allocate.
|
||||
* \return the allocated memory and initialized.
|
||||
*/
|
||||
typedef void * (* ExifMemAllocFunc) (ExifLong s);
|
||||
|
||||
/*! Should work like realloc()
|
||||
*
|
||||
* \param[in] p the pointer to reallocate
|
||||
* \param[in] s the size of the reallocated block
|
||||
* \return allocated memory
|
||||
*/
|
||||
typedef void * (* ExifMemReallocFunc) (void *p, ExifLong s);
|
||||
|
||||
/*! Free method for ExifMem
|
||||
*
|
||||
* \param[in] p the pointer to free
|
||||
* \return the freed pointer
|
||||
*/
|
||||
typedef void (* ExifMemFreeFunc) (void *p);
|
||||
|
||||
/*! ExifMem define a memory allocator */
|
||||
typedef struct _ExifMem ExifMem;
|
||||
|
||||
/*! Create a new ExifMem
|
||||
*
|
||||
* \param[in] a the allocator function
|
||||
* \param[in] r the reallocator function
|
||||
* \param[in] f the free function
|
||||
*/
|
||||
ExifMem *exif_mem_new (ExifMemAllocFunc a, ExifMemReallocFunc r,
|
||||
ExifMemFreeFunc f);
|
||||
/*! Refcount an ExifMem
|
||||
*/
|
||||
void exif_mem_ref (ExifMem *);
|
||||
|
||||
/*! Unrefcount an ExifMem.
|
||||
* If the refcount reaches 0, the ExifMem is freed
|
||||
*/
|
||||
void exif_mem_unref (ExifMem *);
|
||||
|
||||
void *exif_mem_alloc (ExifMem *m, ExifLong s);
|
||||
void *exif_mem_realloc (ExifMem *m, void *p, ExifLong s);
|
||||
void exif_mem_free (ExifMem *m, void *p);
|
||||
|
||||
/*! Create a new ExifMem with default values for your convenience
|
||||
*
|
||||
* \return return a new default ExifMem
|
||||
*/
|
||||
ExifMem *exif_mem_new_default (void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_MEM_H__ */
|
||||
86
libjpega/libexif/exif-mnote-data-priv.h
Executable file
86
libjpega/libexif/exif-mnote-data-priv.h
Executable file
@@ -0,0 +1,86 @@
|
||||
/* exif-mnote-data-priv.h
|
||||
*
|
||||
* Copyright (c) 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_MNOTE_DATA_PRIV_H__
|
||||
#define __EXIF_MNOTE_DATA_PRIV_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-mnote-data.h>
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-log.h>
|
||||
|
||||
/*! \internal */
|
||||
typedef struct _ExifMnoteDataMethods ExifMnoteDataMethods;
|
||||
|
||||
/*! \internal */
|
||||
struct _ExifMnoteDataMethods {
|
||||
|
||||
/* Life cycle */
|
||||
void (* free) (ExifMnoteData *);
|
||||
|
||||
/* Modification */
|
||||
void (* save) (ExifMnoteData *, unsigned char **, unsigned int *);
|
||||
void (* load) (ExifMnoteData *, const unsigned char *, unsigned int);
|
||||
void (* set_offset) (ExifMnoteData *, unsigned int);
|
||||
void (* set_byte_order) (ExifMnoteData *, ExifByteOrder);
|
||||
|
||||
/* Query */
|
||||
unsigned int (* count) (ExifMnoteData *);
|
||||
unsigned int (* get_id) (ExifMnoteData *, unsigned int);
|
||||
const char * (* get_name) (ExifMnoteData *, unsigned int);
|
||||
const char * (* get_title) (ExifMnoteData *, unsigned int);
|
||||
const char * (* get_description) (ExifMnoteData *, unsigned int);
|
||||
char * (* get_value) (ExifMnoteData *, unsigned int, char *val, unsigned int maxlen);
|
||||
};
|
||||
|
||||
/*! \internal */
|
||||
typedef struct _ExifMnoteDataPriv ExifMnoteDataPriv;
|
||||
|
||||
/*! \internal */
|
||||
struct _ExifMnoteData
|
||||
{
|
||||
ExifMnoteDataPriv *priv;
|
||||
|
||||
ExifMnoteDataMethods methods;
|
||||
|
||||
/* Logging */
|
||||
ExifLog *log;
|
||||
|
||||
/* Memory management */
|
||||
ExifMem *mem;
|
||||
};
|
||||
|
||||
/*! \internal */
|
||||
void exif_mnote_data_construct (ExifMnoteData *, ExifMem *mem);
|
||||
|
||||
/*! \internal */
|
||||
void exif_mnote_data_set_byte_order (ExifMnoteData *, ExifByteOrder);
|
||||
|
||||
/*! \internal */
|
||||
void exif_mnote_data_set_offset (ExifMnoteData *, unsigned int);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_MNOTE_PRIV_H__ */
|
||||
122
libjpega/libexif/exif-mnote-data.h
Executable file
122
libjpega/libexif/exif-mnote-data.h
Executable file
@@ -0,0 +1,122 @@
|
||||
/*! \file exif-mnote-data.h
|
||||
* \brief Handling EXIF MakerNote tags
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2003 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_MNOTE_DATA_H__
|
||||
#define __EXIF_MNOTE_DATA_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-log.h>
|
||||
|
||||
/*! Data found in the MakerNote tag */
|
||||
typedef struct _ExifMnoteData ExifMnoteData;
|
||||
|
||||
void exif_mnote_data_ref (ExifMnoteData *);
|
||||
void exif_mnote_data_unref (ExifMnoteData *);
|
||||
|
||||
/*! Load the MakerNote data from a memory buffer.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \param[in] buf pointer to raw MakerNote tag data
|
||||
* \param[in] buf_siz number of bytes of data at buf
|
||||
*/
|
||||
void exif_mnote_data_load (ExifMnoteData *d, const unsigned char *buf,
|
||||
unsigned int buf_siz);
|
||||
|
||||
/*!
|
||||
* Save the raw MakerNote data into a memory buffer. The buffer is
|
||||
* allocated by this function and must subsequently be freed by the
|
||||
* caller.
|
||||
*
|
||||
* \param[in,out] d extract the data from this structure
|
||||
* \param[out] buf pointer to buffer pointer containing MakerNote data on return
|
||||
* \param[out] buf_siz pointer to the size of the buffer
|
||||
*/
|
||||
void exif_mnote_data_save (ExifMnoteData *d, unsigned char **buf,
|
||||
unsigned int *buf_siz);
|
||||
|
||||
/*! Return the number of tags in the MakerNote.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \return number of tags, or 0 if no MakerNote or the type is not supported
|
||||
*/
|
||||
unsigned int exif_mnote_data_count (ExifMnoteData *d);
|
||||
|
||||
/*! Return the MakerNote tag number for the tag at the specified index within
|
||||
* the MakerNote.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \param[in] n index of the entry within the MakerNote data
|
||||
* \return MakerNote tag number
|
||||
*/
|
||||
unsigned int exif_mnote_data_get_id (ExifMnoteData *d, unsigned int n);
|
||||
|
||||
/*! Returns textual name of the given MakerNote tag. The name is a short,
|
||||
* unique (within this type of MakerNote), non-localized text string
|
||||
* containing only US-ASCII alphanumeric characters.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \param[in] n index of the entry within the MakerNote data
|
||||
* \return textual name of the tag
|
||||
*/
|
||||
const char *exif_mnote_data_get_name (ExifMnoteData *d, unsigned int n);
|
||||
|
||||
/*! Returns textual title of the given MakerNote tag.
|
||||
* The title is a short, localized textual description of the tag.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \param[in] n index of the entry within the MakerNote data
|
||||
* \return textual name of the tag
|
||||
*/
|
||||
const char *exif_mnote_data_get_title (ExifMnoteData *d, unsigned int n);
|
||||
|
||||
/*! Returns verbose textual description of the given MakerNote tag.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \param[in] n index of the entry within the MakerNote data
|
||||
* \return textual description of the tag
|
||||
*/
|
||||
const char *exif_mnote_data_get_description (ExifMnoteData *d, unsigned int n);
|
||||
|
||||
/*! Return a textual representation of the value of the MakerNote entry.
|
||||
*
|
||||
* \warning The character set of the returned string may be in
|
||||
* the encoding of the current locale or the native encoding
|
||||
* of the camera.
|
||||
*
|
||||
* \param[in] d MakerNote data
|
||||
* \param[in] n index of the entry within the MakerNote data
|
||||
* \param[out] val buffer in which to store value
|
||||
* \param[in] maxlen length of the buffer val
|
||||
* \return val pointer, or NULL on error
|
||||
*/
|
||||
char *exif_mnote_data_get_value (ExifMnoteData *d, unsigned int n, char *val, unsigned int maxlen);
|
||||
|
||||
void exif_mnote_data_log (ExifMnoteData *, ExifLog *);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_MNOTE_DATA_H__ */
|
||||
32
libjpega/libexif/exif-system.h
Executable file
32
libjpega/libexif/exif-system.h
Executable file
@@ -0,0 +1,32 @@
|
||||
/*! \file exif-system.h
|
||||
* \brief System specific definitions, not for installation!
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2007 Hans Ulrich Niedermann <gp@n-dimensional.de>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef EXIF_SYSTEM_H
|
||||
#define EXIF_SYSTEM_H
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ >= 2)
|
||||
# define UNUSED(param) UNUSED_PARAM_##param __attribute__((unused))
|
||||
#else
|
||||
# define UNUSED(param) param
|
||||
#endif
|
||||
|
||||
#endif /* !defined(EXIF_SYSTEM_H) */
|
||||
287
libjpega/libexif/exif-tag.h
Executable file
287
libjpega/libexif/exif-tag.h
Executable file
@@ -0,0 +1,287 @@
|
||||
/*! \file exif-tag.h
|
||||
* \brief Handling EXIF tags
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_TAG_H__
|
||||
#define __EXIF_TAG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-ifd.h>
|
||||
#include <libexif/exif-data-type.h>
|
||||
|
||||
/*! EXIF tags */
|
||||
typedef enum {
|
||||
EXIF_TAG_INTEROPERABILITY_INDEX = 0x0001,
|
||||
EXIF_TAG_INTEROPERABILITY_VERSION = 0x0002,
|
||||
EXIF_TAG_NEW_SUBFILE_TYPE = 0x00fe,
|
||||
EXIF_TAG_IMAGE_WIDTH = 0x0100,
|
||||
EXIF_TAG_IMAGE_LENGTH = 0x0101,
|
||||
EXIF_TAG_BITS_PER_SAMPLE = 0x0102,
|
||||
EXIF_TAG_COMPRESSION = 0x0103,
|
||||
EXIF_TAG_PHOTOMETRIC_INTERPRETATION = 0x0106,
|
||||
EXIF_TAG_FILL_ORDER = 0x010a,
|
||||
EXIF_TAG_DOCUMENT_NAME = 0x010d,
|
||||
EXIF_TAG_IMAGE_DESCRIPTION = 0x010e,
|
||||
EXIF_TAG_MAKE = 0x010f,
|
||||
EXIF_TAG_MODEL = 0x0110,
|
||||
EXIF_TAG_STRIP_OFFSETS = 0x0111,
|
||||
EXIF_TAG_ORIENTATION = 0x0112,
|
||||
EXIF_TAG_SAMPLES_PER_PIXEL = 0x0115,
|
||||
EXIF_TAG_ROWS_PER_STRIP = 0x0116,
|
||||
EXIF_TAG_STRIP_BYTE_COUNTS = 0x0117,
|
||||
EXIF_TAG_X_RESOLUTION = 0x011a,
|
||||
EXIF_TAG_Y_RESOLUTION = 0x011b,
|
||||
EXIF_TAG_PLANAR_CONFIGURATION = 0x011c,
|
||||
EXIF_TAG_RESOLUTION_UNIT = 0x0128,
|
||||
EXIF_TAG_TRANSFER_FUNCTION = 0x012d,
|
||||
EXIF_TAG_SOFTWARE = 0x0131,
|
||||
EXIF_TAG_DATE_TIME = 0x0132,
|
||||
EXIF_TAG_ARTIST = 0x013b,
|
||||
EXIF_TAG_WHITE_POINT = 0x013e,
|
||||
EXIF_TAG_PRIMARY_CHROMATICITIES = 0x013f,
|
||||
EXIF_TAG_SUB_IFDS = 0x014a,
|
||||
EXIF_TAG_TRANSFER_RANGE = 0x0156,
|
||||
EXIF_TAG_JPEG_PROC = 0x0200,
|
||||
EXIF_TAG_JPEG_INTERCHANGE_FORMAT = 0x0201,
|
||||
EXIF_TAG_JPEG_INTERCHANGE_FORMAT_LENGTH = 0x0202,
|
||||
EXIF_TAG_YCBCR_COEFFICIENTS = 0x0211,
|
||||
EXIF_TAG_YCBCR_SUB_SAMPLING = 0x0212,
|
||||
EXIF_TAG_YCBCR_POSITIONING = 0x0213,
|
||||
EXIF_TAG_REFERENCE_BLACK_WHITE = 0x0214,
|
||||
EXIF_TAG_XML_PACKET = 0x02bc,
|
||||
EXIF_TAG_RELATED_IMAGE_FILE_FORMAT = 0x1000,
|
||||
EXIF_TAG_RELATED_IMAGE_WIDTH = 0x1001,
|
||||
EXIF_TAG_RELATED_IMAGE_LENGTH = 0x1002,
|
||||
EXIF_TAG_CFA_REPEAT_PATTERN_DIM = 0x828d,
|
||||
EXIF_TAG_CFA_PATTERN = 0x828e,
|
||||
EXIF_TAG_BATTERY_LEVEL = 0x828f,
|
||||
EXIF_TAG_COPYRIGHT = 0x8298,
|
||||
EXIF_TAG_EXPOSURE_TIME = 0x829a,
|
||||
EXIF_TAG_FNUMBER = 0x829d,
|
||||
EXIF_TAG_IPTC_NAA = 0x83bb,
|
||||
EXIF_TAG_IMAGE_RESOURCES = 0x8649,
|
||||
EXIF_TAG_EXIF_IFD_POINTER = 0x8769,
|
||||
EXIF_TAG_INTER_COLOR_PROFILE = 0x8773,
|
||||
EXIF_TAG_EXPOSURE_PROGRAM = 0x8822,
|
||||
EXIF_TAG_SPECTRAL_SENSITIVITY = 0x8824,
|
||||
EXIF_TAG_GPS_INFO_IFD_POINTER = 0x8825,
|
||||
EXIF_TAG_ISO_SPEED_RATINGS = 0x8827,
|
||||
EXIF_TAG_OECF = 0x8828,
|
||||
EXIF_TAG_TIME_ZONE_OFFSET = 0x882a,
|
||||
EXIF_TAG_EXIF_VERSION = 0x9000,
|
||||
EXIF_TAG_DATE_TIME_ORIGINAL = 0x9003,
|
||||
EXIF_TAG_DATE_TIME_DIGITIZED = 0x9004,
|
||||
EXIF_TAG_COMPONENTS_CONFIGURATION = 0x9101,
|
||||
EXIF_TAG_COMPRESSED_BITS_PER_PIXEL = 0x9102,
|
||||
EXIF_TAG_SHUTTER_SPEED_VALUE = 0x9201,
|
||||
EXIF_TAG_APERTURE_VALUE = 0x9202,
|
||||
EXIF_TAG_BRIGHTNESS_VALUE = 0x9203,
|
||||
EXIF_TAG_EXPOSURE_BIAS_VALUE = 0x9204,
|
||||
EXIF_TAG_MAX_APERTURE_VALUE = 0x9205,
|
||||
EXIF_TAG_SUBJECT_DISTANCE = 0x9206,
|
||||
EXIF_TAG_METERING_MODE = 0x9207,
|
||||
EXIF_TAG_LIGHT_SOURCE = 0x9208,
|
||||
EXIF_TAG_FLASH = 0x9209,
|
||||
EXIF_TAG_FOCAL_LENGTH = 0x920a,
|
||||
EXIF_TAG_SUBJECT_AREA = 0x9214,
|
||||
EXIF_TAG_TIFF_EP_STANDARD_ID = 0x9216,
|
||||
EXIF_TAG_MAKER_NOTE = 0x927c,
|
||||
EXIF_TAG_USER_COMMENT = 0x9286,
|
||||
EXIF_TAG_SUB_SEC_TIME = 0x9290,
|
||||
EXIF_TAG_SUB_SEC_TIME_ORIGINAL = 0x9291,
|
||||
EXIF_TAG_SUB_SEC_TIME_DIGITIZED = 0x9292,
|
||||
EXIF_TAG_XP_TITLE = 0x9c9b,
|
||||
EXIF_TAG_XP_COMMENT = 0x9c9c,
|
||||
EXIF_TAG_XP_AUTHOR = 0x9c9d,
|
||||
EXIF_TAG_XP_KEYWORDS = 0x9c9e,
|
||||
EXIF_TAG_XP_SUBJECT = 0x9c9f,
|
||||
EXIF_TAG_FLASH_PIX_VERSION = 0xa000,
|
||||
EXIF_TAG_COLOR_SPACE = 0xa001,
|
||||
EXIF_TAG_PIXEL_X_DIMENSION = 0xa002,
|
||||
EXIF_TAG_PIXEL_Y_DIMENSION = 0xa003,
|
||||
EXIF_TAG_RELATED_SOUND_FILE = 0xa004,
|
||||
EXIF_TAG_INTEROPERABILITY_IFD_POINTER = 0xa005,
|
||||
EXIF_TAG_FLASH_ENERGY = 0xa20b,
|
||||
EXIF_TAG_SPATIAL_FREQUENCY_RESPONSE = 0xa20c,
|
||||
EXIF_TAG_FOCAL_PLANE_X_RESOLUTION = 0xa20e,
|
||||
EXIF_TAG_FOCAL_PLANE_Y_RESOLUTION = 0xa20f,
|
||||
EXIF_TAG_FOCAL_PLANE_RESOLUTION_UNIT = 0xa210,
|
||||
EXIF_TAG_SUBJECT_LOCATION = 0xa214,
|
||||
EXIF_TAG_EXPOSURE_INDEX = 0xa215,
|
||||
EXIF_TAG_SENSING_METHOD = 0xa217,
|
||||
EXIF_TAG_FILE_SOURCE = 0xa300,
|
||||
EXIF_TAG_SCENE_TYPE = 0xa301,
|
||||
EXIF_TAG_NEW_CFA_PATTERN = 0xa302,
|
||||
EXIF_TAG_CUSTOM_RENDERED = 0xa401,
|
||||
EXIF_TAG_EXPOSURE_MODE = 0xa402,
|
||||
EXIF_TAG_WHITE_BALANCE = 0xa403,
|
||||
EXIF_TAG_DIGITAL_ZOOM_RATIO = 0xa404,
|
||||
EXIF_TAG_FOCAL_LENGTH_IN_35MM_FILM = 0xa405,
|
||||
EXIF_TAG_SCENE_CAPTURE_TYPE = 0xa406,
|
||||
EXIF_TAG_GAIN_CONTROL = 0xa407,
|
||||
EXIF_TAG_CONTRAST = 0xa408,
|
||||
EXIF_TAG_SATURATION = 0xa409,
|
||||
EXIF_TAG_SHARPNESS = 0xa40a,
|
||||
EXIF_TAG_DEVICE_SETTING_DESCRIPTION = 0xa40b,
|
||||
EXIF_TAG_SUBJECT_DISTANCE_RANGE = 0xa40c,
|
||||
EXIF_TAG_IMAGE_UNIQUE_ID = 0xa420,
|
||||
EXIF_TAG_GAMMA = 0xa500,
|
||||
EXIF_TAG_PRINT_IMAGE_MATCHING = 0xc4a5,
|
||||
EXIF_TAG_PADDING = 0xea1c
|
||||
} ExifTag;
|
||||
|
||||
/* GPS tags overlap with above ones. */
|
||||
#define EXIF_TAG_GPS_VERSION_ID 0x0000
|
||||
#define EXIF_TAG_GPS_LATITUDE_REF 0x0001 /* INTEROPERABILITY_INDEX */
|
||||
#define EXIF_TAG_GPS_LATITUDE 0x0002 /* INTEROPERABILITY_VERSION */
|
||||
#define EXIF_TAG_GPS_LONGITUDE_REF 0x0003
|
||||
#define EXIF_TAG_GPS_LONGITUDE 0x0004
|
||||
#define EXIF_TAG_GPS_ALTITUDE_REF 0x0005
|
||||
#define EXIF_TAG_GPS_ALTITUDE 0x0006
|
||||
#define EXIF_TAG_GPS_TIME_STAMP 0x0007
|
||||
#define EXIF_TAG_GPS_SATELLITES 0x0008
|
||||
#define EXIF_TAG_GPS_STATUS 0x0009
|
||||
#define EXIF_TAG_GPS_MEASURE_MODE 0x000a
|
||||
#define EXIF_TAG_GPS_DOP 0x000b
|
||||
#define EXIF_TAG_GPS_SPEED_REF 0x000c
|
||||
#define EXIF_TAG_GPS_SPEED 0x000d
|
||||
#define EXIF_TAG_GPS_TRACK_REF 0x000e
|
||||
#define EXIF_TAG_GPS_TRACK 0x000f
|
||||
#define EXIF_TAG_GPS_IMG_DIRECTION_REF 0x0010
|
||||
#define EXIF_TAG_GPS_IMG_DIRECTION 0x0011
|
||||
#define EXIF_TAG_GPS_MAP_DATUM 0x0012
|
||||
#define EXIF_TAG_GPS_DEST_LATITUDE_REF 0x0013
|
||||
#define EXIF_TAG_GPS_DEST_LATITUDE 0x0014
|
||||
#define EXIF_TAG_GPS_DEST_LONGITUDE_REF 0x0015
|
||||
#define EXIF_TAG_GPS_DEST_LONGITUDE 0x0016
|
||||
#define EXIF_TAG_GPS_DEST_BEARING_REF 0x0017
|
||||
#define EXIF_TAG_GPS_DEST_BEARING 0x0018
|
||||
#define EXIF_TAG_GPS_DEST_DISTANCE_REF 0x0019
|
||||
#define EXIF_TAG_GPS_DEST_DISTANCE 0x001a
|
||||
#define EXIF_TAG_GPS_PROCESSING_METHOD 0x001b
|
||||
#define EXIF_TAG_GPS_AREA_INFORMATION 0x001c
|
||||
#define EXIF_TAG_GPS_DATE_STAMP 0x001d
|
||||
#define EXIF_TAG_GPS_DIFFERENTIAL 0x001e
|
||||
|
||||
/*! What level of support a tag enjoys in the EXIF standard */
|
||||
typedef enum {
|
||||
/*! The meaning of this tag is unknown */
|
||||
EXIF_SUPPORT_LEVEL_UNKNOWN = 0,
|
||||
|
||||
/*! This tag is not allowed in the given IFD */
|
||||
EXIF_SUPPORT_LEVEL_NOT_RECORDED,
|
||||
|
||||
/*! This tag is mandatory in the given IFD */
|
||||
EXIF_SUPPORT_LEVEL_MANDATORY,
|
||||
|
||||
/*! This tag is optional in the given IFD */
|
||||
EXIF_SUPPORT_LEVEL_OPTIONAL
|
||||
} ExifSupportLevel;
|
||||
|
||||
/*! Return the tag ID given its unique textual name.
|
||||
*
|
||||
* \param[in] name tag name
|
||||
* \return tag ID, or 0 if tag not found
|
||||
* \note The tag not found value cannot be distinguished from a legitimate
|
||||
* tag number 0.
|
||||
*/
|
||||
ExifTag exif_tag_from_name (const char *name);
|
||||
|
||||
/*! Return a textual name of the given tag when found in the given IFD. The
|
||||
* name is a short, unique, non-localized text string containing only
|
||||
* US-ASCII alphanumeric characters.
|
||||
*
|
||||
* \param[in] tag EXIF tag
|
||||
* \param[in] ifd IFD
|
||||
* \return textual name of the tag, or NULL if the tag is unknown
|
||||
*/
|
||||
const char *exif_tag_get_name_in_ifd (ExifTag tag, ExifIfd ifd);
|
||||
|
||||
/*! Return a textual title of the given tag when found in the given IFD.
|
||||
* The title is a short, localized description of the tag.
|
||||
*
|
||||
* \param[in] tag EXIF tag
|
||||
* \param[in] ifd IFD
|
||||
* \return textual title of the tag, or NULL if the tag is unknown
|
||||
*/
|
||||
const char *exif_tag_get_title_in_ifd (ExifTag tag, ExifIfd ifd);
|
||||
|
||||
/*! Return a verbose textual description of the given tag when found in the
|
||||
* given IFD. The description is a verbose, localized description of the tag.
|
||||
*
|
||||
* \param[in] tag EXIF tag
|
||||
* \param[in] ifd IFD
|
||||
* \return textual description of the tag, or NULL if the tag is unknown
|
||||
*/
|
||||
const char *exif_tag_get_description_in_ifd (ExifTag tag, ExifIfd ifd);
|
||||
|
||||
/*! Return whether the given tag is mandatory or not in the given IFD and
|
||||
* data type according to the EXIF specification. If the IFD given is
|
||||
* EXIF_IFD_COUNT, the result is EXIF_SUPPORT_LEVEL_UNKNOWN. If the data
|
||||
* type is EXIF_DATA_TYPE_UNKNOWN, the result is
|
||||
* EXIF_SUPPORT_LEVEL_UNKNOWN unless the support level is the same for
|
||||
* all data types.
|
||||
*
|
||||
* \param[in] tag EXIF tag
|
||||
* \param[in] ifd IFD or EXIF_IFD_COUNT
|
||||
* \param[in] t data type or EXIF_DATA_TYPE_UNKNOWN
|
||||
* \return the level of support for this tag
|
||||
*/
|
||||
ExifSupportLevel exif_tag_get_support_level_in_ifd (ExifTag tag, ExifIfd ifd,
|
||||
ExifDataType t);
|
||||
|
||||
/* Don't use these functions. They are here for compatibility only. */
|
||||
|
||||
/*! \deprecated Use #exif_tag_get_name_in_ifd instead */
|
||||
const char *exif_tag_get_name (ExifTag tag);
|
||||
|
||||
/*! \deprecated Use #exif_tag_get_title_in_ifd instead */
|
||||
const char *exif_tag_get_title (ExifTag tag);
|
||||
|
||||
/*! \deprecated Use #exif_tag_get_description_in_ifd instead */
|
||||
const char *exif_tag_get_description (ExifTag tag);
|
||||
|
||||
|
||||
/* For now, do not use these functions. */
|
||||
|
||||
/*! \internal */
|
||||
ExifTag exif_tag_table_get_tag (unsigned int n);
|
||||
|
||||
/*! \internal */
|
||||
const char *exif_tag_table_get_name (unsigned int n);
|
||||
|
||||
/*! \internal */
|
||||
unsigned int exif_tag_table_count (void);
|
||||
|
||||
|
||||
/* Don't use these definitions. They are here for compatibility only. */
|
||||
|
||||
/*! \deprecated Use EXIF_TAG_PRINT_IMAGE_MATCHING instead. */
|
||||
#define EXIF_TAG_UNKNOWN_C4A5 EXIF_TAG_PRINT_IMAGE_MATCHING
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_TAG_H__ */
|
||||
194
libjpega/libexif/exif-utils.h
Executable file
194
libjpega/libexif/exif-utils.h
Executable file
@@ -0,0 +1,194 @@
|
||||
/*! \file exif-utils.h
|
||||
* \brief EXIF data manipulation functions and types
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __EXIF_UTILS_H__
|
||||
#define __EXIF_UTILS_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/_stdint.h>
|
||||
|
||||
|
||||
/* If these definitions don't work for you, please let us fix the
|
||||
* macro generating _stdint.h */
|
||||
|
||||
/*! EXIF Unsigned Byte data type */
|
||||
typedef unsigned char ExifByte; /* 1 byte */
|
||||
|
||||
/*! EXIF Signed Byte data type */
|
||||
typedef signed char ExifSByte; /* 1 byte */
|
||||
|
||||
/*! EXIF Text String data type */
|
||||
typedef char * ExifAscii;
|
||||
|
||||
/*! EXIF Unsigned Short data type */
|
||||
typedef uint16_t ExifShort; /* 2 bytes */
|
||||
|
||||
/*! EXIF Signed Short data type */
|
||||
typedef int16_t ExifSShort; /* 2 bytes */
|
||||
|
||||
/*! EXIF Unsigned Long data type */
|
||||
typedef uint32_t ExifLong; /* 4 bytes */
|
||||
|
||||
/*! EXIF Signed Long data type */
|
||||
typedef int32_t ExifSLong; /* 4 bytes */
|
||||
|
||||
/*! EXIF Unsigned Rational data type */
|
||||
typedef struct {ExifLong numerator; ExifLong denominator;} ExifRational;
|
||||
|
||||
typedef char ExifUndefined; /* 1 byte */
|
||||
|
||||
/*! EXIF Signed Rational data type */
|
||||
typedef struct {ExifSLong numerator; ExifSLong denominator;} ExifSRational;
|
||||
|
||||
|
||||
/*! Retrieve an #ExifShort value from memory.
|
||||
*
|
||||
* \param[in] b pointer to raw EXIF value in memory
|
||||
* \param[in] order byte order of raw value
|
||||
* \return value
|
||||
*/
|
||||
ExifShort exif_get_short (const unsigned char *b, ExifByteOrder order);
|
||||
|
||||
/*! Retrieve an #ExifSShort value from memory.
|
||||
*
|
||||
* \param[in] b pointer to raw EXIF value in memory
|
||||
* \param[in] order byte order of raw value
|
||||
* \return value
|
||||
*/
|
||||
ExifSShort exif_get_sshort (const unsigned char *b, ExifByteOrder order);
|
||||
|
||||
/*! Retrieve an #ExifLong value from memory.
|
||||
*
|
||||
* \param[in] b pointer to raw EXIF value in memory
|
||||
* \param[in] order byte order of raw value
|
||||
* \return value
|
||||
*/
|
||||
ExifLong exif_get_long (const unsigned char *b, ExifByteOrder order);
|
||||
|
||||
/*! Retrieve an #ExifSLong value from memory.
|
||||
*
|
||||
* \param[in] b pointer to raw EXIF value in memory
|
||||
* \param[in] order byte order of raw value
|
||||
* \return value
|
||||
*/
|
||||
ExifSLong exif_get_slong (const unsigned char *b, ExifByteOrder order);
|
||||
|
||||
/*! Retrieve an #ExifRational value from memory.
|
||||
*
|
||||
* \param[in] b pointer to raw EXIF value in memory
|
||||
* \param[in] order byte order of raw value
|
||||
* \return value
|
||||
*/
|
||||
ExifRational exif_get_rational (const unsigned char *b, ExifByteOrder order);
|
||||
|
||||
/*! Retrieve an #ExifSRational value from memory.
|
||||
*
|
||||
* \param[in] b pointer to raw EXIF value in memory
|
||||
* \param[in] order byte order of raw value
|
||||
* \return value
|
||||
*/
|
||||
ExifSRational exif_get_srational (const unsigned char *b, ExifByteOrder order);
|
||||
|
||||
/*! Store an ExifShort value into memory in EXIF format.
|
||||
*
|
||||
* \param[out] b buffer in which to write raw value
|
||||
* \param[in] order byte order to use
|
||||
* \param[in] value data value to store
|
||||
*/
|
||||
void exif_set_short (unsigned char *b, ExifByteOrder order,
|
||||
ExifShort value);
|
||||
|
||||
/*! Store an ExifSShort value into memory in EXIF format.
|
||||
*
|
||||
* \param[out] b buffer in which to write raw value
|
||||
* \param[in] order byte order to use
|
||||
* \param[in] value data value to store
|
||||
*/
|
||||
void exif_set_sshort (unsigned char *b, ExifByteOrder order,
|
||||
ExifSShort value);
|
||||
|
||||
/*! Store an ExifLong value into memory in EXIF format.
|
||||
*
|
||||
* \param[out] b buffer in which to write raw value
|
||||
* \param[in] order byte order to use
|
||||
* \param[in] value data value to store
|
||||
*/
|
||||
void exif_set_long (unsigned char *b, ExifByteOrder order,
|
||||
ExifLong value);
|
||||
|
||||
/*! Store an ExifSLong value into memory in EXIF format.
|
||||
*
|
||||
* \param[out] b buffer in which to write raw value
|
||||
* \param[in] order byte order to use
|
||||
* \param[in] value data value to store
|
||||
*/
|
||||
void exif_set_slong (unsigned char *b, ExifByteOrder order,
|
||||
ExifSLong value);
|
||||
|
||||
/*! Store an ExifRational value into memory in EXIF format.
|
||||
*
|
||||
* \param[out] b buffer in which to write raw value
|
||||
* \param[in] order byte order to use
|
||||
* \param[in] value data value to store
|
||||
*/
|
||||
void exif_set_rational (unsigned char *b, ExifByteOrder order,
|
||||
ExifRational value);
|
||||
|
||||
/*! Store an ExifSRational value into memory in EXIF format.
|
||||
*
|
||||
* \param[out] b buffer in which to write raw value
|
||||
* \param[in] order byte order to use
|
||||
* \param[in] value data value to store
|
||||
*/
|
||||
void exif_set_srational (unsigned char *b, ExifByteOrder order,
|
||||
ExifSRational value);
|
||||
|
||||
/*! \internal */
|
||||
void exif_convert_utf16_to_utf8 (char *out, const unsigned short *in, int maxlen);
|
||||
|
||||
/* Please do not use this function outside of the library. */
|
||||
|
||||
/*! \internal */
|
||||
void exif_array_set_byte_order (ExifFormat, unsigned char *, unsigned int,
|
||||
ExifByteOrder o_orig, ExifByteOrder o_new);
|
||||
|
||||
#undef MIN
|
||||
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
#undef MAX
|
||||
#define MAX(a, b) (((a) > (b)) ? (a) : (b))
|
||||
|
||||
/* For compatibility with older versions */
|
||||
|
||||
/*! \deprecated Use EXIF_TAG_SUB_SEC_TIME instead. */
|
||||
#define EXIF_TAG_SUBSEC_TIME EXIF_TAG_SUB_SEC_TIME
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __EXIF_UTILS_H__ */
|
||||
87
libjpega/libexif/exif.h
Executable file
87
libjpega/libexif/exif.h
Executable file
@@ -0,0 +1,87 @@
|
||||
/*! \file exif.h exif/exif.h
|
||||
* \brief Dummy header file for documentation purposes
|
||||
* \date 2007
|
||||
* \author Hans Ulrich Niedermann, et. al.
|
||||
*
|
||||
* \mainpage The libexif library
|
||||
*
|
||||
* \section general_notes General Notes
|
||||
*
|
||||
* This documentation is work in progress, as is the code itself.
|
||||
*
|
||||
* \section using_libexif Using libexif
|
||||
*
|
||||
* \#include <libexif/exif-data.h>
|
||||
*
|
||||
* libexif provides a libexif.pc file for use with pkgconfig on the
|
||||
* libexif installation. If you are using libtool to build your
|
||||
* package, you can also make use of libexif-uninstalled.pc.
|
||||
*
|
||||
* An application using libexif would typically first create an #ExifLoader to
|
||||
* load EXIF data into memory. From there, it would extract that data as
|
||||
* an #ExifData to start manipulating it. Each IFD is represented by its own
|
||||
* #ExifContent within that #ExifData, which contains all the tag data in
|
||||
* #ExifEntry form. If the MakerNote data is required, an #ExifMnoteData
|
||||
* can be extracted from the #ExifData and manipulated with the MakerNote
|
||||
* functions.
|
||||
*
|
||||
* libexif is written in C using an object-based style that defines
|
||||
* sets of functions that operate on each data structure.
|
||||
*
|
||||
* \section data_structures Primary Data Structures
|
||||
*
|
||||
* #ExifLoader
|
||||
* State maintained by the loader interface while importing EXIF data
|
||||
* from an external file or memory
|
||||
*
|
||||
* #ExifData
|
||||
* The entirety of EXIF data found in an image
|
||||
*
|
||||
* #ExifContent
|
||||
* All EXIF tags in a single IFD
|
||||
*
|
||||
* #ExifEntry
|
||||
* Data found in a single EXIF tag
|
||||
*
|
||||
* #ExifMnoteData
|
||||
* All data found in the MakerNote tag
|
||||
*
|
||||
* #ExifLog
|
||||
* State maintained by the logging interface
|
||||
*
|
||||
* \section string_conventions String Conventions
|
||||
*
|
||||
* Strings are 8 bit characters ("char*"). When libexif is compiled with
|
||||
* NLS, character set and encoding are as set in the current locale,
|
||||
* except for strings that come directly from the data in EXIF
|
||||
* tags which are generally returned in raw form. Most EXIF strings are
|
||||
* defined to be plain 7-bit ASCII so this raw form should be acceptable in
|
||||
* any UNIX locale, but some software ignores the specification and
|
||||
* writes 8-bit characters. It is up to the application to detect this
|
||||
* and deal with it intelligently.
|
||||
*
|
||||
* \section memory_management Memory Management Patterns
|
||||
*
|
||||
* For pointers to data objects, libexif uses reference counting. The
|
||||
* pattern is to use the foo_new() function to create a data object,
|
||||
* foo_ref() to increase the reference counter, and foo_unref() to
|
||||
* decrease the reference counter and possibly free(3)ing the memory.
|
||||
*
|
||||
* Libexif by default relies on the calloc(3), realloc(3), and free(3)
|
||||
* functions, but the libexif user can tell libexif to use their
|
||||
* special memory management functions at runtime.
|
||||
*
|
||||
* \section thread_safety Thread Safety
|
||||
*
|
||||
* libexif is thread safe when the underlying C library is also thread safe.
|
||||
* Some C libraries may require defining a special macro (like _REENTRANT)
|
||||
* to ensure this, or may require linking to a special thread-safe version of
|
||||
* the library.
|
||||
*
|
||||
* The programmer must ensure that each object allocated by libexif is only
|
||||
* used in a single thread at once. For example, an ExifData* allocated
|
||||
* in one thread can't be used in a second thread if there is any chance
|
||||
* that the first thread could use it at the same time. Multiple threads
|
||||
* can use libexif without issues if they never share handles.
|
||||
*
|
||||
*/
|
||||
53
libjpega/libexif/fuji/exif-mnote-data-fuji.h
Executable file
53
libjpega/libexif/fuji/exif-mnote-data-fuji.h
Executable file
@@ -0,0 +1,53 @@
|
||||
/* exif-mnote-data-fuji.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_FUJI_CONTENT_H__
|
||||
#define __MNOTE_FUJI_CONTENT_H__
|
||||
|
||||
#include <libexif/exif-mnote-data.h>
|
||||
#include <libexif/exif-mnote-data-priv.h>
|
||||
#include <libexif/exif-data.h>
|
||||
#include <libexif/fuji/mnote-fuji-entry.h>
|
||||
|
||||
typedef struct _ExifMnoteDataFuji ExifMnoteDataFuji;
|
||||
|
||||
struct _ExifMnoteDataFuji {
|
||||
ExifMnoteData parent;
|
||||
|
||||
MnoteFujiEntry *entries;
|
||||
unsigned int count;
|
||||
|
||||
ExifByteOrder order;
|
||||
unsigned int offset;
|
||||
};
|
||||
|
||||
/*! Detect if MakerNote is recognized as one handled by the Fuji module.
|
||||
*
|
||||
* \param[in] ed image #ExifData to identify as as a Fuji type
|
||||
* \param[in] e #ExifEntry for EXIF_TAG_MAKER_NOTE, from within ed but
|
||||
* duplicated here for convenience
|
||||
* \return 0 if not recognized, nonzero if recognized. The specific nonzero
|
||||
* value returned may identify a subtype unique within this module.
|
||||
*/
|
||||
int exif_mnote_data_fuji_identify (const ExifData *ed, const ExifEntry *e);
|
||||
|
||||
ExifMnoteData *exif_mnote_data_fuji_new (ExifMem *);
|
||||
|
||||
#endif /* __MNOTE_FUJI_CONTENT_H__ */
|
||||
45
libjpega/libexif/fuji/mnote-fuji-entry.h
Executable file
45
libjpega/libexif/fuji/mnote-fuji-entry.h
Executable file
@@ -0,0 +1,45 @@
|
||||
/* mnote-fuji-entry.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_FUJI_ENTRY_H__
|
||||
#define __MNOTE_FUJI_ENTRY_H__
|
||||
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/fuji/mnote-fuji-tag.h>
|
||||
|
||||
typedef struct _MnoteFujiEntry MnoteFujiEntry;
|
||||
typedef struct _MnoteFujiEntryPrivate MnoteFujiEntryPrivate;
|
||||
|
||||
#include <libexif/fuji/exif-mnote-data-fuji.h>
|
||||
|
||||
struct _MnoteFujiEntry {
|
||||
MnoteFujiTag tag;
|
||||
ExifFormat format;
|
||||
unsigned long components;
|
||||
|
||||
unsigned char *data;
|
||||
unsigned int size;
|
||||
|
||||
ExifByteOrder order;
|
||||
};
|
||||
|
||||
char *mnote_fuji_entry_get_value (MnoteFujiEntry *entry, char *val, unsigned int maxlen);
|
||||
|
||||
#endif /* __MNOTE_FUJI_ENTRY_H__ */
|
||||
92
libjpega/libexif/fuji/mnote-fuji-tag.h
Executable file
92
libjpega/libexif/fuji/mnote-fuji-tag.h
Executable file
@@ -0,0 +1,92 @@
|
||||
/* mnote-fuji-tag.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_FUJI_TAG_H__
|
||||
#define __MNOTE_FUJI_TAG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#include <libexif/exif-data.h>
|
||||
|
||||
enum _MnoteFujiTag {
|
||||
MNOTE_FUJI_TAG_VERSION = 0x0000,
|
||||
MNOTE_FUJI_TAG_SERIAL_NUMBER = 0x0010,
|
||||
MNOTE_FUJI_TAG_QUALITY = 0x1000,
|
||||
MNOTE_FUJI_TAG_SHARPNESS = 0x1001,
|
||||
MNOTE_FUJI_TAG_WHITE_BALANCE = 0x1002,
|
||||
MNOTE_FUJI_TAG_COLOR = 0x1003,
|
||||
MNOTE_FUJI_TAG_TONE = 0x1004,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1006 = 0x1006,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1007 = 0x1007,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1008 = 0x1008,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1009 = 0x1009,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_100A = 0x100A,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_100B = 0x100B,
|
||||
MNOTE_FUJI_TAG_FLASH_MODE = 0x1010,
|
||||
MNOTE_FUJI_TAG_FLASH_STRENGTH = 0x1011,
|
||||
MNOTE_FUJI_TAG_MACRO = 0x1020,
|
||||
MNOTE_FUJI_TAG_FOCUS_MODE = 0x1021,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1022 = 0x1022,
|
||||
MNOTE_FUJI_TAG_FOCUS_POINT = 0x1023,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1024 = 0x1024,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1025 = 0x1025,
|
||||
MNOTE_FUJI_TAG_SLOW_SYNC = 0x1030,
|
||||
MNOTE_FUJI_TAG_PICTURE_MODE = 0x1031,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1032 = 0x1032,
|
||||
MNOTE_FUJI_TAG_CONT_TAKING = 0x1100,
|
||||
MNOTE_FUJI_TAG_SEQUENCE_NUMBER = 0x1101,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1200 = 0x1200,
|
||||
MNOTE_FUJI_TAG_FINEPIX_COLOR = 0x1210,
|
||||
MNOTE_FUJI_TAG_BLUR_CHECK = 0x1300,
|
||||
MNOTE_FUJI_TAG_FOCUS_CHECK = 0x1301,
|
||||
MNOTE_FUJI_TAG_AUTO_EXPOSURE_CHECK = 0x1302,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1303 = 0x1303,
|
||||
MNOTE_FUJI_TAG_DYNAMIC_RANGE = 0x1400,
|
||||
MNOTE_FUJI_TAG_FILM_MODE = 0x1401,
|
||||
MNOTE_FUJI_TAG_DYNAMIC_RANGE_SETTING = 0x1402,
|
||||
MNOTE_FUJI_TAG_DEV_DYNAMIC_RANGE_SETTING= 0x1403,
|
||||
MNOTE_FUJI_TAG_MIN_FOCAL_LENGTH = 0x1404,
|
||||
MNOTE_FUJI_TAG_MAX_FOCAL_LENGTH = 0x1405,
|
||||
MNOTE_FUJI_TAG_MAX_APERT_AT_MIN_FOC = 0x1406,
|
||||
MNOTE_FUJI_TAG_MAX_APERT_AT_MAX_FOC = 0x1407,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1408 = 0x1408,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1409 = 0x1409,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_140A = 0x140A,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1410 = 0x1410,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_1421 = 0x1421,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_4100 = 0x4100,
|
||||
MNOTE_FUJI_TAG_UNKNOWN_4800 = 0x4800,
|
||||
MNOTE_FUJI_TAG_FILE_SOURCE = 0x8000,
|
||||
MNOTE_FUJI_TAG_ORDER_NUMBER = 0x8002,
|
||||
MNOTE_FUJI_TAG_FRAME_NUMBER = 0x8003,
|
||||
};
|
||||
typedef enum _MnoteFujiTag MnoteFujiTag;
|
||||
|
||||
const char *mnote_fuji_tag_get_name (MnoteFujiTag tag);
|
||||
const char *mnote_fuji_tag_get_title (MnoteFujiTag tag);
|
||||
const char *mnote_fuji_tag_get_description (MnoteFujiTag tag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MNOTE_FUJI_TAG_H__ */
|
||||
52
libjpega/libexif/i18n.h
Executable file
52
libjpega/libexif/i18n.h
Executable file
@@ -0,0 +1,52 @@
|
||||
/* i18n.h
|
||||
*
|
||||
* Copyright (c) 2001 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __I18N_H__
|
||||
#define __I18N_H__
|
||||
|
||||
#include "config.h"
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# undef _
|
||||
# define _(String) dgettext (GETTEXT_PACKAGE, String)
|
||||
# ifdef gettext_noop
|
||||
# define N_(String) gettext_noop (String)
|
||||
# else
|
||||
# define N_(String) (String)
|
||||
# endif
|
||||
#else
|
||||
# define textdomain(String) (String)
|
||||
# define gettext(String) (String)
|
||||
# define ngettext(String1,String2,Count) (Count==1?String1:String2)
|
||||
# define dgettext(Domain,Message) (Message)
|
||||
# define dcgettext(Domain,Message,Type) (Message)
|
||||
#ifdef __WATCOMC__
|
||||
# define bind_textdomain_codeset(Domain,Codeset)
|
||||
# define bindtextdomain(Domain,Directory)
|
||||
#else
|
||||
# define bind_textdomain_codeset(Domain,Codeset)
|
||||
# define bindtextdomain(Domain,Directory)
|
||||
#endif
|
||||
# define _(String) (String)
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
#endif /* __I18N_H__ */
|
||||
67
libjpega/libexif/olympus/exif-mnote-data-olympus.h
Executable file
67
libjpega/libexif/olympus/exif-mnote-data-olympus.h
Executable file
@@ -0,0 +1,67 @@
|
||||
/* mnote-olympus-data.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_OLYMPUS_CONTENT_H__
|
||||
#define __MNOTE_OLYMPUS_CONTENT_H__
|
||||
|
||||
#include <libexif/exif-mnote-data-priv.h>
|
||||
#include <libexif/olympus/mnote-olympus-entry.h>
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/exif-data.h>
|
||||
#include <libexif/exif-mem.h>
|
||||
|
||||
enum OlympusVersion {
|
||||
unrecognized = 0,
|
||||
nikonV1 = 1,
|
||||
nikonV2 = 2,
|
||||
olympusV1 = 3,
|
||||
olympusV2 = 4,
|
||||
sanyoV1 = 5,
|
||||
epsonV1 = 6,
|
||||
nikonV0 = 7
|
||||
};
|
||||
|
||||
|
||||
typedef struct _ExifMnoteDataOlympus ExifMnoteDataOlympus;
|
||||
|
||||
struct _ExifMnoteDataOlympus {
|
||||
ExifMnoteData parent;
|
||||
|
||||
MnoteOlympusEntry *entries;
|
||||
unsigned int count;
|
||||
|
||||
ExifByteOrder order;
|
||||
unsigned int offset;
|
||||
enum OlympusVersion version;
|
||||
};
|
||||
|
||||
/*! Detect if MakerNote is recognized as one handled by the Olympus module.
|
||||
*
|
||||
* \param[in] ed image #ExifData to identify as as an Olympus type
|
||||
* \param[in] e #ExifEntry for EXIF_TAG_MAKER_NOTE, from within ed but
|
||||
* duplicated here for convenience
|
||||
* \return 0 if not recognized, nonzero if recognized. The specific nonzero
|
||||
* value returned may identify a subtype unique within this module.
|
||||
*/
|
||||
int exif_mnote_data_olympus_identify (const ExifData *ed, const ExifEntry *e);
|
||||
|
||||
ExifMnoteData *exif_mnote_data_olympus_new (ExifMem *);
|
||||
|
||||
#endif /* __MNOTE_OLYMPUS_CONTENT_H__ */
|
||||
43
libjpega/libexif/olympus/mnote-olympus-entry.h
Executable file
43
libjpega/libexif/olympus/mnote-olympus-entry.h
Executable file
@@ -0,0 +1,43 @@
|
||||
/* mnote-olympus-entry.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_OLYMPUS_ENTRY_H__
|
||||
#define __MNOTE_OLYMPUS_ENTRY_H__
|
||||
|
||||
#include <libexif/exif-format.h>
|
||||
#include <libexif/exif-byte-order.h>
|
||||
#include <libexif/olympus/mnote-olympus-tag.h>
|
||||
|
||||
typedef struct _MnoteOlympusEntry MnoteOlympusEntry;
|
||||
|
||||
struct _MnoteOlympusEntry {
|
||||
MnoteOlympusTag tag;
|
||||
ExifFormat format;
|
||||
unsigned long components;
|
||||
|
||||
unsigned char *data;
|
||||
unsigned int size;
|
||||
|
||||
ExifByteOrder order;
|
||||
};
|
||||
|
||||
char *mnote_olympus_entry_get_value (MnoteOlympusEntry *entry, char *val, unsigned int maxlen);
|
||||
|
||||
#endif /* __MNOTE_OLYMPUS_ENTRY_H__ */
|
||||
229
libjpega/libexif/olympus/mnote-olympus-tag.h
Executable file
229
libjpega/libexif/olympus/mnote-olympus-tag.h
Executable file
@@ -0,0 +1,229 @@
|
||||
/* mnote-olympus-tag.h
|
||||
*
|
||||
* Copyright (c) 2002 Lutz Mueller <lutz@users.sourceforge.net>
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the
|
||||
* Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
#ifndef __MNOTE_OLYMPUS_TAG_H__
|
||||
#define __MNOTE_OLYMPUS_TAG_H__
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
enum _MnoteOlympusTag {
|
||||
|
||||
/* Nikon v.2 */
|
||||
MNOTE_NIKON_TAG_FIRMWARE = 0x0001,
|
||||
MNOTE_NIKON_TAG_ISO = 0x0002,
|
||||
MNOTE_NIKON_TAG_COLORMODE1 = 0x0003,
|
||||
MNOTE_NIKON_TAG_QUALITY = 0x0004,
|
||||
MNOTE_NIKON_TAG_WHITEBALANCE = 0x0005,
|
||||
MNOTE_NIKON_TAG_SHARPENING = 0x0006,
|
||||
MNOTE_NIKON_TAG_FOCUSMODE = 0x0007,
|
||||
MNOTE_NIKON_TAG_FLASHSETTING = 0x0008,
|
||||
MNOTE_NIKON_TAG_FLASHMODE = 0x0009,
|
||||
MNOTE_NIKON_TAG_WHITEBALANCEFINE = 0x000b,
|
||||
MNOTE_NIKON_TAG_WHITEBALANCERB = 0x000c,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X000D = 0x000d,
|
||||
MNOTE_NIKON_TAG_EXPOSUREDIFF = 0x000e,
|
||||
MNOTE_NIKON_TAG_ISOSELECTION = 0x000f,
|
||||
MNOTE_NIKON_TAG_PREVIEWIMAGE_IFD_POINTER= 0x0011,
|
||||
MNOTE_NIKON_TAG_FLASHEXPCOMPENSATION = 0x0012,
|
||||
MNOTE_NIKON_TAG_ISO2 = 0x0013,
|
||||
MNOTE_NIKON_TAG_IMAGEBOUNDARY = 0x0016,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X0017 = 0x0017,
|
||||
MNOTE_NIKON_TAG_FLASHEXPOSUREBRACKETVAL = 0x0018,
|
||||
MNOTE_NIKON_TAG_EXPOSUREBRACKETVAL = 0x0019,
|
||||
MNOTE_NIKON_TAG_IMAGEADJUSTMENT = 0x0080,
|
||||
MNOTE_NIKON_TAG_TONECOMPENSATION = 0x0081,
|
||||
MNOTE_NIKON_TAG_ADAPTER = 0x0082,
|
||||
MNOTE_NIKON_TAG_LENSTYPE = 0x0083,
|
||||
MNOTE_NIKON_TAG_LENS = 0x0084,
|
||||
MNOTE_NIKON_TAG_MANUALFOCUSDISTANCE = 0x0085,
|
||||
MNOTE_NIKON_TAG_DIGITALZOOM = 0x0086,
|
||||
MNOTE_NIKON_TAG_FLASHUSED = 0x0087,
|
||||
MNOTE_NIKON_TAG_AFFOCUSPOSITION = 0x0088,
|
||||
MNOTE_NIKON_TAG_BRACKETING = 0x0089,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X008A = 0x008a,
|
||||
MNOTE_NIKON_TAG_LENS_FSTOPS = 0x008b,
|
||||
MNOTE_NIKON_TAG_CURVE = 0x008c,
|
||||
MNOTE_NIKON_TAG_COLORMODE = 0x008d,
|
||||
MNOTE_NIKON_TAG_LIGHTTYPE = 0x0090,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X0091 = 0x0091,
|
||||
MNOTE_NIKON_TAG_HUE = 0x0092,
|
||||
MNOTE_NIKON_TAG_SATURATION = 0x0094,
|
||||
MNOTE_NIKON_TAG_NOISEREDUCTION = 0x0095,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X0097 = 0x0097,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X0098 = 0x0098,
|
||||
MNOTE_NIKON_TAG_SENSORPIXELSIZE = 0x009a,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X009B = 0x009b,
|
||||
MNOTE_NIKON_TAG_SERIALNUMBER = 0x00a0,
|
||||
MNOTE_NIKON_TAG_IMAGE_DATASIZE = 0x00a2,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X00A3 = 0x00a3,
|
||||
MNOTE_NIKON_TAG_TOTALPICTURES = 0x00a7,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X00A8 = 0x00a8,
|
||||
MNOTE_NIKON_TAG_OPTIMIZATION = 0x00a9,
|
||||
MNOTE_NIKON_TAG_SATURATION2 = 0x00aa,
|
||||
MNOTE_NIKON_TAG_VARIPROGRAM = 0x00ab,
|
||||
MNOTE_NIKON_TAG_CAPTUREEDITORDATA = 0x0e01,
|
||||
MNOTE_NIKON_TAG_CAPTUREEDITORVER = 0x0e09,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X0E0E = 0x0e0e,
|
||||
MNOTE_NIKON_TAG_UNKNOWN_0X0E10 = 0x0e10,
|
||||
|
||||
/* Nikon v1: real values + our proprietary base to distinguish from v2 */
|
||||
MNOTE_NIKON1_TAG_BASE = 0x8000,
|
||||
MNOTE_NIKON1_TAG_UNKNOWN_0X0002 = 0x0002 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_QUALITY = 0x0003 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_COLORMODE = 0x0004 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_IMAGEADJUSTMENT = 0x0005 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_CCDSENSITIVITY = 0x0006 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_WHITEBALANCE = 0x0007 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_FOCUS = 0x0008 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_UNKNOWN_0X0009 = 0x0009 + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_DIGITALZOOM = 0x000a + MNOTE_NIKON1_TAG_BASE,
|
||||
MNOTE_NIKON1_TAG_CONVERTER = 0x000b + MNOTE_NIKON1_TAG_BASE,
|
||||
|
||||
/* Olympus and some Sanyo */
|
||||
MNOTE_OLYMPUS_TAG_THUMBNAILIMAGE = 0x0100,
|
||||
MNOTE_OLYMPUS_TAG_MODE = 0x0200,
|
||||
MNOTE_OLYMPUS_TAG_QUALITY = 0x0201,
|
||||
MNOTE_OLYMPUS_TAG_MACRO = 0x0202,
|
||||
MNOTE_OLYMPUS_TAG_BWMODE = 0x0203,
|
||||
MNOTE_OLYMPUS_TAG_DIGIZOOM = 0x0204,
|
||||
MNOTE_OLYMPUS_TAG_FOCALPLANEDIAGONAL = 0x0205,
|
||||
MNOTE_OLYMPUS_TAG_LENSDISTORTION = 0x0206,
|
||||
MNOTE_OLYMPUS_TAG_VERSION = 0x0207,
|
||||
MNOTE_OLYMPUS_TAG_INFO = 0x0208,
|
||||
MNOTE_OLYMPUS_TAG_ID = 0x0209,
|
||||
MNOTE_OLYMPUS_TAG_PRECAPTUREFRAMES = 0x0300,
|
||||
MNOTE_OLYMPUS_TAG_WHITEBOARD = 0x0301,
|
||||
MNOTE_OLYMPUS_TAG_ONETOUCHWB = 0x0302,
|
||||
MNOTE_OLYMPUS_TAG_WHITEBALANCEBRACKET = 0x0303,
|
||||
MNOTE_OLYMPUS_TAG_WHITEBALANCEBIAS = 0x0304,
|
||||
MNOTE_OLYMPUS_TAG_DATADUMP = 0x0f00,
|
||||
MNOTE_OLYMPUS_TAG_UNKNOWN_4 = 0x0f04,
|
||||
MNOTE_OLYMPUS_TAG_SHUTTERSPEED = 0x1000,
|
||||
MNOTE_OLYMPUS_TAG_ISOVALUE = 0x1001,
|
||||
MNOTE_OLYMPUS_TAG_APERTUREVALUE = 0x1002,
|
||||
MNOTE_OLYMPUS_TAG_BRIGHTNESSVALUE = 0x1003,
|
||||
MNOTE_OLYMPUS_TAG_FLASHMODE = 0x1004,
|
||||
MNOTE_OLYMPUS_TAG_FLASHDEVICE = 0x1005,
|
||||
MNOTE_OLYMPUS_TAG_EXPOSURECOMP = 0x1006,
|
||||
MNOTE_OLYMPUS_TAG_SENSORTEMPERATURE = 0x1007,
|
||||
MNOTE_OLYMPUS_TAG_LENSTEMPERATURE = 0x1008,
|
||||
MNOTE_OLYMPUS_TAG_LIGHTCONDITION = 0x1009,
|
||||
MNOTE_OLYMPUS_TAG_FOCUSRANGE = 0x100a,
|
||||
MNOTE_OLYMPUS_TAG_MANFOCUS = 0x100b,
|
||||
MNOTE_OLYMPUS_TAG_FOCUSDIST = 0x100c,
|
||||
MNOTE_OLYMPUS_TAG_ZOOMSTEPCOUNT = 0x100d,
|
||||
MNOTE_OLYMPUS_TAG_FOCUSSTEPCOUNT = 0x100e,
|
||||
MNOTE_OLYMPUS_TAG_SHARPNESS = 0x100f,
|
||||
MNOTE_OLYMPUS_TAG_FLASHCHARGELEVEL = 0x1010,
|
||||
MNOTE_OLYMPUS_TAG_COLORMATRIX = 0x1011,
|
||||
MNOTE_OLYMPUS_TAG_BLACKLEVEL = 0x1012,
|
||||
MNOTE_OLYMPUS_TAG_WBALANCE = 0x1015,
|
||||
MNOTE_OLYMPUS_TAG_REDBALANCE = 0x1017,
|
||||
MNOTE_OLYMPUS_TAG_BLUEBALANCE = 0x1018,
|
||||
MNOTE_OLYMPUS_TAG_COLORMATRIXNUMBER = 0x1019,
|
||||
MNOTE_OLYMPUS_TAG_SERIALNUMBER2 = 0x101a,
|
||||
MNOTE_OLYMPUS_TAG_FLASHEXPOSURECOMP = 0x1023,
|
||||
MNOTE_OLYMPUS_TAG_INTERNALFLASHTABLE = 0x1024,
|
||||
MNOTE_OLYMPUS_TAG_EXTERNALFLASHGVALUE = 0x1025,
|
||||
MNOTE_OLYMPUS_TAG_EXTERNALFLASHBOUNCE = 0x1026,
|
||||
MNOTE_OLYMPUS_TAG_EXTERNALFLASHZOOM = 0x1027,
|
||||
MNOTE_OLYMPUS_TAG_EXTERNALFLASHMODE = 0x1028,
|
||||
MNOTE_OLYMPUS_TAG_CONTRAST = 0x1029,
|
||||
MNOTE_OLYMPUS_TAG_SHARPNESSFACTOR = 0x102a,
|
||||
MNOTE_OLYMPUS_TAG_COLORCONTROL = 0x102b,
|
||||
MNOTE_OLYMPUS_TAG_IMAGEWIDTH = 0x102e,
|
||||
MNOTE_OLYMPUS_TAG_IMAGEHEIGHT = 0x102f,
|
||||
MNOTE_OLYMPUS_TAG_SCENEDETECT = 0x1030,
|
||||
MNOTE_OLYMPUS_TAG_COMPRESSIONRATIO = 0x1034,
|
||||
MNOTE_OLYMPUS_TAG_PREVIEWIMAGEVALID = 0x1035,
|
||||
MNOTE_OLYMPUS_TAG_AFRESULT = 0x1038,
|
||||
MNOTE_OLYMPUS_TAG_CCDSCANMODE = 0x1039,
|
||||
MNOTE_OLYMPUS_TAG_NOISEREDUCTION = 0x103a,
|
||||
MNOTE_OLYMPUS_TAG_INFINITYLENSSTEP = 0x103b,
|
||||
MNOTE_OLYMPUS_TAG_NEARLENSSTEP = 0x103c,
|
||||
MNOTE_OLYMPUS_TAG_LIGHTVALUECENTER = 0x103d,
|
||||
MNOTE_OLYMPUS_TAG_LIGHTVALUEPERIPHERY = 0x103e,
|
||||
|
||||
/* Epson */
|
||||
MNOTE_EPSON_TAG_IMAGE_WIDTH = 0x020b,
|
||||
MNOTE_EPSON_TAG_IMAGE_HEIGHT = 0x020c,
|
||||
MNOTE_EPSON_TAG_SOFTWARE = 0x020d,
|
||||
|
||||
/* Sanyo */
|
||||
MNOTE_SANYO_TAG_SEQUENTIALSHOT = 0x020e,
|
||||
MNOTE_SANYO_TAG_WIDERANGE = 0x020f,
|
||||
MNOTE_SANYO_TAG_COLORADJUSTMENTMODE = 0x0210,
|
||||
MNOTE_SANYO_TAG_FOCUSMODE = 0x0212,
|
||||
MNOTE_SANYO_TAG_QUICKSHOT = 0x0213,
|
||||
MNOTE_SANYO_TAG_SELFTIMER = 0x0214,
|
||||
MNOTE_SANYO_TAG_VOICEMEMO = 0x0216,
|
||||
MNOTE_SANYO_TAG_RECORDSHUTTERRELEASE = 0x0217,
|
||||
MNOTE_SANYO_TAG_FLICKERREDUCE = 0x0218,
|
||||
MNOTE_SANYO_TAG_OPTICALZOOM = 0x0219,
|
||||
MNOTE_SANYO_TAG_CCDSENSITIVITY = 0x021a,
|
||||
MNOTE_SANYO_TAG_DIGITALZOOM = 0x021b,
|
||||
MNOTE_SANYO_TAG_LIGHTSOURCESPECIAL = 0x021d,
|
||||
MNOTE_SANYO_TAG_RESAVED = 0x021e,
|
||||
MNOTE_SANYO_TAG_SCENESELECT = 0x021f,
|
||||
MNOTE_SANYO_TAG_MANUALFOCUSDISTANCE = 0x0223,
|
||||
MNOTE_SANYO_TAG_SEQUENCESHOTINTERVAL = 0x0224,
|
||||
};
|
||||
typedef enum _MnoteOlympusTag MnoteOlympusTag;
|
||||
|
||||
/* Don't use these definitions. They are here for compatibility only. */
|
||||
#define MNOTE_OLYMPUS_TAG_UNKNOWN_1 MNOTE_OLYMPUS_TAG_BWMODE
|
||||
#define MNOTE_OLYMPUS_TAG_UNKNOWN_2 MNOTE_OLYMPUS_TAG_FOCALPLANEDIAGONAL
|
||||
#define MNOTE_OLYMPUS_TAG_UNKNOWN_3 MNOTE_OLYMPUS_TAG_LENSDISTORTION
|
||||
#define MNOTE_OLYMPUS_TAG_UNKNOWN_5 MNOTE_OLYMPUS_TAG_DATADUMP
|
||||
#define MNOTE_NIKON_TAG_PREVIEWIMAGE MNOTE_NIKON_TAG_PREVIEWIMAGE_IFD_POINTER
|
||||
|
||||
/*! Return a textual name of the given tag within the Olympus-style MakerNote.
|
||||
* The name is a short, unique, non-localized text string containing only
|
||||
* US-ASCII alphanumeric characters.
|
||||
*
|
||||
* \param[in] tag Olympus-style MakerNote tag
|
||||
* \return textual name of the tag, or NULL if the tag is unknown
|
||||
*/
|
||||
const char *mnote_olympus_tag_get_name (MnoteOlympusTag tag);
|
||||
|
||||
/*! Return a textual title of the given tag within the Olympus-style MakerNote.
|
||||
* The title is a short, localized description of the tag.
|
||||
*
|
||||
* \param[in] tag Olympus-style MakerNote tag
|
||||
* \return textual title of the tag, or NULL if the tag is unknown
|
||||
*/
|
||||
const char *mnote_olympus_tag_get_title (MnoteOlympusTag tag);
|
||||
|
||||
/*! Return a verbose textual description of the given tag within the
|
||||
* Olympus-style MakerNote.
|
||||
* The description is a verbose, localized description of the tag.
|
||||
*
|
||||
* \param[in] tag EXIF tag
|
||||
* \return textual description of the tag, or NULL if the tag is unknown
|
||||
*/
|
||||
const char *mnote_olympus_tag_get_description (MnoteOlympusTag tag);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#endif /* __MNOTE_OLYMPUS_TAG_H__ */
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user