libquicktime: Codec registry

- Main Page
- Modules
- Data Structures
- Files
- Directories

# Codec registry

Informations about installed codecs. More...

## Modules
| Structures describing codec parameters
| Informations about supported codec parameters.

## Data Structures
struct | lqt_codec_info_t
| Structure describing a codec. More...
## Enumerations
enum | lqt_codec_type { LQT_CODEC_AUDIO, LQT_CODEC_VIDEO }
| Type of a codec (Audio or video). More...
enum | lqt_codec_direction { LQT_DIRECTION_ENCODE, LQT_DIRECTION_DECODE, LQT_DIRECTION_BOTH }
| Direction of the codec. More...
## Functions
void | lqt_registry_init ()
| Initialize the codec registry.
void | lqt_registry_destroy ()
| Destroy the codec registry.
int | lqt_get_num_audio_codecs ()
| Return the number of installed audio codecs.
int | lqt_get_num_video_codecs ()
| Return the number of installed video codecs.
const lqt_codec_info_t * | lqt_get_audio_codec_info (int index)
| Return an audio codec.
const lqt_codec_info_t * | lqt_get_video_codec_info (int index)
| Return a video codec.
lqt_codec_info_t ** | lqt_query_registry (int audio, int video, int encode, int decode)
| Return an array of any combination of audio/video en/decoders.
lqt_codec_info_t ** | lqt_find_audio_codec (char *fourcc, int encode)
| Find an audio codec for a given fourcc.
lqt_codec_info_t ** | lqt_find_audio_codec_by_wav_id (int wav_id, int encode)
| Find an audio codec for a given WAV ID.
lqt_codec_info_t ** | lqt_find_video_codec (char *fourcc, int encode)
| Find a video codec for a given fourcc.
lqt_codec_info_t ** | lqt_find_audio_codec_by_name (const char *name)
| Find an audio codec by its name.
lqt_codec_info_t ** | lqt_find_video_codec_by_name (const char *name)
| Find a video codec by its name.
lqt_codec_info_t ** | lqt_audio_codec_from_file (quicktime_t *file, int track)
| Get an audio codec from an open file.
lqt_codec_info_t ** | lqt_video_codec_from_file (quicktime_t *file, int track)
| Get a video codec from an open file.
void | lqt_destroy_codec_info (lqt_codec_info_t **info)
| Destroy a codec info array.
void | lqt_reorder_audio_codecs (lqt_codec_info_t **codec_info)
| Reorder audio codecs.
void | lqt_reorder_video_codecs (lqt_codec_info_t **codec_info)
| Reorder video codecs.
void | lqt_set_default_parameter (lqt_codec_type type, int encode, const char *codec_name, const char *parameter_name, lqt_parameter_value_t *val)
| Change a default value for a codec parameter.
void | lqt_restore_default_parameters (lqt_codec_info_t *codec_info, int encode, int decode)
| Restore a default parameter from the codec module.
void | lqt_dump_codec_info (const lqt_codec_info_t *info)
| Dump a codec info to stderr.

## Detailed Description

Informations about installed codecs.

One of the goals when forking libquicktime was to have a modular structure. Codecs were moved to plugins and were compiled according to the dependencies found by the configure script. As a result, a mechanism became necessary for finding informations about available codecs at runtime, their properties, supported parameters etc.

The codec parameters are defined in a way that GUI configuration dialogs can be built at runtime. An example for this is the libquicktime_config utility.

Libquicktime saves data of the codecs in the file .libquicktime_codecs in your home directory. This saves the long time needed for opening each codec module to see what's inside. The codec registry can be configured with the libquicktime_config program.

## Enumeration Type Documentation

enum lqt_codec_type

Type of a codec (Audio or video).

enum lqt_codec_direction

Direction of the codec.

## Function Documentation

void lqt_registry_init | ( |  | ) |

Initialize the codec registry.

Under normal circumstances, you never need to call this function, since the registry is always initialized on demand.

void lqt_registry_destroy | ( |  | ) |

Destroy the codec registry.

This frees memory for the whole codec database. It is normally called automatically, but you will need to call it exclicitely, if you want to reinitialize the codec registry at runtime

int lqt_get_num_audio_codecs | ( |  | ) |

Return the number of installed audio codecs.

Returns:
  Number of installed audio codecs

This function is obsolete, use lqt_query_registry instead

int lqt_get_num_video_codecs | ( |  | ) |

Return the number of installed video codecs.

Returns:
  Number of installed video codecs

This function is obsolete, use lqt_query_registry instead

const lqt_codec_info_t* lqt_get_audio_codec_info | ( | int | index | ) |

Return an audio codec.

Parameters:

  | index | Index of the codec

Returns:
  Pointer to the codec info in the internal database

This function is obsolete, use lqt_query_registry instead

const lqt_codec_info_t* lqt_get_video_codec_info | ( | int | index | ) |

Return a video codec.

Parameters:

  | index | Index of the codec

Returns:
  Pointer to the codec info in the internal database

This function is obsolete, use lqt_query_registry instead

lqt_codec_info_t** lqt_query_registry | ( | int | audio,
|  | int | video,
|  | int | encode,
|  | int | decode |
| ) |  |  |

Return an array of any combination of audio/video en/decoders.

Parameters:

  | audio | Set this to 1 if you want audio codecs to be returned
  | video | Set this to 1 if you want video codecs to be returned
  | encode | Set this to 1 if you want encoders to be returned
  | decode | Set this to 1 if you want decoders to be returned

Returns:
  A NULL terminated array of codec infos.

This function copies the codec infos. Use lqt_destroy_codec_info to free the returned array.

lqt_codec_info_t** lqt_find_audio_codec | ( | char * | fourcc,
|  | int | encode |
| ) |  |  |

Find an audio codec for a given fourcc.

Parameters:

  | fourcc | A four character code
  | encode | Set to 1 to return encoders, 0 to return decoders

Returns:
  A NULL terminated array containing one codec info if the codec was found

This function copies the codec info. Use lqt_destroy_codec_info to free the returned array.

lqt_codec_info_t** lqt_find_audio_codec_by_wav_id | ( | int | wav_id,
|  | int | encode |
| ) |  |  |

Find an audio codec for a given WAV ID.

Parameters:

  | wav_id | A 16 bit audio codec ID as found in WAV and AVI files
  | encode | Set to 1 to return encoders, 0 to return decoders

Returns:
  A NULL terminated array containing one codec info if the codec was found

This function copies the codec info. Use lqt_destroy_codec_info to free the returned array.

lqt_codec_info_t** lqt_find_video_codec | ( | char * | fourcc,
|  | int | encode |
| ) |  |  |

Find a video codec for a given fourcc.

Parameters:

  | fourcc | A four character code
  | encode | Set to 1 to return encoders, 0 to return decoders

Returns:
  A NULL terminated array containing one codec info if the codec was found

This function copies the codec info. Use lqt_destroy_codec_info to free the returned array.

lqt_codec_info_t** lqt_find_audio_codec_by_name | ( | const char * | name | ) |

Find an audio codec by its name.

Parameters:

  | name | Short name of the codec (see lqt_codec_info_s)

Returns:
  A NULL terminated array containing one codec info if the codec was found

This function copies the codec info. Use lqt_destroy_codec_info to free the returned array.

lqt_codec_info_t** lqt_find_video_codec_by_name | ( | const char * | name | ) |

Find a video codec by its name.

Parameters:

  | name | Short name of the codec (see lqt_codec_info_s)

Returns:
  A NULL terminated array containing one codec info if the codec was found

This function copies the codec info. Use lqt_destroy_codec_info to free the returned array.

lqt_codec_info_t** lqt_audio_codec_from_file | ( | quicktime_t * | file,
|  | int | track |
| ) |  |  |

Get an audio codec from an open file.

Parameters:

  | file | A quicktime handle
  | track | Index if the track (starting with 0)

Returns:
  A NULL terminated array containing one codec info if the codec was found

This function copies the codec info. Use lqt_destroy_codec_info to free the returned array.

lqt_codec_info_t** lqt_video_codec_from_file | ( | quicktime_t * | file,
|  | int | track |
| ) |  |  |

Get a video codec from an open file.

Parameters:

  | file | A quicktime handle
  | track | Index if the track (starting with 0)

Returns:
  A NULL terminated array containing one codec info if the codec was found

This function copies the codec info. Use lqt_destroy_codec_info to free the returned array.

void lqt_destroy_codec_info | ( | lqt_codec_info_t ** | info | ) |

Destroy a codec info array.

Parameters:

  | info | A NULL terminated array of codec infos returned by one of the query functions.

Destroys a NULL terminared codec info structure returned by any of the query functions and frees all associated memory.

void lqt_reorder_audio_codecs | ( | lqt_codec_info_t ** | codec_info | ) |

Reorder audio codecs.

Parameters:

  | codec_info | A NULL terminated array of codec infos

The codec order is important if there is more than one codec available for a given fourcc. In this case, the first one will be used. You can simply call lqt_query_registry for getting audio codecs, reorder the returned array and pass this to the functions below.

void lqt_reorder_video_codecs | ( | lqt_codec_info_t ** | codec_info | ) |

Reorder video codecs.

Parameters:

  | codec_info | A NULL terminated array of codec infos

The codec order is important if there is more than one codec available for a given fourcc. In this case, the first one will be used. You can simply call lqt_query_registry for getting video codecs, reorder the returned array and pass this to the functions below.

void lqt_set_default_parameter | ( | lqt_codec_type | type,
|  | int | encode,
|  | const char * | codec_name,
|  | const char * | parameter_name,
|  | lqt_parameter_value_t * | val |
| ) |  |  |

Change a default value for a codec parameter.

Parameters:

  | type | The type of the codec (audio or video)
  | encode | 1 for encode parameter, 0 for decode parameter
  | codec_name | The short name of the codec
  | parameter_name | The short name of the parameter to change
  | val | The new value for the parameter

This stores a new default parameter value in the codec registry. It will become the new default for all files, you open after. This will also be saved in $HOME/.libquicktime_config.

void lqt_restore_default_parameters | ( | lqt_codec_info_t * | codec_info,
|  | int | encode,
|  | int | decode |
| ) |  |  |

Restore a default parameter from the codec module.

Parameters:

  | codec_info | A codec info referring to the codec
  | encode | Set this to 1 to restore encoding parameters, 0 else
  | decode | Set this to 1 to restore decoding parameters, 0 else

This will revert previous calls to lqt_set_default_parameter by loading the module and getting the hardcoded values.

void lqt_dump_codec_info | ( | const lqt_codec_info_t * | info | ) |

Dump a codec info to stderr.

Parameters:

  | info | A codec info

Dump a human readable description of the codec info to stderr. For testing and debugging only.