Writing text
Text

Encode text. More...

## Functions

int | lqt_add_text_track (quicktime_t *file, int timescale)
| Add a text track. More...
void | lqt_set_text_language (quicktime_t *file, int track, const char *language)
| Set the language for a text track. More...
void | lqt_set_chapter_track (quicktime_t *file, int track)
| Make a text track a chapter track. More...
void | lqt_set_text_box (quicktime_t *file, int track, uint16_t top, uint16_t left, uint16_t bottom, uint16_t right)
| Set the text box of a text track. More...
void | lqt_set_text_fg_color (quicktime_t *file, int track, uint16_t r, uint16_t g, uint16_t b, uint16_t a)
| Set the foreground color of a text track. More...
void | lqt_set_text_bg_color (quicktime_t *file, int track, uint16_t r, uint16_t g, uint16_t b, uint16_t a)
| Set the background color of a text track. More...
int | lqt_write_text (quicktime_t *file, int track, const char *text, int64_t duration)
| Write a text sample. More...
void | lqt_set_text_pts_offset (quicktime_t *file, int track, int64_t offset)
| Set an video pts offset. More...

## Detailed Description

Encode text.

## Function Documentation

int lqt_add_text_track | ( | quicktime_t * | file,
|  | int | timescale
| ) |  |

Add a text track.

Parameters

  file | A quicktime handle
  timescale | The timescale, in which timestamps will be given.

void lqt_set_text_language | ( | quicktime_t * | file,
|  | int | track,
|  | const char * | language
| ) |  |

Set the language for a text track.

Parameters

  file | A quicktime handle
  track | Track index (starting with 0)
  language | ISO-639 Language code

The language code is a 3-character code, English is "eng", Japanese is "jpn".

void lqt_set_chapter_track | ( | quicktime_t * | file,
|  | int | track
| ) |  |

Make a text track a chapter track.

Parameters

  file | A quicktime handle
  track | Track index (starting with 0)

By default, text tracks are subtitles. By calling this function, you tell libquicktime, that the text track should be a chapter track.

void lqt_set_text_box | ( | quicktime_t * | file,
|  | int | track,
|  | uint16_t | top,
|  | uint16_t | left,
|  | uint16_t | bottom,
|  | uint16_t | right
| ) |  |

Set the text box of a text track.

Parameters

  file | A quicktime handle
  track | Track index (starting with 0)
  top | Top border
  left | Left border
  bottom | Bottom border
  right | Right border

void lqt_set_text_fg_color | ( | quicktime_t * | file,
|  | int | track,
|  | uint16_t | r,
|  | uint16_t | g,
|  | uint16_t | b,
|  | uint16_t | a
| ) |  |

Set the foreground color of a text track.

Parameters

  file | A quicktime handle
  track | Track index (starting with 0)
  r | Red
  g | Green
  b | Blue
  a | Alpha

Color values are between 0x0000 and 0xffff. The alpha value is only used for mp4.

void lqt_set_text_bg_color | ( | quicktime_t * | file,
|  | int | track,
|  | uint16_t | r,
|  | uint16_t | g,
|  | uint16_t | b,
|  | uint16_t | a
| ) |  |

Set the background color of a text track.

Parameters

  file | A quicktime handle
  track | Track index (starting with 0)
  r | Red
  g | Green
  b | Blue
  a | Alpha

Color values are between 0x0000 and 0xffff. The alpha value is only used for mp4. For Quicktime, the text box is set to transparent if the alpha value is below 0x8000.

int lqt_write_text | ( | quicktime_t * | file,
|  | int | track,
|  | const char * | text,
|  | int64_t | duration
| ) |  |

Write a text sample.

Parameters

  file | A quicktime handle
  track | Track index (starting with 0)
  text | A null-terminated UTF-8 string
  duration | The duration associated with this sample

Returns
  0 if a the text sample could be written to the file, nonzero else

void lqt_set_text_pts_offset | ( | quicktime_t * | file,
|  | int | track,
|  | int64_t | offset
| ) |  |

Set an video pts offset.

Parameters

  file | A quicktime handle
  track | Track index (starting with 0)
  offset | PTS offset of the subtitles (in timescale units)