Uh oh!
There was an error while loading. Please reload this page.
Module: Audio: Add s16/32 source_get_data and sink_get_buffer - #10012
Conversation
815e093 to
51987d2CompareThere was a problem hiding this comment.
Pull Request Overview
This PR adds new APIs for retrieving audio data and buffers in 16-bit and 32-bit sample formats, simplifying pointer arithmetic by returning the sample count instead of byte counts.
- Adds source_get_data_s16 and source_get_data_s32 in source_api.c along with corresponding EXPORT_SYMBOL declarations.
- Adds sink_get_buffer_s16 and sink_get_buffer_s32 in sink_api.c along with updated header documentation.
- Updates template components to use the new APIs and improve const-correctness in pointer handling.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/module/audio/source_api.c | Added new s16 and s32 variants for source data retrieval using bit shifts. |
| src/module/audio/sink_api.c | Added new s16 and s32 variants for sink buffer retrieval using bit shifts. |
| src/include/module/audio/source_api.h | Updated header with new function prototypes and detailed API documentation. |
| src/include/module/audio/sink_api.h | Updated header with new function prototypes and detailed API documentation. |
| src/audio/template_comp/template-generic.c | Refactored to use the new APIs and improved const-correctness in data pointers. |
singalsu
commented
May 16, 2025
@marcinszkudlinski What do you think of this addition? I think it would simplify converting (most of) the modules to the new interface. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
51987d2 to
8b17b47Compare| ret = sink_get_buffer(sink, req_size, (void **)data_ptr, (void **)buffer_start, | ||
| &buffer_size); | ||
| if (!ret) |
There was a problem hiding this comment.
ouch... shouldn't this be the other way round?
There was a problem hiding this comment.
Oops, yes. It stopped working with the control enabled... I should never push a patch blindly without local test. It's fixed in this push.
This patch adds helper functions source_get_data_s16(), source_get_data_s32(), sink_get_buffer_s16(), and sink_get_buffer_s32(). The buffer_samples as number of samples simplifies the processing function with no division or shift needed to convert buffer size in bytes to samples. Also the int16_t and int32_t typed arguments for data pointer and buffer start avoid type casts in a typical simple processing function. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
This patch modifies the template component to use in process functions the source_get_data_s16/32() and sink_get_buffer_s16/32() functions. Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
8b17b47 to
48f9f0bCompare
No description provided.