/*
- * GQView
- * (C) 2005 John Ellis
+ * Geeqie
+ * (C) 2005 John Ellis
+ * Copyright (C) 2008 - 2012 The Geeqie Team
*
* This software is released under the GNU General Public License (GNU GPL).
* Please read the included file COPYING for more information.
*
* Code to add support for Canon CR2 and CRW files, version 0.2
*
- * Developed by Daniel M. German, dmgerman at uvic.ca
+ * Developed by Daniel M. German, dmgerman at uvic.ca
*
* you can find the sources for this patch at http://turingmachine.org/~dmg/libdcraw/gqview/
*
# include "config.h"
#endif
+#ifndef HAVE_EXIV2
#include <stdio.h>
#include <string.h>
#include "intl.h"
-#include "gqview.h"
+#include "main.h"
#include "format_canon.h"
#include "format_raw.h"
*-----------------------------------------------------------------------------
*/
-static gint canon_cr2_tiff_entry(unsigned char *data, const guint len, guint offset, ExifByteOrder bo,
- guint *image_offset, gint *jpeg_encoding)
+static gboolean canon_cr2_tiff_entry(guchar *data, const guint len, guint offset, ExifByteOrder bo,
+ guint *image_offset, gint *jpeg_encoding)
{
guint tag;
guint type;
return TRUE;
}
-static gint canon_cr2_tiff_table(unsigned char *data, const guint len, guint offset, ExifByteOrder bo,
+static gint canon_cr2_tiff_table(guchar *data, const guint len, guint offset, ExifByteOrder bo,
guint *image_offset)
{
- gint jpeg_encoding = FALSE;
+ gboolean jpeg_encoding = FALSE;
guint count;
guint i;
return exif_byte_get_int32(data + offset + count * EXIF_TIFD_SIZE, bo);
}
-gint format_canon_raw_cr2(unsigned char *data, const guint len,
- guint *image_offset, guint *exif_offset)
+gboolean format_canon_raw_cr2(guchar *data, const guint len,
+ guint *image_offset, guint *exif_offset)
{
guint jpeg_offset = 0;
ExifByteOrder bo;
#define CRW_HEADER_SIZE 26
#define CRW_DIR_ENTRY_SIZE 10
-gint format_canon_raw_crw(unsigned char *data, const guint len,
- guint *image_offset, guint *exif_offset)
+gboolean format_canon_raw_crw(guchar *data, const guint len,
+ guint *image_offset, guint *exif_offset)
{
guint block_offset;
guint data_length;
guint jpeg_offset;
jpeg_offset = block_offset + record_offset;
- if (len < jpeg_offset + record_length ||
+ if (len < jpeg_offset + record_length ||
record_length < 4 ||
memcmp(data + jpeg_offset, "\xff\xd8\xff\xdb", 4) != 0)
{
EXIF_MARKER_LIST_END
};
-#if 0
-
-static ExifTextList CanonCustomEnable[] = {
- { 0, "off" },
- { 1, "on" },
- EXIF_TEXT_LIST_END
-};
-
-static ExifTextList CanonCustomEnableInvert[] = {
- { 0, "on" },
- { 1, "off" },
- EXIF_TEXT_LIST_END
-};
-
-static ExifTextList CanonCustomExposureLevel[] = {
- { 0, "1/2 stop" },
- { 1, "1/3 stop" },
- EXIF_TEXT_LIST_END
-};
-
-static ExifTextList CanonCustomAVShutterSpeed[] = {
- { 0, "auto" },
- { 1, "1/200 (fixed)" },
- EXIF_TEXT_LIST_END
-};
-
-static ExifTextList CanonCustomShutterCurtainSync[] = {
- { 0, "1st" },
- { 1, "2nd" },
- EXIF_TEXT_LIST_END
-};
-
-static ExifMarker CanonCustom[] = {
-{ 1, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.NoiseReduction", "Noise reduction", CanonCustomEnable },
-/*{ 2, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.BtnFuncShutter",
- "Shutter/Auto exposure button function",CanonCustomBTNShutter }, */
-{ 3, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.MirrorLockup", "Mirror lockup", CanonCustomEnable },
-{ 4, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.TvAvExposureLevel",
- "Tv/Av and exposure level", CanonCustomExposureLevel },
-{ 5, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.AFAssistLight", "AF assist light", CanonCustomEnableInvert },
-{ 6, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.AvShutterSpeed",
- "Shutter speed in Av mode", CanonCustomAVShutterSpeed },
-/*{ 7, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.AutoBracket",
- "Auto-Exposure bracketting sequence/auto cancellation", CanonCustom }, */
-{ 8, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.ShutterSync", "Shutter sync", CanonCustomShutterCurtainSync },
-/* { 9, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.BtnFuncAF", "AF button function", CanonCustom }, */
-{ 10, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.FillFlashReduction",
- "Fill flash auto reduction", CanonCustomEnableInvert },
-/*{ 11, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.BtnFuncMenu",
- "Menu button function", CanonCustom }, */
-/*{ 12, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.BtnFuncSet", "Set button function", CanonCustom }, */
-{ 13, EXIF_FORMAT_SHORT_UNSIGNED, 1, "MkN.Canon.SensorCleaning", "Sensor cleaning", CanonCustomEnable },
-EXIF_MARKER_LIST_END
-};
-
-#endif
static ExifMarker CanonExifMarkersList[] = {
- { 1, EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.Settings1", NULL, NULL },
+ { 1, EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.Settings1", NULL, NULL },
{ 4, EXIF_FORMAT_SHORT_UNSIGNED, -1, "MkN.Canon.Settings2", NULL, NULL },
{ 6, EXIF_FORMAT_STRING, -1, "MkN.Canon.ImageType", "Image type", NULL },
{ 7, EXIF_FORMAT_STRING, -1, "MkN.Canon.FirmwareVersion", "Firmware version", NULL },
}
}
-#if 0
-static void canon_mknote_parse_convert(ExifData *exif)
-{
- gint value;
- ExifItem *result;
-
- /* seems we need more than only this value for distance */
- if (exif_get_integer(exif, "MkN.Canon.SubjectDistance", &value))
- {
- static ExifMarker marker= { 0x9206, EXIF_FORMAT_RATIONAL_UNSIGNED, 1,
- "SubjectDistance", "Subject distance", NULL };
- ExifItem *item;
- ExifRational *rational;
-
- item = exif_item_new(marker.format, marker.tag, 1, &marker);
- rational = item->data;
- rational->num = value;
- rational->den = 100;
-
- exif->items = g_list_prepend(exif->items, item);
- }
- result = exif_get_item(exif, "MkN.Canon.SerialNumber");
- if (result && result->format == EXIF_FORMAT_LONG_UNSIGNED && result->data_len == 4)
- {
- static ExifMarker marker= { 12, EXIF_FORMAT_STRING, -1,
- "SerialNumber", "Camera serial number", NULL };
- ExifItem *item;
- gchar *text;
- gint l;
- guint32 n;
-
- n = (guint32)((guint32 *)(result->data))[0];
- text = g_strdup_printf("%04X%05d", n & 0xffff0000 >> 8, n & 0x0000ffff);
- l = strlen(text) + 1;
- item = exif_item_new(marker.format, marker.tag, l, &marker);
- memcpy(item->data, text, l);
- g_free(text);
-
- exif->items = g_list_prepend(exif->items, item);
- }
-}
-#endif
-
-gint format_canon_makernote(ExifData *exif, unsigned char *tiff, guint offset,
- guint size, ExifByteOrder bo)
+gboolean format_canon_makernote(ExifData *exif, guchar *tiff, guint offset,
+ guint size, ExifByteOrder bo)
{
ExifItem *item;
canon_mknote_parse_settings(exif, item->data, item->data_len, bo, CanonSet2);
}
-#if 0
- canon_mknote_parse_convert(exif);
-#endif
-
return TRUE;
}
+#endif
+/* not HAVE_EXIV2 */
+/* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */