Skip to content

Commit

Permalink
int (*comp_func)( - final step.
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinszkudlinski committed Oct 18, 2024
1 parent e74c8e7 commit c17bdb7
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 40 deletions.
28 changes: 14 additions & 14 deletions src/audio/pipeline/pipeline-params.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,20 @@ static int pipeline_comp_params_neg(struct comp_dev *current,
err = audio_buffer_set_params(calling_buf, &ppl_data->params->params,
BUFFER_UPDATE_FORCE);
break;
// default:
// /* return 0 if params matches */
//msz if (!buffer_params_match(calling_buf,
// &ppl_data->params->params,
// BUFF_PARAMS_FRAME_FMT |
// BUFF_PARAMS_RATE)) {
// /*
// * parameters conflict with an active pipeline,
// * drop an error and reject the .params() command.
// */
// pipe_err(current->pipeline,
// "pipeline_comp_params_neg(): params conflict with existing active pipeline!");
// err = -EINVAL;
// }
default:
/* return 0 if params matches */
if (!audio_buffer_params_match(calling_buf,
&ppl_data->params->params,
BUFF_PARAMS_FRAME_FMT |
BUFF_PARAMS_RATE)) {
/*
* parameters conflict with an active pipeline,
* drop an error and reject the .params() command.
*/
pipe_err(current->pipeline,
"pipeline_comp_params_neg(): params conflict with existing active pipeline!");
err = -EINVAL;
}
}
return err;
}
Expand Down
28 changes: 14 additions & 14 deletions src/include/sof/audio/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,14 +168,13 @@ struct buffer_cb_free {

static inline struct sof_audio_buffer *buffer_from_list(struct list_item *clist, int dir)
{
return NULL;
//msz
}
struct comp_buffer *comp_buffer =
((dir) == PPL_DIR_DOWNSTREAM ?
container_of(clist, struct comp_buffer, source_list) :
container_of(clist, struct comp_buffer, sink_list));

//#define buffer_from_list(ptr, dir) \
// ((dir) == PPL_DIR_DOWNSTREAM ? \
// container_of(ptr, struct comp_buffer, source_list) : \
// container_of(ptr, struct comp_buffer, sink_list))
return comp_buffer ? &comp_buffer->audio_buffer : NULL;
}

#define buffer_set_cb(buffer, func, data, type) \
do { \
Expand Down Expand Up @@ -261,14 +260,15 @@ void buffer_attach(struct comp_buffer *buffer, struct list_item *head, int dir);
*/
void buffer_detach(struct comp_buffer *buffer, struct list_item *head, int dir);

static inline struct comp_dev *buffer_get_comp(struct sof_audio_buffer *buffer, int dir)
static inline struct comp_dev *buffer_get_comp(struct sof_audio_buffer *audio_buffer, int dir)
{
// struct comp_dev *comp = (dir == PPL_DIR_DOWNSTREAM) ?
// comp_buffer_get_sink_component(buffer) :
// comp_buffer_get_source_component(buffer);
// return comp;
return NULL;
//msz
struct comp_buffer *comp_buffer =
container_of(audio_buffer, struct comp_buffer, audio_buffer);
struct comp_dev *comp = (dir == PPL_DIR_DOWNSTREAM) ?
comp_buffer_get_sink_component(comp_buffer) :
comp_buffer_get_source_component(comp_buffer);

return comp;
}

static inline uint32_t buffer_pipeline_id(const struct comp_buffer *buffer)
Expand Down
26 changes: 14 additions & 12 deletions src/ipc/ipc-helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,18 @@ int comp_verify_params(struct comp_dev *dev, uint32_t flag,
* has only one sink or one source buffer.
*/
if (list_is_empty(source_list) != list_is_empty(sink_list)) {
// if (list_is_empty(sink_list))
// buf = list_first_item(source_list,
// struct comp_buffer,
// sink_list);
// else
// buf = list_first_item(sink_list,
// struct comp_buffer,
// source_list);
//msz

struct comp_buffer *comp_buffer;

if (list_is_empty(sink_list))
comp_buffer = list_first_item(source_list,
struct comp_buffer,
sink_list);
else
comp_buffer = list_first_item(sink_list,
struct comp_buffer,
source_list);

buf = &comp_buffer->audio_buffer;
/* update specific pcm parameter with buffer parameter if
* specific flag is set.
*/
Expand All @@ -156,7 +158,7 @@ int comp_verify_params(struct comp_dev *dev, uint32_t flag,
audio_buffer_set_params(buf, params, BUFFER_UPDATE_FORCE);

/* set component period frames */
//msz component_set_nearest_period_frames(dev, audio_stream_get_rate(&buf->stream));
component_set_nearest_period_frames(dev, audio_buffer_get_rate(buf));
} else {
/* for other components we iterate over all downstream buffers
* (for playback) or upstream buffers (for capture).
Expand All @@ -165,7 +167,7 @@ int comp_verify_params(struct comp_dev *dev, uint32_t flag,

list_for_item(clist, buffer_list) {
buf = buffer_from_list(clist, dir);
// comp_update_params(flag, params, buf);
comp_update_params(flag, params, buf);
audio_buffer_set_params(buf, params, BUFFER_UPDATE_FORCE);
}

Expand Down

0 comments on commit c17bdb7

Please sign in to comment.