* EXIF data is now also parsed in case there was no ioExtension message passed in;
the orientation was only honoured in case there was a message before. * Disabled error alerts; they are more annoying than helpful. * Bumped version to 1.2.0. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@20664 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -53,7 +53,7 @@ EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||||||
char translatorName[] = "JPEG Images";
|
char translatorName[] = "JPEG Images";
|
||||||
char translatorInfo[] =
|
char translatorInfo[] =
|
||||||
"©2002-2003, Marcin Konicki\n"
|
"©2002-2003, Marcin Konicki\n"
|
||||||
"©2005-2006, Haiku\n"
|
"©2005-2007, Haiku\n"
|
||||||
"\n"
|
"\n"
|
||||||
"Based on IJG library © 1991-1998, Thomas G. Lane\n"
|
"Based on IJG library © 1991-1998, Thomas G. Lane\n"
|
||||||
" http://www.ijg.org/files/\n"
|
" http://www.ijg.org/files/\n"
|
||||||
@@ -63,7 +63,7 @@ char translatorInfo[] =
|
|||||||
"With some colorspace conversion routines by Magnus Hellman\n"
|
"With some colorspace conversion routines by Magnus Hellman\n"
|
||||||
" http://www.bebits.com/app/802\n";
|
" http://www.bebits.com/app/802\n";
|
||||||
|
|
||||||
int32 translatorVersion = 0x111;
|
int32 translatorVersion = 0x120;
|
||||||
|
|
||||||
// Define the formats we know how to read
|
// Define the formats we know how to read
|
||||||
translation_format inputFormats[] = {
|
translation_format inputFormats[] = {
|
||||||
@@ -1379,31 +1379,29 @@ Decompress(BPositionIO *in, BPositionIO *out, BMessage* ioExtension)
|
|||||||
jpeg_create_decompress(&cinfo);
|
jpeg_create_decompress(&cinfo);
|
||||||
be_jpeg_stdio_src(&cinfo, in);
|
be_jpeg_stdio_src(&cinfo, in);
|
||||||
|
|
||||||
#if 1
|
|
||||||
jpeg_save_markers(&cinfo, MARKER_EXIF, 131072);
|
jpeg_save_markers(&cinfo, MARKER_EXIF, 131072);
|
||||||
// make sure the EXIF tag is stored
|
// make sure the EXIF tag is stored
|
||||||
#endif
|
|
||||||
|
|
||||||
// Read info about image
|
// Read info about image
|
||||||
jpeg_read_header(&cinfo, TRUE);
|
jpeg_read_header(&cinfo, TRUE);
|
||||||
|
|
||||||
BMessage exif;
|
BMessage exif;
|
||||||
|
|
||||||
if (ioExtension != NULL) {
|
// parse EXIF data and add it ioExtension, if any
|
||||||
// add EXIF data to message, if any
|
jpeg_marker_struct* marker = cinfo.marker_list;
|
||||||
jpeg_marker_struct* marker = cinfo.marker_list;
|
while (marker != NULL) {
|
||||||
while (marker != NULL) {
|
if (marker->marker == MARKER_EXIF
|
||||||
if (marker->marker == MARKER_EXIF
|
&& !strncmp((char*)marker->data, "Exif", 4)) {
|
||||||
&& !strncmp((char*)marker->data, "Exif", 4)) {
|
if (ioExtension != NULL) {
|
||||||
// Strip EXIF header from TIFF data
|
// Strip EXIF header from TIFF data
|
||||||
ioExtension->AddData("exif", B_RAW_TYPE,
|
ioExtension->AddData("exif", B_RAW_TYPE,
|
||||||
(uint8 *)marker->data + 6, marker->data_length - 6);
|
(uint8 *)marker->data + 6, marker->data_length - 6);
|
||||||
|
|
||||||
BMemoryIO io(marker->data + 6, marker->data_length - 6);
|
|
||||||
convert_exif_to_message(io, exif);
|
|
||||||
}
|
}
|
||||||
marker = marker->next;
|
|
||||||
|
BMemoryIO io(marker->data + 6, marker->data_length - 6);
|
||||||
|
convert_exif_to_message(io, exif);
|
||||||
}
|
}
|
||||||
|
marker = marker->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default color info
|
// Default color info
|
||||||
|
|||||||
@@ -67,8 +67,10 @@ be_error_exit (j_common_ptr cinfo)
|
|||||||
/* Create the message */
|
/* Create the message */
|
||||||
(*cinfo->err->format_message) (cinfo, buffer);
|
(*cinfo->err->format_message) (cinfo, buffer);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* show error message */
|
/* show error message */
|
||||||
(new BAlert("JPEG Library Error", buffer, "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
|
(new BAlert("JPEG Library Error", buffer, "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Let the memory manager delete any temp files before we die */
|
/* Let the memory manager delete any temp files before we die */
|
||||||
jpeg_destroy(cinfo);
|
jpeg_destroy(cinfo);
|
||||||
@@ -88,10 +90,12 @@ be_output_message (j_common_ptr cinfo)
|
|||||||
/* Create the message */
|
/* Create the message */
|
||||||
(*cinfo->err->format_message) (cinfo, buffer);
|
(*cinfo->err->format_message) (cinfo, buffer);
|
||||||
|
|
||||||
|
#if 0
|
||||||
/* If it's compressing or decompressing and user turned messages on */
|
/* If it's compressing or decompressing and user turned messages on */
|
||||||
if (!cinfo->is_decompressor || cinfo->err->ShowReadWarnings)
|
if (!cinfo->is_decompressor || cinfo->err->ShowReadWarnings)
|
||||||
/* show warning message */
|
/* show warning message */
|
||||||
(new BAlert("JPEG Library Warning", buffer, "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
|
(new BAlert("JPEG Library Warning", buffer, "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user