libquicktime: Video

# Video

Video related definitions and functions. More...

## Modules
| Video decoding
| Video related definitions and functions (reading).

| Video encoding
| Video related definitions and functions (writing).

## Enumerations
enum | lqt_interlace_mode_t { LQT_INTERLACE_NONE = 0, LQT_INTERLACE_TOP_FIRST, LQT_INTERLACE_BOTTOM_FIRST }
| interlace modes More...
enum | lqt_chroma_placement_t { LQT_CHROMA_PLACEMENT_DEFAULT = 0, LQT_CHROMA_PLACEMENT_MPEG2, LQT_CHROMA_PLACEMENT_DVPAL }
| Chroma placement. More...
## Functions
void | quicktime_set_cmodel (quicktime_t *file, int colormodel)
| Set the colormodel for en-/decoding.
void | quicktime_set_row_span (quicktime_t *file, int row_span)
| Set the row_span for en-/decoding.
void | lqt_set_video_parameter (quicktime_t *file, int track, const char *key, const void *value)
| Set a codec parameter for a video track.
const char * | lqt_interlace_mode_to_string (lqt_interlace_mode_t mode)
| Convert an interlace mode to a human readable string.
const char * | lqt_chroma_placement_to_string (lqt_chroma_placement_t chroma_placement)
| Convert a chroma placement to a human readable string.
int | lqt_get_best_colormodel (quicktime_t *file, int track, int *supported)
| Get the best colormodel out of a list of supported colormodels.
int | lqt_get_cmodel (quicktime_t *file, int track)
| Get the colormodel, which will be valid for the next en-/decode call.
uint8_t ** | lqt_rows_alloc (int width, int height, int colormodel, int *rowspan, int *rowspan_uv)
| Allocate a frame buffer for use with libquicktime.
void | lqt_rows_copy (uint8_t **out_rows, uint8_t **in_rows, int width, int height, int in_rowspan, int in_rowspan_uv, int out_rowspan, int out_rowspan_uv, int colormodel)
| Copy a video frame.
void | lqt_rows_free (uint8_t **rows)
| Free a frame allocated by lqt_rows_alloc.
void | lqt_set_cmodel (quicktime_t *file, int track, int colormodel)
| Set the colormodel for en-/decoding.
void | lqt_set_row_span (quicktime_t *file, int track, int row_span)
| Set the row span for the luma plane.
void | lqt_set_row_span_uv (quicktime_t *file, int track, int row_span_uv)
| Set the row span for the chroma planes.

## Detailed Description

Video related definitions and functions.

## Enumeration Type Documentation

enum lqt_interlace_mode_t

interlace modes

This is the interlace mode of a video track. Read it with lqt_get_interlace_mode .

Enumerator:

  LQT_INTERLACE_NONE | No interlacing (= progressive)
  LQT_INTERLACE_TOP_FIRST | Top field first
  LQT_INTERLACE_BOTTOM_FIRST | Bottom field first

enum lqt_chroma_placement_t

Chroma placement.

This describes the chroma placement of a video track. Read it with lqt_get_chroma_placement . Chroma placement makes only sense for YUV420 formats. For other pixelformats, it is set implicitely to LQT_CHROMA_PLACEMENT_DEFAULT.

Enumerator:

  LQT_CHROMA_PLACEMENT_DEFAULT | MPEG-1, JPEG or non 4:2:0
  LQT_CHROMA_PLACEMENT_MPEG2 | MPEG-2
  LQT_CHROMA_PLACEMENT_DVPAL | DV PAL

## Function Documentation

void quicktime_set_cmodel | ( | quicktime_t * | file,
|  | int | colormodel |
| ) |  |  |

Set the colormodel for en-/decoding.

Parameters:

  | file | A quicktime handle
  | colormodel | The colormodel to use.

This sets the colormodels for all video tracks at once. It's a better idea to use lqt_set_cmodel instead.

void quicktime_set_row_span | ( | quicktime_t * | file,
|  | int | row_span |
| ) |  |  |

Set the row_span for en-/decoding.

Parameters:

  | file | A quicktime handle
  | row_span | The rowspan to use.

This sets the rowspans for all video tracks at once. It's a better idea to use lqt_set_row_span and lqt_set_row_span_uv instead.

void lqt_set_video_parameter | ( | quicktime_t * | file,
|  | int | track,
|  | const char * | key,
|  | const void * | value |
| ) |  |  |

Set a codec parameter for a video track.

Parameters:

  | file | A quicktime handle
  | track | Track index (starting with 0)
  | key | Short name of the parameter
  | value | Parameter value.

For integer parameters, value must be of the type int*. For string parameters, use char*. For floating-point parameters, use float*.

const char* lqt_interlace_mode_to_string | ( | lqt_interlace_mode_t | mode | ) |

Convert an interlace mode to a human readable string.

Parameters:

  | mode | An interlace mode

Returns:
  A description of the interlace mode

const char* lqt_chroma_placement_to_string | ( | lqt_chroma_placement_t | chroma_placement | ) |

Convert a chroma placement to a human readable string.

Parameters:

  | chroma_placement | A chroma placement

Returns:
  A description of the chroma placement

int lqt_get_best_colormodel | ( | quicktime_t * | file,
|  | int | track,
|  | int * | supported |
| ) |  |  |

Get the best colormodel out of a list of supported colormodels.

Parameters:

  | file | A quicktime handle
  | track | Track index (starting with 0)
  | supported | An array with supported colormodels.

Returns:
  The best colormodel

This is a convenience function for application developers: It takes an array with supported colormodels (Terminated with LQT_COLORMODEL_NONE) and returns the best colormodel. The decision is done according to the conversion overhead. i.e. you'll get the colormodel of your list, which is "closest" to the colormodel, the codec delivers. To make sure, that this function never fails, you should at least support BC_RGB888 . This function works for en- and decoding.

int lqt_get_cmodel | ( | quicktime_t * | file,
|  | int | track |
| ) |  |  |

Get the colormodel, which will be valid for the next en-/decode call.

Parameters:

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

Returns:
  The colormodel used for en-/decode functions.

By default, it will return the colormodel, which is used natively by the codec. It can be changed with lqt_set_cmodel .

uint8_t** lqt_rows_alloc | ( | int | width,
|  | int | height,
|  | int | colormodel,
|  | int * | rowspan,
|  | int * | rowspan_uv |
| ) |  |  |

Allocate a frame buffer for use with libquicktime.

Parameters:

  | width | The width of the frame
  | height | The height of the frame
  | colormodel | The colormodel of the frame (see Color handling).
  | rowspan | Specifies the row span to use for the luma plane. Can be 0 to use default values. After the function call, it will contain the rowspan actually used.
  | rowspan_uv | Specifies the row span to use for the chroma planes. Can be 0 to use default values. After the function call, it will contain the rowspan actually used.

Returns:
  An array of pointers to be passed to any of the en-/decoding functions.

What is called "row_pointers" here is a bit misleading: For packed formats, the pointers point to the beginnings of scanlines. For planar formats, the pointers point to the beginning of planes. In either case, the byte offsets between scanlines are be specified by rowspan and rowspan_uv. To free the returned frame, call lqt_rows_free

void lqt_rows_copy | ( | uint8_t ** | out_rows,
|  | uint8_t ** | in_rows,
|  | int | width,
|  | int | height,
|  | int | in_rowspan,
|  | int | in_rowspan_uv,
|  | int | out_rowspan,
|  | int | out_rowspan_uv,
|  | int | colormodel |
| ) |  |  |

Copy a video frame.

Parameters:

  | out_rows | Destination frame
  | in_rows | Source frame
  | width | Width of the frame
  | height | Height of the frame
  | in_rowspan | Rowspan for the luma plane of the input frame
  | in_rowspan_uv | Rowspan for the chroma planes of the input frame
  | out_rowspan | Rowspan for the luma plane of the output frame
  | out_rowspan_uv | Rowspan for the chroma planes of the output frame
  | colormodel | The colormodel of the frames

void lqt_rows_free | ( | uint8_t ** | rows | ) |

Free a frame allocated by lqt_rows_alloc.

Parameters:

  | rows | The frame to be freed

void lqt_set_cmodel | ( | quicktime_t * | file,
|  | int | track,
|  | int | colormodel |
| ) |  |  |

Set the colormodel for en-/decoding.

Parameters:

  | file | A quicktime handle
  | track | Track index (starting with 0)
  | colormodel | The colormodel to use.

Set colormodel of a video track. It's the colormodel, libquicktime will expect for the next call to lqt_encode_video or lqt_decode_video respectively. Before you should call this, you should verify, that this colormodel can be used with quicktime_reads_cmodel (for reading), quicktime_writes_cmodel (for writing) or lqt_get_best_colormodel (for reading and writing).

void lqt_set_row_span | ( | quicktime_t * | file,
|  | int | track,
|  | int | row_span |
| ) |  |  |

Set the row span for the luma plane.

Parameters:

  | file | A quicktime handle
  | track | Track index (starting with 0)
  | row_span | The row span for the luma plane

This sets the row_span, which will be used for the next en-/decode calls (see lqt_rows_alloc ).

void lqt_set_row_span_uv | ( | quicktime_t * | file,
|  | int | track,
|  | int | row_span_uv |
| ) |  |  |

Set the row span for the chroma planes.

Parameters:

  | file | A quicktime handle
  | track | Track index (starting with 0)
  | row_span_uv | The row span for the chroma planes

This sets the row_span, which will be used for the next en-/decode calls (see lqt_rows_alloc ).