HAL: Converting PCM enum to AUDIO FORMAT enum

Add function for PCM FORMAT enum to AUDIO FORMAT enum conversion.

Change-Id: I0fc3c1adfe3aec6b309b790db8be537d50cee0ae
Signed-off-by: Raghu Bankapur <quic_rbankapu@quicinc.com>
This commit is contained in:
Raghu Bankapur 2022-12-01 09:30:00 +05:30
parent 08c0d1e4c1
commit 37cbf38ee5
2 changed files with 26 additions and 1 deletions

View File

@ -7188,7 +7188,7 @@ static size_t in_get_buffer_size(const struct audio_stream *stream)
if(in->usecase == USECASE_COMPRESS_VOIP_CALL)
return voice_extn_compress_voip_in_get_buffer_size(in);
else if(audio_extn_compr_cap_usecase_supported(in->usecase))
return audio_extn_compr_cap_get_buffer_size(in->config.format);
return audio_extn_compr_cap_get_buffer_size(pcm_format_to_audio_format(in->config.format));
else if(audio_extn_cin_attached_usecase(in))
return audio_extn_cin_get_buffer_size(in);

View File

@ -947,4 +947,29 @@ audio_patch_handle_t generate_patch_handle();
* and latch at last.
*/
static inline audio_format_t pcm_format_to_audio_format(const enum pcm_format format)
{
audio_format_t ret = AUDIO_FORMAT_INVALID;
switch(format) {
case PCM_FORMAT_S16_LE:
ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_16_BIT;
break;
case PCM_FORMAT_S32_LE:
ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_32_BIT;
break;
case PCM_FORMAT_S8:
ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_8_BIT;
break;
case PCM_FORMAT_S24_LE:
ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_8_24_BIT;
break;
case PCM_FORMAT_S24_3LE:
ret = (audio_format_t)AUDIO_FORMAT_PCM_SUB_24_BIT_PACKED;
break;
default:
break;
}
return ret;
}
#endif // QCOM_AUDIO_HW_H