File dng4ps2-compile.diff of Package dng4ps2

Index: dng4ps2-r62/src/Utils.cpp
===================================================================
--- dng4ps2-r62.orig/src/Utils.cpp
+++ dng4ps2-r62/src/Utils.cpp
@@ -56,16 +56,17 @@
 #include "dng_memory_stream.h"
 #include "dng_xmp.h"
 #include "dng_read_image.h"
 #include "dng_camera_profile.h"
+#include "dng_preview.h"
 
 // Exiflib
 #include "exif-data.h"
 #include "exif-utils.h"
 #include "exif-loader.h"
 #include "exif-tag.h"
 #include "exif-utils.h"
-#include "exif-mnote-data-priv.h"
+//#include "exif-mnote-data-priv.h"
 #include "exif-mnote-data.h"
 
 #include "Exception.hpp"
 #include "ProgramObjects.h"
@@ -351,15 +352,19 @@ void Utils::add_metadata_from_jpeg(dng_h
 		exif->fFocalPlaneResolutionUnit = get_short_exif(jpeg.ed, EXIF_TAG_FOCAL_PLANE_RESOLUTION_UNIT); // Focal Plane Resolution Unit
 		exif->fSceneCaptureType         = get_short_exif(jpeg.ed, EXIF_TAG_SCENE_CAPTURE_TYPE);          // Scene Capture Type
 		exif->fISOSpeedRatings[0]       = get_short_exif(jpeg.ed, EXIF_TAG_ISO_SPEED_RATINGS);           // ISO
 		exif->fLightSource              = get_short_exif(jpeg.ed, EXIF_TAG_LIGHT_SOURCE);                // LightSource
-
-		copy_exif(jpeg.ed, EXIF_TAG_DATE_TIME_DIGITIZED,      exif->fDateTimeDigitized);     // DateTime Digitized
-		copy_exif(jpeg.ed, EXIF_TAG_DATE_TIME_ORIGINAL,       exif->fDateTimeOriginal);      // DateTime Original
-
+
 		dng_date_time dt_shot;
+		copy_exif(jpeg.ed, EXIF_TAG_DATE_TIME_DIGITIZED, dt_shot);
+		exif->fDateTimeDigitized.SetDateTime(dt_shot);
+		copy_exif(jpeg.ed, EXIF_TAG_DATE_TIME_ORIGINAL, dt_shot);
+		exif->fDateTimeOriginal.SetDateTime(dt_shot);      // DateTime Original
+
 		copy_exif(jpeg.ed, EXIF_TAG_DATE_TIME,                dt_shot);              // DateTime
-		negative->UpdateDateTime(dt_shot, 0);
+		dng_date_time_info dt_shot_info;
+		dt_shot_info.SetDateTime(dt_shot);
+		negative->UpdateDateTime(dt_shot_info);
 
 		copy_exif(jpeg.ed, EXIF_TAG_MODEL,                    exif->fModel, true);           // Model
 		copy_exif(jpeg.ed, EXIF_TAG_MAKE,                     exif->fMake, true);            // Manufacturer
 
@@ -604,9 +609,10 @@ void Utils::create_dng_file
 	negative->SetShadowScale( dng_urational(1, 1) );
 
 	negative->SetAnalogBalance(dng_vector_3(1.0,1.0,1.0));
 
-	negative->SetEmbeddedCameraProfile(camprofile);
+	//negative->SetEmbeddedCameraProfile(camprofile);
+	negative->AddProfile(camprofile);
 
 	// Add EXIF data from JPEG
 	if (sys().options->add_metadata && jpeg_exists) add_metadata_from_jpeg(host, negative.Get(), jpeg);
 	else
@@ -622,11 +628,13 @@ void Utils::create_dng_file
 		dt.fHour = date_time.GetHour();
 		dt.fMinute = date_time.GetMinute();
 		dt.fSecond = date_time.GetSecond();
 
-		negative->GetExif()->fDateTimeOriginal = dt;
-		negative->GetExif()->fDateTimeDigitized = dt;
-		negative->UpdateDateTime(dt, 0);
+		negative->GetExif()->fDateTimeOriginal.SetDateTime(dt);
+		negative->GetExif()->fDateTimeDigitized.SetDateTime(dt);
+		dng_date_time_info dt_info;
+		dt_info.SetDateTime(dt);
+		negative->UpdateDateTime(dt_info);
 	}
 
 	// Artist
 	if (sys().options->use_artist) negative->GetExif()->fArtist.Set_SystemEncoding(sys().options->artist.char_str());
@@ -641,13 +649,13 @@ void Utils::create_dng_file
 	negative->SynchronizeMetadata();
 	negative->RebuildIPTC();
 
 	// Preview image
-	AutoPtr<dng_jpeg_preview> jpeg_preview;
+	dng_jpeg_preview *jpeg_preview = new dng_jpeg_preview;
+	AutoPtr<dng_preview> dpv(jpeg_preview);
 	if ((sys().options->preview_type == pt_Medium) || (sys().options->preview_type == pt_Full))
 	{
 		wxImage pre_image;
-		jpeg_preview.Reset(new dng_jpeg_preview);
 
 		if (!jpeg_exists || resultImage)
 		{
 			AutoPtr<dng_image> finalImage;
@@ -719,18 +727,23 @@ void Utils::create_dng_file
 		mis.Read(jpeg_preview->fCompressedData->Buffer_char(), jpeg_preview_file_size);
 	}
 
 	// Build thumbnail image.
-	AutoPtr<dng_image> thumbnail;
+	dng_image_preview dip;
 	dng_render thumbnail_render(host, *negative);
 	thumbnail_render.SetFinalSpace(dng_space_sRGB::Get());
 	thumbnail_render.SetFinalPixelType(ttByte);
 	thumbnail_render.SetMaximumSize(256);
-	thumbnail.Reset(thumbnail_render.Render());
+	dip.fImage.Reset(thumbnail_render.Render());
 
 	dng_image_writer writer;
 	dng_file_stream filestream(new_file.char_str(), true);
-	writer.WriteDNG(host, filestream, *negative.Get(), *thumbnail.Get(), sys().options->compress_dng ? ccJPEG : ccUncompressed, jpeg_preview.Get());
+	// FIXME
+	//AutoPtr<dng_preview> dpv(reinterpret_cast<dng_preview*>(jpeg_preview.Get()));
+	//AutoPtr<dng_preview> dpv((dng_preview*)jpeg_preview.Get());
+	dng_preview_list dpl; //dpl.Append(reinterpret_cast<AutoPtr<dng_preview> >jpeg_preview);
+	dpl.Append(dpv);
+	writer.WriteDNG(host, filestream, *negative.Get(), dip, sys().options->compress_dng ? ccJPEG : ccUncompressed, &dpl);
 }
 
 
 inline unsigned short swap_bytes_uint16(unsigned short src)