use gsm0808_speech_codec

Change-Id: Ie72afae98f8efc04231af6f9e71daa9e84562bca
This commit is contained in:
Neels Hofmeyr 2022-09-23 19:08:52 +02:00
parent cb39fcedda
commit 8d962f9a1d
1 changed files with 17 additions and 16 deletions

View File

@ -222,21 +222,7 @@ const struct codec_mapping *codec_mapping_by_speech_ver(enum gsm48_bcap_speech_v
return NULL;
}
const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec(const struct gsm0808_speech_codec *sc)
{
const struct codec_mapping *m;
foreach_codec_mapping(m) {
if (!m->has_gsm0808_speech_codec)
continue;
if (m->gsm0808_speech_codec.type == sc->type)
return m;
/* FIXME: evaluate cfg bits? */
}
return NULL;
}
const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec_type(enum gsm0808_speech_codec_type sct);
const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec_type(enum gsm0808_speech_codec_type sct, uint16_t cfg)
const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec_type(enum gsm0808_speech_codec_type sct)
{
const struct codec_mapping *m;
foreach_codec_mapping(m) {
@ -244,7 +230,22 @@ const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec_type(enum gsm0
continue;
if (m->gsm0808_speech_codec.type == sct)
return m;
/* TODO: evaluate cfg bits? */
}
return NULL;
}
const struct codec_mapping *codec_mapping_by_gsm0808_speech_codec(const struct gsm0808_speech_codec *sc)
{
const struct codec_mapping *m;
foreach_codec_mapping(m) {
if (!m->has_gsm0808_speech_codec)
continue;
if (m->gsm0808_speech_codec.type != sc->type)
continue;
/* Return only those where sc->cfg is a subset of m->gsm0808_speech_codec.cfg. */
if ((m->gsm0808_speech_codec.cfg & sc->cfg) != sc->cfg)
continue;
return m;
}
return NULL;
}