summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2015-01-02 20:48:20 +0000
committerMarcus Meissner <marcus@jet.franken.de>2015-01-02 20:48:20 +0000
commit856db453f8b22f70cd9ee14a06bed66dc04f0844 (patch)
treea48fb2209d490df7b620ddba33e3c05fc5727f83
parenta16e03376f93a153f7c3eee7feb974fe9c941e30 (diff)
downloadlibgphoto2-856db453f8b22f70cd9ee14a06bed66dc04f0844.tar.gz
From: Jiří Pinkava <j-pi@seznam.cz>
camlibs-pentax: fix PEF RAW file header git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@15307 67ed7778-7388-44ab-90cf-0a291f65f57c
-rw-r--r--camlibs/pentax/library.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/camlibs/pentax/library.c b/camlibs/pentax/library.c
index fdd1550b6..80bcee4d9 100644
--- a/camlibs/pentax/library.c
+++ b/camlibs/pentax/library.c
@@ -185,6 +185,29 @@ save_buffer(pslr_handle_t camhandle, int bufno, CameraFile *file, pslr_status *s
bytes = pslr_buffer_read(camhandle, buf, sizeof(buf));
if (bytes == 0)
break;
+ // PEF file got from K100D Super have broken header, WTF?
+ if (current == 0 && status->image_format == PSLR_IMAGE_FORMAT_RAW &&
+ status->raw_format == PSLR_RAW_FORMAT_PEF) {
+ const unsigned char correct_header[92] =
+ {
+ 0x4d, 0x4d, 0x00, 0x2a, 0x00, 0x00, 0x00, 0x08,
+ 0x00, 0x13, 0x01, 0x00, 0x00, 0x04, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x0b, 0xe0, 0x01, 0x01,
+ 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
+ 0x07, 0xe8, 0x01, 0x02, 0x00, 0x03, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x0c, 0x00, 0x00, 0x01, 0x03,
+ 0x00, 0x03, 0x00, 0x00, 0x00, 0x01, 0x80, 0x05,
+ 0x00, 0x00, 0x01, 0x06, 0x00, 0x03, 0x00, 0x00,
+ 0x00, 0x01, 0x80, 0x23, 0x00, 0x00, 0x01, 0x0f,
+ 0x00, 0x02, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00,
+ 0x00, 0xf2, 0x01, 0x10, 0x00, 0x02, 0x00, 0x00,
+ 0x00, 0x14, 0x00, 0x00
+ };
+
+ if (bytes < sizeof(correct_header))
+ return GP_ERROR;
+ memcpy(buf, correct_header, sizeof(correct_header));
+ }
gp_file_append (file, (char*)buf, bytes);
current += bytes;
}