MP4v2

Classes | Macros | Typedefs | Enumerations | Functions
MP4v2 Chapter

## Classes
struct | MP4Chapter_s
| Chapter item. More...

## Macros
#define | MP4V2_CHAPTER_TITLE_MAX 1023
| The maximum length of a QuickTime chapter title (in 8-bit chars)

## Typedefs
typedef struct MP4Chapter_s | MP4Chapter_t
| Chapter item. More...

## Enumerations
enum | MP4ChapterType { MP4ChapterTypeNone = 0 , MP4ChapterTypeAny = 1 , MP4ChapterTypeQt = 2 , MP4ChapterTypeNero = 4 }
| Known chapter types. More...

## Functions
void | MP4AddChapter (MP4FileHandle hFile, MP4TrackId chapterTrackId, MP4Duration chapterDuration, const char *chapterTitle=0)
| Add a QuickTime chapter. More...
MP4TrackId | MP4AddChapterTextTrack (MP4FileHandle hFile, MP4TrackId refTrackId, uint32_t timescale=0)
| Add a QuickTime chapter track. More...
void | MP4AddNeroChapter (MP4FileHandle hFile, MP4Timestamp chapterStart, const char *chapterTitle=0)
| Add a Nero chapter. More...
MP4ChapterType | MP4ConvertChapters (MP4FileHandle hFile, MP4ChapterType toChapterType=MP4ChapterTypeQt)
| Convert chapters to another type. More...
MP4ChapterType | MP4DeleteChapters (MP4FileHandle hFile, MP4ChapterType chapterType=MP4ChapterTypeQt, MP4TrackId chapterTrackId=MP4_INVALID_TRACK_ID)
| Delete chapters. More...
MP4ChapterType | MP4GetChapters (MP4FileHandle hFile, MP4Chapter_t **chapterList, uint32_t *chapterCount, MP4ChapterType chapterType=MP4ChapterTypeQt)
| Get list of chapters. More...
MP4ChapterType | MP4SetChapters (MP4FileHandle hFile, MP4Chapter_t *chapterList, uint32_t chapterCount, MP4ChapterType chapterType=MP4ChapterTypeQt)
| Set list of chapters OKOK. More...

## Detailed Description

## Typedef Documentation

## ◆ MP4Chapter_t

typedef struct MP4Chapter_s MP4Chapter_t

Chapter item.

This item defines various attributes for a chapter.

## Enumeration Type Documentation

## ◆ MP4ChapterType

enum MP4ChapterType

Known chapter types.

Enumerator
MP4ChapterTypeNone | no chapters found return value
MP4ChapterTypeAny | any or all known chapter types
MP4ChapterTypeQt | QuickTime chapter type.
MP4ChapterTypeNero | Nero chapter type.

## Function Documentation

## ◆ MP4AddChapter()

void MP4AddChapter | ( | MP4FileHandle | hFile,
|  | MP4TrackId | chapterTrackId,
|  | MP4Duration | chapterDuration,
|  | const char * | chapterTitle = `0`
| ) |  |

Add a QuickTime chapter.

This function adds a QuickTime chapter to file hFile.

Parameters

  hFile | handle of file to add chapter.
  chapterTrackId | ID of chapter track or MP4_INVALID_TRACK_ID if unknown.
  chapterDuration | duration (in the timescale of the chapter track).
  chapterTitle | title text for the chapter or NULL to use default title format ("Chapter %03d", n) where n is the chapter number.

## ◆ MP4AddChapterTextTrack()

MP4TrackId MP4AddChapterTextTrack | ( | MP4FileHandle | hFile,
|  | MP4TrackId | refTrackId,
|  | uint32_t | timescale = `0`
| ) |  |

Add a QuickTime chapter track.

This function adds a chapter (text) track to file hFile. The optional parameter timescale may be supplied to give the new chapter a specific timescale. Otherwise the chapter track will have the same timescale as the reference track defined in parameter refTrackId.

Parameters

  hFile | handle of file to add chapter track.
  refTrackId | ID of the track that will reference the chapter track.
  timescale | the timescale of the chapter track or 0 to use the timescale of track specified by refTrackId.

Returns
  ID of the created chapter track.

## ◆ MP4AddNeroChapter()

void MP4AddNeroChapter | ( | MP4FileHandle | hFile,
|  | MP4Timestamp | chapterStart,
|  | const char * | chapterTitle = `0`
| ) |  |

Add a Nero chapter.

This function adds a Nero chapter to file hFile.

Parameters

  hFile | handle of file to add chapter.
  chapterStart | the start time of the chapter in 100 nanosecond units
  chapterTitle | title text for the chapter or NULL to use default title format ("Chapter %03d", n) where n is the chapter number.

## ◆ MP4ConvertChapters()

MP4ChapterType MP4ConvertChapters | ( | MP4FileHandle | hFile,
|  | MP4ChapterType | toChapterType = `MP4ChapterTypeQt`
| ) |  |

Convert chapters to another type.

This function converts existing chapters in file hFile from one type to another type. Conversion from Nero to QuickTime or QuickTime to Nero is supported.

Parameters

  hFile | handle of file to convert.
  toChapterType | the chapter type to convert to: MP4ChapterTypeQt (convert from Nero to Qt) MP4ChapterTypeNero (convert from Qt to Nero)

Returns
  the chapter type before conversion or MP4ChapterTypeNone if the source chapters do not exist or invalid toChapterType was specified.

## ◆ MP4DeleteChapters()

MP4ChapterType MP4DeleteChapters | ( | MP4FileHandle | hFile,
|  | MP4ChapterType | chapterType = `MP4ChapterTypeQt`,
|  | MP4TrackId | chapterTrackId = `MP4_INVALID_TRACK_ID`
| ) |  |

Delete chapters.

This function deletes existing chapters in file hFile.

Parameters

  hFile | handle of file to delete chapters.
  chapterType | the type of chapters to delete: MP4ChapterTypeAny (delete all known chapter types) MP4ChapterTypeQt MP4ChapterTypeNero
  chapterTrackId | ID of the chapter track if known, or MP4_INVALID_TRACK_ID. Only applies when chapterType=MP4ChapterTypeQt.

Returns
  the type of deleted chapters

## ◆ MP4GetChapters()

MP4ChapterType MP4GetChapters | ( | MP4FileHandle | hFile,
|  | MP4Chapter_t ** | chapterList,
|  | uint32_t * | chapterCount,
|  | MP4ChapterType | chapterType = `MP4ChapterTypeQt`
| ) |  |

Get list of chapters.

This function gets a chpter list from file hFile.

Parameters

  hFile | handle of file to read.
  chapterList | address receiving array of chapter items. If a non-NULL is received the caller is responsible for freeing the memory with MP4Free().
  chapterCount | address receiving count of items in array.
  chapterType | the type of chapters to read: MP4ChapterTypeAny (any chapters, searched in order of Qt, Nero) MP4ChapterTypeQt MP4ChapterTypeNero

Returns
  the first type of chapters found.

## ◆ MP4SetChapters()

MP4ChapterType MP4SetChapters | ( | MP4FileHandle | hFile,
|  | MP4Chapter_t * | chapterList,
|  | uint32_t | chapterCount,
|  | MP4ChapterType | chapterType = `MP4ChapterTypeQt`
| ) |  |

Set list of chapters OKOK.

This functions sets the complete chapter list in file hFile. If any chapters of the same type already exist they will first be deleted.

Parameters

  hFile | handle of file to modify.
  chapterList | array of chapters items.
  chapterCount | count of items in array.
  chapterType | type of chapters to write: MP4ChapterTypeAny (chapters of all types are written) MP4ChapterTypeQt MP4ChapterTypeNero

Returns
  the type of chapters written.