Sound Open Firmware
Loading...
Searching...
No Matches
source_api.h File Reference
Include dependency graph for source_api.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void source_init (struct sof_source *source, const struct source_ops *ops, struct sof_audio_stream_params *audio_stream_params)
 Init of the API, must be called before any operation.
size_t source_get_num_of_processed_bytes (struct sof_source *source)
 Get total number of bytes processed by the source (meaning - freed by source_release_data()).
void source_reset_num_of_processed_bytes (struct sof_source *source)
 sets counter of total number of bytes processed to zero
bool source_get_underrun (struct sof_source *source)
 set of functions for retrieve audio parameters
uint32_t source_get_id (struct sof_source *source)
int source_set_frm_fmt (struct sof_source *source, enum sof_ipc_frame frm_fmt)
 set of functions for setting audio parameters
int source_set_valid_fmt (struct sof_source *source, enum sof_ipc_frame valid_sample_fmt)
int source_set_rate (struct sof_source *source, unsigned int rate)
int source_set_channels (struct sof_source *source, unsigned int channels)
int source_set_underrun (struct sof_source *source, bool underrun_permitted)
int source_set_buffer_fmt (struct sof_source *source, uint32_t buffer_fmt)
void source_set_min_available (struct sof_source *source, size_t min_available)
int source_set_params (struct sof_source *source, struct sof_ipc_stream_params *params, bool force_update)
 initial set of audio parameters, provided in sof_ipc_stream_params
int source_set_alignment_constants (struct sof_source *source, const uint32_t byte_align, const uint32_t frame_align_req)
 Set frame_align_shift and frame_align of stream according to byte_align and frame_align_req alignment requirement.

Function Documentation

◆ source_get_id()

uint32_t source_get_id ( struct sof_source * source)

◆ source_get_num_of_processed_bytes()

size_t source_get_num_of_processed_bytes ( struct sof_source * source)

Get total number of bytes processed by the source (meaning - freed by source_release_data()).

◆ source_get_underrun()

bool source_get_underrun ( struct sof_source * source)

set of functions for retrieve audio parameters

◆ source_init()

void source_init ( struct sof_source * source,
const struct source_ops * ops,
struct sof_audio_stream_params * audio_stream_params )

Init of the API, must be called before any operation.

Parameters
sourcepointer to the structure
opspointer to API operations
audio_stream_paramspointer to structure with audio parameters note that the audio_stream_params must be accessible by the caller core the implementation must ensure coherent access to the parameteres in case of i.e. cross core shared queue, it must be located in non-cached memory

◆ source_reset_num_of_processed_bytes()

void source_reset_num_of_processed_bytes ( struct sof_source * source)

sets counter of total number of bytes processed to zero

◆ source_set_alignment_constants()

int source_set_alignment_constants ( struct sof_source * source,
const uint32_t byte_align,
const uint32_t frame_align_req )

Set frame_align_shift and frame_align of stream according to byte_align and frame_align_req alignment requirement.

Once the channel number,frame size are determined, the frame_align and frame_align_shift are determined too. these two feature will be used in audio_stream_get_avail_frames_aligned to calculate the available frames. it should be called in component prepare or param functions only once before stream copy. if someone forgets to call this first, there would be unexampled error such as nothing is copied at all.

Parameters
sourcea handler to source
byte_alignProcessing byte alignment requirement.
frame_align_reqProcessing frames alignment requirement.
Returns
0 if success

◆ source_set_buffer_fmt()

int source_set_buffer_fmt ( struct sof_source * source,
uint32_t buffer_fmt )

◆ source_set_channels()

int source_set_channels ( struct sof_source * source,
unsigned int channels )

◆ source_set_frm_fmt()

int source_set_frm_fmt ( struct sof_source * source,
enum sof_ipc_frame frm_fmt )

set of functions for setting audio parameters

◆ source_set_min_available()

void source_set_min_available ( struct sof_source * source,
size_t min_available )

◆ source_set_params()

int source_set_params ( struct sof_source * source,
struct sof_ipc_stream_params * params,
bool force_update )

initial set of audio parameters, provided in sof_ipc_stream_params

Parameters
sourcea handler to source
paramsthe set of parameters
force_updatetells the implementation that the params should override actual settings
Returns
0 if success

◆ source_set_rate()

int source_set_rate ( struct sof_source * source,
unsigned int rate )

◆ source_set_underrun()

int source_set_underrun ( struct sof_source * source,
bool underrun_permitted )

◆ source_set_valid_fmt()

int source_set_valid_fmt ( struct sof_source * source,
enum sof_ipc_frame valid_sample_fmt )