beagle r4699 - in trunk/beagle/Util/F-Spot: Imaging upstream-changes



Author: dbera
Date: Sun Apr 13 20:35:26 2008
New Revision: 4699
URL: http://svn.gnome.org/viewvc/beagle?rev=4699&view=rev

Log:
Import 02-iptc.diff.


Added:
   trunk/beagle/Util/F-Spot/upstream-changes/03-iptc.diff
Modified:
   trunk/beagle/Util/F-Spot/Imaging/IptcFile.cs
   trunk/beagle/Util/F-Spot/Imaging/JpegHeader.cs

Modified: trunk/beagle/Util/F-Spot/Imaging/IptcFile.cs
==============================================================================
--- trunk/beagle/Util/F-Spot/Imaging/IptcFile.cs	(original)
+++ trunk/beagle/Util/F-Spot/Imaging/IptcFile.cs	Sun Apr 13 20:35:26 2008
@@ -346,6 +346,9 @@
 	public class IptcFile : SemWeb.StatementSource
 	{
 		System.Collections.ArrayList sets = new System.Collections.ArrayList ();
+		public System.Collections.ArrayList Sets {
+			get { return sets; }
+		}
 
                 // False seems a safe default
                 public bool Distinct {

Modified: trunk/beagle/Util/F-Spot/Imaging/JpegHeader.cs
==============================================================================
--- trunk/beagle/Util/F-Spot/Imaging/JpegHeader.cs	(original)
+++ trunk/beagle/Util/F-Spot/Imaging/JpegHeader.cs	Sun Apr 13 20:35:26 2008
@@ -371,6 +371,26 @@
 		}
 	}
 
+	public FSpot.Iptc.IptcFile GetIptc ()
+	{
+		string name = PhotoshopSignature.Name;
+		JpegHeader.Marker marker = FindMarker (PhotoshopSignature);
+		if (marker != null) {
+			int len = name.Length;
+			using (System.IO.Stream bimstream = new System.IO.MemoryStream (marker.Data, len,
+											marker.Data.Length - len, false)) {
+
+				FSpot.Bim.BimFile bim = new FSpot.Bim.BimFile (bimstream);
+				// FIXME: What about EntryType.XMP ?
+				FSpot.Bim.Entry iptc_entry = bim.FindEntry (FSpot.Bim.EntryType.IPTCNAA);
+				System.IO.Stream iptcstream = new System.IO.MemoryStream (iptc_entry.Data);
+				FSpot.Iptc.IptcFile iptc = new FSpot.Iptc.IptcFile (iptcstream);
+				return iptc;
+			}
+		}
+		return null;
+	}
+
 	public Exif.ExifData Exif {
 		get {
 			Marker m = FindMarker (ExifSignature);

Added: trunk/beagle/Util/F-Spot/upstream-changes/03-iptc.diff
==============================================================================
--- (empty file)
+++ trunk/beagle/Util/F-Spot/upstream-changes/03-iptc.diff	Sun Apr 13 20:35:26 2008
@@ -0,0 +1,50 @@
+From: Debajyoti Bera <dbera web gmail com>
+
+Extract Iptc header from Jpeg files. There could be (and should be) a better way
+to do this using some Semweb sink.
+
+Index: Imaging/JpegHeader.cs
+===================================================================
+--- Imaging/JpegHeader.cs	(revision 4698)
++++ Imaging/JpegHeader.cs	(working copy)
+@@ -371,6 +371,26 @@
+ 		}
+ 	}
+ 
++	public FSpot.Iptc.IptcFile GetIptc ()
++	{
++		string name = PhotoshopSignature.Name;
++		JpegHeader.Marker marker = FindMarker (PhotoshopSignature);
++		if (marker != null) {
++			int len = name.Length;
++			using (System.IO.Stream bimstream = new System.IO.MemoryStream (marker.Data, len,
++											marker.Data.Length - len, false)) {
++
++				FSpot.Bim.BimFile bim = new FSpot.Bim.BimFile (bimstream);
++				// FIXME: What about EntryType.XMP ?
++				FSpot.Bim.Entry iptc_entry = bim.FindEntry (FSpot.Bim.EntryType.IPTCNAA);
++				System.IO.Stream iptcstream = new System.IO.MemoryStream (iptc_entry.Data);
++				FSpot.Iptc.IptcFile iptc = new FSpot.Iptc.IptcFile (iptcstream);
++				return iptc;
++			}
++		}
++		return null;
++	}
++
+ 	public Exif.ExifData Exif {
+ 		get {
+ 			Marker m = FindMarker (ExifSignature);
+Index: Imaging/IptcFile.cs
+===================================================================
+--- Imaging/IptcFile.cs	(revision 4696)
++++ Imaging/IptcFile.cs	(working copy)
+@@ -346,6 +346,9 @@
+ 	public class IptcFile : SemWeb.StatementSource
+ 	{
+ 		System.Collections.ArrayList sets = new System.Collections.ArrayList ();
++		public System.Collections.ArrayList Sets {
++			get { return sets; }
++		}
+ 
+                 // False seems a safe default
+                 public bool Distinct {



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