Imported Upstream version 0.6

parents
This diff is collapsed.
# -----------------------------------------------------------------------------
# MetaCam - Extract EXIF information from digital camera files, with
# support for Vendor specific blocks.
# Copyright (C) 2000 Daniel Stephens (daniel@cheeseplant.org)
#
# 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.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# -----------------------------------------------------------------------------
#
# $Id: Makefile,v 1.7 2001/12/25 19:56:44 daniel Exp $
# Some operating-system dependent choices for compile-time flags. Uncomment
# whichever is most appropriate
# -- g++ on linux
OSCXXFLAGS=-ansi -pedantic
# -- Cygwin under Windows 2000
#OSCXXFLAGS=
CXX=g++
INCLUDES=
CXXFLAGS=-Wall $(OSCXXFLAGS) -D_GNU_SOURCE -O2 $(INCLUDES)
OBJS=metacam.o rationals.o ifdentry.o ifd.o tifffile.o exiftags.o \
nikontags.o olympustags.o canontags.o casiotags.o dpyfuncs.o
HDRS=metacam.h dpyfuncs.h
DEPS=$(OBJS:.o=.dep)
TIFS=$(wildcard *.TIF)
JPGS=$(wildcard *.JPG)
CAMS=$(TIFS:.TIF=.tcam) $(JPGS:.JPG=.jcam)
##### TARGETS ######
default: metacam
clean:
-rm -f *.o *~
tags:
etags *.cc *.h
realclean:
-rm -f metacam
-rm -f *.o *~
-rm -f *.dep
-rm -f dependencies
-rm -f TAGS
metacam: $(OBJS)
$(CXX) $(CXXFLAGS) $(OBJS) -o metacam -lm
# Dependency rules
dependencies: Makefile $(DEPS)
cat $(DEPS) > dependencies-
mv -f dependencies- dependencies
# Each .dep file will hold dependencies for both the .o file, and an identical
# list to determine when the .dep file needs rebuilding. Clever eh?
%.dep: %.cc $(HDRS)
$(CXX) $(CFLAGS) $(INCS) -M -E -c $*.cc > $*.dep-
sed -e 's/[.]o:/.dep:/' $*.dep- > $*.dep--
cat $*.dep-- >> $*.dep-
rm -f $*.dep--
mv -f $*.dep- $*.dep
include dependencies
Implementation notes by Jan Brittenson (bson@rockgarden.net)
This is notes on the implementation and against
http://www.burren.cx/david/canon.html.
The Canon makenote implementation has been tested against S100 and G1.
The S100 doesn't output focal length information; it leaves the fields
zero.
Tag 0x8 (Image Number): the value 1000 should be 10000.
Tag 0x4 AF point isn't implemented since it's not really understood.
I'll take a stab at it.
Both the S100 and G1 output tags:
TAG 0x2-3:2,672,285,214,
TAG 0x10-4:67371008,
The latter appears to be a long broken into two shorts. The high-end
short is a large number, the low-end short a small number or zero.
Tag 0xc (Camera Serial Number) has been implemented but is untested
since neither my S100 or G1 creates this.
Implementation notes by Pat Tullmann (pat@tullmann.org)
I used the data from
http://www.ba.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html#APP3
and
http://www.dicasoft.de/dicainfo.htm
in late July 2001 to write casiotags.cc.
I based all the code I wrote on the canontags.cc and they dpy* code in
metacam proper.
I tested the casiotags on pictures generated from a Casio QV2000-UX.
The http://www.dicasoft.de/dicainfo.htm source indicates that a some
Casio cameras use a software revision that doesn't generate EXIF
makerinfo tags. Also, the "Object Distance" field is probably bogus.
There are also several fields that are not yet reverse engineered.
dpyfuncs.cc,801
static const char *rcsid=29,1092
dpyISO(32,1182
dpyString(39,1358
void Display_Rational(45,1503
void Display_Rational(56,1672
dpyLens(68,1847
dpyZoom(98,2407
dpyExpAdjust(113,2709
dpyShutter(127,3013
dpyAperture(137,3238
dpyPixels(144,3407
dpySigned(151,3576
dpyUnsigned(162,3804
dpyResolution(169,3962
dpyNULL(179,4212
dpyYes(183,4279
dpyResolutionType(189,4381
dpyBitsPerSample(207,4706
dpyPhotometric(225,5076
dpyCompression(243,5669
dpyYCbCrPositioning(260,6213
dpyExposureProgram(272,6537
dpyMeteringMode(290,7180
dpyLightSource(305,7645
dpyYesNo(320,8094
dpySensingMethod(332,8386
dpyExifVersion(343,8672
dpyExifAperture(357,9006
dpyExifShutter(370,9289
dpyRationalAsDouble(385,9615
dpyOlymSpecialMode(394,9809
dpyOlymJPEGQuality(421,10482
dpyOlymZoom(434,10824
exiftags.cc,123
static const char *rcsid=25,1030
knowntag main_known[31,1266
knowntag exif_known[69,3336
knowntag empty_known[118,5897
ifd.cc,181
static const char *rcsid=27,1052
IFD::IFD(29,1132
IFD::operator=41,1394
IFD::~IFD(67,1882
IFD::IFD(75,1990
IFD::operator[109,2620
if 111,2652
return *table[115,2747
ifdentry.cc,328
static const char *rcsid=27,1052
IFDEntry::Get_UVALUES(30,1158
IFDEntry::Get_SVALUES(50,1639
IFDEntry::Get_RATIONALS(70,2123
IFDEntry::Get_SRATIONALS(84,2443
IFDEntry::Get_STRINGS(98,2756
IFDEntry::Get_OPAQUE(111,3042
IFDEntry::Type_Length(131,3422
static const char *hexdigit=151,4098
IFDEntry::Output_Value(154,4152
metacam.cc,174
static const char *rcsid=41,1288
Process_IFD(44,1384
option opts[54,1621
const char *resolution_unit 61,1743
Display_Tags(64,1787
Clear_Tag_Map(104,2664
main(117,2910
nikontags.cc,64
static const char *rcsid=25,1030
knowntag nikon_known[30,1240
olympustags.cc,66
static const char *rcsid=25,1030
knowntag olympus_known[30,1232
rationals.cc,131
static const char *rcsid=27,1048
unsigned long Euclid(29,1134
tiffRATIONAL::Normalize(38,1290
tiffSRATIONAL::Normalize(47,1438
tifffile.cc,349
static const char *rcsid=30,1115
tiffFile::tiffFile(32,1200
tiffFile::Seek(58,1730
tiffFile::Get_Data(64,1817
tiffFile::Get_UByte(75,2031
tiffFile::Get_UShort(83,2146
tiffFile::Get_ULong(92,2300
tiffFile::Get_SByte(101,2450
tiffFile::Get_SShort(109,2561
tiffFile::Get_SLong(118,2711
tiffFile::Get_IFD(127,2851
tiffFile::Get_IFD(134,2956
dpyfuncs.h,265
#define DPYFUNCS_H_INCLUDED27,1115
extern knowntag main_known[67,3392
extern knowntag exif_known[68,3422
extern knowntag empty_known[69,3452
extern knowntag nikon_known[71,3484
extern knowntag olympus_known[73,3516
extern const char *resolution_unit;75,3550
metacam.h,983
#define METACAM_H_INCLUDED27,1113
class IFD;33,1193
class IFDEntry;34,1204
class istream;35,1220
class ostream;36,1235
typedef unsigned long tiffUNSIGNED;tiffUNSIGNED38,1251
typedef signed long tiffSIGNED;tiffSIGNED39,1287
const unsigned short tBYTE 41,1320
const unsigned short tASCII 42,1357
const unsigned short tSHORT 43,1394
const unsigned short tLONG 44,1431
const unsigned short tRATIONAL 45,1468
const unsigned short tSBYTE 46,1505
const unsigned short tUNDEFINED 47,1542
const unsigned short tSSHORT 48,1579
const unsigned short tSLONG 49,1616
const unsigned short tSRATIONAL 50,1653
const unsigned short tFLOAT 51,1691
const unsigned short tDOUBLE 52,1729
inline ostream &operator << (ostream &os,104,2765
inline ostream &operator << (ostream &os,110,2887
class IFDEntry;150,3733
operator<<(ostream &os,213,5238
typedef map<idpair, IFDEntry*> tagmap;tagmap259,6342
typedef void dpyFunction(dpyFunction261,6382
struct knowntagknowntag263,6455
I'd like to thank the following contributors and supporters of MetaCam for
their help during its ongoing development.
Jan Brittenson
David C. Hansen
Geoff Kuenning
Pat Tullmann
Jan Niehusmann
Holm Sieber
Jeremie Rostand
Also, many thanks to all of the contributors to the various free software
projects which I use on a daily basis, and without which this project (and
many others) would likely never have started!
Daniel Stephens.
/*
------------------------------------------------------------------------------
MetaCam - Extract EXIF information from digital camera files, with
support for Vendor specific blocks.
Copyright (C) 2000 Daniel Stephens (daniel@cheeseplant.org)
Copyright (C) 2001, Jan Brittenson (bson@rockgarden.net)
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.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------
*/
#include "dpyfuncs.h"
static const char *rcsid="";
// Initial Canon tag references from
// http://www.butaman.ne.jp/~tsuruzoh/Computer/Digicams/exif-e.html
knowntag canon_known[] = {
{ 0x1, tSHORT, 0, " ", dpyCanonBlock1},
// 0x2 is unknown
// 0x3 is unknown
{ 0x4, tSHORT, 0, " ", dpyCanonBlock4},
{ 0x8, tLONG, 0, " Image Number", dpyCanonImageNumber},
{ 0x6, tASCII, 0, " Image Type", dpyString},
{ 0x7, tASCII, 0, " Firmware Version", dpyString},
{ 0x9, tASCII, 0, " Owner Name", dpyString},
{ 0xc, tLONG, 0, " Camera Serial Number", dpyCanonSerialNumber},
// { 0xf, tSHORT, 0, " ", dpyCanonCustomTags},
// 0x10 is unknown
{0,0,0,0}
};
/*
------------------------------------------------------------------------------
MetaCam - Extract EXIF information from digital camera files, with
support for Vendor specific blocks.
Copyright (C) 2000 Daniel Stephens (daniel@cheeseplant.org)
Copyright (C) 2001, Jan Brittenson (bson@rockgarden.net)
Copyright (C) 2001, Patrick Tullmann (pat@tullmann.org)
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.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------
*/
#include "dpyfuncs.h"
static const char *rcsid="";
// Initial Casio tag references from
// http://www.ba.wakwak.com/~tsuruzoh/Computer/Digicams/exif-e.html
// and
// http://www.dicasoft.de/dicainfo.htm
knowntag casio_known[] = {
{ 0x1, tSHORT, 0, " Recording Mode", dpyCasioRecMode},
{ 0x2, tSHORT, 0, " Quality", dpyCasioQuality},
{ 0x3, tSHORT, 0, " Focusing Mode", dpyCasioFocusMode},
{ 0x4, tSHORT, 0, " Flash Mode", dpyCasioFlashMode},
{ 0x5, tSHORT, 0, " Flash Intensity", dpyCasioFlashInten},
{ 0x6, tLONG, 0, " Object Distance ~", dpyCasioDistance},
{ 0x7, tSHORT, 0, " White Balance", dpyCasioWhiteBalance},
// 0x8 is unknown tSHORT
// 0x9 is unknown tSHORT
{ 0xa, tLONG, 0, " Digital Zoom", dpyCasioDigitalZoom},
{ 0xb, tSHORT, 0, " Sharpness", dpyCasioSharpness},
{ 0xc, tSHORT, 0, " Contrast", dpyCasioContrast},
{ 0xd, tSHORT, 0, " Saturation", dpyCasioSaturation},
// 0xe through 0x013 are unknown tSHORT
{ 0x14,tSHORT, 0, " CCD Sensitivity", dpyCasioSensitivity},
{0,0,0,0}
};
This diff is collapsed.
/* This file is -*-C++-*-
------------------------------------------------------------------------------
MetaCam - Extract EXIF information from digital camera files, with
support for Vendor specific blocks.
Copyright (C) 2000 Daniel Stephens (daniel@cheeseplant.org)
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.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------
$Id: dpyfuncs.h,v 1.5 2001/12/25 19:47:39 daniel Exp $
*/
#ifndef DPYFUNCS_H_INCLUDED
#define DPYFUNCS_H_INCLUDED
#include "metacam.h"
// Display functions
extern void dpyISO(ostream &os, const char *, const IFDEntry &e);
extern void dpyString(ostream &os, const char *, const IFDEntry &e);
extern void dpyLens(ostream &os, const char *, const IFDEntry &e);
extern void dpyZoom(ostream &os, const char *, const IFDEntry &e);
extern void dpyExpAdjust(ostream &os, const char *, const IFDEntry &e);
extern void dpyShutter(ostream &os, const char *, const IFDEntry &e);
extern void dpyAperture(ostream &os, const char *, const IFDEntry &e);
extern void dpyPixels(ostream &os, const char *, const IFDEntry &e);
extern void dpySigned(ostream &os, const char *, const IFDEntry &e);
extern void dpyUnsigned(ostream &os, const char *, const IFDEntry &e);
extern void dpyResolution(ostream &os, const char *, const IFDEntry &e);
extern void dpyNULL(ostream &os, const char *, const IFDEntry &e);
extern void dpyYes(ostream &os, const char *, const IFDEntry &e);
extern void dpyResolutionType(ostream &os, const char *, const IFDEntry &e);
extern void dpyBitsPerSample(ostream &os, const char *, const IFDEntry &e);
extern void dpyPhotometric(ostream &os, const char *, const IFDEntry &e);
extern void dpyCompression(ostream &os, const char *, const IFDEntry &e);
extern void dpyYCbCrPositioning(ostream &os, const char *, const IFDEntry &e);
extern void dpyExposureProgram(ostream &os, const char *, const IFDEntry &e);
extern void dpyMeteringMode(ostream &os, const char *, const IFDEntry &e);
extern void dpyLightSource(ostream &os, const char *, const IFDEntry &e);
extern void dpyYesNo(ostream &os, const char *, const IFDEntry &e);
extern void dpySensingMethod(ostream &os, const char *, const IFDEntry &e);
extern void dpyExifVersion(ostream &os, const char *, const IFDEntry &e);
extern void dpyExifAperture(ostream &os, const char *, const IFDEntry &e);
extern void dpyExifShutter(ostream &os, const char *, const IFDEntry &e);
extern void dpyRationalAsDouble(ostream &os, const char *, const IFDEntry &e);
extern void dpyOlymJPEGQuality(ostream &os, const char *, const IFDEntry &e);
extern void dpyOlymSpecialMode(ostream &os, const char *, const IFDEntry &e);
extern void dpyOlymZoom(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCanonBlock1(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCanonBlock4(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCanonImageNumber(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCanonSerialNumber(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCasioRecMode(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCasioQuality(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCasioFocusMode(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCasioFlashMode(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCasioFlashInten(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCasioDistance(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCasioWhiteBalance(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCasioDigitalZoom(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCasioSharpness(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCasioContrast(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCasioSaturation(ostream &os, const char *name, const IFDEntry &e);
extern void dpyCasioSensitivity(ostream &os, const char *name, const IFDEntry &e);
// Tag Format Lists
extern knowntag main_known[];
extern knowntag exif_known[];
extern knowntag empty_known[];
extern knowntag nikon_known[];
extern knowntag olympus_known[];
extern knowntag canon_known[];
extern knowntag casio_known[];
extern const char *resolution_unit; // hack 8-(
#endif /* DPYFUNCS_H_INCLUDED */
/*
------------------------------------------------------------------------------
MetaCam - Extract EXIF information from digital camera files, with
support for Vendor specific blocks.
Copyright (C) 2000 Daniel Stephens (daniel@cheeseplant.org)
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.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------
*/
#include "dpyfuncs.h"
static const char *rcsid="$Id: exiftags.cc,v 1.2 2000/05/29 22:11:28 daniel Exp $";
// Many of these from the TIFF V6.0 Standard
// Extra EXIF references from:
// http://www.butaman.ne.jp/~tsuruzoh/Computer/Digicams/exif-e.html
knowntag main_known[] = {
{306, 2, 0, " Image Creation Date", dpyString},
{271, 2, 0, " Make", dpyString},
{272, 2, 0, " Model", dpyString},
{305, 2, 0, " Software Version", dpyString},
{296, 3, 0, " Resolution Unit", dpyResolutionType},
{282, 5, 0, " X Resolution", dpyResolution},
{283, 5, 0, " Y Resolution", dpyResolution},
{277, 3, 0, " Samples Per Pixel", dpyUnsigned},
{258, 3, 0, " Bits Per Sample", dpyBitsPerSample},
{270, 2, 0, " Image Description", dpyString},
{513, 4, 0, " Jpeg File Format", dpyYes},
{262, 3, 0, " Photometric Interpretation", dpyPhotometric},
{259, 3, 0, " Compression", dpyCompression},
{0x0213, 3, 0, " YCbCr Positioning", dpyYCbCrPositioning},
{0x0112, 3, 1, " [Orientation]", 0},
{0x013E, 5, 1, " [White Point]", 0},
{0x013F, 5, 1, " [Primary Chromacities]", 0},
{0x0211, 5, 1, " [YCbCr Coefficients]", 0},
{0x0214, 5, 1, " [Reference Black/White]", 0},
{257, 3, 1, " Image Length", dpyNULL},
{257, 4, 1, " Image Length", dpyNULL},
{256, 3, 1, " Image Width", dpyNULL},
{256, 4, 1, " Image Width", dpyNULL},
{278, 3, 2, " Rows Per Strip", dpyNULL},
{278, 4, 2, " Rows Per Strip", dpyNULL},
{273, 3, 2, " Strip Offsets", dpyNULL},
{273, 4, 2, " Strip Offsets", dpyNULL},
{279, 3, 2, " Strip Byte Counts", dpyNULL},
{279, 4, 2, " Strip Byte Counts", dpyNULL},
{284, 3, 2, " Planar Configuration", dpyNULL},
{514, 4, 2, " JPEG Interchange Fmt Length", dpyNULL},
{515, 3, 2, " JPEG Restart Interval", dpyNULL},
{0,0,0,0}
};
knowntag exif_known[] = {
{0x9290, 2, 0, " Sub-Second Creation Time", dpyString},
{0x9003, 2, 0, " Image Capture Date", dpyString},
{0x9291, 2, 0, " Sub-Second Capture Time", dpyString},
{0x9004, 2, 0, " Image Digitized Date", dpyString},
{0x9292, 2, 0, " Sub-Second Digitized Time", dpyString},
{0x9204, 10, 0, " Exposure Bias", dpyExpAdjust},
{0x920a, 5, 0, " Focal Length", dpyZoom},
{0x829a, 5, 0, " Exposure Time", dpyShutter},
{0x829d, 5, 0, " Aperture", dpyAperture},
{0xa002, 3, 0, " Exif Image Width", dpyPixels},
{0xa002, 4, 0, " Exif Image Width", dpyPixels},
{0xa003, 3, 0, " Exif Image Height", dpyPixels},
{0xa003, 4, 0, " Exif Image Height", dpyPixels},
{0x8822, 3, 0, " Exposure Program", dpyExposureProgram},
{0x8827, 3, 0, " ISO Speed Rating", dpyISO},
{0x9207, 3, 0, " Metering Mode", dpyMeteringMode},
{0x9000, 7, 0, " EXIF Version", dpyExifVersion},
{0xa000, 7, 0, " FlashPix Version", dpyExifVersion},
{0x9208, 3, 0, " Light Source/White Balance", dpyLightSource},
{0x9209, 3, 0, " Flash", dpyYesNo},
{0xa217, 3, 0, " Sensing Method", dpySensingMethod},
{0x9102, 5, 0, " Compressed Bits Per Pixel", dpyRationalAsDouble},
{0x9202, 5, 0, " Aperture Value", dpyExifAperture},
{0x9203, 10,0, " Brightness Value", dpyExpAdjust},
{0x9205, 5, 0, " Max Aperture Value", dpyExifAperture},
{0xa210, 3, 0, " Focal Plane Resolution Unit", dpyResolutionType},
{0xa20e, 5, 0, " Focal Plane X Resolution", dpyResolution},
{0xa20f, 5, 0, " Focal Plane Y Resolution", dpyResolution},
{0x8298, 2, 0, " Copyright", dpyString},
{0x9201, 10,0, " Shutter Speed Value", dpyExifShutter},
{0x9101, 7, 1, " [Component Configuration]", 0},
{0x9206, 10,1, " [Subject Distance]", 0},
{0x9286, 7, 1, " [User Comment]", 0},
{0xa001, 3, 1, " [ColorSpace]", 0},
{0xa004, 2, 1, " [Related Sound File]", 0},
{0xa005, 4, 2, "[ExifInteroperabilityOffset]", 0},
{0xa300, 7, 1, " [File Source]", 0},
{0xa301, 7, 1, " [Scene Type]", 0},
{0xa302, 7, 1, " [CFA Pattern]", 0},
{0,0,0,0}
};
knowntag empty_known[] = {
{0,0,0,0}
};
/*
------------------------------------------------------------------------------
MetaCam - Extract EXIF information from digital camera files, with
support for Vendor specific blocks.
Copyright (C) 2000 Daniel Stephens (daniel@cheeseplant.org)
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.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------
*/
#include <iostream.h>
#include "metacam.h"
static const char *rcsid="$Id: ifd.cc,v 1.2 2000/05/29 22:11:28 daniel Exp $";
IFD::IFD(const IFD &i)
: file(i.file), ofs(i.ofs), entries(i.entries), next_ifd(i.next_ifd)
{
if (entries) {
table = new IFDEntry *[i.entries];
for (int x=0; x<entries; ++x) table[x] = new IFDEntry(*i.table[x]);
} else {
table = 0;
}
}
IFD &
IFD::operator=(const IFD &i)
{
if (this == &i) return *this;
if (&file != &i.file) {
cerr << "Cannot change file!" << endl;
exit(2);
}
if (entries) {
for (int i=0; i<entries; ++i) delete table[i];
delete [] table;
}
ofs = i.ofs;
entries = i.entries;
next_ifd = i.next_ifd;
if (entries) {
table = new IFDEntry *[i.entries];
for (int x=0; x<entries; ++x) table[x] = new IFDEntry(*i.table[x]);
} else {
table = 0;
}
return *this;
}
IFD::~IFD()
{
if (entries) {
for (int i=0; i<entries; ++i) delete table[i];
delete [] table;
}
}
IFD::IFD(tiffFile &t, unsigned long o, unsigned long tagofs)
: file(t), ofs(o), table(0)
{
if (!ofs) {
entries=0;
table=0;
next_ifd=0;
return;
}
file.Seek(ofs);
entries = file.Get_UShort();
table = new IFDEntry *[entries];
int i;
for (i=0; i<entries; ++i) {
IFDEntry e(file);
e.tag = file.Get_UShort() + tagofs;
e.type = file.Get_UShort();
e.values = file.Get_ULong();
if (e.Length() <= 4) {
e.offset = file.Get_Offset();
file.Get_ULong();
} else {
e.offset = file.Get_ULong();
}
table[i] = new IFDEntry(e);
}
next_ifd = file.Get_ULong();
}
const IFDEntry &
IFD::operator[](int n) const
{
if ((n<0) || (n>=entries)) {
cerr << "IFD Array Bounds Violated" << endl;
exit(2);
}
return *table[n];
}
/*
------------------------------------------------------------------------------
MetaCam - Extract EXIF information from digital camera files, with
support for Vendor specific blocks.
Copyright (C) 2000 Daniel Stephens (daniel@cheeseplant.org)
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.
This program 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
------------------------------------------------------------------------------
*/
#include <iostream.h>