diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-08-30 22:05:35 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2021-08-30 22:05:35 +0000 |
commit | 3374792448db161153da54a7b25c9b63941afccc (patch) | |
tree | 76a3f1ee81a835806626a5279759fd782df0fc9c | |
parent | 7af6952af79e3ca5a58878bd0548a653d68caac3 (diff) | |
parent | 59ab62c9cd847563a68ef88b81eec9014413f23a (diff) |
Snap for 7687840 from 59ab62c9cd847563a68ef88b81eec9014413f23a to t-keystone-qcom-release
Change-Id: Ibeb8515fe4f2b17289a333012b33348b52552763
-rw-r--r-- | compress.c | 17 | ||||
-rw-r--r-- | compress_plugin.c | 4 | ||||
-rw-r--r-- | include/tinycompress/tinycompress.h | 11 |
3 files changed, 31 insertions, 1 deletions
@@ -622,6 +622,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(¶ms.codec, codec, sizeof(params.codec)); + + if (compress->ops->ioctl(compress->data, SNDRV_COMPRESS_SET_PARAMS, ¶ms)) + 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) { diff --git a/compress_plugin.c b/compress_plugin.c index 7a5538d..eac0f38 100644 --- a/compress_plugin.c +++ b/compress_plugin.c @@ -84,7 +84,9 @@ 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) return -EBADFD; if (params->buffer.fragment_size == 0 || diff --git a/include/tinycompress/tinycompress.h b/include/tinycompress/tinycompress.h index 62dcade..97b305f 100644 --- a/include/tinycompress/tinycompress.h +++ b/include/tinycompress/tinycompress.h @@ -323,6 +323,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, |