[f-spot/rubenv-gsoc-2009: 38/86] Fix support for PANASONIC FZ50 RAW files.



commit e0e3945dd2be6f040e005f8a893e0dde2204cf3b
Author: Ruben Vermeersch <ruben savanne be>
Date:   Wed Jul 29 19:29:22 2009 +0200

    Fix support for PANASONIC FZ50 RAW files.

 lib/libfspotraw/fspot-librawloader.cpp |    4 +++-
 src/FSpot.Imaging.dll.config.in        |    5 +++++
 src/Imaging/Tiff.cs                    |   19 ++-----------------
 src/Loaders/LibrawImageLoader.cs       |    5 +++++
 src/PhotoStore.cs                      |    1 +
 5 files changed, 16 insertions(+), 18 deletions(-)
---
diff --git a/lib/libfspotraw/fspot-librawloader.cpp b/lib/libfspotraw/fspot-librawloader.cpp
index 0a96205..c0da10e 100644
--- a/lib/libfspotraw/fspot-librawloader.cpp
+++ b/lib/libfspotraw/fspot-librawloader.cpp
@@ -192,7 +192,9 @@ fspot_librawloader_load_embedded (FSpotLibrawLoader *self, int *orientation)
 
 	self->priv->raw_proc->unpack_thumb ();
 	image = self->priv->raw_proc->dcraw_make_mem_thumb (&result);
-	g_assert (result == 0 && image != NULL);
+	if (result != 0 || image == NULL) {
+		return NULL;
+	}
 	g_assert (image->type == LIBRAW_IMAGE_JPEG);
 
 	loader = gdk_pixbuf_loader_new ();
diff --git a/src/FSpot.Imaging.dll.config.in b/src/FSpot.Imaging.dll.config.in
index c966f8d..184b343 100644
--- a/src/FSpot.Imaging.dll.config.in
+++ b/src/FSpot.Imaging.dll.config.in
@@ -1,6 +1,11 @@
 <configuration>
+  <dllmap dll="libglib-2.0-0.dll" target="libglib-2.0.so.0"/>
+  <dllmap dll="libgobject-2.0-0.dll" target="libgobject-2.0.so.0"/>
   <dllmap dll="libgnomeui-2-0.dll" target="libgnomeui-2.so.0"/>
   <dllmap dll="libfspot" target="@expanded_libdir@/f-spot/libfspot.so.0"/>
   <dllmap dll="libfspotjpeg" target="@expanded_libdir@/f-spot/libfspotjpg.so.0"/>
+  <dllmap dll="libgdk-2.0-0.dll" target="libgdk-x11-2.0.so.0"/>
   <dllmap dll="libgdk_pixbuf-2.0-0.dll" target="libgdk_pixbuf-2.0.so.0"/>
+  <dllmap dll="liblcms-1.0.0.dll" target="liblcms.so.1"/>
+  <dllmap dll="libexif.dll" target="libexif so  EXIF_SOVERSION@"/>
 </configuration>
diff --git a/src/Imaging/Tiff.cs b/src/Imaging/Tiff.cs
index fed6d56..c26ae24 100644
--- a/src/Imaging/Tiff.cs
+++ b/src/Imaging/Tiff.cs
@@ -2214,7 +2214,7 @@ namespace FSpot.Tiff {
 		}
 	}	
 	
-	public class NefFile : TiffFile, IThumbnailContainer, IRawFile {
+	public class NefFile : TiffFile, IRawFile {
 		public NefFile (string path) : base (path) 
 		{
 		}
@@ -2258,13 +2258,6 @@ namespace FSpot.Tiff {
 			} while (i < sub.Directory.Length);
 		}
 
-		public Gdk.Pixbuf GetEmbeddedThumbnail ()
-		{
-			using (System.IO.Stream stream = Open ()) {
-				return TransformAndDispose (new Gdk.Pixbuf (stream));
-			}
-		}
-
 		public override System.IO.Stream PixbufStream ()
 		{
 			try {
@@ -2278,7 +2271,7 @@ namespace FSpot.Tiff {
 	}
 		
 
-	public class Cr2File : TiffFile, IThumbnailContainer, IRawFile {
+	public class Cr2File : TiffFile, IRawFile {
 		public Cr2File (string path) : base (path) 
 		{
 		}
@@ -2302,14 +2295,6 @@ namespace FSpot.Tiff {
 		}
 		*/
 
-		public Gdk.Pixbuf GetEmbeddedThumbnail ()
-		{
-			ImageDirectory directory;
-			directory = Header.Directory.NextDirectory;
-			return TransformAndDispose (LoadJpegInterchangeFormat (directory));
-		}
-
-
 		public override System.IO.Stream PixbufStream ()
 		{
 			uint offset = Header.Directory.Lookup (TagId.StripOffsets).ValueAsLong [0];
diff --git a/src/Loaders/LibrawImageLoader.cs b/src/Loaders/LibrawImageLoader.cs
index 2f8bbdb..11d13b9 100644
--- a/src/Loaders/LibrawImageLoader.cs
+++ b/src/Loaders/LibrawImageLoader.cs
@@ -178,6 +178,11 @@ namespace FSpot.Loaders {
 
 			int orientation;
 			large = loader.LoadEmbedded (out orientation);
+			if (large == null) {
+				// Fallback for files without an embedded preview (yuck!)
+				LoadFull ();
+				large = full.ShallowCopy ();
+			}
 
 			switch (orientation) {
 				case 0:
diff --git a/src/PhotoStore.cs b/src/PhotoStore.cs
index 89422eb..bd53a6f 100644
--- a/src/PhotoStore.cs
+++ b/src/PhotoStore.cs
@@ -25,6 +25,7 @@ using FSpot;
 using FSpot.Query;
 using FSpot.Utils;
 using FSpot.Platform;
+using FSpot.Loaders;
 
 using Banshee.Database;
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]