13#ifndef __MODULE_AUDIO_SINK_API_H__
14#define __MODULE_AUDIO_SINK_API_H__
79 void **data_ptr,
void **buffer_start,
size_t *buffer_size);
122 const uint32_t byte_align,
123 const uint32_t frame_align_req);
217 size_t *buffer_size);
236 int16_t **buffer_start,
size_t *buffer_samples);
255 int32_t **buffer_start,
size_t *buffer_samples);
315 const uint32_t byte_align,
316 const uint32_t frame_align_req);
int sink_set_buffer_fmt(struct sof_sink *sink, uint32_t buffer_fmt)
size_t sink_get_free_frames(struct sof_sink *sink)
Retrieves size of free space available in sink (in frames) return number of free frames in buffer ava...
static struct processing_module * sink_get_bound_module(struct sof_sink *sink)
Definition sink_api.h:410
int sink_get_buffer_s32(struct sof_sink *sink, size_t req_size, int32_t **data_ptr, int32_t **buffer_start, size_t *buffer_samples)
Get a circular buffer to operate on (to write).
int sink_set_channels(struct sof_sink *sink, unsigned int channels)
int sink_set_alignment_constants(struct sof_sink *sink, 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...
int sink_set_valid_fmt(struct sof_sink *sink, enum sof_ipc_frame valid_sample_fmt)
int sink_set_params(struct sof_sink *sink, struct sof_ipc_stream_params *params, bool force_update)
initial set of audio parameters, provided in sof_ipc_stream_params
int sink_set_overrun(struct sof_sink *sink, bool overrun_permitted)
static uint32_t sink_get_buffer_fmt(struct sof_sink *sink)
Definition sink_api.h:284
static uint32_t sink_get_id(struct sof_sink *sink)
Definition sink_api.h:339
static size_t sink_get_free_frames_aligned(struct sof_sink *sink)
Retrieves number of free frames in sink aligned to the alignment constants set by sink_set_alignment_...
Definition sink_api.h:172
static int sink_get_state(struct sof_sink *sink)
get the state of the component consuming data from this sink
Definition sink_api.h:360
int sink_get_buffer(struct sof_sink *sink, size_t req_size, void **data_ptr, void **buffer_start, size_t *buffer_size)
Get a circular buffer to operate on (to write).
static int sink_bind(struct sof_sink *sink, struct processing_module *module)
hook to be called when a module connects to the API
Definition sink_api.h:373
static uint32_t sink_get_rate(struct sof_sink *sink)
Definition sink_api.h:279
static int sink_unbind(struct sof_sink *sink)
hook to be called when a module disconnects from the API
Definition sink_api.h:394
int sink_set_rate(struct sof_sink *sink, unsigned int rate)
static size_t sink_get_min_free_space(struct sof_sink *sink)
Definition sink_api.h:334
static uint32_t sink_get_last_feeding_time(struct sof_sink *sink)
Definition sink_api.h:415
static uint32_t sink_get_channels(struct sof_sink *sink)
Definition sink_api.h:183
int sink_set_frm_fmt(struct sof_sink *sink, enum sof_ipc_frame frame_fmt)
set of functions for retrieve audio parameters
int sink_commit_buffer(struct sof_sink *sink, size_t commit_size)
Commits that the buffer previously obtained by get_buffer is filled with data and ready to be used.
static enum sof_ipc_frame sink_get_valid_fmt(struct sof_sink *sink)
Definition sink_api.h:274
size_t sink_get_frame_bytes(struct sof_sink *sink)
get size of a single audio frame (in bytes)
static enum sof_ipc_frame sink_get_frm_fmt(struct sof_sink *sink)
Definition sink_api.h:178
int sink_set_size(struct sof_sink *sink, size_t size)
Resize the buffer backing the sink.
int sink_get_buffer_s16(struct sof_sink *sink, size_t req_size, int16_t **data_ptr, int16_t **buffer_start, size_t *buffer_samples)
Get a circular buffer to operate on (to write).
static size_t sink_get_free_size(struct sof_sink *sink)
Public functions.
Definition sink_api.h:162
static uint32_t sink_get_pipeline_id(struct sof_sink *sink)
Definition sink_api.h:344
sof_ipc_frame
Definition stream.h:16
Audio Stream API definition.
this is a definition of internals of sink API
Definition sink_api.h:69
int(* audio_set_ipc_params)(struct sof_sink *sink, struct sof_ipc_stream_params *params, bool force_update)
OPTIONAL see sink_set_params comments.
Definition sink_api.h:114
int(* on_bind)(struct sof_sink *sink, struct processing_module *module)
OPTIONAL events called when a module is starting / finishing using of the API on the core that the mo...
Definition sink_api.h:136
int(* on_unbind)(struct sof_sink *sink)
Definition sink_api.h:137
int(* set_alignment_constants)(struct sof_sink *sink, const uint32_t byte_align, const uint32_t frame_align_req)
OPTIONAL see comment for sink_set_alignment_constants.
Definition sink_api.h:121
int(* commit_buffer)(struct sof_sink *sink, size_t commit_size)
see comment of sink_commit_buffer()
Definition sink_api.h:84
int(* get_state)(struct sof_sink *sink)
OPTIONAL: get the state of the component consuming data from this sink.
Definition sink_api.h:97
int(* set_size)(struct sof_sink *sink, size_t size)
OPTIONAL see comment for sink_set_size.
Definition sink_api.h:129
uint32_t(* get_lft)(struct sof_sink *sink)
get latest feeding time for this sink, result is a number of microseconds since "NOW" where "now" mea...
Definition sink_api.h:90
int(* on_audio_format_set)(struct sof_sink *sink)
OPTIONAL: Notification to the sink implementation about changes in audio format.
Definition sink_api.h:108
size_t(* get_free_size)(struct sof_sink *sink)
see comment of sink_get_free_size()
Definition sink_api.h:73
int(* get_buffer)(struct sof_sink *sink, size_t req_size, void **data_ptr, void **buffer_start, size_t *buffer_size)
see comment of sink_get_buffer()
Definition sink_api.h:78
set of parameters describing audio stream this structure is shared between audio_stream....
Definition audio_stream.h:49
uint16_t align_shift_idx
the free/available bytes of sink/source right shift align_shift_idx, the result multiplied by align_f...
Definition audio_stream.h:75
enum sof_ipc_frame frame_fmt
Sample data format.
Definition audio_stream.h:52
uint32_t buffer_fmt
enum sof_ipc_buffer_format
Definition audio_stream.h:80
uint32_t pipeline_id
Definition audio_stream.h:51
uint16_t align_frame_cnt
align_frame_cnt indicates minimum number of frames that satisfies both byte align and frame align req...
Definition audio_stream.h:68
uint32_t rate
Number of data frames per second [Hz].
Definition audio_stream.h:55
bool overrun_permitted
indicates whether overrun is permitted
Definition audio_stream.h:77
enum sof_ipc_frame valid_sample_fmt
Definition audio_stream.h:53
uint16_t channels
Number of samples in each frame.
Definition audio_stream.h:56
uint32_t id
Definition audio_stream.h:50
internals of sink API.
Definition sink_api.h:141
struct processing_module * bound_module
minimum buffer space required by the module using sink it is module's OBS as declared in module bind ...
Definition sink_api.h:148
size_t num_of_bytes_processed
keeps number of bytes requested by get_buffer()
Definition sink_api.h:144
const struct sink_ops * ops
Definition sink_api.h:142
size_t requested_write_frag_size
operations interface
Definition sink_api.h:143
struct sof_audio_stream_params * audio_stream_params
Definition sink_api.h:149
size_t min_free_space
processed bytes counter
Definition sink_api.h:145