2 * Copyright (C) 2010 Thiago Santos <thiago.sousa.santos@collabora.co.uk>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
20 #include "gsttageditingprivate.h"
25 __exif_tag_image_orientation_to_exif_value (const gchar * str)
30 if (strcmp (str, "rotate-0") == 0)
32 else if (strcmp (str, "flip-rotate-0") == 0)
34 else if (strcmp (str, "rotate-180") == 0)
36 else if (strcmp (str, "flip-rotate-180") == 0)
38 else if (strcmp (str, "flip-rotate-270") == 0)
40 else if (strcmp (str, "rotate-90") == 0)
42 else if (strcmp (str, "flip-rotate-90") == 0)
44 else if (strcmp (str, "rotate-270") == 0)
48 GST_WARNING ("Invalid image orientation tag: %s", str);
53 __exif_tag_image_orientation_from_exif_value (gint value)
59 return "flip-rotate-0";
63 return "flip-rotate-180";
65 return "flip-rotate-270";
69 return "flip-rotate-90";
73 GST_WARNING ("Invalid tiff orientation tag value: %d", value);
79 __exif_tag_capturing_exposure_program_to_exif_value (const gchar * str)
84 if (strcmp (str, "undefined") == 0)
86 else if (strcmp (str, "manual") == 0)
88 else if (strcmp (str, "normal") == 0)
90 else if (strcmp (str, "aperture-priority") == 0)
92 else if (strcmp (str, "shutter-priority") == 0)
94 else if (strcmp (str, "creative") == 0)
96 else if (strcmp (str, "action") == 0)
98 else if (strcmp (str, "portrait") == 0)
100 else if (strcmp (str, "landscape") == 0)
104 GST_WARNING ("Invalid capturing exposure program tag: %s", str);
109 __exif_tag_capturing_exposure_program_from_exif_value (gint value)
119 return "aperture-priority";
121 return "shutter-priority";
131 GST_WARNING ("Invalid exif exposure program: %d", value);
137 __exif_tag_capturing_exposure_mode_to_exif_value (const gchar * str)
142 if (strcmp (str, "auto-exposure") == 0)
144 else if (strcmp (str, "manual-exposure") == 0)
146 else if (strcmp (str, "auto-bracket") == 0)
150 GST_WARNING ("Invalid capturing exposure mode tag: %s", str);
155 __exif_tag_capturing_exposure_mode_from_exif_value (gint value)
159 return "auto-exposure";
161 return "manual-exposure";
163 return "auto-bracket";
165 GST_WARNING ("Invalid exif exposure mode: %d", value);
171 __exif_tag_capturing_scene_capture_type_to_exif_value (const gchar * str)
176 if (strcmp (str, "standard") == 0)
178 else if (strcmp (str, "landscape") == 0)
180 else if (strcmp (str, "portrait") == 0)
182 else if (strcmp (str, "night-scene") == 0)
186 GST_WARNING ("Invalid capturing scene capture type: %s", str);
191 __exif_tag_capturing_scene_capture_type_from_exif_value (gint value)
201 return "night-scene";
203 GST_WARNING ("Invalid exif scene capture type: %d", value);
209 __exif_tag_capturing_gain_adjustment_to_exif_value (const gchar * str)
214 if (strcmp (str, "none") == 0)
216 else if (strcmp (str, "low-gain-up") == 0)
218 else if (strcmp (str, "high-gain-up") == 0)
220 else if (strcmp (str, "low-gain-down") == 0)
222 else if (strcmp (str, "high-gain-down") == 0)
226 GST_WARNING ("Invalid capturing gain adjustment type: %s", str);
231 __exif_tag_capturing_gain_adjustment_from_exif_value (gint value)
237 return "low-gain-up";
239 return "high-gain-up";
241 return "low-gain-down";
243 return "high-gain-down";
245 GST_WARNING ("Invalid exif gain control type: %d", value);
251 __exif_tag_capturing_white_balance_to_exif_value (const gchar * str)
256 if (strcmp (str, "auto") == 0)
258 else /* everything else is just manual */
262 GST_WARNING ("Invalid white balance: %s", str);
267 __exif_tag_capturing_white_balance_from_exif_value (gint value)
275 GST_WARNING ("Invalid white balance type: %d", value);
281 __exif_tag_capturing_contrast_sharpness_to_exif_value (const gchar * str,
282 const gchar * tag_name)
287 if (strcmp (str, "normal") == 0)
289 else if (strcmp (str, "soft") == 0)
291 else if (strcmp (str, "hard") == 0)
295 GST_WARNING ("Invalid %s type: %s", tag_name, str);
300 __exif_tag_capturing_contrast_sharpness_from_exif_value (gint value,
301 const gchar * tag_name)
311 GST_WARNING ("Invalid %s type: %d", tag_name, value);
317 __exif_tag_capturing_contrast_to_exif_value (const gchar * str)
319 return __exif_tag_capturing_contrast_sharpness_to_exif_value (str,
324 __exif_tag_capturing_contrast_from_exif_value (gint value)
326 return __exif_tag_capturing_contrast_sharpness_from_exif_value (value,
331 __exif_tag_capturing_saturation_to_exif_value (const gchar * str)
336 if (strcmp (str, "normal") == 0)
338 else if (strcmp (str, "low-saturation") == 0)
340 else if (strcmp (str, "high-saturation") == 0)
344 GST_WARNING ("Invalid saturation type: %s", str);
349 __exif_tag_capturing_saturation_from_exif_value (gint value)
355 return "low-saturation";
357 return "high-saturation";
359 GST_WARNING ("Invalid saturation type: %d", value);
365 __exif_tag_capturing_sharpness_to_exif_value (const gchar * str)
367 return __exif_tag_capturing_contrast_sharpness_to_exif_value (str,
372 __exif_tag_capturing_sharpness_from_exif_value (gint value)
374 return __exif_tag_capturing_contrast_sharpness_from_exif_value (value,
379 __exif_tag_capturing_metering_mode_to_exif_value (const gchar * str)
384 if (strcmp (str, "unknown") == 0)
386 else if (strcmp (str, "average") == 0)
388 else if (strcmp (str, "center-weighted-average") == 0)
390 else if (strcmp (str, "spot") == 0)
392 else if (strcmp (str, "multi-spot") == 0)
394 else if (strcmp (str, "pattern") == 0)
396 else if (strcmp (str, "partial") == 0)
398 else if (strcmp (str, "other") == 0)
402 GST_WARNING ("Invalid metering mode type: %s", str);
407 __exif_tag_capturing_metering_mode_from_exif_value (gint value)
415 return "center-weighted-average";
427 GST_WARNING ("Invalid metering mode type: %d", value);
433 __exif_tag_capturing_source_to_exif_value (const gchar * str)
438 if (strcmp (str, "dsc") == 0)
440 else if (strcmp (str, "other") == 0)
442 else if (strcmp (str, "transparent-scanner") == 0)
444 else if (strcmp (str, "reflex-scanner") == 0)
448 GST_WARNING ("Invalid capturing source type: %s", str);
453 __exif_tag_capturing_source_from_exif_value (gint value)
459 return "transparent-scanner";
461 return "reflex-scanner";
465 GST_WARNING ("Invalid capturing source type: %d", value);