Revision: 2010
          http://gtkpod.svn.sourceforge.net/gtkpod/?rev=2010&view=rev
Author:   teuf
Date:     2008-06-09 12:57:02 -0700 (Mon, 09 Jun 2008)

Log Message:
-----------
* src/db-artwork-writer.c:
* src/db-image-parser.h:
* src/itdb.h:
* src/itdb_device.c:
* src/itdb_device.h:
* src/ithumb-writer.c: get rid of ItdbThumbType, it's replaced by
pointers to the appropriate Itdb_ArtworkFormat for the thumbnail
type when it's needed

Modified Paths:
--------------
    libgpod/trunk/ChangeLog
    libgpod/trunk/src/db-artwork-writer.c
    libgpod/trunk/src/db-image-parser.h
    libgpod/trunk/src/itdb.h
    libgpod/trunk/src/itdb_device.c
    libgpod/trunk/src/itdb_device.h
    libgpod/trunk/src/ithumb-writer.c

Modified: libgpod/trunk/ChangeLog
===================================================================
--- libgpod/trunk/ChangeLog     2008-06-09 19:53:36 UTC (rev 2009)
+++ libgpod/trunk/ChangeLog     2008-06-09 19:57:02 UTC (rev 2010)
@@ -1,5 +1,16 @@
 2008-06-09  Christophe Fergeau  <[EMAIL PROTECTED]>
 
+       * src/db-artwork-writer.c:
+       * src/db-image-parser.h:
+       * src/itdb.h:
+       * src/itdb_device.c:
+       * src/itdb_device.h:
+       * src/ithumb-writer.c: get rid of ItdbThumbType, it's replaced by
+       pointers to the appropriate Itdb_ArtworkFormat for the thumbnail
+       type when it's needed
+
+2008-06-09  Christophe Fergeau  <[EMAIL PROTECTED]>
+
        * src/db-artwork-parser.c: remove duplicated artwork/photo support
        testing functions
        * src/db-artwork-parser.h: ditto

Modified: libgpod/trunk/src/db-artwork-writer.c
===================================================================
--- libgpod/trunk/src/db-artwork-writer.c       2008-06-09 19:53:36 UTC (rev 
2009)
+++ libgpod/trunk/src/db-artwork-writer.c       2008-06-09 19:57:02 UTC (rev 
2010)
@@ -749,31 +749,6 @@
        return get_gint32 (mhif->header_len, buffer->byte_order);
 }
 
-G_GNUC_INTERNAL gboolean
-itdb_thumb_type_is_valid_for_db (const Itdb_ArtworkFormat *format,
-                                 DbType db_type)
-{
-        switch (format->type) {
-        case ITDB_THUMB_COVER_SMALL:
-        case ITDB_THUMB_COVER_LARGE:
-        case ITDB_THUMB_COVER_XLARGE:
-        case ITDB_THUMB_COVER_MEDIUM:
-        case ITDB_THUMB_COVER_SMEDIUM:
-        case ITDB_THUMB_COVER_XSMALL:
-           return (db_type == DB_TYPE_ITUNES);
-        case ITDB_THUMB_CHAPTER_SMALL:
-        case ITDB_THUMB_CHAPTER_LARGE:
-           return FALSE; /* not supported yet */
-        case ITDB_THUMB_PHOTO_SMALL:
-        case ITDB_THUMB_PHOTO_LARGE:
-        case ITDB_THUMB_PHOTO_FULL_SCREEN:
-        case ITDB_THUMB_PHOTO_TV_SCREEN:
-           return (db_type == DB_TYPE_PHOTO);
-        }
-
-        g_return_val_if_reached (FALSE);
-}
-
 static int
 write_mhlf (Itdb_DB *db, iPodBuffer *buffer)
 {

Modified: libgpod/trunk/src/db-image-parser.h
===================================================================
--- libgpod/trunk/src/db-image-parser.h 2008-06-09 19:53:36 UTC (rev 2009)
+++ libgpod/trunk/src/db-image-parser.h 2008-06-09 19:57:02 UTC (rev 2010)
@@ -82,8 +82,4 @@
                                                           Itdb_DB *db);
 
 G_GNUC_INTERNAL int itdb_write_ithumb_files (Itdb_DB *db);
-
-G_GNUC_INTERNAL gboolean
-itdb_thumb_type_is_valid_for_db (const Itdb_ArtworkFormat *format, DbType 
db_type);
-
 #endif

Modified: libgpod/trunk/src/itdb.h
===================================================================
--- libgpod/trunk/src/itdb.h    2008-06-09 19:53:36 UTC (rev 2009)
+++ libgpod/trunk/src/itdb.h    2008-06-09 19:57:02 UTC (rev 2010)
@@ -478,21 +478,6 @@
 #define ITDB_RATING_STEP 20
 
 /* Types of thumbnails in Itdb_Image */
-typedef enum { 
-    ITDB_THUMB_COVER_SMALL = 0,
-    ITDB_THUMB_COVER_LARGE,
-    ITDB_THUMB_PHOTO_SMALL,
-    ITDB_THUMB_PHOTO_LARGE,
-    ITDB_THUMB_PHOTO_FULL_SCREEN,
-    ITDB_THUMB_PHOTO_TV_SCREEN,
-    ITDB_THUMB_COVER_XLARGE,      /* iPhone: cover flow */
-    ITDB_THUMB_COVER_MEDIUM,      /* iPhone: cover view */
-    ITDB_THUMB_COVER_SMEDIUM,     /* iPhone: ??         */
-    ITDB_THUMB_COVER_XSMALL,      /* iPhone: ??         */
-    ITDB_THUMB_CHAPTER_SMALL,     /* classic -- not supported yet */
-    ITDB_THUMB_CHAPTER_LARGE,     /* classic -- not supported yet */
-} ItdbThumbType;
-
 enum _ItdbThumbDataType {
     ITDB_THUMB_TYPE_INVALID,
     ITDB_THUMB_TYPE_FILE,

Modified: libgpod/trunk/src/itdb_device.c
===================================================================
--- libgpod/trunk/src/itdb_device.c     2008-06-09 19:53:36 UTC (rev 2009)
+++ libgpod/trunk/src/itdb_device.c     2008-06-09 19:57:02 UTC (rev 2010)
@@ -268,100 +268,100 @@
 
 
 static const Itdb_ArtworkFormat ipod_photo_cover_art_info[] = {
-    {ITDB_THUMB_COVER_SMALL,       56,  56, 1017, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_COVER_LARGE,      140, 140, 1016, THUMB_FORMAT_RGB565_LE},
-    {-1,                           -1,  -1,   -1, -1}
+    { 56,  56, 1017, THUMB_FORMAT_RGB565_LE},
+    {140, 140, 1016, THUMB_FORMAT_RGB565_LE},
+    { -1,  -1,   -1, -1}
 };
 
 static const Itdb_ArtworkFormat ipod_photo_photo_info[] = {
-    {ITDB_THUMB_PHOTO_SMALL,       42,  30, 1009, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_PHOTO_LARGE,      130,  88, 1015, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_PHOTO_FULL_SCREEN,220, 176, 1013, THUMB_FORMAT_RGB565_BE_90},
-    {ITDB_THUMB_PHOTO_TV_SCREEN,  720, 480, 1019, THUMB_FORMAT_UYVY_BE},
-    {-1,                           -1,  -1,   -1, -1}
+    { 42,  30, 1009, THUMB_FORMAT_RGB565_LE},
+    {130,  88, 1015, THUMB_FORMAT_RGB565_LE},
+    {220, 176, 1013, THUMB_FORMAT_RGB565_BE_90},
+    {720, 480, 1019, THUMB_FORMAT_UYVY_BE},
+    { -1,  -1,   -1, -1}
 };
 
 static const Itdb_ArtworkFormat ipod_nano_cover_art_info[] = {
-    {ITDB_THUMB_COVER_SMALL,       42,  42, 1031, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_COVER_LARGE,      100, 100, 1027, THUMB_FORMAT_RGB565_LE},
-    {-1,                           -1,  -1,   -1, -1}
+    { 42,  42, 1031, THUMB_FORMAT_RGB565_LE},
+    {100, 100, 1027, THUMB_FORMAT_RGB565_LE},
+    { -1,  -1,   -1, -1}
 };
 
 static const Itdb_ArtworkFormat ipod_nano_photo_info[] = {
-    {ITDB_THUMB_PHOTO_LARGE,       42,  37, 1032, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_PHOTO_FULL_SCREEN,176, 132, 1023, THUMB_FORMAT_RGB565_BE},
-    {-1,                           -1,  -1,   -1, -1}
+    { 42,  37, 1032, THUMB_FORMAT_RGB565_LE},
+    {176, 132, 1023, THUMB_FORMAT_RGB565_BE},
+    { -1,  -1,   -1, -1}
 };
 
 static const Itdb_ArtworkFormat ipod_video_cover_art_info[] = {
-    {ITDB_THUMB_COVER_SMALL,      100, 100, 1028, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_COVER_LARGE,      200, 200, 1029, THUMB_FORMAT_RGB565_LE},
-    {-1,                           -1,  -1,   -1, -1}
+    {100, 100, 1028, THUMB_FORMAT_RGB565_LE},
+    {200, 200, 1029, THUMB_FORMAT_RGB565_LE},
+    { -1,  -1,   -1, -1}
 };
 
 static const Itdb_ArtworkFormat ipod_video_photo_info[] = {
-    {ITDB_THUMB_PHOTO_SMALL,       50,  41, 1036, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_PHOTO_LARGE,      130,  88, 1015, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_PHOTO_FULL_SCREEN,320, 240, 1024, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_PHOTO_TV_SCREEN,  720, 480, 1019, THUMB_FORMAT_UYVY_BE},
-    {-1,                           -1,  -1,   -1, -1}
+    { 50,  41, 1036, THUMB_FORMAT_RGB565_LE},
+    {130,  88, 1015, THUMB_FORMAT_RGB565_LE},
+    {320, 240, 1024, THUMB_FORMAT_RGB565_LE},
+    {720, 480, 1019, THUMB_FORMAT_UYVY_BE},
+    { -1,  -1,   -1, -1}
 };
 
 static const Itdb_ArtworkFormat ipod_mobile_1_cover_art_info[] = {
-    {ITDB_THUMB_COVER_SMALL,       50,  50, 2002, THUMB_FORMAT_RGB565_BE},
-    {ITDB_THUMB_COVER_LARGE,      150, 150, 2003, THUMB_FORMAT_RGB565_BE},
-    {-1,                           -1,  -1,   -1, -1}
+    { 50,  50, 2002, THUMB_FORMAT_RGB565_BE},
+    {150, 150, 2003, THUMB_FORMAT_RGB565_BE},
+    { -1,  -1,   -1, -1}
 };
 
 static const Itdb_ArtworkFormat ipod_touch_1_cover_art_info[] = {
-    {ITDB_THUMB_COVER_LARGE,      256, 256, 3001, THUMB_FORMAT_REC_RGB555_LE},
-    {ITDB_THUMB_COVER_MEDIUM,     128, 128, 3002, THUMB_FORMAT_REC_RGB555_LE},
-    {ITDB_THUMB_COVER_SMALL,       64,  64, 3003, THUMB_FORMAT_REC_RGB555_LE},
-    {ITDB_THUMB_COVER_XLARGE,     320, 320, 3005, THUMB_FORMAT_RGB555_LE},
-    {ITDB_THUMB_COVER_XSMALL,      56,  56, 3006, THUMB_FORMAT_RGB555_LE,  
8192}, /*pad data to  8192 bytes */
-    {ITDB_THUMB_COVER_SMEDIUM,     88,  88, 3007, THUMB_FORMAT_RGB555_LE, 
16364}, /*pad data to 16384 bytes */
-    {-1,                           -1,  -1,   -1, -1}
+    {256, 256, 3001, THUMB_FORMAT_REC_RGB555_LE},
+    {128, 128, 3002, THUMB_FORMAT_REC_RGB555_LE},
+    { 64,  64, 3003, THUMB_FORMAT_REC_RGB555_LE},
+    {320, 320, 3005, THUMB_FORMAT_RGB555_LE},
+    { 56,  56, 3006, THUMB_FORMAT_RGB555_LE,  8192}, /*pad data to  8192 bytes 
*/
+    { 88,  88, 3007, THUMB_FORMAT_RGB555_LE, 16364}, /*pad data to 16384 bytes 
*/
+    { -1,  -1,   -1, -1}
 };
 
 static const Itdb_ArtworkFormat ipod_touch_1_photo_info[] = {
     /* In the album list, if a photo is being used to represent a whole album,
        PHOTO_SMALL is used.  We specify TRUE for the crop option so we fill
        the square completely. */
-    {ITDB_THUMB_PHOTO_SMALL,       56,  55, 3004, THUMB_FORMAT_RGB555_LE, 
8192, TRUE},
+    { 56,  55, 3004, THUMB_FORMAT_RGB555_LE, 8192, TRUE},
     /* In thumbnail view, PHOTO_LARGE is used.  It's actually 79x79, with a 4px
        white border on the right and bottom.  We specify TRUE for the crop 
option
        so we fill the square completely. */
-    {ITDB_THUMB_PHOTO_LARGE,       80,  79, 3011, THUMB_FORMAT_RGB555_LE, 0, 
TRUE},
-    {ITDB_THUMB_PHOTO_FULL_SCREEN,160, 120, 3009, THUMB_FORMAT_RGB555_LE},
+    { 80,  79, 3011, THUMB_FORMAT_RGB555_LE, 0, TRUE},
+    {160, 120, 3009, THUMB_FORMAT_RGB555_LE},
     /* When viewing an individual photo, PHOTO_TV_SCREEN is used.  Note that it
        is acceptable to write a thumbnail less than the specified width or
        height, the iPhone / iTouch will scale it to fit the screen.  This is
        important for images that are taller than they wide. */
-    {ITDB_THUMB_PHOTO_TV_SCREEN,  640, 480, 3008, THUMB_FORMAT_RGB555_LE},
-    {-1,                           -1,  -1,   -1, -1}
+    {640, 480, 3008, THUMB_FORMAT_RGB555_LE},
+    { -1,  -1,   -1, -1}
 };
 
 static const Itdb_ArtworkFormat ipod_classic_1_cover_art_info[] = {
     /* officially 55x55 -- verify! */
-    {ITDB_THUMB_COVER_SMALL,       56,  56, 1061, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_COVER_MEDIUM,     128, 128, 1055, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_COVER_LARGE,      320, 320, 1060, THUMB_FORMAT_RGB565_LE},
-    {-1,                           -1,  -1,   -1, -1}
+    { 56,  56, 1061, THUMB_FORMAT_RGB565_LE},
+    {128, 128, 1055, THUMB_FORMAT_RGB565_LE},
+    {320, 320, 1060, THUMB_FORMAT_RGB565_LE},
+    { -1,  -1,   -1, -1}
 };
 
 static const Itdb_ArtworkFormat ipod_classic_1_photo_info[] = {
-    {ITDB_THUMB_PHOTO_TV_SCREEN,  720, 480, 1067, THUMB_FORMAT_I420_LE},
-    {ITDB_THUMB_PHOTO_FULL_SCREEN,320, 240, 1024, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_PHOTO_SMALL,       64,  64, 1066, THUMB_FORMAT_RGB565_LE},
-    {-1,                           -1,  -1,   -1, -1}
+    {720, 480, 1067, THUMB_FORMAT_I420_LE},
+    {320, 240, 1024, THUMB_FORMAT_RGB565_LE},
+    { 64,  64, 1066, THUMB_FORMAT_RGB565_LE},
+    { -1,  -1,   -1, -1}
 };
 
 static const Itdb_ArtworkFormat ipod_classic_1_chapter_image_info[] = {
     /*  These are the same as for the iPod video... -- labeled by the iPod as
         "chapter images" */
-    {ITDB_THUMB_CHAPTER_SMALL,    100, 100, 1028, THUMB_FORMAT_RGB565_LE},
-    {ITDB_THUMB_CHAPTER_LARGE,    200, 200, 1029, THUMB_FORMAT_RGB565_LE},
-    {-1,                           -1,  -1,   -1, -1}
+    {100, 100, 1028, THUMB_FORMAT_RGB565_LE},
+    {200, 200, 1029, THUMB_FORMAT_RGB565_LE},
+    { -1,  -1,   -1, -1}
 };
 
 enum ArtworkType {
@@ -772,7 +772,7 @@
         return NULL;
     }
 
-    for (it = formats; it->type != -1; it++) {
+    for (it = formats; it->format_id != -1; it++) {
         photo_formats = g_list_prepend (photo_formats, (gpointer)it);
     }
 
@@ -790,7 +790,7 @@
         return NULL;
     }
 
-    for (it = formats; it->type != -1; it++) {
+    for (it = formats; it->format_id != -1; it++) {
         cover_art_formats = g_list_prepend (cover_art_formats, (gpointer)it);
     }
 
@@ -1097,18 +1097,11 @@
 
 gboolean itdb_device_supports_photo (const Itdb_Device *device)
 {
-    const Itdb_ArtworkFormat *formats;
-
     if (device == NULL) {
         return FALSE;
     }
 
-    formats = itdb_device_get_artwork_formats (device, ARTWORK_TYPE_PHOTO);
-    if (formats == NULL) {
-       return FALSE;
-    }
-
-    return (formats->type != -1);
+    return (itdb_device_get_artwork_formats (device, ARTWORK_TYPE_PHOTO) != 
NULL);
 }
 
 

Modified: libgpod/trunk/src/itdb_device.h
===================================================================
--- libgpod/trunk/src/itdb_device.h     2008-06-09 19:53:36 UTC (rev 2009)
+++ libgpod/trunk/src/itdb_device.h     2008-06-09 19:57:02 UTC (rev 2010)
@@ -52,8 +52,8 @@
 {
     THUMB_FORMAT_UYVY_LE,
     THUMB_FORMAT_UYVY_BE,
-       THUMB_FORMAT_I420_LE,
-       THUMB_FORMAT_I420_BE,
+    THUMB_FORMAT_I420_LE,
+    THUMB_FORMAT_I420_BE,
     THUMB_FORMAT_RGB565_LE,
     THUMB_FORMAT_RGB565_LE_90,
     THUMB_FORMAT_RGB565_BE,
@@ -74,7 +74,6 @@
     THUMB_FORMAT_EXPERIMENTAL_BE,
 };
 
-
 struct _Itdb_Device
 {
     gchar *mountpoint;    /* mountpoint of the iPod */
@@ -97,7 +96,6 @@
 
 struct _Itdb_ArtworkFormat
 {
-       ItdbThumbType type;
        gint16 width;
        gint16 height;
        gint16 format_id;

Modified: libgpod/trunk/src/ithumb-writer.c
===================================================================
--- libgpod/trunk/src/ithumb-writer.c   2008-06-09 19:53:36 UTC (rev 2009)
+++ libgpod/trunk/src/ithumb-writer.c   2008-06-09 19:57:02 UTC (rev 2010)
@@ -482,8 +482,21 @@
     return yuvdata;
 }
 
+static char *get_ithmb_filename (iThumbWriter *writer)
+{
+    switch (writer->db_type) {
+        case DB_TYPE_ITUNES:
+            return g_strdup_printf (":F%d_%d.ithmb", 
+                                   writer->img_info->format_id,
+                                    writer->current_file_index);
+        case DB_TYPE_PHOTO:
+            return g_strdup_printf (":Thumbs:F%d_%d.ithmb", 
+                                   writer->img_info->format_id,
+                                    writer->current_file_index);
+    }
+    g_return_val_if_reached (NULL);
+}
 
-
 static char *
 ipod_image_get_ithmb_filename (const char *mount_point, gint format_id, gint 
index, DbType db_type ) 
 {
@@ -781,35 +794,6 @@
     return TRUE;
 }
 
-static char *get_ithmb_filename (iThumbWriter *writer, 
-                                 const Itdb_ArtworkFormat *format)
-{
-    switch (format->type)
-    {
-    case ITDB_THUMB_PHOTO_LARGE:
-    case ITDB_THUMB_PHOTO_SMALL:
-    case ITDB_THUMB_PHOTO_FULL_SCREEN:
-    case ITDB_THUMB_PHOTO_TV_SCREEN:
-       return g_strdup_printf (":Thumbs:F%d_%d.ithmb", 
-                               writer->img_info->format_id,
-                                writer->current_file_index);
-       break;
-    case ITDB_THUMB_COVER_LARGE:
-    case ITDB_THUMB_COVER_SMALL:
-    case ITDB_THUMB_COVER_XLARGE:
-    case ITDB_THUMB_COVER_MEDIUM:
-    case ITDB_THUMB_COVER_SMEDIUM:
-    case ITDB_THUMB_COVER_XSMALL:
-    case ITDB_THUMB_CHAPTER_LARGE:
-    case ITDB_THUMB_CHAPTER_SMALL:
-       return g_strdup_printf (":F%d_%d.ithmb", 
-                               writer->img_info->format_id,
-                                writer->current_file_index);
-       break;
-    }
-    g_return_val_if_reached (NULL);
-}
-
 static void set_thumb_padding (iThumbWriter *writer, 
                                Itdb_Thumb_Ipod_Item *thumb, 
                                gint width, gint height)
@@ -821,11 +805,6 @@
        thumb->vertical_padding = (writer->img_info->height - height)/2;
        break;
     case DB_TYPE_ITUNES:
-       /* IPOD_COVER_LARGE will be centered automatically using
-          the info in mhni->width/height. Free space around
-          IPOD_COVER_SMALL will be used to display track
-          information -> no padding (tested on iPod
-          Nano). mhni->hor_/ver_padding is working */
        thumb->horizontal_padding = 0;
        thumb->vertical_padding = 0;
        break;
@@ -933,7 +912,7 @@
     pixels = pack_thumbnail (writer, thumb_ipod, scaled_pixbuf);
     g_object_unref (G_OBJECT (scaled_pixbuf));
 
-    thumb_ipod->filename = get_ithmb_filename (writer, writer->img_info);
+    thumb_ipod->filename = get_ithmb_filename (writer);
     result = write_pixels (writer, thumb_ipod, pixels);
     g_free (pixels);
 


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
gtkpod-cvs2 mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gtkpod-cvs2

Reply via email to