}
private void processMakerNote(int subdirOffset, @NotNull Set<Integer> processedDirectoryOffsets, int tiffHeaderOffset, @NotNull final Metadata metadata, @NotNull BufferReader reader) throws BufferBoundsException
{
// Determine the camera model and makernote format
Directory ifd0Directory = metadata.getDirectory(ExifIFD0Directory.class);
if (ifd0Directory==null)
return;
String cameraModel = ifd0Directory.getString(ExifIFD0Directory.TAG_MAKE);
//final String firstTwoChars = reader.getString(subdirOffset, 2);
final String firstThreeChars = reader.getString(subdirOffset, 3);
final String firstFourChars = reader.getString(subdirOffset, 4);
final String firstFiveChars = reader.getString(subdirOffset, 5);
final String firstSixChars = reader.getString(subdirOffset, 6);
final String firstSevenChars = reader.getString(subdirOffset, 7);
final String firstEightChars = reader.getString(subdirOffset, 8);
final String firstTwelveChars = reader.getString(subdirOffset, 12);
if ("OLYMP".equals(firstFiveChars) || "EPSON".equals(firstFiveChars) || "AGFA".equals(firstFourChars)) {
// Olympus Makernote
// Epson and Agfa use Olympus maker note standard: http://www.ozhiker.com/electronics/pjmt/jpeg_info/
processDirectory(metadata.getOrCreateDirectory(OlympusMakernoteDirectory.class), processedDirectoryOffsets, subdirOffset + 8, tiffHeaderOffset, metadata, reader);
} else if (cameraModel != null && cameraModel.trim().toUpperCase().startsWith("NIKON")) {
if ("Nikon".equals(firstFiveChars)) {
/* There are two scenarios here:
* Type 1: **
* :0000: 4E 69 6B 6F 6E 00 01 00-05 00 02 00 02 00 06 00 Nikon...........
* :0010: 00 00 EC 02 00 00 03 00-03 00 01 00 00 00 06 00 ................
* Type 3: **
* :0000: 4E 69 6B 6F 6E 00 02 00-00 00 4D 4D 00 2A 00 00 Nikon....MM.*...
* :0010: 00 08 00 1E 00 01 00 07-00 00 00 04 30 32 30 30 ............0200
*/
switch (reader.getUInt8(subdirOffset + 6)) {
case 1:
processDirectory(metadata.getOrCreateDirectory(NikonType1MakernoteDirectory.class), processedDirectoryOffsets, subdirOffset + 8, tiffHeaderOffset, metadata, reader);
break;
case 2:
processDirectory(metadata.getOrCreateDirectory(NikonType2MakernoteDirectory.class), processedDirectoryOffsets, subdirOffset + 18, subdirOffset + 10, metadata, reader);
break;
default:
ifd0Directory.addError("Unsupported Nikon makernote data ignored.");
break;
}
} else {
// The IFD begins with the first MakerNote byte (no ASCII name). This occurs with CoolPix 775, E990 and D1 models.
processDirectory(metadata.getOrCreateDirectory(NikonType2MakernoteDirectory.class), processedDirectoryOffsets, subdirOffset, tiffHeaderOffset, metadata, reader);