  
    
main.htmlMain Page     
classes.htmlData Structures     
files.htmlFiles     
dirs.htmlDirectories   
  
    
files.htmlFile List     
globals.htmlGlobals   
dir_3c4fde49625df9344590fff295c7c38d.htmllibexif  &raquo dir_865be09178e76dd210ba2d95815f3c04.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#be3f1c3be53cd1322a0c0d55b7277e6400035  #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#07ec45612d8ae3bfd365de49a1459ce300047  #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#78f90c775fe0ce878f9d729c2a3a12b900058          exif-tag_8h.html#1a0ded93d47585f6889eb546915d0f41ExifTag  mnote-canon-tag_8c.html#f81b5c697b6608b9a512a4bf55f025e8tag ;
00059         struct {
mnote-pentax-entry_8c.html#750b5d744c39a06bfb13e6eb010e35d000060                  int exif-entry_8c.html#750b5d744c39a06bfb13e6eb010e35d0index ;
mnote-pentax-entry_8c.html#e1adbce218e7a9d09164012443191d2400061                  const char * mnote-olympus-entry_8c.html#e1adbce218e7a9d09164012443191d24string ;
00062         } exif-entry_8c.html#999e61f123728f445ec40f6062a1b338elem [7];
00063 } mnote-olympus-entry_8c.html#371468674b06da9cb591a4132a61abe1items [] = {
00064   { mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e2e34436ce94bdceaae34499dba3fa608MNOTE_PENTAX_TAG_MODE ,
00065     { {0, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Auto")},
00066       {1, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Night-scene")},
00067       {2, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Manual")},
00068       {0, NULL}}},
00069   { mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e538c9b7e4ce9dba71dd83161646581e0MNOTE_PENTAX_TAG_QUALITY ,
00070     { {0, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Good")},
00071       {1, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Better")},
00072       {2, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Best")},{0,NULL}}},
00073   { mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e8a2b75bc0571732c6466c54da58ff131MNOTE_PENTAX_TAG_FOCUS ,
00074     { {2, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Custom")},
00075       {3, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Auto")},
00076       {0, NULL}}},
00077   { mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e9b6d897c68e1d6eb06a675a4e28847f1MNOTE_PENTAX_TAG_FLASH ,
00078     { {1, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Auto")},
00079       {2, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Flash on")},
00080       {4, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Flash off")},
00081       {6, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Red-eye Reduction")},
00082       {0, NULL}}},
00083   { mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639ed3fb7de5ca43432776059d164b06f834MNOTE_PENTAX_TAG_WHITE_BALANCE ,
00084     { {0, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Auto")},
00085       {1, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Daylight")},
00086       {2, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Shade")},
00087       {3, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Tungsten")},
00088       {4, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Fluorescent")},
00089       {5, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Manual")},
00090       {0, NULL}}},
00091   { mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e464a029f834297ee1e4f048740475953MNOTE_PENTAX_TAG_SHARPNESS ,
00092     { {0, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Normal")},
00093       {1, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Soft")},
00094       {2, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Hard")},
00095       {0, NULL}}},
00096   { mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e532be4f1f21009cd0b495d447a5091dfMNOTE_PENTAX_TAG_CONTRAST ,
00097     { {0, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Normal")},
00098       {1, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Low")},
00099       {2, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("High")},
00100       {0, NULL}}},
00101   { mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e76646f5899e18b6d277198ed09745bd3MNOTE_PENTAX_TAG_SATURATION ,
00102     { {0, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Normal")},
00103       {1, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Low")},
00104       {2, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("High")},
00105       {0, NULL}}},
00106   { mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639ecbb43ad48d4237adbbe24043a0889718MNOTE_PENTAX_TAG_ISO_SPEED ,
00107     { {10,  i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("100")},
00108       {16,  i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("200")},
00109       {100, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("100")},
00110       {200, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("200")},
00111       { 0,  NULL}}},
00112   { mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639ebe002abc0773ecfffacd807112ddecd7MNOTE_PENTAX_TAG_COLOR ,
00113     { {1, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Full")},
00114       {2, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Black & White")},
00115       {3, i18n_8h.html#75278405e7f034d2b1af80bfd94675feN_ ("Sepia")},
00116       {0, NULL}}},
00117 };
00118 
00119 char *
mnote-pentax-entry_8h.html#db79ea438e2552d504077606912af8ac00120  mnote-pentax-entry_8c.html#db79ea438e2552d504077606912af8acmnote_pentax_entry_get_value  ( struct__MnotePentaxEntry.htmlMnotePentaxEntry  *entry,
00121                               char *val, unsigned int maxlen)
00122 {
00123         exif-utils_8h.html#34c5d7765ab2e6dec8308c5127a10afaExifLong  vl;
00124         exif-utils_8h.html#398536727127a9bc2206ffbdacaafaadExifShort  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#d74cf1e86ed5e97e5e2b9a21fc6504a7tag ) {
00133           case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e2e34436ce94bdceaae34499dba3fa608MNOTE_PENTAX_TAG_MODE :
00134           case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e538c9b7e4ce9dba71dd83161646581e0MNOTE_PENTAX_TAG_QUALITY :
00135           case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e8a2b75bc0571732c6466c54da58ff131MNOTE_PENTAX_TAG_FOCUS :
00136           case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e9b6d897c68e1d6eb06a675a4e28847f1MNOTE_PENTAX_TAG_FLASH :
00137           case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639ed3fb7de5ca43432776059d164b06f834MNOTE_PENTAX_TAG_WHITE_BALANCE :
00138           case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e464a029f834297ee1e4f048740475953MNOTE_PENTAX_TAG_SHARPNESS :
00139           case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e532be4f1f21009cd0b495d447a5091dfMNOTE_PENTAX_TAG_CONTRAST :
00140           case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e76646f5899e18b6d277198ed09745bd3MNOTE_PENTAX_TAG_SATURATION :
00141           case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639ecbb43ad48d4237adbbe24043a0889718MNOTE_PENTAX_TAG_ISO_SPEED :
00142           case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639ebe002abc0773ecfffacd807112ddecd7MNOTE_PENTAX_TAG_COLOR :
00143                 mnote-canon-entry_8c.html#be3f1c3be53cd1322a0c0d55b7277e64CF  (entry-> struct__MnotePentaxEntry.html#95dab7a0b02912e659be0469c841411bformat , exif-format_8h.html#761152047d73b4a9fcdc4e2051b817d25f22efb2ec9e3bd9e29faa87cd7b64e5EXIF_FORMAT_SHORT , val, maxlen);
00144                 mnote-canon-entry_8c.html#07ec45612d8ae3bfd365de49a1459ce3CC  (entry-> struct__MnotePentaxEntry.html#12157d57c04c460c96a2603fedad2735components , 1, val, maxlen);
00145                 vs = exif-utils_8c.html#4b4acf537a8c6b9405e7b53be868e4d7exif_get_short  (entry-> struct__MnotePentaxEntry.html#a789cc86395b0218d875948e75a6dfd8data , entry-> struct__MnotePentaxEntry.html#8a7370d33d1b61808a1030700eca3eeaorder );
00146 
00147                 /* search the tag */ 00148                 for (i = 0; ( mnote-olympus-entry_8c.html#371468674b06da9cb591a4132a61abe1items [i].tag && mnote-olympus-entry_8c.html#371468674b06da9cb591a4132a61abe1items [i].tag != entry-> struct__MnotePentaxEntry.html#d74cf1e86ed5e97e5e2b9a21fc6504a7tag ); i++);
00149                 if (! mnote-olympus-entry_8c.html#371468674b06da9cb591a4132a61abe1items [i]. mnote-canon-tag_8c.html#f81b5c697b6608b9a512a4bf55f025e8tag ) {
00150                         strncpy (val, "Internal error", maxlen);
00151                         break;
00152                 }
00153 
00154                 /* find the value */ 00155                 for (j = 0; mnote-olympus-entry_8c.html#371468674b06da9cb591a4132a61abe1items [i].elem[j].string &&
00156                             ( mnote-olympus-entry_8c.html#371468674b06da9cb591a4132a61abe1items [i].elem[j].index < vs); j++);
00157                 if ( mnote-olympus-entry_8c.html#371468674b06da9cb591a4132a61abe1items [i]. exif-entry_8c.html#999e61f123728f445ec40f6062a1b338elem [j]. exif-entry_8c.html#750b5d744c39a06bfb13e6eb010e35d0index  != 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#371468674b06da9cb591a4132a61abe1items [i]. exif-entry_8c.html#999e61f123728f445ec40f6062a1b338elem [j]. mnote-olympus-entry_8c.html#e1adbce218e7a9d09164012443191d24string );
00163                 break;
00164 
00165         case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639ececa0ebafd31f5b72be9f67af43e0885MNOTE_PENTAX_TAG_ZOOM :
00166                 mnote-canon-entry_8c.html#be3f1c3be53cd1322a0c0d55b7277e64CF  (entry->format, exif-format_8h.html#761152047d73b4a9fcdc4e2051b817d25611dcd2fcdcaf91f25412bece8485b6EXIF_FORMAT_LONG , val, maxlen);
00167                 mnote-canon-entry_8c.html#07ec45612d8ae3bfd365de49a1459ce3CC  (entry->components, 1, val, maxlen);
00168                 vl = exif-utils_8c.html#4ad94614630897766dd0a5c9bc2a59bfexif_get_long  (entry->data, entry->order);
00169                 snprintf (val, maxlen, "%li", (long int) vl);
00170                 break;
00171         case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639ee8287985cecc2fd848303b03b13ad069MNOTE_PENTAX_TAG_PRINTIM :
00172                 mnote-canon-entry_8c.html#be3f1c3be53cd1322a0c0d55b7277e64CF  (entry->format, exif-format_8h.html#761152047d73b4a9fcdc4e2051b817d25ce63b2dc5a1db046bcd130bb0eff2bcEXIF_FORMAT_UNDEFINED , val, maxlen);
00173                 mnote-canon-entry_8c.html#07ec45612d8ae3bfd365de49a1459ce3CC  (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#cd4e4c67fce607e4cf4d015ac1b5639ef33b51f959bcb067441e9b30c1df7e7fMNOTE_PENTAX_TAG_TZ_CITY :
00178                 mnote-canon-entry_8c.html#be3f1c3be53cd1322a0c0d55b7277e64CF  (entry->format, exif-format_8h.html#761152047d73b4a9fcdc4e2051b817d25ce63b2dc5a1db046bcd130bb0eff2bcEXIF_FORMAT_UNDEFINED , val, maxlen);
00179                 mnote-canon-entry_8c.html#07ec45612d8ae3bfd365de49a1459ce3CC  (entry->components, 4, val, maxlen);
00180                 snprintf (val, entry->components, "%s", entry->data);
00181                 break;
00182         case mnote-pentax-tag_8h.html#cd4e4c67fce607e4cf4d015ac1b5639e52b061ae668350a3099d3a042402af79MNOTE_PENTAX_TAG_TZ_DST :
00183                 mnote-canon-entry_8c.html#be3f1c3be53cd1322a0c0d55b7277e64CF  (entry->format, exif-format_8h.html#761152047d73b4a9fcdc4e2051b817d25ce63b2dc5a1db046bcd130bb0eff2bcEXIF_FORMAT_UNDEFINED , val, maxlen);
00184                 mnote-canon-entry_8c.html#07ec45612d8ae3bfd365de49a1459ce3CC  (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#761152047d73b4a9fcdc4e2051b817d28cee3caa738d8bb85311678f0cb0e868EXIF_FORMAT_ASCII :
00190                   strncpy (val, (char *)entry->data, exif-loader_8c.html#3acffbd305ee72dcd4593c0d8af64a4fMIN (maxlen, entry->components));
00191                   break;
00192                 case exif-format_8h.html#761152047d73b4a9fcdc4e2051b817d25f22efb2ec9e3bd9e29faa87cd7b64e5EXIF_FORMAT_SHORT :
00193                   vs = exif-utils_8c.html#4b4acf537a8c6b9405e7b53be868e4d7exif_get_short  (entry->data, entry->order);
00194                   snprintf (val, maxlen, "%i", vs);
00195                   break;
00196                 case exif-format_8h.html#761152047d73b4a9fcdc4e2051b817d25611dcd2fcdcaf91f25412bece8485b6EXIF_FORMAT_LONG :
00197                   vl = exif-utils_8c.html#4ad94614630897766dd0a5c9bc2a59bfexif_get_long  (entry->data, entry->order);
00198                   snprintf (val, maxlen, "%li", (long int) vl);
00199                   break;
00200                 case exif-format_8h.html#761152047d73b4a9fcdc4e2051b817d25ce63b2dc5a1db046bcd130bb0eff2bcEXIF_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 02:19:19 2006 for EXIF library (libexif) Internals by 
http://www.doxygen.org/index.htmldoxygen  1.4.6 