Audio related definitions and functions (writing). More...
Functions | |
int | quicktime_set_audio (quicktime_t *file, int channels, long sample_rate, int bits, char *compressor) |
Set up tracks in a new file after opening and before writing. | |
int | quicktime_encode_audio (quicktime_t *file, int16_t **input_i, float **input_f, long samples) |
Encode a number of audio samples for the first track. | |
int | lqt_set_audio (quicktime_t *file, int channels, long sample_rate, int bits, lqt_codec_info_t *codec_info) |
Set up audio tracks for encoding. | |
int | lqt_add_audio_track (quicktime_t *file, int channels, long sample_rate, int bits, lqt_codec_info_t *codec_info) |
Add an audio track for encoding. | |
int | lqt_set_audio_codec (quicktime_t *file, int track, lqt_codec_info_t *info) |
Set a codec for an audio track. | |
void | lqt_set_audio_language (quicktime_t *file, int track, const char *language) |
Set the audio language. | |
int | lqt_encode_audio_track (quicktime_t *file, int16_t **output_i, float **output_f, long samples, int track) |
Encode a number of audio samples for the first track. | |
int | lqt_encode_audio_raw (quicktime_t *file, void *input, long samples, int track) |
Encode audio in the native sampleformat of the codec. | |
void | lqt_set_audio_pts_offset (quicktime_t *file, int track, int64_t offset) |
Set an audio pts offset. |
Audio related definitions and functions (writing).
The audio API changed a lot during the last years (causing lot of confusion), so here is the preferred way: Use the Codec registry functions to get all supported audio encoders. Once you found a codec (i.e. a lqt_codec_info_t ), call lqt_add_audio_track to add the track to the file. You can repeat this procedure to add as many tracks as you like with different formats and/or codecs.
Next you might want to set some compression parameters. This is done by calling lqt_set_audio_parameter. Supported parameters and valid ranges are in the lqt_codec_info_t.
For each track, encode noninterleaved samples (either in 16bit integer or floating point [-1.0..1.0] format) with lqt_encode_audio_track . In this case, libquicktime will convert your samples to the format used by the codec. This won't give the full precision when using 24/32 bit formats. If you want to pass the samples as raw as possible (bypassing all internal sample format conversions), use lqt_get_sample_format to get the sampleformat natively used by the codec and lqt_encode_audio_raw to encode it.
int quicktime_set_audio | ( | quicktime_t * | file, | |
int | channels, | |||
long | sample_rate, | |||
int | bits, | |||
char * | compressor | |||
) |
Set up tracks in a new file after opening and before writing.
file | A quicktime handle | |
channels | Number of channels | |
sample_rate | Samplerate | |
bits | Bits per sample | |
compressor | Compressor to use |
Returns the number of quicktime tracks allocated. Audio is stored two channels per quicktime track.
This function is depracated and should not be used in newly written code. It won't let you add individual tracks with different codecs, samplerates etc. Use lqt_add_audio_track instread.
int quicktime_encode_audio | ( | quicktime_t * | file, | |
int16_t ** | input_i, | |||
float ** | input_f, | |||
long | samples | |||
) |
Encode a number of audio samples for the first track.
file | A quicktime handle | |
input_i | 16 bit integer output buffer (or NULL) | |
input_f | floating point output buffer (or NULL) | |
samples | Number of samples to decode |
Never use this function: It won't let you encode more than one audio track. To encode audio for multiple tracks, use lqt_encode_audio_track . If you want to pass the full resolution even for 24/32 bit audio, use lqt_encode_audio_raw .
int lqt_set_audio | ( | quicktime_t * | file, | |
int | channels, | |||
long | sample_rate, | |||
int | bits, | |||
lqt_codec_info_t * | codec_info | |||
) |
Set up audio tracks for encoding.
file | A quicktime handle | |
channels | Number of channels | |
sample_rate | Samplerate | |
bits | Bits per sample (always 16) | |
codec_info | Codec to use (see Codec registry ) |
This sets one audio track for encoding. Note that the bits argument should always be 16 since it's implicit to the codec in all cases. To add more than one audio track, use lqt_add_audio_track .
int lqt_add_audio_track | ( | quicktime_t * | file, | |
int | channels, | |||
long | sample_rate, | |||
int | bits, | |||
lqt_codec_info_t * | codec_info | |||
) |
Add an audio track for encoding.
file | A quicktime handle | |
channels | Number of channels | |
sample_rate | Samplerate | |
bits | Bits per sample (always 16) | |
codec_info | Codec to use (see Codec registry) or NULL |
This sets adds a new audio track for encoding. Note that the bits argument should always be 16 since it's implicit to the codec in all cases. Call this function to subsequently to add as many tracks as you like.
If you passed NULL for the codec_info, you should call lqt_set_audio_codec once you know which codec to use.
int lqt_set_audio_codec | ( | quicktime_t * | file, | |
int | track, | |||
lqt_codec_info_t * | info | |||
) |
Set a codec for an audio track.
file | A quicktime handle | |
track | Track index (starting with 0) | |
info | The codec to be used for encoding |
void lqt_set_audio_language | ( | quicktime_t * | file, | |
int | track, | |||
const char * | language | |||
) |
Set the audio language.
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".
int lqt_encode_audio_track | ( | quicktime_t * | file, | |
int16_t ** | output_i, | |||
float ** | output_f, | |||
long | samples, | |||
int | track | |||
) |
Encode a number of audio samples for the first track.
file | A quicktime handle | |
output_i | 16 bit integer output buffer (or NULL) | |
output_f | floating point output buffer (or NULL) | |
samples | Number of samples to decode | |
track | index (starting with 0) |
Same as quicktime_encode_audio but with an additional track argument for encoding files with more than one audio track. If you want to pass the full resolution even for 24/32 bit audio, use lqt_encode_audio_raw .
int lqt_encode_audio_raw | ( | quicktime_t * | file, | |
void * | input, | |||
long | samples, | |||
int | track | |||
) |
Encode audio in the native sampleformat of the codec.
file | A quicktime handle | |
input | An array of interleaved samples | |
samples | Number of samples to encode | |
track | Track index (starting with 0) |
This function bypasses all internal sampleformat conversion and allows full resolution input for up to 32 bit integer and 32 bit float. To check, which dataformat the samples will have, use lqt_get_sample_format .
void lqt_set_audio_pts_offset | ( | quicktime_t * | file, | |
int | track, | |||
int64_t | offset | |||
) |
Set an audio pts offset.
file | A quicktime handle | |
track | Track index (starting with 0) | |
offset | PTS of the first audio sample (in samples) |