13#ifndef __MODULE_AUDIO_SOURCE_API_H__
14#define __MODULE_AUDIO_SOURCE_API_H__
81 void const **data_ptr,
void const **buffer_start,
size_t *buffer_size);
118 const uint32_t byte_align,
119 const uint32_t frame_align_req);
226 void const **buffer_start,
size_t *buffer_size);
244 int16_t
const **buffer_start,
size_t *buffer_samples);
262 int32_t
const **buffer_start,
size_t *buffer_samples);
398 return ROUND_UP(frames, align);
408 return ROUND_DOWN(frames, align);
418 return ROUND_DOWN(frames + (align >> 1), align);
sof_audio_buffer_state
Define states of an audio stream buffer connecting two components.
Definition audio_stream.h:35
static unsigned int source_get_channels(struct sof_source *source)
Definition source_api.h:180
static uint32_t source_align_frames_round_up(struct sof_source *source, uint32_t frames)
Definition source_api.h:391
static int source_bind(struct sof_source *source, struct processing_module *module)
hook to be called when a module connects to the API
Definition source_api.h:325
static uint32_t source_get_id(struct sof_source *source)
Definition source_api.h:310
size_t source_get_data_frames_available(struct sof_source *source)
Retrieves size of available data (in frames) return number of frames that are available for immediate...
static unsigned int source_get_rate(struct sof_source *source)
Definition source_api.h:295
static int source_unbind(struct sof_source *source)
hook to be called when a module disconnects from the API
Definition source_api.h:346
static enum sof_ipc_frame source_get_frm_fmt(struct sof_source *source)
Definition source_api.h:175
int source_get_data(struct sof_source *source, size_t req_size, void const **data_ptr, void const **buffer_start, size_t *buffer_size)
Retrieves a fragment of circular data to be used by the caller (to read) After calling get_data,...
static uint32_t source_align_frames_round_nearest(struct sof_source *source, uint32_t frames)
Definition source_api.h:411
int source_set_size(struct sof_source *source, size_t size)
Resize the buffer backing the source.
size_t source_get_frame_bytes(struct sof_source *source)
get size of a single audio frame (in bytes)
static struct processing_module * source_get_bound_module(struct sof_source *source)
Definition source_api.h:362
int source_get_data_s16(struct sof_source *source, size_t req_size, int16_t const **data_ptr, int16_t const **buffer_start, size_t *buffer_samples)
Retrieves a fragment of circular data (to read)
static uint32_t source_get_pipeline_id(struct sof_source *source)
Definition source_api.h:315
static size_t source_get_aligned_frames_available(struct sof_source *source)
Retrieves number of available data frames aligned to the alignment constants set by source_set_alignm...
Definition source_api.h:169
static uint32_t source_get_buffer_fmt(struct sof_source *source)
Definition source_api.h:300
static uint32_t source_align_frames_round_down(struct sof_source *source, uint32_t frames)
Definition source_api.h:401
int source_release_data(struct sof_source *source, size_t free_size)
Releases fragment previously obtained by source_get_data() Once called, the data are no longer availa...
static size_t source_get_data_available(struct sof_source *source)
Public functions.
Definition source_api.h:159
static enum sof_ipc_frame source_get_valid_fmt(struct sof_source *source)
set of functions for retrieve audio parameters
Definition source_api.h:290
static size_t source_get_min_available(struct sof_source *source)
Definition source_api.h:305
static enum sof_audio_buffer_state source_get_state(const struct sof_source *source)
Definition source_api.h:367
int source_get_data_s32(struct sof_source *source, size_t req_size, int32_t const **data_ptr, int32_t const **buffer_start, size_t *buffer_samples)
Retrieves a fragment of circular data (to read)
static int source_get_comp_state(struct sof_source *source)
get the state of the component producing data to this source
Definition source_api.h:383
sof_ipc_frame
Definition stream.h:16
Fixed-point arithmetic, saturation, rounding, and number format conversions.
Audio Stream API definition.
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
enum sof_audio_buffer_state state
audio stream state
Definition audio_stream.h:84
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 source API.
Definition source_api.h:137
const struct source_ops * ops
Definition source_api.h:138
size_t num_of_bytes_processed
Definition source_api.h:140
struct sof_audio_stream_params * audio_stream_params
Definition source_api.h:146
size_t requested_read_frag_size
Definition source_api.h:139
struct processing_module * bound_module
Definition source_api.h:145
size_t min_available
Definition source_api.h:141
this is a definition of internals of source API
Definition source_api.h:71
int(* get_state)(struct sof_source *source)
OPTIONAL: get the state of the component producing data to this source.
Definition source_api.h:93
int(* set_size)(struct sof_source *source, size_t size)
OPTIONAL see comment for source_set_size.
Definition source_api.h:125
int(* on_unbind)(struct sof_source *source)
Definition source_api.h:133
int(* audio_set_ipc_params)(struct sof_source *source, struct sof_ipc_stream_params *params, bool force_update)
OPTIONAL see source_set_params comments.
Definition source_api.h:110
int(* on_bind)(struct sof_source *source, struct processing_module *module)
OPTIONAL events called when a module is starting / finishing using of the API on the core that the mo...
Definition source_api.h:132
int(* get_data)(struct sof_source *source, size_t req_size, void const **data_ptr, void const **buffer_start, size_t *buffer_size)
see comment of source_get_data_available()
Definition source_api.h:80
int(* set_alignment_constants)(struct sof_source *source, const uint32_t byte_align, const uint32_t frame_align_req)
OPTIONAL see comment for source_set_alignment_constants.
Definition source_api.h:117
size_t(* get_data_available)(struct sof_source *source)
see comment of source_get_data_available()
Definition source_api.h:75
int(* release_data)(struct sof_source *source, size_t free_size)
see comment of source_release_data()
Definition source_api.h:86
int(* on_audio_format_set)(struct sof_source *source)
OPTIONAL: Notification to the source implementation about changes in audio format.
Definition source_api.h:104