1 /* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
2 /*          EXIFPROBE - TIFF/JPEG/EXIF image file probe               */
3 /* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
4 /* Copyright (C) 2002,2005 by Duane H. Hesser. All rights reserved.   */
5 /*                                                                    */
6 /* See the file LICENSE.EXIFPROBE for terms of use.                   */
7 /* =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- */
8 
9 #ifndef lint
10 static char *ModuleId = "@(#) $Id: maker_tagnames.c,v 1.14 2005/07/24 21:32:11 alex Exp $";
11 #endif
12 
13 /* This file contains routines to produce tag names for tags found in */
14 /* EXIF image MakerNotes on a make/model basis. The "master" routine, */
15 /* maker_tagname() dispatches to maker-specific routines, which may   */
16 /* then examine model magic number (maker.h). Those maker-specific    */
17 /* routines are arranged to check first for model-specific tags; if   */
18 /* the model-specific routine does not exist, or does not name the    */
19 /* current tag, the caller (maker-specific routine) may examine a     */
20 /* "generic" list of tags for that maker. Finally, if the             */
21 /* maker-specific routine finds nothing, the top-level routine        */
22 /* (maker_tagname()) produces and returns a string which is the hex   */
23 /* value of the tag, constructed in static storage.                   */
24 
25 /* Note that only "known" tags are decoded; tags marked "unknnown" in */
26 /* the various references used are unlisted in the maker_specific     */
27 /* routines, so that the tag number will print.                       */
28 
29 #include <stdio.h>
30 #include <string.h>
31 
32 #include "defs.h"
33 #include "maker.h"
34 #include "datadefs.h"
35 #include "maker_datadefs.h"
36 #include "summary.h"
37 #include "misc.h"
38 #include "tags.h"
39 #include "maker_extern.h"
40 #include "extern.h"
41 
42 /* The "master" tagname routine; dispatches to maker-specific         */
43 /* routines. If no maker-specific routine is supplied, a name (hex    */
44 /* value of the tag) will be constructed in static storage. This      */
45 /* routine intends to always return a non-null pointer;               */
46 
47 char *
maker_tagname(unsigned short tag,int make,int model)48 maker_tagname(unsigned short tag,int make,int model)
49 {
50     static char unknown_buf[16];
51     char *tagname = NULL;
52 
53     switch(make)
54     {
55         case MAKER_AGFA:
56             tagname = maker_agfa_tagname(tag,model);
57             break;
58         case MAKER_ASAHI:
59         case MAKER_PENTAX:
60             tagname = maker_asahi_tagname(tag,model);
61             break;
62         case MAKER_CANON:
63             tagname = maker_canon_tagname(tag,model);
64             break;
65         case MAKER_CASIO:
66             tagname = maker_casio_tagname(tag,model);
67             break;
68         case MAKER_EPSON:
69             tagname = maker_epson_tagname(tag,model);
70             break;
71         case MAKER_FUJIFILM:
72             tagname = maker_fujifilm_tagname(tag,model);
73             break;
74         case MAKER_KYOCERA:
75             tagname = maker_kyocera_tagname(tag,model);
76             break;
77         case MAKER_LEICA:
78             tagname = maker_leica_tagname(tag,model);
79             break;
80         case MAKER_MINOLTA:
81             tagname = maker_minolta_tagname(tag,model);
82             break;
83         case MAKER_NIKON:
84             tagname = maker_nikon_tagname(tag,model);
85             break;
86         case MAKER_OLYMPUS:
87             tagname = maker_olympus_tagname(tag,model);
88             break;
89         case MAKER_PANASONIC:
90             tagname = maker_panasonic_tagname(tag,model);
91             break;
92         case MAKER_SANYO:
93             tagname = maker_sanyo_tagname(tag,model);
94             break;
95         case MAKER_SIGMA:
96             tagname = maker_sigma_tagname(tag,model);
97             break;
98         case MAKER_TOSHIBA:
99             tagname = maker_toshiba_tagname(tag,model);
100             break;
101         case MAKER_SONY:
102         case MAKER_KODAK:
103         case MAKER_KONICA:
104         case MAKER_HP:
105         case MAKER_RICOH:
106         case MAKER_TRAVELER:
107         default:
108             break;
109     }
110 
111     if(tagname == NULL)
112     {
113         memset(unknown_buf,'\0',16);
114         /* "regular" tags use lower case; use upper case for          */
115         /* MakerNote tags                                             */
116         if(snprintf(unknown_buf,11,"TAG_%#06X",(int)tag) > 11)
117         {
118             printf(" bad tag %#x not converted\n",tag);
119             why(stdout);
120             tagname = "Maker_BADTAG";
121         }
122         else
123             tagname = unknown_buf;
124     }
125     return(tagname);
126 }
127