MLT  7.38.0
Multimedia Framework
Public Member Functions | Data Fields
mlt_audio_s Struct Reference

Audio class. More...

#include <mlt_audio.h>

Public Member Functions

void mlt_audio_alloc_data (mlt_audio self)
 Allocate the data field based on the other properties of the Audio. More...
 
int mlt_audio_calculate_frame_samples (float fps, int frequency, int64_t position)
 Determine the number of samples that belong in a frame at a time position. More...
 
int64_t mlt_audio_calculate_samples_to_position (float fps, int frequency, int64_t position)
 Determine the number of samples that belong before a time position. More...
 
int mlt_audio_calculate_size (mlt_audio self)
 Calculate the number of bytes needed for the Audio data. More...
 
int mlt_audio_channel_layout_channels (mlt_channel_layout layout)
 Get the number of channels for a channel layout. More...
 
mlt_channel_layout mlt_audio_channel_layout_default (int channels)
 Get a default channel layout for a given number of channels. More...
 
mlt_channel_layout mlt_audio_channel_layout_id (const char *name)
 Get the id of channel layout from short name. More...
 
const char * mlt_audio_channel_layout_name (mlt_channel_layout layout)
 Get the short name for a channel layout. More...
 
void mlt_audio_close (mlt_audio self)
 Destroy an audio object created by mlt_audio_new(). More...
 
void mlt_audio_copy (mlt_audio dst, mlt_audio src, int samples, int src_start, int dst_start)
 Copy audio samples from src to dst. More...
 
const char * mlt_audio_format_name (mlt_audio_format format)
 Get the short name for an audio format. More...
 
int mlt_audio_format_size (mlt_audio_format format, int samples, int channels)
 Get the amount of bytes needed for a block of audio. More...
 
void mlt_audio_free_data (mlt_audio self)
 Free the data field using the destructor function. More...
 
void mlt_audio_get_planes (mlt_audio self, uint8_t **planes)
 Populate an array of pointers each pointing to the beginning of an audio plane. More...
 
void mlt_audio_get_values (mlt_audio self, void **data, int *frequency, mlt_audio_format *format, int *samples, int *channels)
 Get the most common values for the audio. More...
 
int mlt_audio_plane_count (mlt_audio self)
 Get the number of planes for the audio type. More...
 
int mlt_audio_plane_size (mlt_audio self)
 Get the size of an audio plane. More...
 
void mlt_audio_reverse (mlt_audio self)
 Reverse the audio samples. More...
 
void mlt_audio_set_values (mlt_audio self, void *data, int frequency, mlt_audio_format format, int samples, int channels)
 Set the most common values for the audio. More...
 
void mlt_audio_shrink (mlt_audio self, int samples)
 Shrink the audio to the new number of samples. More...
 
void mlt_audio_silence (mlt_audio self, int samples, int start)
 Set a range of samples to silence. More...
 

Data Fields

int channels
 
mlt_destructor close
 
void * data
 
mlt_audio_format format
 
int frequency
 
mlt_channel_layout layout
 
mlt_destructor release_data
 
int samples
 

Detailed Description

Audio class.

Audio is the data object that represents audio for a period of time.

Member Function Documentation

◆ mlt_audio_alloc_data()

void mlt_audio_alloc_data ( mlt_audio  self)

Allocate the data field based on the other properties of the Audio.

If the data field is already set, and a destructor function exists, the data will be released. Else, the data pointer will be overwritten without being released.

After this function call, the release_data field will be set and can be used to release the data when necessary.

Parameters
selfthe Audio object

◆ mlt_audio_calculate_frame_samples()

int mlt_audio_calculate_frame_samples ( float  fps,
int  frequency,
int64_t  position 
)

Determine the number of samples that belong in a frame at a time position.

Parameters
fpsthe frame rate
frequencythe sample rate
positionthe time position
Returns
the number of samples per channel

◆ mlt_audio_calculate_samples_to_position()

int64_t mlt_audio_calculate_samples_to_position ( float  fps,
int  frequency,
int64_t  position 
)

Determine the number of samples that belong before a time position.

Parameters
fpsthe frame rate
frequencythe sample rate
positionthe time position
Returns
the number of samples per channel

◆ mlt_audio_calculate_size()

int mlt_audio_calculate_size ( mlt_audio  self)

Calculate the number of bytes needed for the Audio data.

Parameters
selfthe Audio object
Returns
the number of bytes

◆ mlt_audio_channel_layout_channels()

int mlt_audio_channel_layout_channels ( mlt_channel_layout  layout)

Get the number of channels for a channel layout.

Parameters
layoutthe channel layout
Returns
the number of channels for the channel layout

◆ mlt_audio_channel_layout_default()

mlt_channel_layout mlt_audio_channel_layout_default ( int  channels)

Get a default channel layout for a given number of channels.

Parameters
channelsthe number of channels
Returns
the default channel layout

◆ mlt_audio_channel_layout_id()

mlt_channel_layout mlt_audio_channel_layout_id ( const char *  name)

Get the id of channel layout from short name.

Parameters
namethe channel layout short name
Returns
a channel layout

◆ mlt_audio_channel_layout_name()

const char * mlt_audio_channel_layout_name ( mlt_channel_layout  layout)

Get the short name for a channel layout.

You do not need to deallocate the returned string.

Parameters
layoutthe channel layout
Returns
a string for the name of the channel layout

◆ mlt_audio_close()

void mlt_audio_close ( mlt_audio  self)

Destroy an audio object created by mlt_audio_new().

Parameters
selfthe Audio object

◆ mlt_audio_copy()

void mlt_audio_copy ( mlt_audio  dst,
mlt_audio  src,
int  samples,
int  src_start,
int  dst_start 
)

Copy audio samples from src to dst.

Parameters
dstthe destination object
srcthe source object
samplesthe number of samples to copy
src_startthe number of samples to skip from the source
dst_startthe number of samples to skip from the destination
Returns
none

◆ mlt_audio_format_name()

const char * mlt_audio_format_name ( mlt_audio_format  format)

Get the short name for an audio format.

You do not need to deallocate the returned string.

Parameters
formatan audio format enum
Returns
a string for the name of the image format

◆ mlt_audio_format_size()

int mlt_audio_format_size ( mlt_audio_format  format,
int  samples,
int  channels 
)

Get the amount of bytes needed for a block of audio.

Parameters
formatan audio format enum
samplesthe number of samples per channel
channelsthe number of channels
Returns
the number of bytes

◆ mlt_audio_free_data()

void mlt_audio_free_data ( mlt_audio  self)

Free the data field using the destructor function.

If the constructor function does not exist, the value will be set to NULL without being released.

After this function call, the data and release_data fields will be NULL.

Parameters
selfthe Audio object

◆ mlt_audio_get_planes()

void mlt_audio_get_planes ( mlt_audio  self,
uint8_t **  planes 
)

Populate an array of pointers each pointing to the beginning of an audio plane.

Parameters
selfthe Audio object
[out]planesthe array of pointers to populate

◆ mlt_audio_get_values()

void mlt_audio_get_values ( mlt_audio  self,
void **  data,
int *  frequency,
mlt_audio_format format,
int *  samples,
int *  channels 
)

Get the most common values for the audio.

Parameters
selfthe Audio object
[out]datathe buffer that contains the audio data
[out]frequencythe sample rate
[out]formatthe audio format
[out]samplesthe number of samples in the data
[out]channelsthe number of audio channels

◆ mlt_audio_plane_count()

int mlt_audio_plane_count ( mlt_audio  self)

Get the number of planes for the audio type.

Parameters
selfthe Audio object
Returns
the number of planes.

◆ mlt_audio_plane_size()

int mlt_audio_plane_size ( mlt_audio  self)

Get the size of an audio plane.

Parameters
selfthe Audio object
Returns
the size of a plane.

◆ mlt_audio_reverse()

void mlt_audio_reverse ( mlt_audio  self)

Reverse the audio samples.

Parameters
selfthe Audio object

◆ mlt_audio_set_values()

void mlt_audio_set_values ( mlt_audio  self,
void *  data,
int  frequency,
mlt_audio_format  format,
int  samples,
int  channels 
)

Set the most common values for the audio.

Less common values will be set to reasonable defaults.

You should use the mlt_audio_calculate_frame_samples to determine the number of samples you want.

Parameters
selfthe Audio object
datathe buffer that contains the audio data
frequencythe sample rate
formatthe audio format
samplesthe number of samples in the data
channelsthe number of audio channels

◆ mlt_audio_shrink()

void mlt_audio_shrink ( mlt_audio  self,
int  samples 
)

Shrink the audio to the new number of samples.

Existing samples will be moved as necessary to ensure that the audio planes immediately follow each other. The samples field will be updated to match the new number.

Parameters
selfthe Audio object
samplesthe new number of samples to shrink to

◆ mlt_audio_silence()

void mlt_audio_silence ( mlt_audio  self,
int  samples,
int  start 
)

Set a range of samples to silence.

Parameters
selfthe Audio object
samplesthe number of samples to silence
startthe sample at which to begin the silence
Returns
none

Field Documentation

◆ channels

int mlt_audio_s::channels

◆ close

mlt_destructor mlt_audio_s::close

◆ data

void* mlt_audio_s::data

◆ format

mlt_audio_format mlt_audio_s::format

◆ frequency

int mlt_audio_s::frequency

◆ layout

mlt_channel_layout mlt_audio_s::layout

◆ release_data

mlt_destructor mlt_audio_s::release_data

◆ samples

int mlt_audio_s::samples

The documentation for this struct was generated from the following files: