## Chapter Data Chapter Data — Data structure to store chapter data for tracks |

## Synopsis

    struct              Itdb_Chapter;
    struct              Itdb_Chapterdata;
    Itdb_Chapter *      itdb_chapter_new                    (void);
    Itdb_Chapter *      itdb_chapter_duplicate              (Itdb_Chapter *chapter);
    void                itdb_chapter_free                   (Itdb_Chapter *chapter);
    Itdb_Chapterdata *  itdb_chapterdata_new                (void);
    gboolean            itdb_chapterdata_add_chapter        (Itdb_Chapterdata *chapterdata,
                                                             guint32 startpos,
                                                             gchar *chaptertitle);
    Itdb_Chapterdata *  itdb_chapterdata_duplicate          (Itdb_Chapterdata *chapterdata);
    void                itdb_chapterdata_remove_chapter     (Itdb_Chapterdata *chapterdata,
                                                             Itdb_Chapter *chapter);
    void                itdb_chapterdata_remove_chapters    (Itdb_Chapterdata *chapterdata);
    void                itdb_chapterdata_unlink_chapter     (Itdb_Chapterdata *chapterdata,
                                                             Itdb_Chapter *chapter);
    void                itdb_chapterdata_free               (Itdb_Chapterdata *chapterdata);

## Description

Chapters allow for a large file to be divided into sections. The start and stop points in the track are defined here, as well as the title for each chapter.

## Details

### struct Itdb_Chapter

    struct Itdb_Chapter {
        guint32 startpos;
        gchar *chaptertitle;
        /* reserved for future use */
        gint32 reserved_int1;
        gint32 reserved_int2;
        gpointer reserved1;
        gpointer reserved2;
    };

Structure representing an iTunesDB Chapter

guint32 `startpos`; | The start position of the chapter in ms. The first chapter begins at 1.
gchar *`chaptertitle`; | The chapter title in UTF8
gint32 `reserved_int1`; | Reserved for future use
gint32 `reserved_int2`; | Reserved for future use
gpointer `reserved1`; | Reserved for future use
gpointer `reserved2`; | Reserved for future use

Since 0.7.0

### struct Itdb_Chapterdata

    struct Itdb_Chapterdata {
        GList *chapters;
        guint32 unk024;
        guint32 unk028;
        guint32 unk032;
        /* reserved for future use */
        gint32 reserved_int1;
        gint32 reserved_int2;
        gpointer reserved1;
        gpointer reserved2;
    };

Structure representing iTunesDB Chapter data

GList *`chapters`; | A list of chapters (Itdb_Chapter)
guint32 `unk024`; | Unknown
guint32 `unk028`; | Unknown
guint32 `unk032`; | Unknown
gint32 `reserved_int1`; | Reserved for future use
gint32 `reserved_int2`; | Reserved for future use
gpointer `reserved1`; | Reserved for future use
gpointer `reserved2`; | Reserved for future use

Since 0.7.0

### itdb_chapter_new ()

    Itdb_Chapter *      itdb_chapter_new                    (void);

Creates a new Itdb_Chapter

Returns : | newly allocated Itdb_Chapter to be freed with `itdb_chapter_free()` after use

Since 0.7.0

### itdb_chapter_duplicate ()

    Itdb_Chapter *      itdb_chapter_duplicate              (Itdb_Chapter *chapter);

Duplicates the data contained in `chapter`

`chapter` : | an Itdb_Chapter
Returns : | a newly allocated copy of `chapter` to be freed with `itdb_chapter_free()` after use

Since 0.7.0

### itdb_chapter_free ()

    void                itdb_chapter_free                   (Itdb_Chapter *chapter);

Frees the memory used by `chapter`

`chapter` : | an Itdb_Chapter

Since 0.7.0

### itdb_chapterdata_new ()

    Itdb_Chapterdata *  itdb_chapterdata_new                (void);

Creates a new Itdb_Chapterdata

Returns : | a new Itdb_Chapterdata to be freed with `itdb_chapterdata_free()` when no longer needed

Since 0.7.0

### itdb_chapterdata_add_chapter ()

    gboolean            itdb_chapterdata_add_chapter        (Itdb_Chapterdata *chapterdata,
                                                             guint32 startpos,
                                                             gchar *chaptertitle);

Appends a chapter to existing chapters in `chapterdata`.

`chapterdata` : | an Itdb_Chapterdata
`startpos` : | chapter start time in milliseconds
`chaptertitle` : | chapter title
Returns : | TRUE if the chapter could be successfully added, FALSE otherwise.

Since 0.7.0

### itdb_chapterdata_duplicate ()

    Itdb_Chapterdata *  itdb_chapterdata_duplicate          (Itdb_Chapterdata *chapterdata);

Duplicates `chapterdata`

`chapterdata` : | an Itdb_Chapterdata
Returns : | a new copy of `chapterdata`

Since 0.7.0

### itdb_chapterdata_remove_chapter ()

    void                itdb_chapterdata_remove_chapter     (Itdb_Chapterdata *chapterdata,
                                                             Itdb_Chapter *chapter);

Removes `chapter` from `chapterdata`. The memory used by `chapter` is freed.

`chapterdata` : | an Itdb_Chapterdata
`chapter` : | an Itdb_Chapter

Since 0.7.0

### itdb_chapterdata_remove_chapters ()

    void                itdb_chapterdata_remove_chapters    (Itdb_Chapterdata *chapterdata);

Removes all chapters from `chapterdata`

`chapterdata` : | an Itdb_Chapterdata

Since 0.7.0

### itdb_chapterdata_unlink_chapter ()

    void                itdb_chapterdata_unlink_chapter     (Itdb_Chapterdata *chapterdata,
                                                             Itdb_Chapter *chapter);

### itdb_chapterdata_free ()

    void                itdb_chapterdata_free               (Itdb_Chapterdata *chapterdata);

Frees memory used by `chapterdata`

`chapterdata` : | an Itdb_Chapterdata

Since 0.7.0