Skip to content

Commit

Permalink
ALSA: compress: Add output rate and output format support
Browse files Browse the repository at this point in the history
Add 'pcm_format' for struct snd_codec, add 'pcm_formats' for
struct snd_codec_desc, these are used for accelerator usage.

Current accelerator example is sample rate converter (SRC).
Define struct snd_codec_desc_src for descript minmum and maxmum
sample rates. And add 'src_d' in union snd_codec_options
structure. These are mainly used for capbility query.

Signed-off-by: Jaroslav Kysela <perex@perex.cz>
Signed-off-by: Shengjiu Wang <shengjiu.wang@nxp.com>
Acked-by: Jaroslav Kysela <perex@perex.cz>
Acked-by: Vinod Koul <vkoul@kernel.org>
Link: https://patch.msgid.link/20241212074509.3445859-2-shengjiu.wang@nxp.com
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Shengjiu Wang authored and Mark Brown committed Dec 13, 2024
1 parent fac04ef commit f4425e3
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions include/uapi/sound/compress_params.h
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,14 @@ union snd_codec_options {
struct snd_dec_wma wma_d;
struct snd_dec_alac alac_d;
struct snd_dec_ape ape_d;
struct {
__u32 out_sample_rate;
} src_d;
} __attribute__((packed, aligned(4)));

struct snd_codec_desc_src {
__u32 out_sample_rate_min;
__u32 out_sample_rate_max;
} __attribute__((packed, aligned(4)));

/** struct snd_codec_desc - description of codec capabilities
Expand All @@ -347,6 +355,9 @@ union snd_codec_options {
* @modes: Supported modes. See SND_AUDIOMODE defines
* @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines
* @min_buffer: Minimum buffer size handled by codec implementation
* @pcm_formats: Output (for decoders) or input (for encoders)
* PCM formats (required to accel mode, 0 for other modes)
* @u_space: union space (for codec dependent data)
* @reserved: reserved for future use
*
* This structure provides a scalar value for profiles, modes and stream
Expand All @@ -370,7 +381,12 @@ struct snd_codec_desc {
__u32 modes;
__u32 formats;
__u32 min_buffer;
__u32 reserved[15];
__u32 pcm_formats;
union {
__u32 u_space[6];
struct snd_codec_desc_src src;
} __attribute__((packed, aligned(4)));
__u32 reserved[8];
} __attribute__((packed, aligned(4)));

/** struct snd_codec
Expand All @@ -395,6 +411,8 @@ struct snd_codec_desc {
* @align: Block alignment in bytes of an audio sample.
* Only required for PCM or IEC formats.
* @options: encoder-specific settings
* @pcm_format: Output (for decoders) or input (for encoders)
* PCM formats (required to accel mode, 0 for other modes)
* @reserved: reserved for future use
*/

Expand All @@ -411,7 +429,8 @@ struct snd_codec {
__u32 format;
__u32 align;
union snd_codec_options options;
__u32 reserved[3];
__u32 pcm_format;
__u32 reserved[2];
} __attribute__((packed, aligned(4)));

#endif

0 comments on commit f4425e3

Please sign in to comment.