Mercurial > hg > forks > geeqie
annotate src/exif-common.c @ 2887:d89d46433c78
Bug fix: reads of uninitialized data
author | Rinat Ibragimov <ibragimovrinat@mail.ru> |
---|---|
date | Sun, 20 Jan 2019 22:56:30 +0300 |
parents | 938790283e32 |
children | 10177e8c588b |
rev | line source |
---|---|
182 | 1 /* |
2350
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
2 * Copyright (C) 2006 John Ellis |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
3 * Copyright (C) 2008 - 2016 The Geeqie Team |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
4 * |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
5 * This program is free software; you can redistribute it and/or modify |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
6 * it under the terms of the GNU General Public License as published by |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
7 * the Free Software Foundation; either version 2 of the License, or |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
8 * (at your option) any later version. |
182 | 9 * |
2350
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
10 * This program is distributed in the hope that it will be useful, |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
13 * GNU General Public License for more details. |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
14 * |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
15 * You should have received a copy of the GNU General Public License along |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
16 * with this program; if not, write to the Free Software Foundation, Inc., |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
95507e596256
Update copyright in all files
Klaus Ethgen <Klaus@Ethgen.de>
parents:
2190
diff
changeset
|
18 */ |
182 | 19 |
20 #ifdef HAVE_CONFIG_H | |
21 # include "config.h" | |
22 #endif | |
23 | |
1804
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
24 #define _XOPEN_SOURCE |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
25 |
182 | 26 #include <stdio.h> |
27 #include <string.h> | |
28 #include <fcntl.h> | |
29 #include <unistd.h> | |
30 #include <sys/types.h> | |
31 #include <sys/stat.h> | |
32 #include <sys/mman.h> | |
33 #include <math.h> | |
438
52b830478878
added fColorProfile pseudo-tag with detailed information
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
300
diff
changeset
|
34 |
52b830478878
added fColorProfile pseudo-tag with detailed information
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
300
diff
changeset
|
35 #ifdef HAVE_LCMS |
52b830478878
added fColorProfile pseudo-tag with detailed information
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
300
diff
changeset
|
36 /*** color support enabled ***/ |
52b830478878
added fColorProfile pseudo-tag with detailed information
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
300
diff
changeset
|
37 |
2100 | 38 #ifdef HAVE_LCMS2 |
39 #include <lcms2.h> | |
438
52b830478878
added fColorProfile pseudo-tag with detailed information
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
300
diff
changeset
|
40 #else |
2100 | 41 #include <lcms.h> |
438
52b830478878
added fColorProfile pseudo-tag with detailed information
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
300
diff
changeset
|
42 #endif |
52b830478878
added fColorProfile pseudo-tag with detailed information
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
300
diff
changeset
|
43 #endif |
52b830478878
added fColorProfile pseudo-tag with detailed information
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
300
diff
changeset
|
44 |
182 | 45 #include <glib.h> |
46 | |
47 #include "intl.h" | |
48 | |
281 | 49 #include "main.h" |
182 | 50 #include "exif.h" |
51 | |
586
122fc2223b42
split filelist.c to filefilter.c and filedata.c
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
568
diff
changeset
|
52 #include "filedata.h" |
122fc2223b42
split filelist.c to filefilter.c and filedata.c
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
568
diff
changeset
|
53 #include "filefilter.h" |
844
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
54 #include "filecache.h" |
182 | 55 #include "format_raw.h" |
56 #include "ui_fileops.h" | |
1224
8caed680d86f
improved sidecar writting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1211
diff
changeset
|
57 #include "cache.h" |
1902
5e5a8f36f019
split jpeg parser functions to separate file
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1871
diff
changeset
|
58 #include "jpeg_parser.h" |
2771
3aa4c31b93ff
Show star rating in files pane
Colin Clark <colin.clark@cclark.uk>
parents:
2767
diff
changeset
|
59 #include "misc.h" |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
60 #include "zonedetect.h" |
182 | 61 |
62 | |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
63 static gdouble exif_rational_to_double(ExifRational *r, gint sign) |
182 | 64 { |
65 if (!r || r->den == 0.0) return 0.0; | |
66 | |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
67 if (sign) return (gdouble)((gint)r->num) / (gdouble)((gint)r->den); |
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
68 return (gdouble)r->num / r->den; |
182 | 69 } |
70 | |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
71 static gdouble exif_get_rational_as_double(ExifData *exif, const gchar *key) |
182 | 72 { |
73 ExifRational *r; | |
74 gint sign; | |
75 | |
76 r = exif_get_rational(exif, key, &sign); | |
77 return exif_rational_to_double(r, sign); | |
78 } | |
79 | |
80 static GString *append_comma_text(GString *string, const gchar *text) | |
81 { | |
82 string = g_string_append(string, ", "); | |
83 string = g_string_append(string, text); | |
84 | |
85 return string; | |
86 } | |
87 | |
222
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
88 static gchar *remove_common_prefix(gchar *s, gchar *t) |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
89 { |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
90 gint i; |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
91 |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
92 if (!s || !t) return t; |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
93 |
297
e0dca97ac332
Fix broken remove_common_prefix(), fCamera didn't display model as it should.
Laurent Monin <geeqie@norz.org>
parents:
281
diff
changeset
|
94 for (i = 0; s[i] && t[i] && s[i] == t[i]; i++) |
222
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
95 ; |
442 | 96 if (!i) |
222
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
97 return t; |
300 | 98 if (s[i-1] == ' ' || !s[i]) |
222
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
99 { |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
100 while (t[i] == ' ') |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
101 i++; |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
102 return t + i; |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
103 } |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
104 return s; |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
105 } |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
106 |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
107 static gdouble get_crop_factor(ExifData *exif) |
222
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
108 { |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
109 gdouble res_unit_tbl[] = {0.0, 25.4, 25.4, 10.0, 1.0, 0.001 }; |
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
110 gdouble xres = exif_get_rational_as_double(exif, "Exif.Photo.FocalPlaneXResolution"); |
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
111 gdouble yres = exif_get_rational_as_double(exif, "Exif.Photo.FocalPlaneYResolution"); |
922 | 112 gint res_unit; |
113 gint w, h; | |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
114 gdouble xsize, ysize, size, ratio; |
442 | 115 |
116 if (xres == 0.0 || yres == 0.0) return 0.0; | |
117 | |
118 if (!exif_get_integer(exif, "Exif.Photo.FocalPlaneResolutionUnit", &res_unit)) return 0.0; | |
119 if (res_unit < 1 || res_unit > 5) return 0.0; | |
222
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
120 |
442 | 121 if (!exif_get_integer(exif, "Exif.Photo.PixelXDimension", &w)) return 0.0; |
122 if (!exif_get_integer(exif, "Exif.Photo.PixelYDimension", &h)) return 0.0; | |
123 | |
124 xsize = w * res_unit_tbl[res_unit] / xres; | |
125 ysize = h * res_unit_tbl[res_unit] / yres; | |
126 | |
127 ratio = xsize / ysize; | |
128 | |
129 if (ratio < 0.5 || ratio > 2.0) return 0.0; /* reasonable ratio */ | |
130 | |
131 size = sqrt(xsize * xsize + ysize * ysize); | |
132 | |
133 if (size < 1.0 || size > 100.0) return 0.0; /* reasonable sensor size in mm */ | |
134 | |
135 return sqrt(36*36+24*24) / size; | |
136 | |
222
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
137 } |
fe6cb572a798
various exif improvements based on patch by Uwe Ohse
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
212
diff
changeset
|
138 |
1422
bbdc6fe7f1b8
gint -> gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1361
diff
changeset
|
139 static gboolean remove_suffix(gchar *str, const gchar *suffix, gint suffix_len) |
519
eecd23cbff90
Cleanup exif_get_formatted_by_key().
Laurent Monin <geeqie@norz.org>
parents:
516
diff
changeset
|
140 { |
eecd23cbff90
Cleanup exif_get_formatted_by_key().
Laurent Monin <geeqie@norz.org>
parents:
516
diff
changeset
|
141 gint str_len = strlen(str); |
2101 | 142 |
519
eecd23cbff90
Cleanup exif_get_formatted_by_key().
Laurent Monin <geeqie@norz.org>
parents:
516
diff
changeset
|
143 if (suffix_len < 0) suffix_len = strlen(suffix); |
eecd23cbff90
Cleanup exif_get_formatted_by_key().
Laurent Monin <geeqie@norz.org>
parents:
516
diff
changeset
|
144 if (str_len < suffix_len) return FALSE; |
2101 | 145 |
922 | 146 if (strcmp(str + str_len - suffix_len, suffix) != 0) return FALSE; |
519
eecd23cbff90
Cleanup exif_get_formatted_by_key().
Laurent Monin <geeqie@norz.org>
parents:
516
diff
changeset
|
147 str[str_len - suffix_len] = '\0'; |
2101 | 148 |
519
eecd23cbff90
Cleanup exif_get_formatted_by_key().
Laurent Monin <geeqie@norz.org>
parents:
516
diff
changeset
|
149 return TRUE; |
eecd23cbff90
Cleanup exif_get_formatted_by_key().
Laurent Monin <geeqie@norz.org>
parents:
516
diff
changeset
|
150 } |
182 | 151 |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
152 static gchar *exif_build_formatted_Camera(ExifData *exif) |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
153 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
154 gchar *text; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
155 gchar *make = exif_get_data_as_text(exif, "Exif.Image.Make"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
156 gchar *model = exif_get_data_as_text(exif, "Exif.Image.Model"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
157 gchar *software = exif_get_data_as_text(exif, "Exif.Image.Software"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
158 gchar *model2; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
159 gchar *software2; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
160 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
161 if (make) |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
162 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
163 g_strstrip(make); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
164 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
165 if (remove_suffix(make, " CORPORATION", 12)) { /* Nikon */ } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
166 else if (remove_suffix(make, " Corporation", 12)) { /* Pentax */ } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
167 else if (remove_suffix(make, " OPTICAL CO.,LTD", 16)) { /* OLYMPUS */ }; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
168 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
169 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
170 if (model) |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
171 g_strstrip(model); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
172 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
173 if (software) |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
174 { |
985
f35ec0ea2edd
Minor optimization: no need to copy the whole remaining of the string, just copy next char.
Laurent Monin <geeqie@norz.org>
parents:
922
diff
changeset
|
175 gint i, j; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
176 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
177 g_strstrip(software); |
2101 | 178 |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
179 /* remove superfluous spaces (pentax K100D) */ |
985
f35ec0ea2edd
Minor optimization: no need to copy the whole remaining of the string, just copy next char.
Laurent Monin <geeqie@norz.org>
parents:
922
diff
changeset
|
180 for (i = 0, j = 0; software[i]; i++, j++) |
f35ec0ea2edd
Minor optimization: no need to copy the whole remaining of the string, just copy next char.
Laurent Monin <geeqie@norz.org>
parents:
922
diff
changeset
|
181 { |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
182 if (software[i] == ' ' && software[i + 1] == ' ') |
985
f35ec0ea2edd
Minor optimization: no need to copy the whole remaining of the string, just copy next char.
Laurent Monin <geeqie@norz.org>
parents:
922
diff
changeset
|
183 i++; |
f35ec0ea2edd
Minor optimization: no need to copy the whole remaining of the string, just copy next char.
Laurent Monin <geeqie@norz.org>
parents:
922
diff
changeset
|
184 if (i != j) software[j] = software[i]; |
f35ec0ea2edd
Minor optimization: no need to copy the whole remaining of the string, just copy next char.
Laurent Monin <geeqie@norz.org>
parents:
922
diff
changeset
|
185 } |
f35ec0ea2edd
Minor optimization: no need to copy the whole remaining of the string, just copy next char.
Laurent Monin <geeqie@norz.org>
parents:
922
diff
changeset
|
186 software[j] = '\0'; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
187 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
188 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
189 model2 = remove_common_prefix(make, model); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
190 software2 = remove_common_prefix(model2, software); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
191 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
192 text = g_strdup_printf("%s%s%s%s%s%s", (make) ? make : "", (make && model2) ? " " : "", |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
193 (model2) ? model2 : "", |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
194 (software2 && (make || model2)) ? " (" : "", |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
195 (software2) ? software2 : "", |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
196 (software2 && (make || model2)) ? ")" : ""); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
197 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
198 g_free(make); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
199 g_free(model); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
200 g_free(software); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
201 return text; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
202 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
203 |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
204 static gchar *exif_build_formatted_DateTime(ExifData *exif) |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
205 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
206 gchar *text = exif_get_data_as_text(exif, "Exif.Photo.DateTimeOriginal"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
207 gchar *subsec = NULL; |
1804
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
208 gchar buf[128]; |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
209 gchar *tmp; |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
210 gint buflen; |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
211 struct tm tm; |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
212 GError *error = NULL; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
213 |
1422
bbdc6fe7f1b8
gint -> gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1361
diff
changeset
|
214 if (text) |
bbdc6fe7f1b8
gint -> gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1361
diff
changeset
|
215 { |
bbdc6fe7f1b8
gint -> gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1361
diff
changeset
|
216 subsec = exif_get_data_as_text(exif, "Exif.Photo.SubSecTimeOriginal"); |
bbdc6fe7f1b8
gint -> gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1361
diff
changeset
|
217 } |
bbdc6fe7f1b8
gint -> gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1361
diff
changeset
|
218 else |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
219 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
220 text = exif_get_data_as_text(exif, "Exif.Image.DateTime"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
221 if (text) subsec = exif_get_data_as_text(exif, "Exif.Photo.SubSecTime"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
222 } |
1804
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
223 |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
224 /* Convert the stuff into a tm struct */ |
1808
c1a2cd480f76
Fix a small issue with strptime
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1804
diff
changeset
|
225 memset(&tm, 0, sizeof(tm)); /* Uh, strptime could let garbage in tm! */ |
1804
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
226 if (text && strptime(text, "%Y:%m:%d %H:%M:%S", &tm)) |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
227 { |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
228 buflen = strftime(buf, sizeof(buf), "%x %X", &tm); |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
229 if (buflen > 0) |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
230 { |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
231 tmp = g_locale_to_utf8(buf, buflen, NULL, NULL, &error); |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
232 if (error) |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
233 { |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
234 log_printf("Error converting locale strftime to UTF-8: %s\n", error->message); |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
235 g_error_free(error); |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
236 } |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
237 else |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
238 { |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
239 g_free(text); |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
240 text = g_strdup(tmp); |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
241 } |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
242 } |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
243 } |
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
244 |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
245 if (subsec) |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
246 { |
1804
e2e71736b2d6
Unifying the datetime output
Klaus Ethgen <Klaus@Ethgen.de>
parents:
1802
diff
changeset
|
247 tmp = text; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
248 text = g_strconcat(tmp, ".", subsec, NULL); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
249 g_free(tmp); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
250 g_free(subsec); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
251 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
252 return text; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
253 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
254 |
2698
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
255 static gchar *exif_build_formatted_DateTimeDigitized(ExifData *exif) |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
256 { |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
257 gchar *text = exif_get_data_as_text(exif, "Exif.Photo.DateTimeDigitized"); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
258 gchar *subsec = NULL; |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
259 gchar buf[128]; |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
260 gchar *tmp; |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
261 gint buflen; |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
262 struct tm tm; |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
263 GError *error = NULL; |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
264 |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
265 if (text) |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
266 { |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
267 subsec = exif_get_data_as_text(exif, "Exif.Photo.SubSecTimeDigitized"); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
268 } |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
269 else |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
270 { |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
271 text = exif_get_data_as_text(exif, "Exif.Image.DateTime"); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
272 if (text) subsec = exif_get_data_as_text(exif, "Exif.Photo.SubSecTime"); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
273 } |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
274 |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
275 /* Convert the stuff into a tm struct */ |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
276 memset(&tm, 0, sizeof(tm)); /* Uh, strptime could let garbage in tm! */ |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
277 if (text && strptime(text, "%Y:%m:%d %H:%M:%S", &tm)) |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
278 { |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
279 buflen = strftime(buf, sizeof(buf), "%x %X", &tm); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
280 if (buflen > 0) |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
281 { |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
282 tmp = g_locale_to_utf8(buf, buflen, NULL, NULL, &error); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
283 if (error) |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
284 { |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
285 log_printf("Error converting locale strftime to UTF-8: %s\n", error->message); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
286 g_error_free(error); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
287 } |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
288 else |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
289 { |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
290 g_free(text); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
291 text = g_strdup(tmp); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
292 } |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
293 } |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
294 } |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
295 |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
296 if (subsec) |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
297 { |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
298 tmp = text; |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
299 text = g_strconcat(tmp, ".", subsec, NULL); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
300 g_free(tmp); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
301 g_free(subsec); |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
302 } |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
303 return text; |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
304 } |
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
305 |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
306 static gchar *exif_build_formatted_ShutterSpeed(ExifData *exif) |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
307 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
308 ExifRational *r; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
309 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
310 r = exif_get_rational(exif, "Exif.Photo.ExposureTime", NULL); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
311 if (r && r->num && r->den) |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
312 { |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
313 gdouble n = (gdouble)r->den / (gdouble)r->num; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
314 return g_strdup_printf("%s%.0fs", n > 1.0 ? "1/" : "", |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
315 n > 1.0 ? n : 1.0 / n); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
316 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
317 r = exif_get_rational(exif, "Exif.Photo.ShutterSpeedValue", NULL); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
318 if (r && r->num && r->den) |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
319 { |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
320 gdouble n = pow(2.0, exif_rational_to_double(r, TRUE)); |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
321 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
322 /* Correct exposure time to avoid values like 1/91s (seen on Minolta DImage 7) */ |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
323 if (n > 1.0 && (gint)n - ((gint)(n/10))*10 == 1) n--; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
324 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
325 return g_strdup_printf("%s%.0fs", n > 1.0 ? "1/" : "", |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
326 n > 1.0 ? floor(n) : 1.0 / n); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
327 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
328 return NULL; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
329 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
330 |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
331 static gchar *exif_build_formatted_Aperture(ExifData *exif) |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
332 { |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
333 gdouble n; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
334 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
335 n = exif_get_rational_as_double(exif, "Exif.Photo.FNumber"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
336 if (n == 0.0) n = exif_get_rational_as_double(exif, "Exif.Photo.ApertureValue"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
337 if (n == 0.0) return NULL; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
338 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
339 return g_strdup_printf("f/%.1f", n); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
340 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
341 |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
342 static gchar *exif_build_formatted_ExposureBias(ExifData *exif) |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
343 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
344 ExifRational *r; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
345 gint sign; |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
346 gdouble n; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
347 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
348 r = exif_get_rational(exif, "Exif.Photo.ExposureBiasValue", &sign); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
349 if (!r) return NULL; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
350 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
351 n = exif_rational_to_double(r, sign); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
352 return g_strdup_printf("%+.1f", n); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
353 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
354 |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
355 static gchar *exif_build_formatted_FocalLength(ExifData *exif) |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
356 { |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
357 gdouble n; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
358 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
359 n = exif_get_rational_as_double(exif, "Exif.Photo.FocalLength"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
360 if (n == 0.0) return NULL; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
361 return g_strdup_printf("%.0f mm", n); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
362 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
363 |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
364 static gchar *exif_build_formatted_FocalLength35mmFilm(ExifData *exif) |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
365 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
366 gint n; |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
367 gdouble f, c; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
368 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
369 if (exif_get_integer(exif, "Exif.Photo.FocalLengthIn35mmFilm", &n) && n != 0) |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
370 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
371 return g_strdup_printf("%d mm", n); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
372 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
373 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
374 f = exif_get_rational_as_double(exif, "Exif.Photo.FocalLength"); |
922 | 375 if (f == 0.0) return NULL; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
376 |
922 | 377 c = get_crop_factor(exif); |
378 if (c == 0.0) return NULL; | |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
379 |
922 | 380 return g_strdup_printf("%.0f mm", f * c); |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
381 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
382 |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
383 static gchar *exif_build_formatted_ISOSpeedRating(ExifData *exif) |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
384 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
385 gchar *text; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
386 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
387 text = exif_get_data_as_text(exif, "Exif.Photo.ISOSpeedRatings"); |
2761 | 388 /* old canon may set this instead */ |
389 if (!text) text = exif_get_data_as_text(exif, "Exif.CanonSi.ISOSpeed"); | |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
390 /* kodak may set this instead */ |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
391 if (!text) text = exif_get_data_as_text(exif, "Exif.Photo.ExposureIndex"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
392 return text; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
393 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
394 |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
395 static gchar *exif_build_formatted_SubjectDistance(ExifData *exif) |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
396 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
397 ExifRational *r; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
398 gint sign; |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
399 gdouble n; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
400 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
401 r = exif_get_rational(exif, "Exif.Photo.SubjectDistance", &sign); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
402 if (!r) return NULL; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
403 |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
404 if ((glong)r->num == (glong)0xffffffff) return g_strdup(_("infinity")); |
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
405 if ((glong)r->num == 0) return g_strdup(_("unknown")); |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
406 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
407 n = exif_rational_to_double(r, sign); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
408 if (n == 0.0) return _("unknown"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
409 return g_strdup_printf("%.3f m", n); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
410 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
411 |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
412 static gchar *exif_build_formatted_Flash(ExifData *exif) |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
413 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
414 /* grr, flash is a bitmask... */ |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
415 GString *string; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
416 gchar *text; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
417 gint n; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
418 gint v; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
419 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
420 if (!exif_get_integer(exif, "Exif.Photo.Flash", &n)) return NULL; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
421 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
422 /* Exif 2.1 only defines first 3 bits */ |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
423 if (n <= 0x07) return exif_get_data_as_text(exif, "Exif.Photo.Flash"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
424 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
425 /* must be Exif 2.2 */ |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
426 string = g_string_new(""); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
427 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
428 /* flash fired (bit 0) */ |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
429 string = g_string_append(string, (n & 0x01) ? _("yes") : _("no")); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
430 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
431 /* flash mode (bits 3, 4) */ |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
432 v = (n >> 3) & 0x03; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
433 if (v) string = append_comma_text(string, _("mode:")); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
434 switch (v) |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
435 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
436 case 1: |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
437 string = g_string_append(string, _("on")); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
438 break; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
439 case 2: |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
440 string = g_string_append(string, _("off")); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
441 break; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
442 case 3: |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
443 string = g_string_append(string, _("auto")); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
444 break; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
445 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
446 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
447 /* return light (bits 1, 2) */ |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
448 v = (n >> 1) & 0x03; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
449 if (v == 2) string = append_comma_text(string, _("not detected by strobe")); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
450 if (v == 3) string = append_comma_text(string, _("detected by strobe")); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
451 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
452 /* we ignore flash function (bit 5) */ |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
453 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
454 /* red-eye (bit 6) */ |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
455 if ((n >> 5) & 0x01) string = append_comma_text(string, _("red-eye reduction")); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
456 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
457 text = string->str; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
458 g_string_free(string, FALSE); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
459 return text; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
460 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
461 |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
462 static gchar *exif_build_formatted_Resolution(ExifData *exif) |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
463 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
464 ExifRational *rx, *ry; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
465 gchar *units; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
466 gchar *text; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
467 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
468 rx = exif_get_rational(exif, "Exif.Image.XResolution", NULL); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
469 ry = exif_get_rational(exif, "Exif.Image.YResolution", NULL); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
470 if (!rx || !ry) return NULL; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
471 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
472 units = exif_get_data_as_text(exif, "Exif.Image.ResolutionUnit"); |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
473 text = g_strdup_printf("%0.f x %0.f (%s/%s)", rx->den ? (gdouble)rx->num / rx->den : 1.0, |
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
474 ry->den ? (gdouble)ry->num / ry->den : 1.0, |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
475 _("dot"), (units) ? units : _("unknown")); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
476 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
477 g_free(units); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
478 return text; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
479 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
480 |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
481 static gchar *exif_build_formatted_ColorProfile(ExifData *exif) |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
482 { |
2100 | 483 #ifdef HAVE_LCMS2 |
484 cmsUInt8Number profileID[17]; | |
485 #endif | |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
486 const gchar *name = ""; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
487 const gchar *source = ""; |
922 | 488 guchar *profile_data; |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
489 guint profile_len; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
490 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
491 profile_data = exif_get_color_profile(exif, &profile_len); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
492 if (!profile_data) |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
493 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
494 gint cs; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
495 gchar *interop_index; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
496 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
497 /* ColorSpace == 1 specifies sRGB per EXIF 2.2 */ |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
498 if (!exif_get_integer(exif, "Exif.Photo.ColorSpace", &cs)) cs = 0; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
499 interop_index = exif_get_data_as_text(exif, "Exif.Iop.InteroperabilityIndex"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
500 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
501 if (cs == 1) |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
502 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
503 name = _("sRGB"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
504 source = "ColorSpace"; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
505 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
506 else if (cs == 2 || (interop_index && !strcmp(interop_index, "R03"))) |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
507 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
508 name = _("AdobeRGB"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
509 source = (cs == 2) ? "ColorSpace" : "Iop"; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
510 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
511 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
512 g_free(interop_index); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
513 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
514 else |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
515 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
516 source = _("embedded"); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
517 #ifdef HAVE_LCMS |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
518 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
519 { |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
520 cmsHPROFILE profile; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
521 |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
522 profile = cmsOpenProfileFromMem(profile_data, profile_len); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
523 if (profile) |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
524 { |
2100 | 525 #ifdef HAVE_LCMS2 |
526 profileID[16] = '\0'; | |
527 cmsGetHeaderProfileID(profile, profileID); | |
2190
904e3e385059
Silent 2 warnings using explicit type casting.
Laurent Monin <zas@norz.org>
parents:
2101
diff
changeset
|
528 name = (gchar *) profileID; |
2100 | 529 #else |
2190
904e3e385059
Silent 2 warnings using explicit type casting.
Laurent Monin <zas@norz.org>
parents:
2101
diff
changeset
|
530 name = (gchar *) cmsTakeProductName(profile); |
2100 | 531 #endif |
546
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
532 cmsCloseProfile(profile); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
533 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
534 g_free(profile_data); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
535 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
536 #endif |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
537 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
538 if (name[0] == 0 && source[0] == 0) return NULL; |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
539 return g_strdup_printf("%s (%s)", name, source); |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
540 } |
4188b8dd963c
Explode exif_get_formatted_by_key() in smaller functions prefixed "exif_build_f".
Laurent Monin <geeqie@norz.org>
parents:
542
diff
changeset
|
541 |
1052
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
542 static gchar *exif_build_formatted_GPSPosition(ExifData *exif) |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
543 { |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
544 GString *string; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
545 gchar *text, *ref; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
546 ExifRational *value; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
547 ExifItem *item; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
548 guint i; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
549 gdouble p, p3; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
550 gulong p1, p2; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
551 |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
552 string = g_string_new(""); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
553 |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
554 item = exif_get_item(exif, "Exif.GPSInfo.GPSLatitude"); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
555 ref = exif_get_data_as_text(exif, "Exif.GPSInfo.GPSLatitudeRef"); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
556 if (item && ref) |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
557 { |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
558 p = 0; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
559 for (i = 0; i < exif_item_get_elements(item); i++) |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
560 { |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
561 value = exif_item_get_rational(item, NULL, i); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
562 if (value && value->num && value->den) |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
563 p += (gdouble)value->num / (gdouble)value->den / pow(60.0, (gdouble)i); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
564 } |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
565 p1 = (gint)p; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
566 p2 = (gint)((p - p1)*60); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
567 p3 = ((p - p1)*60 - p2)*60; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
568 |
1164 | 569 g_string_append_printf(string, "%0lu° %0lu' %0.2f\" %.1s", p1, p2, p3, ref); |
1052
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
570 } // if (item && ref) |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
571 |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
572 item = exif_get_item(exif, "Exif.GPSInfo.GPSLongitude"); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
573 ref = exif_get_data_as_text(exif, "Exif.GPSInfo.GPSLongitudeRef"); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
574 if (item && ref) |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
575 { |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
576 p = 0; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
577 for (i = 0; i < exif_item_get_elements(item); i++) |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
578 { |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
579 value = exif_item_get_rational(item, NULL, i); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
580 if (value && value->num && value->den) |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
581 p += (gdouble)value->num / (gdouble)value->den / pow(60.0, (gdouble)i); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
582 } |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
583 p1 = (gint)p; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
584 p2 = (gint)((p - p1)*60); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
585 p3 = ((p - p1)*60 - p2)*60; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
586 |
1164 | 587 g_string_append_printf(string, ", %0lu° %0lu' %0.2f\" %.1s", p1, p2, p3, ref); |
1052
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
588 } // if (item && ref) |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
589 |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
590 text = string->str; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
591 g_string_free(string, FALSE); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
592 |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
593 return text; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
594 } // static gchar *exif_build_forma... |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
595 |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
596 static gchar *exif_build_formatted_GPSAltitude(ExifData *exif) |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
597 { |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
598 ExifRational *r; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
599 ExifItem *item; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
600 gdouble alt; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
601 gint ref; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
602 |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
603 item = exif_get_item(exif, "Exif.GPSInfo.GPSAltitudeRef"); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
604 r = exif_get_rational(exif, "Exif.GPSInfo.GPSAltitude", NULL); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
605 |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
606 if (!r || !item) return NULL; |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
607 |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
608 alt = exif_rational_to_double(r, 0); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
609 exif_item_get_integer(item, &ref); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
610 |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
611 return g_strdup_printf("%0.f m %s", alt, (ref==0)?_("Above Sea Level"):_("Below Sea Level")); |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
612 } |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
613 |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
614 /** |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
615 * @brief Extracts timezone data from a ZoneDetect search structure |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
616 * @param[in] results ZoneDetect search structure |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
617 * @param[out] timezone in the form "Europe/London" |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
618 * @param[out] countryname in the form "United Kingdom" |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
619 * @param[out] countryalpha2 in the form "GB" |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
620 * |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
621 * Refer to https://github.com/BertoldVdb/ZoneDetect |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
622 * for structure details |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
623 */ |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
624 static void zd_tz(ZoneDetectResult *results, gchar **timezone, gchar **countryname, gchar **countryalpha2) |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
625 { |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
626 gchar *timezone_pre = NULL; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
627 gchar *timezone_id = NULL; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
628 unsigned int index = 0; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
629 |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
630 while(results[index].lookupResult != ZD_LOOKUP_END) |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
631 { |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
632 if(results[index].data) |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
633 { |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
634 for(unsigned int i=0; i<results[index].numFields; i++) |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
635 { |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
636 if (g_strstr_len(results[index].fieldNames[i], -1, "TimezoneIdPrefix")) |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
637 { |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
638 timezone_pre = g_strdup(results[index].data[i]); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
639 } |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
640 if (g_strstr_len(results[index].fieldNames[i], -1, "TimezoneId")) |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
641 { |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
642 timezone_id = g_strdup(results[index].data[i]); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
643 } |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
644 if (g_strstr_len(results[index].fieldNames[i], -1, "CountryName")) |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
645 { |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
646 *countryname = g_strdup(results[index].data[i]); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
647 } |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
648 if (g_strstr_len(results[index].fieldNames[i], -1, "CountryAlpha2")) |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
649 { |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
650 *countryalpha2 = g_strdup(results[index].data[i]); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
651 } |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
652 } |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
653 } |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
654 index++; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
655 } |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
656 |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
657 *timezone = g_strconcat(timezone_pre, timezone_id, NULL); |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
658 g_free(timezone_pre); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
659 g_free(timezone_id); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
660 } |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
661 |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
662 /** |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
663 * @brief Gets timezone data from an exif structure |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
664 * @param[in] exif |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
665 * @returns TRUE if timezone data found |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
666 * @param[out] exif_date_time exif date/time in the form 2018:11:30:17:05:04 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
667 * @param[out] timezone in the form "Europe/London" |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
668 * @param[out] countryname in the form "United Kingdom" |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
669 * @param[out] countryalpha2 in the form "GB" |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
670 * |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
671 * |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
672 */ |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
673 static gboolean exif_build_tz_data(ExifData *exif, gchar **exif_date_time, gchar **timezone, gchar **countryname, gchar **countryalpha2) |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
674 { |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
675 gfloat latitude; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
676 gfloat longitude; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
677 gchar *text_latitude; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
678 gchar *text_longitude; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
679 gchar *text_latitude_ref; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
680 gchar *text_longitude_ref; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
681 gchar *text_date; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
682 gchar *text_time; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
683 gchar *lat_deg; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
684 gchar *lat_min; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
685 gchar *lon_deg; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
686 gchar *lon_min; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
687 gchar *zd_path; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
688 ZoneDetect *cd; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
689 ZoneDetectResult *results; |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
690 gboolean ret = FALSE; |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
691 |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
692 text_latitude = exif_get_data_as_text(exif, "Exif.GPSInfo.GPSLatitude"); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
693 text_longitude = exif_get_data_as_text(exif, "Exif.GPSInfo.GPSLongitude"); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
694 text_latitude_ref = exif_get_data_as_text(exif, "Exif.GPSInfo.GPSLatitudeRef"); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
695 text_longitude_ref = exif_get_data_as_text(exif, "Exif.GPSInfo.GPSLongitudeRef"); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
696 text_date = exif_get_data_as_text(exif, "Exif.GPSInfo.GPSDateStamp"); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
697 text_time = exif_get_data_as_text(exif, "Exif.GPSInfo.GPSTimeStamp"); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
698 |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
699 if (text_latitude && text_longitude && text_latitude_ref && |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
700 text_longitude_ref && text_date && text_time) |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
701 { |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
702 *exif_date_time = g_strconcat(text_date, ":", text_time, NULL); |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
703 |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
704 lat_deg = strtok(text_latitude, "deg'"); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
705 lat_min = strtok(NULL, "deg'"); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
706 latitude = atof(lat_deg) + atof(lat_min) / 60; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
707 if (!g_strcmp0(text_latitude_ref, "South")) |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
708 { |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
709 latitude = -latitude; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
710 } |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
711 lon_deg = strtok(text_longitude, "deg'"); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
712 lon_min = strtok(NULL, "deg'"); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
713 longitude = atof(lon_deg) + atof(lon_min) / 60; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
714 if (!g_strcmp0(text_longitude_ref, "West")) |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
715 { |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
716 longitude = -longitude; |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
717 } |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
718 |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
719 zd_path = g_build_filename(GQ_BIN_DIR, TIMEZONE_DATABASE, NULL); |
2821
0c4659cd6d32
Remove ZoneDetect .bin file from repository
Colin Clark <colin.clark@cclark.uk>
parents:
2811
diff
changeset
|
720 if (g_file_test(zd_path, G_FILE_TEST_EXISTS)) |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
721 { |
2821
0c4659cd6d32
Remove ZoneDetect .bin file from repository
Colin Clark <colin.clark@cclark.uk>
parents:
2811
diff
changeset
|
722 cd = ZDOpenDatabase(zd_path); |
0c4659cd6d32
Remove ZoneDetect .bin file from repository
Colin Clark <colin.clark@cclark.uk>
parents:
2811
diff
changeset
|
723 if (cd) |
0c4659cd6d32
Remove ZoneDetect .bin file from repository
Colin Clark <colin.clark@cclark.uk>
parents:
2811
diff
changeset
|
724 { |
0c4659cd6d32
Remove ZoneDetect .bin file from repository
Colin Clark <colin.clark@cclark.uk>
parents:
2811
diff
changeset
|
725 results = ZDLookup(cd, latitude, longitude, NULL); |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
726 if (results) |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
727 { |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
728 zd_tz(results, timezone, countryname, countryalpha2); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
729 ret = TRUE; |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
730 } |
2821
0c4659cd6d32
Remove ZoneDetect .bin file from repository
Colin Clark <colin.clark@cclark.uk>
parents:
2811
diff
changeset
|
731 } |
0c4659cd6d32
Remove ZoneDetect .bin file from repository
Colin Clark <colin.clark@cclark.uk>
parents:
2811
diff
changeset
|
732 else |
0c4659cd6d32
Remove ZoneDetect .bin file from repository
Colin Clark <colin.clark@cclark.uk>
parents:
2811
diff
changeset
|
733 { |
0c4659cd6d32
Remove ZoneDetect .bin file from repository
Colin Clark <colin.clark@cclark.uk>
parents:
2811
diff
changeset
|
734 log_printf("Error: Init of timezone database %s failed\n", zd_path); |
0c4659cd6d32
Remove ZoneDetect .bin file from repository
Colin Clark <colin.clark@cclark.uk>
parents:
2811
diff
changeset
|
735 } |
0c4659cd6d32
Remove ZoneDetect .bin file from repository
Colin Clark <colin.clark@cclark.uk>
parents:
2811
diff
changeset
|
736 ZDCloseDatabase(cd); |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
737 } |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
738 g_free(zd_path); |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
739 } |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
740 |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
741 return ret; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
742 } |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
743 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
744 /** |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
745 * @brief Creates local time from GPS lat/long |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
746 * @param[in] exif |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
747 * @returns Localised time and date |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
748 * |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
749 * GPS lat/long is translated to timezone using ZoneDetect. |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
750 * GPS UTC is converted to Unix time stamp (seconds since 1970). |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
751 * The TZ environment variable is set to the relevant timezone |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
752 * and the Unix timestamp converted to local time using locale. |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
753 * If the conversion fails, unformatted UTC is returned. |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
754 */ |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
755 static gchar *exif_build_formatted_localtime(ExifData *exif) |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
756 { |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
757 gchar buf[128]; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
758 gchar *tmp; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
759 gint buflen; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
760 GError *error = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
761 gchar *time_zone_image; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
762 gchar *time_zone_org; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
763 struct tm *tm_local; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
764 struct tm tm_utc; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
765 time_t stamp; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
766 gchar *exif_date_time = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
767 gchar *timezone = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
768 gchar *countryname = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
769 gchar *countryalpha2 = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
770 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
771 if (exif_build_tz_data(exif, &exif_date_time, &timezone, &countryname, &countryalpha2)) |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
772 { |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
773 time_zone_image = g_strconcat("TZ=", timezone, NULL); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
774 time_zone_org = g_strconcat("TZ=", getenv("TZ"), NULL); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
775 putenv("TZ=UTC"); |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
776 |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
777 memset(&tm_utc, 0, sizeof(tm_utc)); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
778 if (exif_date_time && strptime(exif_date_time, "%Y:%m:%d:%H:%M:%S", &tm_utc)) |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
779 { |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
780 stamp = mktime(&tm_utc); // Convert the struct to a Unix timestamp |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
781 putenv(time_zone_image); // Switch to destination time zone |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
782 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
783 tm_local = localtime(&stamp); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
784 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
785 /* Convert to localtime using locale */ |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
786 buflen = strftime(buf, sizeof(buf), "%x %X", tm_local); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
787 if (buflen > 0) |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
788 { |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
789 tmp = g_locale_to_utf8(buf, buflen, NULL, NULL, &error); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
790 if (error) |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
791 { |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
792 log_printf("Error converting locale strftime to UTF-8: %s\n", error->message); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
793 g_error_free(error); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
794 } |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
795 else |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
796 { |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
797 g_free(exif_date_time); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
798 exif_date_time = g_strdup(tmp); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
799 } |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
800 } |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
801 g_free(tmp); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
802 } |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
803 putenv(time_zone_org); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
804 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
805 g_free(time_zone_image); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
806 g_free(time_zone_org); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
807 } |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
808 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
809 g_free(timezone); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
810 g_free(countryname); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
811 g_free(countryalpha2); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
812 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
813 return exif_date_time; |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
814 } |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
815 |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
816 /** |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
817 * @brief Gets timezone from GPS lat/long |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
818 * @param[in] exif |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
819 * @returns Timezone string in the form "Europe/London" |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
820 * |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
821 * |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
822 */ |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
823 static gchar *exif_build_formatted_timezone(ExifData *exif) |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
824 { |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
825 gchar *time_zone = NULL; |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
826 gchar *exif_date_time = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
827 gchar *timezone = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
828 gchar *countryname = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
829 gchar *countryalpha2 = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
830 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
831 exif_build_tz_data(exif, &exif_date_time, &timezone, &countryname, &countryalpha2); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
832 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
833 g_free(exif_date_time); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
834 g_free(countryname); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
835 g_free(countryalpha2); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
836 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
837 return timezone; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
838 } |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
839 |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
840 /** |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
841 * @brief Gets countryname from GPS lat/long |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
842 * @param[in] exif |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
843 * @returns Countryname string |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
844 * |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
845 * |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
846 */ |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
847 static gchar *exif_build_formatted_countryname(ExifData *exif) |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
848 { |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
849 gchar *exif_date_time = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
850 gchar *timezone = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
851 gchar *countryname = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
852 gchar *countryalpha2 = NULL; |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
853 |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
854 exif_build_tz_data(exif, &exif_date_time, &timezone, &countryname, &countryalpha2); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
855 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
856 g_free(exif_date_time); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
857 g_free(timezone); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
858 g_free(countryalpha2); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
859 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
860 return countryname; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
861 } |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
862 |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
863 /** |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
864 * @brief Gets two-letter country code from GPS lat/long |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
865 * @param[in] exif |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
866 * @returns Countryalpha2 string |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
867 * |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
868 * |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
869 */ |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
870 static gchar *exif_build_formatted_countrycode(ExifData *exif) |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
871 { |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
872 gchar *exif_date_time = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
873 gchar *timezone = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
874 gchar *countryname = NULL; |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
875 gchar *countryalpha2 = NULL; |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
876 |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
877 exif_build_tz_data(exif, &exif_date_time, &timezone, &countryname, &countryalpha2); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
878 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
879 g_free(exif_date_time); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
880 g_free(timezone); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
881 g_free(countryname); |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
882 |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
883 return countryalpha2; |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
884 } |
548
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
885 |
2767
699c2ad6a287
Show rating as star characters
Colin Clark <colin.clark@cclark.uk>
parents:
2765
diff
changeset
|
886 static gchar *exif_build_formatted_star_rating(ExifData *exif) |
699c2ad6a287
Show rating as star characters
Colin Clark <colin.clark@cclark.uk>
parents:
2765
diff
changeset
|
887 { |
2887
d89d46433c78
Bug fix: reads of uninitialized data
Rinat Ibragimov <ibragimovrinat@mail.ru>
parents:
2823
diff
changeset
|
888 gint n = 0; |
2767
699c2ad6a287
Show rating as star characters
Colin Clark <colin.clark@cclark.uk>
parents:
2765
diff
changeset
|
889 |
699c2ad6a287
Show rating as star characters
Colin Clark <colin.clark@cclark.uk>
parents:
2765
diff
changeset
|
890 exif_get_integer(exif, "Xmp.xmp.Rating", &n); |
699c2ad6a287
Show rating as star characters
Colin Clark <colin.clark@cclark.uk>
parents:
2765
diff
changeset
|
891 |
2771
3aa4c31b93ff
Show star rating in files pane
Colin Clark <colin.clark@cclark.uk>
parents:
2767
diff
changeset
|
892 return convert_rating_to_stars(n); |
2767
699c2ad6a287
Show rating as star characters
Colin Clark <colin.clark@cclark.uk>
parents:
2765
diff
changeset
|
893 } |
699c2ad6a287
Show rating as star characters
Colin Clark <colin.clark@cclark.uk>
parents:
2765
diff
changeset
|
894 |
548
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
895 /* List of custom formatted pseudo-exif tags */ |
1189
2f89804152d0
Do not hardcode exif formatted prefix.
Laurent Monin <geeqie@norz.org>
parents:
1164
diff
changeset
|
896 #define EXIF_FORMATTED_TAG(name, label) { EXIF_FORMATTED()#name, label, exif_build_formatted##_##name } |
548
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
897 |
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
898 ExifFormattedText ExifFormattedList[] = { |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
899 EXIF_FORMATTED_TAG(Camera, N_("Camera")), |
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
900 EXIF_FORMATTED_TAG(DateTime, N_("Date")), |
2698
940f217da9ec
Sort/search on Exif.Photo.DateTimeDigitized
Colin Clark <colin.clark@cclark.uk>
parents:
2350
diff
changeset
|
901 EXIF_FORMATTED_TAG(DateTimeDigitized, N_("DateDigitized")), |
566
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
902 EXIF_FORMATTED_TAG(ShutterSpeed, N_("Shutter speed")), |
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
903 EXIF_FORMATTED_TAG(Aperture, N_("Aperture")), |
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
904 EXIF_FORMATTED_TAG(ExposureBias, N_("Exposure bias")), |
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
905 EXIF_FORMATTED_TAG(ISOSpeedRating, N_("ISO sensitivity")), |
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
906 EXIF_FORMATTED_TAG(FocalLength, N_("Focal length")), |
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
907 EXIF_FORMATTED_TAG(FocalLength35mmFilm, N_("Focal length 35mm")), |
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
908 EXIF_FORMATTED_TAG(SubjectDistance, N_("Subject distance")), |
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
909 EXIF_FORMATTED_TAG(Flash, N_("Flash")), |
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
910 EXIF_FORMATTED_TAG(Resolution, N_("Resolution")), |
fe00cebd415b
Change the prefix of formatted exif tags to a more explicit "formatted." prefix
Laurent Monin <geeqie@norz.org>
parents:
552
diff
changeset
|
911 EXIF_FORMATTED_TAG(ColorProfile, N_("Color profile")), |
1052
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
912 EXIF_FORMATTED_TAG(GPSPosition, N_("GPS position")), |
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
913 EXIF_FORMATTED_TAG(GPSAltitude, N_("GPS altitude")), |
2746
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
914 EXIF_FORMATTED_TAG(localtime, N_("Local time")), |
8bab8ac8ade0
Local time - UTC offset and daylight saving correction
Colin Clark <colin.clark@cclark.uk>
parents:
2698
diff
changeset
|
915 EXIF_FORMATTED_TAG(timezone, N_("Time zone")), |
2823
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
916 EXIF_FORMATTED_TAG(countryname, N_("Country name")), |
938790283e32
Additional parameters from ZoneDetect
Colin Clark <colin.clark@cclark.uk>
parents:
2821
diff
changeset
|
917 EXIF_FORMATTED_TAG(countrycode, N_("Country code")), |
2767
699c2ad6a287
Show rating as star characters
Colin Clark <colin.clark@cclark.uk>
parents:
2765
diff
changeset
|
918 EXIF_FORMATTED_TAG(star_rating, N_("Star rating")), |
1483
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
919 {"file.size", N_("File size"), NULL}, |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
920 {"file.date", N_("File date"), NULL}, |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
921 {"file.mode", N_("File mode"), NULL}, |
2765
407334574789
Include file ctime as a formatted tag
Colin Clark <colin.clark@cclark.uk>
parents:
2761
diff
changeset
|
922 {"file.ctime", N_("File ctime"), NULL}, |
2791
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
923 {"file.owner", N_("File owner"), NULL}, |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
924 {"file.group", N_("File group"), NULL}, |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
925 {"file.link", N_("File link"), NULL}, |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
926 {"file.class", N_("File class"), NULL}, |
548
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
927 { NULL, NULL, NULL } |
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
928 }; |
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
929 |
1422
bbdc6fe7f1b8
gint -> gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1361
diff
changeset
|
930 gchar *exif_get_formatted_by_key(ExifData *exif, const gchar *key, gboolean *key_valid) |
182 | 931 { |
1189
2f89804152d0
Do not hardcode exif formatted prefix.
Laurent Monin <geeqie@norz.org>
parents:
1164
diff
changeset
|
932 if (strncmp(key, EXIF_FORMATTED(), EXIF_FORMATTED_LEN) == 0) |
182 | 933 { |
548
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
934 gint i; |
442 | 935 |
548
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
936 if (key_valid) *key_valid = TRUE; |
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
937 |
1189
2f89804152d0
Do not hardcode exif formatted prefix.
Laurent Monin <geeqie@norz.org>
parents:
1164
diff
changeset
|
938 key += EXIF_FORMATTED_LEN; |
548
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
939 for (i = 0; ExifFormattedList[i].key; i++) |
1483
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
940 if (ExifFormattedList[i].build_func && strcmp(key, ExifFormattedList[i].key + EXIF_FORMATTED_LEN) == 0) |
548
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
941 return ExifFormattedList[i].build_func(exif); |
ee1b627276aa
Add a pointer to the build function in the formatted exif tags struct
Laurent Monin <geeqie@norz.org>
parents:
547
diff
changeset
|
942 } |
182 | 943 |
944 if (key_valid) *key_valid = FALSE; | |
945 return NULL; | |
946 } | |
947 | |
1053
d213ef1fc608
fixed charset of exiv2 strings in non-utf8 locales
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1052
diff
changeset
|
948 gchar *exif_get_description_by_key(const gchar *key) |
182 | 949 { |
950 if (!key) return NULL; | |
951 | |
1483
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
952 if (strncmp(key, EXIF_FORMATTED(), EXIF_FORMATTED_LEN) == 0 || |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
953 strncmp(key, "file.", 5) == 0) |
568
77da13cb250b
exif_get_description_by_key(): check for "formatted." prefix, and optimize.
Laurent Monin <geeqie@norz.org>
parents:
567
diff
changeset
|
954 { |
922 | 955 gint i; |
956 | |
568
77da13cb250b
exif_get_description_by_key(): check for "formatted." prefix, and optimize.
Laurent Monin <geeqie@norz.org>
parents:
567
diff
changeset
|
957 for (i = 0; ExifFormattedList[i].key; i++) |
1483
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
958 if (strcmp(key, ExifFormattedList[i].key) == 0) |
1053
d213ef1fc608
fixed charset of exiv2 strings in non-utf8 locales
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1052
diff
changeset
|
959 return g_strdup(_(ExifFormattedList[i].description)); |
568
77da13cb250b
exif_get_description_by_key(): check for "formatted." prefix, and optimize.
Laurent Monin <geeqie@norz.org>
parents:
567
diff
changeset
|
960 } |
182 | 961 |
962 return exif_get_tag_description_by_key(key); | |
963 } | |
184 | 964 |
965 gint exif_get_integer(ExifData *exif, const gchar *key, gint *value) | |
966 { | |
967 ExifItem *item; | |
968 | |
969 item = exif_get_item(exif, key); | |
970 return exif_item_get_integer(item, value); | |
971 } | |
972 | |
973 ExifRational *exif_get_rational(ExifData *exif, const gchar *key, gint *sign) | |
974 { | |
975 ExifItem *item; | |
976 | |
977 item = exif_get_item(exif, key); | |
1052
05910ddeb395
Add support for GPSInfo - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1000
diff
changeset
|
978 return exif_item_get_rational(item, sign, 0); |
184 | 979 } |
980 | |
981 gchar *exif_get_data_as_text(ExifData *exif, const gchar *key) | |
982 { | |
983 ExifItem *item; | |
984 gchar *text; | |
1422
bbdc6fe7f1b8
gint -> gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1361
diff
changeset
|
985 gboolean key_valid; |
184 | 986 |
987 if (!key) return NULL; | |
988 | |
989 text = exif_get_formatted_by_key(exif, key, &key_valid); | |
990 if (key_valid) return text; | |
991 | |
992 item = exif_get_item(exif, key); | |
993 if (item) return exif_item_get_data_as_text(item); | |
994 | |
995 return NULL; | |
996 } | |
188
3577ab0e5e8b
write comment and keywords to xmp, sidecars are used if exist
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
184
diff
changeset
|
997 |
844
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
998 |
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
999 static FileCacheData *exif_cache; |
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1000 |
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1001 void exif_release_cb(FileData *fd) |
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1002 { |
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1003 exif_free(fd->exif); |
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1004 fd->exif = NULL; |
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1005 } |
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1006 |
1871
a8cdf1b5af6f
Fix bug 3006812: ensure exif cache is initialized even when all files are unreadable.
Laurent Monin <geeqie@norz.org>
parents:
1808
diff
changeset
|
1007 void exif_init_cache(void) |
a8cdf1b5af6f
Fix bug 3006812: ensure exif cache is initialized even when all files are unreadable.
Laurent Monin <geeqie@norz.org>
parents:
1808
diff
changeset
|
1008 { |
2027
943ddff586b1
replaced assert with g_assert
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
2021
diff
changeset
|
1009 g_assert(!exif_cache); |
1871
a8cdf1b5af6f
Fix bug 3006812: ensure exif cache is initialized even when all files are unreadable.
Laurent Monin <geeqie@norz.org>
parents:
1808
diff
changeset
|
1010 exif_cache = file_cache_new(exif_release_cb, 4); |
a8cdf1b5af6f
Fix bug 3006812: ensure exif cache is initialized even when all files are unreadable.
Laurent Monin <geeqie@norz.org>
parents:
1808
diff
changeset
|
1011 } |
a8cdf1b5af6f
Fix bug 3006812: ensure exif cache is initialized even when all files are unreadable.
Laurent Monin <geeqie@norz.org>
parents:
1808
diff
changeset
|
1012 |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1013 ExifData *exif_read_fd(FileData *fd) |
188
3577ab0e5e8b
write comment and keywords to xmp, sidecars are used if exist
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
184
diff
changeset
|
1014 { |
1224
8caed680d86f
improved sidecar writting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1211
diff
changeset
|
1015 gchar *sidecar_path; |
2101 | 1016 |
1871
a8cdf1b5af6f
Fix bug 3006812: ensure exif cache is initialized even when all files are unreadable.
Laurent Monin <geeqie@norz.org>
parents:
1808
diff
changeset
|
1017 if (!exif_cache) exif_init_cache(); |
190
fb9b2e418e24
whitelist of files that can have an xmp sidecar, sample external command
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
188
diff
changeset
|
1018 |
2028 | 1019 if (!fd) return NULL; |
2101 | 1020 |
844
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1021 if (file_cache_get(exif_cache, fd)) return fd->exif; |
2014
b3bc1aa2d666
fixed bug in cache handling
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1902
diff
changeset
|
1022 g_assert(fd->exif == NULL); |
2101 | 1023 |
1224
8caed680d86f
improved sidecar writting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1211
diff
changeset
|
1024 /* CACHE_TYPE_XMP_METADATA file should exist only if the metadata are |
8caed680d86f
improved sidecar writting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1211
diff
changeset
|
1025 * not writable directly, thus it should contain the most up-to-date version */ |
1686
4cb7c2245306
fixes for a built without Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1483
diff
changeset
|
1026 sidecar_path = NULL; |
4cb7c2245306
fixes for a built without Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1483
diff
changeset
|
1027 |
4cb7c2245306
fixes for a built without Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1483
diff
changeset
|
1028 #ifdef HAVE_EXIV2 |
4cb7c2245306
fixes for a built without Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1483
diff
changeset
|
1029 /* we are not able to handle XMP sidecars without exiv2 */ |
1224
8caed680d86f
improved sidecar writting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1211
diff
changeset
|
1030 sidecar_path = cache_find_location(CACHE_TYPE_XMP_METADATA, fd->path); |
204
ba84f42c8416
improved xmp vs. legacy metadata handling
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
190
diff
changeset
|
1031 |
1224
8caed680d86f
improved sidecar writting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1211
diff
changeset
|
1032 if (!sidecar_path) sidecar_path = file_data_get_sidecar_path(fd, TRUE); |
1686
4cb7c2245306
fixes for a built without Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1483
diff
changeset
|
1033 #endif |
188
3577ab0e5e8b
write comment and keywords to xmp, sidecars are used if exist
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
184
diff
changeset
|
1034 |
1203
3d2d07d88a5b
prepared infrastructure for delayed metadata writting - refreshing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1189
diff
changeset
|
1035 fd->exif = exif_read(fd->path, sidecar_path, fd->modified_xmp); |
1224
8caed680d86f
improved sidecar writting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1211
diff
changeset
|
1036 |
8caed680d86f
improved sidecar writting
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1211
diff
changeset
|
1037 g_free(sidecar_path); |
2028 | 1038 file_cache_put(exif_cache, fd, 1); |
844
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1039 return fd->exif; |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1040 } |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1041 |
1203
3d2d07d88a5b
prepared infrastructure for delayed metadata writting - refreshing
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1189
diff
changeset
|
1042 |
844
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1043 void exif_free_fd(FileData *fd, ExifData *exif) |
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1044 { |
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1045 if (!fd) return; |
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1046 g_assert(fd->exif == exif); |
a311d66693d4
implemented generic FileData cache
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
736
diff
changeset
|
1047 } |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1048 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1049 /* embedded icc in jpeg */ |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1050 |
1422
bbdc6fe7f1b8
gint -> gboolean and tidy up.
Laurent Monin <geeqie@norz.org>
parents:
1361
diff
changeset
|
1051 gboolean exif_jpeg_parse_color(ExifData *exif, guchar *data, guint size) |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1052 { |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1053 guint seg_offset = 0; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1054 guint seg_length = 0; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1055 guint chunk_offset[255]; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1056 guint chunk_length[255]; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1057 guint chunk_count = 0; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1058 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1059 /* For jpeg/jfif, ICC color profile data can be in more than one segment. |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1060 the data is in APP2 data segments that start with "ICC_PROFILE\x00\xNN\xTT" |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1061 NN = segment number for data |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1062 TT = total number of ICC segments (TT in each ICC segment should match) |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1063 */ |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1064 |
1902
5e5a8f36f019
split jpeg parser functions to separate file
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1871
diff
changeset
|
1065 while (jpeg_segment_find(data + seg_offset + seg_length, |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1066 size - seg_offset - seg_length, |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1067 JPEG_MARKER_APP2, |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1068 "ICC_PROFILE\x00", 12, |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1069 &seg_offset, &seg_length)) |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1070 { |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1071 guchar chunk_num; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1072 guchar chunk_tot; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1073 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1074 if (seg_length < 14) return FALSE; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1075 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1076 chunk_num = data[seg_offset + 12]; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1077 chunk_tot = data[seg_offset + 13]; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1078 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1079 if (chunk_num == 0 || chunk_tot == 0) return FALSE; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1080 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1081 if (chunk_count == 0) |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1082 { |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1083 guint i; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1084 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1085 chunk_count = (guint)chunk_tot; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1086 for (i = 0; i < chunk_count; i++) chunk_offset[i] = 0; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1087 for (i = 0; i < chunk_count; i++) chunk_length[i] = 0; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1088 } |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1089 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1090 if (chunk_tot != chunk_count || |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1091 chunk_num > chunk_count) return FALSE; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1092 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1093 chunk_num--; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1094 chunk_offset[chunk_num] = seg_offset + 14; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1095 chunk_length[chunk_num] = seg_length - 14; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1096 } |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1097 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1098 if (chunk_count > 0) |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1099 { |
1000
07f6093c1c1a
For the sake of consistency, use glib basic types everywhere.
Laurent Monin <geeqie@norz.org>
parents:
985
diff
changeset
|
1100 guchar *cp_data; |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1101 guint cp_length = 0; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1102 guint i; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1103 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1104 for (i = 0; i < chunk_count; i++) cp_length += chunk_length[i]; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1105 cp_data = g_malloc(cp_length); |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1106 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1107 for (i = 0; i < chunk_count; i++) |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1108 { |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1109 if (chunk_offset[i] == 0) |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1110 { |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1111 /* error, we never saw this chunk */ |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1112 g_free(cp_data); |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1113 return FALSE; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1114 } |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1115 memcpy(cp_data, data + chunk_offset[i], chunk_length[i]); |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1116 } |
506
03d66738b225
Handle the newline in DEBUG_N() macro instead of adding one
Laurent Monin <geeqie@norz.org>
parents:
495
diff
changeset
|
1117 DEBUG_1("Found embedded icc profile in jpeg"); |
449
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1118 exif_add_jpeg_color_profile(exif, cp_data, cp_length); |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1119 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1120 return TRUE; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1121 } |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1122 |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1123 return FALSE; |
19e6026ceed7
read color profiles from jpeg also with Exiv2
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
442
diff
changeset
|
1124 } |
1483
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1125 |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1126 /* |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1127 *------------------------------------------------------------------- |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1128 * file info |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1129 * it is here because it shares tag neming infrastructure with exif |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1130 * we should probably not invest too much effort into this because |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1131 * new exiv2 will support the same functionality |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1132 * http://dev.exiv2.org/issues/show/505 |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1133 *------------------------------------------------------------------- |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1134 */ |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1135 |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1136 static gchar *mode_number(mode_t m) |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1137 { |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1138 gint mb, mu, mg, mo; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1139 gchar pbuf[12]; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1140 |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1141 mb = mu = mg = mo = 0; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1142 |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1143 if (m & S_ISUID) mb |= 4; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1144 if (m & S_ISGID) mb |= 2; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1145 if (m & S_ISVTX) mb |= 1; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1146 |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1147 if (m & S_IRUSR) mu |= 4; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1148 if (m & S_IWUSR) mu |= 2; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1149 if (m & S_IXUSR) mu |= 1; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1150 |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1151 if (m & S_IRGRP) mg |= 4; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1152 if (m & S_IWGRP) mg |= 2; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1153 if (m & S_IXGRP) mg |= 1; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1154 |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1155 if (m & S_IROTH) mo |= 4; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1156 if (m & S_IWOTH) mo |= 2; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1157 if (m & S_IXOTH) mo |= 1; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1158 |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1159 pbuf[0] = (m & S_IRUSR) ? 'r' : '-'; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1160 pbuf[1] = (m & S_IWUSR) ? 'w' : '-'; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1161 pbuf[2] = (m & S_IXUSR) ? 'x' : '-'; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1162 pbuf[3] = (m & S_IRGRP) ? 'r' : '-'; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1163 pbuf[4] = (m & S_IWGRP) ? 'w' : '-'; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1164 pbuf[5] = (m & S_IXGRP) ? 'x' : '-'; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1165 pbuf[6] = (m & S_IROTH) ? 'r' : '-'; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1166 pbuf[7] = (m & S_IWOTH) ? 'w' : '-'; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1167 pbuf[8] = (m & S_IXOTH) ? 'x' : '-'; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1168 pbuf[9] = '\0'; |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1169 |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1170 return g_strdup_printf("%s (%d%d%d%d)", pbuf, mb, mu, mg, mo); |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1171 } |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1172 |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1173 gchar *metadata_file_info(FileData *fd, const gchar *key, MetadataFormat format) |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1174 { |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1175 if (strcmp(key, "file.size") == 0) |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1176 { |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1177 return g_strdup_printf("%ld", (long)fd->size); |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1178 } |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1179 if (strcmp(key, "file.date") == 0) |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1180 { |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1181 return g_strdup(text_from_time(fd->date)); |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1182 } |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1183 if (strcmp(key, "file.mode") == 0) |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1184 { |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1185 return mode_number(fd->mode); |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1186 } |
2765
407334574789
Include file ctime as a formatted tag
Colin Clark <colin.clark@cclark.uk>
parents:
2761
diff
changeset
|
1187 if (strcmp(key, "file.ctime") == 0) |
407334574789
Include file ctime as a formatted tag
Colin Clark <colin.clark@cclark.uk>
parents:
2761
diff
changeset
|
1188 { |
407334574789
Include file ctime as a formatted tag
Colin Clark <colin.clark@cclark.uk>
parents:
2761
diff
changeset
|
1189 return g_strdup(text_from_time(fd->cdate)); |
407334574789
Include file ctime as a formatted tag
Colin Clark <colin.clark@cclark.uk>
parents:
2761
diff
changeset
|
1190 } |
2791
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1191 if (strcmp(key, "file.class") == 0) |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1192 { |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1193 return g_strdup(format_class_list[fd->format_class]); |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1194 } |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1195 if (strcmp(key, "file.owner") == 0) |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1196 { |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1197 return g_strdup(fd->owner); |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1198 } |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1199 if (strcmp(key, "file.group") == 0) |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1200 { |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1201 return g_strdup(fd->group); |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1202 } |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1203 if (strcmp(key, "file.link") == 0) |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1204 { |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1205 return g_strdup(fd->sym_link); |
7061c1eacc20
Additional file info parameters
Colin Clark <colin.clark@cclark.uk>
parents:
2771
diff
changeset
|
1206 } |
1483
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1207 return g_strdup(""); |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1208 } |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1209 |
757f4a41c203
re-added possibility to display basic file info (size, mode, date)
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1422
diff
changeset
|
1210 |
1055
4bbdfab3c89a
Adding a vim modeline to all files - patch by Klaus Ethgen
Vladimir Nadvornik <nadvornik@suse.cz>
parents:
1053
diff
changeset
|
1211 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */ |