  
    
main.htmlMain Page     
classes.htmlData Structures     
files.htmlFiles     
dirs.htmlDirectories   
  
    
files.htmlFile List     
globals.htmlGlobals   
dir_20715630405f3b63e7ab7a5c713843d9.htmllibexif  &raquo dir_4fac0cd1acc3f1069489eacf8876e579.htmlpentax mnote-pentax-entry.c
mnote-pentax-entry_8c.htmlGo 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.htmlmnote-pentax-entry.h " 00023 
00024 #include < i18n_8h.htmllibexif/i18n.h > 00025 
00026 #include <stdio.h> 00027 #include <stdlib.h> 00028 #include <string.h> 00029 
00030 #include < exif-format_8h.htmllibexif/exif-format.h > 00031 #include < exif-utils_8h.htmllibexif/exif-utils.h > 00032 #include < exif-entry_8h.htmllibexif/exif-entry.h > 00033 
00034 
mnote-pentax-entry_8c.html#a0a1e2b5f27a27bd54258f665f4a0f5e00035  #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#1eddfa358a4bf2f9641d7c267eeaffbd00047  #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#00b5e67d036a56d6bde55b838adcd30400058          exif-tag_8h.html#c9815913f16bb40205dcbc2b4d9f36a3ExifTag  mnote-canon-tag_8c.html#d88e1213ca240fe301a9559678bddd9btag ;
00059         struct {
mnote-pentax-entry_8c.html#de656d9dbc961315338502c279442a7a00060                  int exif-entry_8c.html#de656d9dbc961315338502c279442a7aindex ;
mnote-pentax-entry_8c.html#fdc36b1bc56391e3ac1692b287dc2bb800061                  const char * mnote-olympus-entry_8c.html#fdc36b1bc56391e3ac1692b287dc2bb8string ;
00062         } exif-entry_8c.html#1a2e3f9570a7b119e5ffc2124239ec0aelem [7];
00063 } mnote-olympus-entry_8c.html#811e40b15bce44da9a6d024957a47a55items [] = {
00064   { mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae95285dc1fd031c2e2601c42052aab1cecaa1MNOTE_PENTAX_TAG_MODE ,
00065     { {0, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Auto")},
00066       {1, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Night-scene")},
00067       {2, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Manual")},
00068       {0, NULL}}},
00069   { mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae95287b1550c9d0a0693f0b766a68873d0a70MNOTE_PENTAX_TAG_QUALITY ,
00070     { {0, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Good")},
00071       {1, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Better")},
00072       {2, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Best")},{0,NULL}}},
00073   { mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae9528f5c1462126143b216988abea2cac23b7MNOTE_PENTAX_TAG_FOCUS ,
00074     { {2, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Custom")},
00075       {3, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Auto")},
00076       {0, NULL}}},
00077   { mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae952800eb986002a3c181c15403719e1686e8MNOTE_PENTAX_TAG_FLASH ,
00078     { {1, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Auto")},
00079       {2, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Flash on")},
00080       {4, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Flash off")},
00081       {6, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Red-eye Reduction")},
00082       {0, NULL}}},
00083   { mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae95285df564052e315878737aad6d9a329fb5MNOTE_PENTAX_TAG_WHITE_BALANCE ,
00084     { {0, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Auto")},
00085       {1, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Daylight")},
00086       {2, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Shade")},
00087       {3, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Tungsten")},
00088       {4, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Fluorescent")},
00089       {5, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Manual")},
00090       {0, NULL}}},
00091   { mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae952836dcb80cd9c45462da94783b9a0b65b5MNOTE_PENTAX_TAG_SHARPNESS ,
00092     { {0, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Normal")},
00093       {1, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Soft")},
00094       {2, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Hard")},
00095       {0, NULL}}},
00096   { mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae9528aed54cd959a2afb23eefbc6401873902MNOTE_PENTAX_TAG_CONTRAST ,
00097     { {0, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Normal")},
00098       {1, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Low")},
00099       {2, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("High")},
00100       {0, NULL}}},
00101   { mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae952823d2c44de76de17bb1aa93ce3d461fa8MNOTE_PENTAX_TAG_SATURATION ,
00102     { {0, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Normal")},
00103       {1, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Low")},
00104       {2, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("High")},
00105       {0, NULL}}},
00106   { mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae9528f9eb7654ead4e18c256ee3e59815635dMNOTE_PENTAX_TAG_ISO_SPEED ,
00107     { {10,  i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("100")},
00108       {16,  i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("200")},
00109       {100, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("100")},
00110       {200, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("200")},
00111       { 0,  NULL}}},
00112   { mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae9528126c6309941876a4b337dd4d6495fd45MNOTE_PENTAX_TAG_COLOR ,
00113     { {1, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Full")},
00114       {2, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Black & White")},
00115       {3, i18n_8h.html#3a5ebfb532ab1a97cf24a0c0320b9c58N_ ("Sepia")},
00116       {0, NULL}}},
00117 };
00118 
00119 char *
mnote-pentax-entry_8h.html#137033048632a708298473624cea661a00120  mnote-pentax-entry_8c.html#137033048632a708298473624cea661amnote_pentax_entry_get_value  ( struct__MnotePentaxEntry.htmlMnotePentaxEntry  *entry,
00121                               char *val, unsigned int maxlen)
00122 {
00123         exif-utils_8h.html#1601686195534cc6337c596fb8af54faExifLong  vl;
00124         exif-utils_8h.html#23497f35004fb9e65a70b29fd1622a9cExifShort  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#38c3042efdaa48809bd7be5da7a2d8d6tag ) {
00133           case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae95285dc1fd031c2e2601c42052aab1cecaa1MNOTE_PENTAX_TAG_MODE :
00134           case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae95287b1550c9d0a0693f0b766a68873d0a70MNOTE_PENTAX_TAG_QUALITY :
00135           case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae9528f5c1462126143b216988abea2cac23b7MNOTE_PENTAX_TAG_FOCUS :
00136           case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae952800eb986002a3c181c15403719e1686e8MNOTE_PENTAX_TAG_FLASH :
00137           case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae95285df564052e315878737aad6d9a329fb5MNOTE_PENTAX_TAG_WHITE_BALANCE :
00138           case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae952836dcb80cd9c45462da94783b9a0b65b5MNOTE_PENTAX_TAG_SHARPNESS :
00139           case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae9528aed54cd959a2afb23eefbc6401873902MNOTE_PENTAX_TAG_CONTRAST :
00140           case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae952823d2c44de76de17bb1aa93ce3d461fa8MNOTE_PENTAX_TAG_SATURATION :
00141           case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae9528f9eb7654ead4e18c256ee3e59815635dMNOTE_PENTAX_TAG_ISO_SPEED :
00142           case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae9528126c6309941876a4b337dd4d6495fd45MNOTE_PENTAX_TAG_COLOR :
00143                 mnote-canon-entry_8c.html#a0a1e2b5f27a27bd54258f665f4a0f5eCF  (entry-> struct__MnotePentaxEntry.html#b9499a7a6b509595cf6b4bffad75c792format , exif-format_8h.html#b34eef28c00c9728719334fa6a37bcd16187ddb8892af4772728e34118b26a4fEXIF_FORMAT_SHORT , val, maxlen);
00144                 mnote-canon-entry_8c.html#1eddfa358a4bf2f9641d7c267eeaffbdCC  (entry-> struct__MnotePentaxEntry.html#38c4466a74c42e696d65a652c3322ececomponents , 1, val, maxlen);
00145                 vs = exif-utils_8c.html#28505bc3777648fce6676fc01d74eb40exif_get_short  (entry-> struct__MnotePentaxEntry.html#7c5263fcf2b3d701746a9bab6339cc63data , entry-> struct__MnotePentaxEntry.html#cf6efc685e5a478d59742d77e4feb87eorder );
00146 
00147                 /* search the tag */ 00148                 for (i = 0; ( mnote-olympus-entry_8c.html#811e40b15bce44da9a6d024957a47a55items [i].tag && mnote-olympus-entry_8c.html#811e40b15bce44da9a6d024957a47a55items [i].tag != entry-> struct__MnotePentaxEntry.html#38c3042efdaa48809bd7be5da7a2d8d6tag ); i++);
00149                 if (! mnote-olympus-entry_8c.html#811e40b15bce44da9a6d024957a47a55items [i]. mnote-canon-tag_8c.html#d88e1213ca240fe301a9559678bddd9btag ) {
00150                         strncpy (val, "Internal error", maxlen);
00151                         break;
00152                 }
00153 
00154                 /* find the value */ 00155                 for (j = 0; mnote-olympus-entry_8c.html#811e40b15bce44da9a6d024957a47a55items [i].elem[j].string &&
00156                             ( mnote-olympus-entry_8c.html#811e40b15bce44da9a6d024957a47a55items [i].elem[j].index < vs); j++);
00157                 if ( mnote-olympus-entry_8c.html#811e40b15bce44da9a6d024957a47a55items [i]. exif-entry_8c.html#1a2e3f9570a7b119e5ffc2124239ec0aelem [j]. exif-entry_8c.html#de656d9dbc961315338502c279442a7aindex  != 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#811e40b15bce44da9a6d024957a47a55items [i]. exif-entry_8c.html#1a2e3f9570a7b119e5ffc2124239ec0aelem [j]. mnote-olympus-entry_8c.html#fdc36b1bc56391e3ac1692b287dc2bb8string );
00163                 break;
00164 
00165         case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae95286aad6b494e6c3afb1e77dfbe06cc57beMNOTE_PENTAX_TAG_ZOOM :
00166                 mnote-canon-entry_8c.html#a0a1e2b5f27a27bd54258f665f4a0f5eCF  (entry->format, exif-format_8h.html#b34eef28c00c9728719334fa6a37bcd1b6f3a3c87b514af859dc91a1a1760f51EXIF_FORMAT_LONG , val, maxlen);
00167                 mnote-canon-entry_8c.html#1eddfa358a4bf2f9641d7c267eeaffbdCC  (entry->components, 1, val, maxlen);
00168                 vl = exif-utils_8c.html#c8ce446b600340ccf5f120d8735319f3exif_get_long  (entry->data, entry->order);
00169                 snprintf (val, maxlen, "%li", (long int) vl);
00170                 break;
00171         case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae95287af5949d9d7b299562b3230476e51f82MNOTE_PENTAX_TAG_PRINTIM :
00172                 mnote-canon-entry_8c.html#a0a1e2b5f27a27bd54258f665f4a0f5eCF  (entry->format, exif-format_8h.html#b34eef28c00c9728719334fa6a37bcd1a52e87eea3c82b9ef481cb68b95843e2EXIF_FORMAT_UNDEFINED , val, maxlen);
00173                 mnote-canon-entry_8c.html#1eddfa358a4bf2f9641d7c267eeaffbdCC  (entry->components, 124, val, maxlen);
00174                 snprintf (val, maxlen, "%li bytes unknown data",
00175                           entry->components);
00176                 break;
00177         case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae95285364c1440dd1340cbbdd2ab5aa55a3b5MNOTE_PENTAX_TAG_TZ_CITY :
00178                 mnote-canon-entry_8c.html#a0a1e2b5f27a27bd54258f665f4a0f5eCF  (entry->format, exif-format_8h.html#b34eef28c00c9728719334fa6a37bcd1a52e87eea3c82b9ef481cb68b95843e2EXIF_FORMAT_UNDEFINED , val, maxlen);
00179                 mnote-canon-entry_8c.html#1eddfa358a4bf2f9641d7c267eeaffbdCC  (entry->components, 4, val, maxlen);
00180                 snprintf (val, entry->components, "%s", entry->data);
00181                 break;
00182         case mnote-pentax-tag_8h.html#a38dd309db190b5a8de2fc308eae9528ba89ac9b8569f1a82b76e48446ab5c40MNOTE_PENTAX_TAG_TZ_DST :
00183                 mnote-canon-entry_8c.html#a0a1e2b5f27a27bd54258f665f4a0f5eCF  (entry->format, exif-format_8h.html#b34eef28c00c9728719334fa6a37bcd1a52e87eea3c82b9ef481cb68b95843e2EXIF_FORMAT_UNDEFINED , val, maxlen);
00184                 mnote-canon-entry_8c.html#1eddfa358a4bf2f9641d7c267eeaffbdCC  (entry->components, 4, val, maxlen);
00185                 snprintf (val, entry->components, "%s", entry->data);
00186                 break;
00187         default:
00188                 switch (entry->format) {
00189                 case exif-format_8h.html#b34eef28c00c9728719334fa6a37bcd1ed05b7fe35145d01244085c176001486EXIF_FORMAT_ASCII :
00190                   strncpy (val, (char *)entry->data, exif-loader_8c.html#9b073a1e97ac8f23636b9d2d443525a5MIN (maxlen, entry->components));
00191                   break;
00192                 case exif-format_8h.html#b34eef28c00c9728719334fa6a37bcd16187ddb8892af4772728e34118b26a4fEXIF_FORMAT_SHORT :
00193                   vs = exif-utils_8c.html#28505bc3777648fce6676fc01d74eb40exif_get_short  (entry->data, entry->order);
00194                   snprintf (val, maxlen, "%i", vs);
00195                   break;
00196                 case exif-format_8h.html#b34eef28c00c9728719334fa6a37bcd1b6f3a3c87b514af859dc91a1a1760f51EXIF_FORMAT_LONG :
00197                   vl = exif-utils_8c.html#c8ce446b600340ccf5f120d8735319f3exif_get_long  (entry->data, entry->order);
00198                   snprintf (val, maxlen, "%li", (long int) vl);
00199                   break;
00200                 case exif-format_8h.html#b34eef28c00c9728719334fa6a37bcd1a52e87eea3c82b9ef481cb68b95843e2EXIF_FORMAT_UNDEFINED :
00201                 default:
00202                   snprintf (val, maxlen, "%li bytes unknown data",
00203                             entry->components);
00204                   break;
00205                 }
00206                 break;
00207         }
00208 
00209         return (val);
00210 }
Generated on Sun Apr 23 01:22:39 2006 for EXIF library (libexif) Internals by 
http://www.doxygen.org/index.htmldoxygen  1.4.6 