Author: jwilcox
Date: 2007-10-04 13:13:46 -0400 (Thu, 04 Oct 2007)
New Revision: 86893

Modified:
   trunk/ipod-sharp/ChangeLog
   trunk/ipod-sharp/src/Hal/HalDevice.cs
   trunk/ipod-sharp/src/Thumbnail.cs
Log:
2007-10-04  James Willcox  <[EMAIL PROTECTED]>

        * src/Thumbnail.cs: use the data length instead of the format length
        when writing the thumbnail since the latter is not required
        to be valid.

        * src/Hal/HalDevice.cs: ignore artwork formats with unknown
        pixel formats.


Modified: trunk/ipod-sharp/ChangeLog
===================================================================
--- trunk/ipod-sharp/ChangeLog  2007-10-04 17:13:04 UTC (rev 86892)
+++ trunk/ipod-sharp/ChangeLog  2007-10-04 17:13:46 UTC (rev 86893)
@@ -1,3 +1,12 @@
+2007-10-04  James Willcox  <[EMAIL PROTECTED]>
+
+       * src/Thumbnail.cs: use the data length instead of the format length
+       when writing the thumbnail since the latter is not required
+       to be valid.
+
+       * src/Hal/HalDevice.cs: ignore artwork formats with unknown
+       pixel formats.
+
 2007-09-22  James Willcox  <[EMAIL PROTECTED]>
 
        * src/TrackDatabase.cs: some cleanups, and do the rest of the things

Modified: trunk/ipod-sharp/src/Hal/HalDevice.cs
===================================================================
--- trunk/ipod-sharp/src/Hal/HalDevice.cs       2007-10-04 17:13:04 UTC (rev 
86892)
+++ trunk/ipod-sharp/src/Hal/HalDevice.cs       2007-10-04 17:13:46 UTC (rev 
86893)
@@ -49,7 +49,6 @@
             return String.Format("{0} {1}", (int)Math.Round(value), format);
         }
 
-
         internal HalDevice (Volume volume) {
             this.volume = volume;
 
@@ -141,6 +140,9 @@
                         case "rgb565be":
                             pformat = PixelFormat.Rgb565BE;
                             break;
+                        case "unknown":
+                            pformat = PixelFormat.Unknown;
+                            break;
                         }
                         break;
                     case "image_type":
@@ -159,8 +161,10 @@
                     }
                 }
 
-                formats.Add (new ArtworkFormat (usage, width, height, 
correlationId,
-                                                size, pformat, rotation));
+                if (pformat != PixelFormat.Unknown) {
+                    formats.Add (new ArtworkFormat (usage, width, height, 
correlationId,
+                                                    size, pformat, rotation));
+                }
             }
 
             return formats;

Modified: trunk/ipod-sharp/src/Thumbnail.cs
===================================================================
--- trunk/ipod-sharp/src/Thumbnail.cs   2007-10-04 17:13:04 UTC (rev 86892)
+++ trunk/ipod-sharp/src/Thumbnail.cs   2007-10-04 17:13:46 UTC (rev 86893)
@@ -95,9 +95,9 @@
             stream.Seek (0, SeekOrigin.End);
             
             record.ThumbnailOffset = (int) stream.Position;
-            record.ImageSize = format.Size;
+            record.ImageSize = data.Length;
             
-            stream.Write (data, 0, format.Size);
+            stream.Write (data, 0, data.Length);
             
             record.Dirty = true;
         }

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to