main.html
Main Page
|
classes.html
Alphabetical List
|
annotated.html
Data Structures
|
dirs.html
Directories
|
files.html
File List
|
functions.html
Data Fields
|
globals.html
Globals
dir_000000.html
libexif
&raquo
dir_000003.html
pentax
mnote-pentax-entry.c
mnote-pentax-entry_8c.html
Go to the documentation of this file.
00001
/* mnote-pentax-entry.c
00002
*
00003
* Copyright ? 2002 Lutz M?ller <lutz@users.sourceforge.net>
00004
*
00005
* This library is free software; you can redistribute it and/or
00006
* modify it under the terms of the GNU Lesser General Public
00007
* License as published by the Free Software Foundation; either
00008
* version 2 of the License, or (at your option) any later version.
00009
*
00010
* This library is distributed in the hope that it will be useful,
00011
* but WITHOUT ANY WARRANTY; without even the implied warranty of
00012
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013
* Lesser General Public License for more details.
00014
*
00015
* You should have received a copy of the GNU Lesser General Public
00016
* License along with this library; if not, write to the
00017
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00018
* Boston, MA 02111-1307, USA.
00019
*/
00020
00021
#include <config.h>
00022
#include "
mnote-pentax-entry_8h.html
mnote-pentax-entry.h
"
00023
00024
#include <
i18n_8h.html
libexif/i18n.h
>
00025
00026
#include <stdio.h>
00027
#include <stdlib.h>
00028
#include <string.h>
00029
00030
#include <
exif-format_8h.html
libexif/exif-format.h
>
00031
#include <
exif-utils_8h.html
libexif/exif-utils.h
>
00032
#include <
exif-entry_8h.html
libexif/exif-entry.h
>
00033
00034
mnote-pentax-entry_8c.html#a0
00035
#define CF(format,target,v,maxlen)                              \
00036
{                                                               \
00037
if (format != target) {                                 \
00038
snprintf (v, maxlen,                            \
00039
_("Invalid format '%s', "               \
00040
"expected '%s'."),                      \
00041
exif_format_get_name (format),          \
00042
exif_format_get_name (target));         \
00043
break;                                          \
00044
}                                                       \
00045
}
00046
mnote-pentax-entry_8c.html#a1
00047
#define CC(number,target,v,maxlen)                                      \
00048
{                                                                       \
00049
if (number != target) {                                         \
00050
snprintf (v, maxlen,                                    \
00051
_("Invalid number of components (%i, "          \
00052
"expected %i)."), (int) number, (int) target);  \
00053
break;                                                  \
00054
}                                                               \
00055
}
00056
00057
static
struct
{
mnote-pentax-entry_8c.html#a2
00058
exif-tag_8h.html#a153
ExifTag
mnote-canon-tag_8c.html#a0
tag
;
00059
struct
{
mnote-pentax-entry_8c.html#a3
00060
int
exif-entry_8c.html#a5
index
;
mnote-pentax-entry_8c.html#a4
00061
const
char
*
mnote-olympus-entry_8c.html#a6
string
;
00062         }
exif-entry_8c.html#a7
elem
[7];
00063 }
mnote-olympus-entry_8c.html#a8
items
[] = {
00064   {
mnote-pentax-tag_8h.html#a31a1
MNOTE_PENTAX_TAG_MODE
,
00065     { {0,
i18n_8h.html#a7
N_
(
"Auto"
)},
00066       {1,
i18n_8h.html#a7
N_
(
"Night-scene"
)},
00067       {2,
i18n_8h.html#a7
N_
(
"Manual"
)},
00068       {0, NULL}}},
00069   {
mnote-pentax-tag_8h.html#a31a2
MNOTE_PENTAX_TAG_QUALITY
,
00070     { {0,
i18n_8h.html#a7
N_
(
"Good"
)},
00071       {1,
i18n_8h.html#a7
N_
(
"Better"
)},
00072       {2,
i18n_8h.html#a7
N_
(
"Best"
)},{0,NULL}}},
00073   {
mnote-pentax-tag_8h.html#a31a3
MNOTE_PENTAX_TAG_FOCUS
,
00074     { {2,
i18n_8h.html#a7
N_
(
"Custom"
)},
00075       {3,
i18n_8h.html#a7
N_
(
"Auto"
)},
00076       {0, NULL}}},
00077   {
mnote-pentax-tag_8h.html#a31a4
MNOTE_PENTAX_TAG_FLASH
,
00078     { {1,
i18n_8h.html#a7
N_
(
"Auto"
)},
00079       {2,
i18n_8h.html#a7
N_
(
"Flash on"
)},
00080       {4,
i18n_8h.html#a7
N_
(
"Flash off"
)},
00081       {6,
i18n_8h.html#a7
N_
(
"Red-eye Reduction"
)},
00082       {0, NULL}}},
00083   {
mnote-pentax-tag_8h.html#a31a7
MNOTE_PENTAX_TAG_WHITE_BALANCE
,
00084     { {0,
i18n_8h.html#a7
N_
(
"Auto"
)},
00085       {1,
i18n_8h.html#a7
N_
(
"Daylight"
)},
00086       {2,
i18n_8h.html#a7
N_
(
"Shade"
)},
00087       {3,
i18n_8h.html#a7
N_
(
"Tungsten"
)},
00088       {4,
i18n_8h.html#a7
N_
(
"Fluorescent"
)},
00089       {5,
i18n_8h.html#a7
N_
(
"Manual"
)},
00090       {0, NULL}}},
00091   {
mnote-pentax-tag_8h.html#a31a11
MNOTE_PENTAX_TAG_SHARPNESS
,
00092     { {0,
i18n_8h.html#a7
N_
(
"Normal"
)},
00093       {1,
i18n_8h.html#a7
N_
(
"Soft"
)},
00094       {2,
i18n_8h.html#a7
N_
(
"Hard"
)},
00095       {0, NULL}}},
00096   {
mnote-pentax-tag_8h.html#a31a12
MNOTE_PENTAX_TAG_CONTRAST
,
00097     { {0,
i18n_8h.html#a7
N_
(
"Normal"
)},
00098       {1,
i18n_8h.html#a7
N_
(
"Low"
)},
00099       {2,
i18n_8h.html#a7
N_
(
"High"
)},
00100       {0, NULL}}},
00101   {
mnote-pentax-tag_8h.html#a31a13
MNOTE_PENTAX_TAG_SATURATION
,
00102     { {0,
i18n_8h.html#a7
N_
(
"Normal"
)},
00103       {1,
i18n_8h.html#a7
N_
(
"Low"
)},
00104       {2,
i18n_8h.html#a7
N_
(
"High"
)},
00105       {0, NULL}}},
00106   {
mnote-pentax-tag_8h.html#a31a20
MNOTE_PENTAX_TAG_ISO_SPEED
,
00107     { {10,
i18n_8h.html#a7
N_
(
"100"
)},
00108       {16,
i18n_8h.html#a7
N_
(
"200"
)},
00109       {100,
i18n_8h.html#a7
N_
(
"100"
)},
00110       {200,
i18n_8h.html#a7
N_
(
"200"
)},
00111       { 0,  NULL}}},
00112   {
mnote-pentax-tag_8h.html#a31a22
MNOTE_PENTAX_TAG_COLOR
,
00113     { {1,
i18n_8h.html#a7
N_
(
"Full"
)},
00114       {2,
i18n_8h.html#a7
N_
(
"Black & White"
)},
00115       {3,
i18n_8h.html#a7
N_
(
"Sepia"
)},
00116       {0, NULL}}},
00117 };
00118
00119
char
*
mnote-pentax-entry_8h.html#a1
00120
mnote-pentax-entry_8c.html#a7
mnote_pentax_entry_get_value
(
struct__MnotePentaxEntry.html
MnotePentaxEntry
*entry,
00121
char
*val,
unsigned
int
maxlen)
00122 {
00123
exif-utils_8h.html#a6
ExifLong
vl;
00124
exif-utils_8h.html#a4
ExifShort
vs;
00125
int
i = 0, j = 0;
00126
00127
if
(!entry)
return
(NULL);
00128
00129         memset (val, 0, maxlen);
00130         maxlen--;
00131
00132
switch
(entry->
struct__MnotePentaxEntry.html#o0
tag
) {
00133
case
mnote-pentax-tag_8h.html#a31a1
MNOTE_PENTAX_TAG_MODE
:
00134
case
mnote-pentax-tag_8h.html#a31a2
MNOTE_PENTAX_TAG_QUALITY
:
00135
case
mnote-pentax-tag_8h.html#a31a3
MNOTE_PENTAX_TAG_FOCUS
:
00136
case
mnote-pentax-tag_8h.html#a31a4
MNOTE_PENTAX_TAG_FLASH
:
00137
case
mnote-pentax-tag_8h.html#a31a7
MNOTE_PENTAX_TAG_WHITE_BALANCE
:
00138
case
mnote-pentax-tag_8h.html#a31a11
MNOTE_PENTAX_TAG_SHARPNESS
:
00139
case
mnote-pentax-tag_8h.html#a31a12
MNOTE_PENTAX_TAG_CONTRAST
:
00140
case
mnote-pentax-tag_8h.html#a31a13
MNOTE_PENTAX_TAG_SATURATION
:
00141
case
mnote-pentax-tag_8h.html#a31a20
MNOTE_PENTAX_TAG_ISO_SPEED
:
00142
case
mnote-pentax-tag_8h.html#a31a22
MNOTE_PENTAX_TAG_COLOR
:
00143
mnote-canon-entry_8c.html#a0
CF
(entry->
struct__MnotePentaxEntry.html#o1
format
,
exif-format_8h.html#a14a2
EXIF_FORMAT_SHORT
, val, maxlen);
00144
mnote-canon-entry_8c.html#a1
CC
(entry->
struct__MnotePentaxEntry.html#o2
components
, 1, val, maxlen);
00145                 vs =
exif-utils_8c.html#a2
exif_get_short
(entry->
struct__MnotePentaxEntry.html#o3
data
, entry->
struct__MnotePentaxEntry.html#o5
order
);
00146
00147
/* search the tag */
00148
for
(i = 0; (
mnote-olympus-entry_8c.html#a8
items
[i].
mnote-canon-tag_8c.html#a0
tag
&&
mnote-olympus-entry_8c.html#a8
items
[i].
mnote-canon-tag_8c.html#a0
tag
!= entry->
struct__MnotePentaxEntry.html#o0
tag
); i++);
00149
if
(!
mnote-olympus-entry_8c.html#a8
items
[i].
mnote-canon-tag_8c.html#a0
tag
) {
00150                         strncpy (val,
"Internal error"
, maxlen);
00151
break
;
00152                 }
00153
00154
/* find the value */
00155
for
(j = 0;
mnote-olympus-entry_8c.html#a8
items
[i].
exif-entry_8c.html#a7
elem
[j].
mnote-olympus-entry_8c.html#a6
string
&&
00156                             (
mnote-olympus-entry_8c.html#a8
items
[i].
exif-entry_8c.html#a7
elem
[j].
exif-entry_8c.html#a5
index
< vs); j++);
00157
if
(
mnote-olympus-entry_8c.html#a8
items
[i].
exif-entry_8c.html#a7
elem
[j].
exif-entry_8c.html#a5
index
!= vs) {
00158                         snprintf (val, maxlen,
00159
"Internal error (unknown value %i)"
, vs);
00160
break
;
00161                 }
00162                 snprintf (val, maxlen,
"%s"
,
mnote-olympus-entry_8c.html#a8
items
[i].
exif-entry_8c.html#a7
elem
[j].
mnote-olympus-entry_8c.html#a6
string
);
00163
break
;
00164
00165
case
mnote-pentax-tag_8h.html#a31a10
MNOTE_PENTAX_TAG_ZOOM
:
00166
mnote-canon-entry_8c.html#a0
CF
(entry->
struct__MnotePentaxEntry.html#o1
format
,
exif-format_8h.html#a14a3
EXIF_FORMAT_LONG
, val, maxlen);
00167
mnote-canon-entry_8c.html#a1
CC
(entry->
struct__MnotePentaxEntry.html#o2
components
, 1, val, maxlen);
00168                 vl =
exif-utils_8c.html#a7
exif_get_long
(entry->
struct__MnotePentaxEntry.html#o3
data
, entry->
struct__MnotePentaxEntry.html#o5
order
);
00169                 snprintf (val, maxlen,
"%li"
, (
long
int
) vl);
00170
break
;
00171
case
mnote-pentax-tag_8h.html#a31a25
MNOTE_PENTAX_TAG_PRINTIM
:
00172
mnote-canon-entry_8c.html#a0
CF
(entry->
struct__MnotePentaxEntry.html#o1
format
,
exif-format_8h.html#a14a6
EXIF_FORMAT_UNDEFINED
, val, maxlen);
00173
mnote-canon-entry_8c.html#a1
CC
(entry->
struct__MnotePentaxEntry.html#o2
components
, 124, val, maxlen);
00174                 snprintf (val, maxlen,
"%li bytes unknown data"
,
00175                           entry->
struct__MnotePentaxEntry.html#o2
components
);
00176
break
;
00177
case
mnote-pentax-tag_8h.html#a31a26
MNOTE_PENTAX_TAG_TZ_CITY
:
00178
mnote-canon-entry_8c.html#a0
CF
(entry->
struct__MnotePentaxEntry.html#o1
format
,
exif-format_8h.html#a14a6
EXIF_FORMAT_UNDEFINED
, val, maxlen);
00179
mnote-canon-entry_8c.html#a1
CC
(entry->
struct__MnotePentaxEntry.html#o2
components
, 4, val, maxlen);
00180                 snprintf (val, entry->
struct__MnotePentaxEntry.html#o2
components
,
"%s"
, entry->
struct__MnotePentaxEntry.html#o3
data
);
00181
break
;
00182
case
mnote-pentax-tag_8h.html#a31a27
MNOTE_PENTAX_TAG_TZ_DST
:
00183
mnote-canon-entry_8c.html#a0
CF
(entry->
struct__MnotePentaxEntry.html#o1
format
,
exif-format_8h.html#a14a6
EXIF_FORMAT_UNDEFINED
, val, maxlen);
00184
mnote-canon-entry_8c.html#a1
CC
(entry->
struct__MnotePentaxEntry.html#o2
components
, 4, val, maxlen);
00185                 snprintf (val, entry->
struct__MnotePentaxEntry.html#o2
components
,
"%s"
, entry->
struct__MnotePentaxEntry.html#o3
data
);
00186
break
;
00187
default
:
00188
switch
(entry->
struct__MnotePentaxEntry.html#o1
format
) {
00189
case
exif-format_8h.html#a14a1
EXIF_FORMAT_ASCII
:
00190                   strncpy (val, (
char
*)entry->
struct__MnotePentaxEntry.html#o3
data
,
exif-loader_8c.html#a5
MIN
(maxlen, entry->
struct__MnotePentaxEntry.html#o2
components
));
00191
break
;
00192
case
exif-format_8h.html#a14a2
EXIF_FORMAT_SHORT
:
00193                   vs =
exif-utils_8c.html#a2
exif_get_short
(entry->
struct__MnotePentaxEntry.html#o3
data
, entry->
struct__MnotePentaxEntry.html#o5
order
);
00194                   snprintf (val, maxlen,
"%i"
, vs);
00195
break
;
00196
case
exif-format_8h.html#a14a3
EXIF_FORMAT_LONG
:
00197                   vl =
exif-utils_8c.html#a7
exif_get_long
(entry->
struct__MnotePentaxEntry.html#o3
data
, entry->
struct__MnotePentaxEntry.html#o5
order
);
00198                   snprintf (val, maxlen,
"%li"
, (
long
int
) vl);
00199
break
;
00200
case
exif-format_8h.html#a14a6
EXIF_FORMAT_UNDEFINED
:
00201
default
:
00202                   snprintf (val, maxlen,
"%li bytes unknown data"
,
00203                             entry->
struct__MnotePentaxEntry.html#o2
components
);
00204
break
;
00205                 }
00206
break
;
00207         }
00208
00209
return
(val);
00210 }
Generated on Fri Sep 9 16:28:11 2005 for EXIF library (libexif) Internals by
http://www.doxygen.org/index.html
doxygen
1.4.4
