Compare commits

...

3 commits

Author SHA1 Message Date
Ritu Sharma
1eb2e5bf3b tinycompress: plugin: Set codec params in SETUP state
Allow codec params to be set in COMPRESS_PLUG_SETUP state as well.

CRs-Fixed: 3023915

Change-Id: Ic1f93628c9fa325653cbd65a0cc827310276f81d
2024-09-07 21:36:10 +00:00
Ritu Sharma
14215fe64e tinycompress: Add support for compress_set_codec_params API
Add support for compress_set_codec_params API which is used
to send codec parameters from clients directly.

CRs-Fixed: 2926417

Change-Id: I83f52378e288f15bccfc8a7798d33943a02d5e52
2024-09-07 21:36:06 +00:00
Michael Bestas
70676065b0 tinycompress: Conditionally enable extended compress format
Squashed with:

Author: LuK1337 <priv.luk@gmail.com>
Date:   Thu Oct 15 17:12:12 2020 +0200

    tinycompress: Convert lineage product variables to soong config variables

    Change-Id: I5c0d32b9def67979c74a49d9dc03415a5cc4d2d1

Change-Id: Iac589fcc06bd7cea544475f7d82eaf4af8af2348
2024-09-07 21:36:02 +00:00
4 changed files with 33 additions and 1 deletions

View file

@ -21,6 +21,7 @@ license {
cc_library_shared {
name: "libtinycompress",
defaults: ["extended_compress_format_defaults"],
vendor: true,
cflags: [

View file

@ -619,6 +619,23 @@ int compress_wait(struct compress *compress, int timeout_ms)
return oops(compress, EIO, "poll signalled unhandled event");
}
int compress_set_codec_params(struct compress *compress,
struct snd_codec *codec) {
struct snd_compr_params params;
if (!is_compress_running(compress))
return oops(compress, ENODEV, "device not ready");
params.buffer.fragment_size = compress->config->fragment_size;
params.buffer.fragments = compress->config->fragments;
memcpy(&params.codec, codec, sizeof(params.codec));
if (compress->ops->ioctl(compress->data, SNDRV_COMPRESS_SET_PARAMS, &params))
return oops(compress, errno, "cannot set device");
return 0;
}
#ifdef ENABLE_EXTENDED_COMPRESS_FORMAT
int compress_get_metadata(struct compress *compress,
struct snd_compr_metadata *mdata) {

View file

@ -84,7 +84,10 @@ static int compress_plug_set_params(struct compress_plug_data *plug_data,
struct compress_plugin *plugin = plug_data->plugin;
int rc;
if (plugin->state != COMPRESS_PLUG_STATE_OPEN)
if (plugin->state == COMPRESS_PLUG_STATE_RUNNING)
return plugin->ops->set_params(plugin, params);
else if (plugin->state != COMPRESS_PLUG_STATE_OPEN &&
plugin->state != COMPRESS_PLUG_STATE_SETUP)
return -EBADFD;
if (params->buffer.fragment_size == 0 ||

View file

@ -309,6 +309,17 @@ const char *compress_get_error(struct compress *compress);
/* utility functions */
unsigned int compress_get_alsa_rate(unsigned int rate);
/*
* compress_set_codec_params: set codec config intended for next track
* if DSP has support to switch CODEC config during gapless playback
* This API is expected to be called after compress_next_track is called
* return 0 on success, negative on error
*
* @compress: compress stream for which metadata has to set
* @codec: codec configuration for next track
*/
int compress_set_codec_params(struct compress *compress, struct snd_codec *codec);
#ifdef ENABLE_EXTENDED_COMPRESS_FORMAT
/* set metadata */
int compress_set_metadata(struct compress *compress,