|  |  |  | libgpod Reference Manual |  | 
|---|---|---|---|---|
| Top | Description | ||||
Itdb_Device; Itdb_Device * itdb_device_new (void); void itdb_device_free (Itdb_Device *device); void itdb_device_set_mountpoint (Itdb_Device *device,const gchar *mp); gboolean itdb_device_supports_artwork (const Itdb_Device *device); gboolean itdb_device_supports_chapter_image (const Itdb_Device *device); gboolean itdb_device_supports_photo (const Itdb_Device *device); gboolean itdb_device_supports_podcast (const Itdb_Device *device); gboolean itdb_device_supports_video (const Itdb_Device *device); struct Itdb_IpodInfo; const Itdb_IpodInfo * itdb_device_get_ipod_info (const Itdb_Device *device); const Itdb_IpodInfo * itdb_info_get_ipod_info_table (void); enum Itdb_IpodGeneration; const gchar * itdb_info_get_ipod_generation_string (Itdb_IpodGeneration generation); enum Itdb_IpodModel; const gchar * itdb_info_get_ipod_model_name_string (Itdb_IpodModel model); Itdb_ArtworkFormat; gboolean itdb_device_read_sysinfo (Itdb_Device *device); gchar * itdb_device_get_sysinfo (const Itdb_Device *device,const gchar *field); void itdb_device_set_sysinfo (Itdb_Device *device,const gchar *field,const gchar *value); gboolean itdb_device_write_sysinfo (Itdb_Device *device,GError **error);
typedef struct {
    gchar *mountpoint;
    gint   musicdirs;
    guint  byte_order;
    GHashTable *sysinfo;
    SysInfoIpodProperties *sysinfo_extended;
    gboolean sysinfo_changed;
    gint timezone_shift;
    void *iphone_sync_context;
    int iphone_sync_nest_level;
} Itdb_Device;
Structure representing an iPod device
| gchar * | The mountpoint of the iPod | 
| gint  | The number of /iPod_Control/Music/F.. dirs | 
| guint  | G_LITTLE_ENDIAN "regular" endianness G_BIG_ENDIAN "reversed" endianness (e.g. mobile phone iTunesDBs) | 
| GHashTable * | A hash with key/value pairs of all entries in Device/SysInfo | 
| The parsed content of SysInfoExtended, which can be NULL | |
| gboolean  | True if the sysinfo hash been changed by the user, false
otherwise.  (see itdb_set_sysinfo()) | 
| gint  | The difference in seconds between the current timezone and UTC | 
| Private data passed as is to libimobiledevice by itdb_start/stop_sync | |
| Nesting count for itdb_start/stop_sync calls itdb_start/stop_sync | 
Since 0.4.0
Itdb_Device *       itdb_device_new                     (void);
Creates a new Itdb_Device structure
| Returns : | a newly allocated Itdb_Device which must be freed with itdb_device_free()when no longer needed | 
Since 0.4.0
void                itdb_device_free                    (Itdb_Device *device);
Frees memory used by device
| 
 | an Itdb_Device | 
Since 0.4.0
void itdb_device_set_mountpoint (Itdb_Device *device,const gchar *mp);
Sets the mountpoint of device to mp and update the cached device 
information (in particular, re-read the SysInfo file)
Calling this function invalidates all the artwork in the
Itdb_iTunesDB database using this Itdb_Device. Trying to access this
artwork will result in memory corruption. It's recommended to use
itdb_set_mountpoint() instead which will clean the invalidated artwork
for you.
.
| 
 | an Itdb_Device | 
| 
 | the new mount point | 
Since 0.4.0
gboolean            itdb_device_supports_artwork        (const Itdb_Device *device);
Indicates whether device can display artwork or not. When dealing
with a non-art capable iPod, no artwork data will be written to the
iPod so you can spare calls to the artwork handling methods.
| 
 | an Itdb_Device | 
| Returns : | true if devicecan display artwork. | 
Since 0.5.0
gboolean            itdb_device_supports_chapter_image  (const Itdb_Device *device);
Indicates whether device can display chapter images or not.
| 
 | an Itdb_Device | 
| Returns : | true if devicecan display chapter images. | 
Since 0.7.2
gboolean            itdb_device_supports_photo          (const Itdb_Device *device);
Indicates whether device can display photos or not.
| 
 | an Itdb_Device | 
| Returns : | true if devicecan display photos. | 
Since 0.5.0
gboolean            itdb_device_supports_podcast        (const Itdb_Device *device);
Indicates whether device can play podcasts or not.
| 
 | an Itdb_Device | 
| Returns : | true if devicecan play podcasts. | 
Since 0.7.2
gboolean            itdb_device_supports_video          (const Itdb_Device *device);
Indicates whether device can play videos or not.
| 
 | an Itdb_Device | 
| Returns : | true if devicecan play videos. | 
Since 0.7.0
struct Itdb_IpodInfo {
    const gchar *model_number;
    const double capacity;
    const Itdb_IpodModel ipod_model;
    const Itdb_IpodGeneration ipod_generation;
    const guint musicdirs;
    /* reserved for future use */
    const gint32 reserved_int1;
    const gint32 reserved_int2;
    gconstpointer reserved1;
    gconstpointer reserved2;
};
Structure representing information about an iPod
| const gchar * | The model number. This is abbreviated. If the first character is not numeric, it is ommited. e.g. "MA350 -> A350", "M9829 -> 9829" | 
| The iPod's capacity in gigabytes | |
| const Itdb_IpodModel  | The iPod model | 
| const Itdb_IpodGeneration  | The iPod generation | 
| const guint  | The number of music (Fnn) dirs created by iTunes. The exact number seems to be version dependent. Therefore, the numbers here represent a mixture of reported values and common sense. Note: this number does not necessarily represent the number of dirs present on a particular iPod. It is used when setting up a new iPod from scratch. | 
| const gint32  | Reserved for future use | 
| const gint32  | Reserved for future use | 
| gconstpointer  | Reserved for future use | 
| gconstpointer  | Reserved for future use | 
Since 0.4.0
const Itdb_IpodInfo * itdb_device_get_ipod_info         (const Itdb_Device *device);
Retrieve the Itdb_IpodInfo entry for this iPod
| 
 | an Itdb_Device | 
| Returns : | the Itdb_IpodInfo entry for this iPod | 
Since 0.4.0
const Itdb_IpodInfo * itdb_info_get_ipod_info_table     (void);
Return a pointer to the start of valid iPod model descriptions, which is an array of Itdb_IpodInfo entries. This can be useful if you want to build a list of all iPod models known to the current libgpod.
| Returns : | a pointer to the array of Itdb_IpodInfo entries. | 
Since 0.4.0
typedef enum {
    ITDB_IPOD_GENERATION_UNKNOWN,
    ITDB_IPOD_GENERATION_FIRST,
    ITDB_IPOD_GENERATION_SECOND,
    ITDB_IPOD_GENERATION_THIRD,
    ITDB_IPOD_GENERATION_FOURTH,
    ITDB_IPOD_GENERATION_PHOTO,
    ITDB_IPOD_GENERATION_MOBILE,
    ITDB_IPOD_GENERATION_MINI_1,
    ITDB_IPOD_GENERATION_MINI_2,
    ITDB_IPOD_GENERATION_SHUFFLE_1,
    ITDB_IPOD_GENERATION_SHUFFLE_2,
    ITDB_IPOD_GENERATION_SHUFFLE_3,
    ITDB_IPOD_GENERATION_NANO_1,
    ITDB_IPOD_GENERATION_NANO_2,
    ITDB_IPOD_GENERATION_NANO_3,
    ITDB_IPOD_GENERATION_NANO_4,
    ITDB_IPOD_GENERATION_VIDEO_1,
    ITDB_IPOD_GENERATION_VIDEO_2,
    ITDB_IPOD_GENERATION_CLASSIC_1,
    ITDB_IPOD_GENERATION_CLASSIC_2,
    ITDB_IPOD_GENERATION_TOUCH_1,
    ITDB_IPOD_GENERATION_IPHONE_1,
    ITDB_IPOD_GENERATION_SHUFFLE_4,
    ITDB_IPOD_GENERATION_TOUCH_2,
    ITDB_IPOD_GENERATION_IPHONE_2,
    ITDB_IPOD_GENERATION_IPHONE_3,
    ITDB_IPOD_GENERATION_CLASSIC_3,
    ITDB_IPOD_GENERATION_NANO_5,
    ITDB_IPOD_GENERATION_TOUCH_3,
    ITDB_IPOD_GENERATION_IPAD_1,
    ITDB_IPOD_GENERATION_IPHONE_4,
    ITDB_IPOD_GENERATION_TOUCH_4,
    ITDB_IPOD_GENERATION_NANO_6
} Itdb_IpodGeneration;
iPod generation information
See http://support.apple.com/kb/HT1353 and http://en.wikipedia.org/wiki/IPod for more details.
| Unknown iPod | |
| First Generation iPod | |
| Second Generation iPod | |
| Third Generation iPod | |
| Fourth Generation iPod | |
| Photo iPod | |
| Mobile iPod | |
| First Generation iPod Mini | |
| Second Generation iPod Mini | |
| First Generation iPod Shuffle | |
| Second Generation iPod Shuffle | |
| Third Generation iPod Shuffle | |
| First Generation iPod Nano | |
| Second Generation iPod Nano | |
| Third Generation iPod Nano | |
| Fourth Generation iPod Nano | |
| First Generation iPod Video (aka 5g) | |
| Second Generation iPod Video (aka 5.5g) | |
| First Generation iPod Classic | |
| Second Generation iPod Classic | |
| First Generation iPod Touch | |
| First Generation iPhone | |
| Third Generation iPod Shuffle | |
| Second Generation iPod Touch | |
| Second Generation iPhone (aka iPhone 3G) | |
| Third Generation iPhone (aka iPhone 3GS) | |
| Third Generation iPod Classic | |
| Fifth Generation iPod Nano (with camera) | |
| Third Generation iPod Touch | |
| Fourth Generation iPhone | |
| Fourth Generation iPod Touch | |
Since 0.4.0
const gchar *       itdb_info_get_ipod_generation_string
                                                        (Itdb_IpodGeneration generation);
Return the iPod's generic generation name, like "First Generation", "Mobile Phone"...
| 
 | an Itdb_IpodGeneration | 
| Returns : | a pointer to the generation name. This is a static
string and must not be g_free()d. | 
Since 0.4.0
typedef enum {
    ITDB_IPOD_MODEL_INVALID,
    ITDB_IPOD_MODEL_UNKNOWN,
    ITDB_IPOD_MODEL_COLOR,
    ITDB_IPOD_MODEL_COLOR_U2,
    ITDB_IPOD_MODEL_REGULAR,
    ITDB_IPOD_MODEL_REGULAR_U2,
    ITDB_IPOD_MODEL_MINI,
    ITDB_IPOD_MODEL_MINI_BLUE,
    ITDB_IPOD_MODEL_MINI_PINK,
    ITDB_IPOD_MODEL_MINI_GREEN,
    ITDB_IPOD_MODEL_MINI_GOLD,
    ITDB_IPOD_MODEL_SHUFFLE,
    ITDB_IPOD_MODEL_NANO_WHITE,
    ITDB_IPOD_MODEL_NANO_BLACK,
    ITDB_IPOD_MODEL_VIDEO_WHITE,
    ITDB_IPOD_MODEL_VIDEO_BLACK,
    ITDB_IPOD_MODEL_MOBILE_1,
    ITDB_IPOD_MODEL_VIDEO_U2,
    ITDB_IPOD_MODEL_NANO_SILVER,
    ITDB_IPOD_MODEL_NANO_BLUE,
    ITDB_IPOD_MODEL_NANO_GREEN,
    ITDB_IPOD_MODEL_NANO_PINK,
    ITDB_IPOD_MODEL_NANO_RED,
    ITDB_IPOD_MODEL_NANO_YELLOW,
    ITDB_IPOD_MODEL_NANO_PURPLE,
    ITDB_IPOD_MODEL_NANO_ORANGE,
    ITDB_IPOD_MODEL_IPHONE_1,
    ITDB_IPOD_MODEL_SHUFFLE_SILVER,
    ITDB_IPOD_MODEL_SHUFFLE_PINK,
    ITDB_IPOD_MODEL_SHUFFLE_BLUE,
    ITDB_IPOD_MODEL_SHUFFLE_GREEN,
    ITDB_IPOD_MODEL_SHUFFLE_ORANGE,
    ITDB_IPOD_MODEL_SHUFFLE_PURPLE,
    ITDB_IPOD_MODEL_SHUFFLE_RED,
    ITDB_IPOD_MODEL_CLASSIC_SILVER,
    ITDB_IPOD_MODEL_CLASSIC_BLACK,
    ITDB_IPOD_MODEL_TOUCH_SILVER,
    ITDB_IPOD_MODEL_SHUFFLE_BLACK,
    ITDB_IPOD_MODEL_IPHONE_WHITE,
    ITDB_IPOD_MODEL_IPHONE_BLACK,
    ITDB_IPOD_MODEL_SHUFFLE_GOLD,
    ITDB_IPOD_MODEL_SHUFFLE_STAINLESS,
    ITDB_IPOD_MODEL_IPAD
} Itdb_IpodModel;
iPod model information
| Invalid model | |
| Unknown model | |
| Color iPod | |
| Color iPod (U2) | |
| Regular iPod | |
| Regular iPod (U2) | |
| iPod Mini | |
| iPod Mini (Blue) | |
| iPod Mini (Pink) | |
| iPod Mini (Green) | |
| iPod Mini (Gold) | |
| iPod Shuffle | |
| iPod Nano (White) | |
| iPod Nano (Black) | |
| iPod Video (White) | |
| iPod Video (Black) | |
| Mobile iPod | |
| iPod Video (U2) | |
| iPod Nano (Silver) | |
| iPod Nano (Blue) | |
| iPod Nano (Green) | |
| iPod Nano (Pink) | |
| iPod Nano (Red) | |
| iPod Nano (Yellow) | |
| iPod Nano (Purple) | |
| iPod Nano (Orange) | |
| iPhone | |
| iPod Shuffle (Silver) | |
| iPod Shuffle (Pink) | |
| iPod Shuffle (Blue) | |
| iPod Shuffle (Green) | |
| iPod Shuffle (Orange) | |
| iPod Shuffle (Purple) | |
| iPod Shuffle (Red) | |
| iPod Classic (Silver) | |
| iPod Classic (Black) | |
| iPod Touch (Silver) | |
| iPod Shuffle (Black) | |
| iPhone (White) | |
| iPhone (Black) | |
Since 0.4.0
const gchar *       itdb_info_get_ipod_model_name_string
                                                        (Itdb_IpodModel model);
Return the iPod's generic model name, like "Color", "Nano"...
| 
 | an Itdb_IpodModel | 
| Returns : | a pointer to the model name. This is a static string
and must not be g_free()d. | 
Since 0.4.0
typedef struct {
        gint format_id;
        gint width;
        gint height;
        ItdbThumbFormat format;
        gint32 padding;
        gboolean crop;
        gint rotation;
        guchar back_color[4];
        gint display_width;
        gboolean interlaced;
        gint color_adjustment;
        gdouble gamma;
        gint associated_format;
        gint row_bytes_alignment;
} Itdb_ArtworkFormat;
Structure representing the characteristics of the thumbnails to write to a given .ithmb file. The format of the structure is based on the way artwork formats are written to SysInfoExtended.
| gint  | Unique ID for the format (generally a 4 digit int) | 
| gint  | Width of the thumbnail | 
| gint  | Height of the thumbnail | 
| Pixel format of the thumbnail (RGB, YUV, ...) | |
| gint32  | Number of bytes of padding to add after the thumbnail (not found in SysInfoExtended -- added for compatibility with hardcoded artwork formats) | 
| gboolean  | Indicates if the thumbnail is to be cropped | 
| gint  | Degrees to rotate the thumbnail | 
| guchar  | Background color for the thumbnail | 
| gint  | Width at which the thumbnail will be displayed (not currently used) | 
| gboolean  | If TRUE, the thumbnails are interlaced (not currently used) | 
| gint  | Color adjustment for the thumbnails (not currently used) | 
| gdouble  | Gamma value for the thumbails (not currently used) | 
| gint  | Unknown (not currently used) | 
| gint  | Specifies the number of bytes a pixel row must be aligned to | 
gboolean            itdb_device_read_sysinfo            (Itdb_Device *device);
Reads the SysInfo file and stores information in device->sysinfo for later use.
Calling this function invalidates all the artwork in the Itdb_iTunesDB database using this Itdb_Device. Trying to access this artwork will result in memory corruption. Directly calling this function shouldn't ever be needed and it will be deprecated soon.
.
| 
 | an Itdb_Device | 
| Returns : | TRUE if file could be read, FALSE otherwise | 
Since 0.4.0
gchar * itdb_device_get_sysinfo (const Itdb_Device *device,const gchar *field);
Retrieve specified field from the SysInfo file.
| 
 | an Itdb_Device | 
| 
 | field to retrive information from | 
| Returns : | the information associated with field, or NULL iffieldcouldn't be found.g_free()after use | 
Since 0.4.0
void itdb_device_set_sysinfo (Itdb_Device *device,const gchar *field,const gchar *value);
Set specified field. It can later be written to the iPod using
itdb_device_write_sysinfo()
| 
 | an Itdb_Device | 
| 
 | field to set | 
| 
 | value to set (or NULL to remove the field). | 
Since 0.4.0
gboolean itdb_device_write_sysinfo (Itdb_Device *device,GError **error);
Fills the SysInfo file with information in device->sysinfo. Note: no directories are created if not already existent.
| 
 | an Itdb_Device | 
| 
 | return location for a GError or NULL | 
| Returns : | TRUE if file could be read, FALSE otherwise | 
Since 0.4.0