cosmetic: rename to sdp_audio_codecs_foreach()
Better match the pattern of sdp_audio_codecs_* instead of having foreach_ in the front. Prepare for prepending osmo_ some day, because I plan to move the SDP API to a separate library. Change-Id: Ia96190e0bdb513886663be1c8c12be3b403b71c9
This commit is contained in:
parent
589bfe5cb6
commit
95681a9adf
|
@ -41,8 +41,8 @@ struct sdp_msg {
|
||||||
struct csd_bs_list bearer_services;
|
struct csd_bs_list bearer_services;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define foreach_sdp_audio_codec(/* struct sdp_audio_codec* */ CODEC, \
|
#define sdp_audio_codecs_foreach(/* struct sdp_audio_codec* */ CODEC, \
|
||||||
/* struct sdp_audio_codecs* */ AC) \
|
/* struct sdp_audio_codecs* */ AC) \
|
||||||
for (CODEC = (AC)->codec; \
|
for (CODEC = (AC)->codec; \
|
||||||
(CODEC - (AC)->codec) < OSMO_MIN((AC)->count, ARRAY_SIZE((AC)->codec)); \
|
(CODEC - (AC)->codec) < OSMO_MIN((AC)->count, ARRAY_SIZE((AC)->codec)); \
|
||||||
CODEC++)
|
CODEC++)
|
||||||
|
|
|
@ -371,7 +371,7 @@ int sdp_audio_codecs_to_bearer_cap(struct gsm_mncc_bearer_cap *bearer_cap, const
|
||||||
const struct sdp_audio_codec *codec;
|
const struct sdp_audio_codec *codec;
|
||||||
int added = 0;
|
int added = 0;
|
||||||
|
|
||||||
foreach_sdp_audio_codec(codec, ac) {
|
sdp_audio_codecs_foreach(codec, ac) {
|
||||||
added += sdp_audio_codec_add_to_bearer_cap(bearer_cap, codec);
|
added += sdp_audio_codec_add_to_bearer_cap(bearer_cap, codec);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,7 +439,7 @@ void sdp_audio_codecs_to_speech_codec_list(struct gsm0808_speech_codec_list *scl
|
||||||
|
|
||||||
*scl = (struct gsm0808_speech_codec_list){};
|
*scl = (struct gsm0808_speech_codec_list){};
|
||||||
|
|
||||||
foreach_sdp_audio_codec(codec, ac) {
|
sdp_audio_codecs_foreach(codec, ac) {
|
||||||
int rc = sdp_audio_codec_to_speech_codec_list(scl, codec);
|
int rc = sdp_audio_codec_to_speech_codec_list(scl, codec);
|
||||||
if (rc == -ENOSPC)
|
if (rc == -ENOSPC)
|
||||||
break;
|
break;
|
||||||
|
@ -472,7 +472,7 @@ int sdp_audio_codecs_to_gsm0808_channel_type(struct gsm0808_channel_type *ct, co
|
||||||
.ch_indctr = GSM0808_CHAN_SPEECH,
|
.ch_indctr = GSM0808_CHAN_SPEECH,
|
||||||
};
|
};
|
||||||
|
|
||||||
foreach_sdp_audio_codec(codec, ac) {
|
sdp_audio_codecs_foreach(codec, ac) {
|
||||||
const struct codec_mapping *m;
|
const struct codec_mapping *m;
|
||||||
int i;
|
int i;
|
||||||
bool dup;
|
bool dup;
|
||||||
|
|
|
@ -322,7 +322,7 @@ static int rtp_stream_do_mgcp_verb(struct rtp_stream *rtps, enum mgcp_verb verb,
|
||||||
* reasons we still need to translate to a struct mgcp_conn_peer representation to send it. */
|
* reasons we still need to translate to a struct mgcp_conn_peer representation to send it. */
|
||||||
struct sdp_audio_codec *codec;
|
struct sdp_audio_codec *codec;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
foreach_sdp_audio_codec(codec, &rtps->codecs) {
|
sdp_audio_codecs_foreach(codec, &rtps->codecs) {
|
||||||
const struct codec_mapping *m = codec_mapping_by_subtype_name(codec->subtype_name);
|
const struct codec_mapping *m = codec_mapping_by_subtype_name(codec->subtype_name);
|
||||||
if (!m) {
|
if (!m) {
|
||||||
LOG_RTPS(rtps, LOGL_ERROR, "Cannot map codec '%s' to MGCP: codec is unknown\n",
|
LOG_RTPS(rtps, LOGL_ERROR, "Cannot map codec '%s' to MGCP: codec is unknown\n",
|
||||||
|
|
|
@ -102,9 +102,9 @@ int sdp_audio_codecs_cmp(const struct sdp_audio_codecs *a, const struct sdp_audi
|
||||||
return cmp;
|
return cmp;
|
||||||
|
|
||||||
/* See if each codec in a is also present in b */
|
/* See if each codec in a is also present in b */
|
||||||
foreach_sdp_audio_codec(codec_a, a) {
|
sdp_audio_codecs_foreach(codec_a, a) {
|
||||||
bool match_found = false;
|
bool match_found = false;
|
||||||
foreach_sdp_audio_codec(codec_b, b) {
|
sdp_audio_codecs_foreach(codec_b, b) {
|
||||||
if (!sdp_audio_codec_cmp(codec_a, codec_b, cmp_fmtp, cmp_payload_type)) {
|
if (!sdp_audio_codec_cmp(codec_a, codec_b, cmp_fmtp, cmp_payload_type)) {
|
||||||
match_found = true;
|
match_found = true;
|
||||||
break;
|
break;
|
||||||
|
@ -175,7 +175,7 @@ struct sdp_audio_codec *sdp_audio_codecs_by_payload_type(struct sdp_audio_codecs
|
||||||
bool create)
|
bool create)
|
||||||
{
|
{
|
||||||
struct sdp_audio_codec *codec;
|
struct sdp_audio_codec *codec;
|
||||||
foreach_sdp_audio_codec(codec, ac) {
|
sdp_audio_codecs_foreach(codec, ac) {
|
||||||
if (codec->payload_type == payload_type)
|
if (codec->payload_type == payload_type)
|
||||||
return codec;
|
return codec;
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ struct sdp_audio_codec *sdp_audio_codecs_by_payload_type(struct sdp_audio_codecs
|
||||||
struct sdp_audio_codec *sdp_audio_codecs_by_descr(struct sdp_audio_codecs *ac, const struct sdp_audio_codec *codec)
|
struct sdp_audio_codec *sdp_audio_codecs_by_descr(struct sdp_audio_codecs *ac, const struct sdp_audio_codec *codec)
|
||||||
{
|
{
|
||||||
struct sdp_audio_codec *i;
|
struct sdp_audio_codec *i;
|
||||||
foreach_sdp_audio_codec(i, ac) {
|
sdp_audio_codecs_foreach(i, ac) {
|
||||||
if (!sdp_audio_codec_cmp(i, codec, false, false))
|
if (!sdp_audio_codec_cmp(i, codec, false, false))
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
@ -218,7 +218,7 @@ int sdp_audio_codecs_remove(struct sdp_audio_codecs *ac, const struct sdp_audio_
|
||||||
|
|
||||||
/* Move all following entries one up */
|
/* Move all following entries one up */
|
||||||
ac->count--;
|
ac->count--;
|
||||||
foreach_sdp_audio_codec(i, ac) {
|
sdp_audio_codecs_foreach(i, ac) {
|
||||||
if (i < codec)
|
if (i < codec)
|
||||||
continue;
|
continue;
|
||||||
*i = *(i+1);
|
*i = *(i+1);
|
||||||
|
@ -261,12 +261,12 @@ int sdp_msg_to_sdp_str_buf(char *dst, size_t dst_size, const struct sdp_msg *sdp
|
||||||
sdp->rtp.port);
|
sdp->rtp.port);
|
||||||
|
|
||||||
/* Append all payload type numbers to 'm=audio <port> RTP/AVP 3 4 112' line */
|
/* Append all payload type numbers to 'm=audio <port> RTP/AVP 3 4 112' line */
|
||||||
foreach_sdp_audio_codec(codec, &sdp->audio_codecs)
|
sdp_audio_codecs_foreach(codec, &sdp->audio_codecs)
|
||||||
OSMO_STRBUF_PRINTF(sb, " %d", codec->payload_type);
|
OSMO_STRBUF_PRINTF(sb, " %d", codec->payload_type);
|
||||||
OSMO_STRBUF_PRINTF(sb, "\r\n");
|
OSMO_STRBUF_PRINTF(sb, "\r\n");
|
||||||
|
|
||||||
/* Add details for all codecs */
|
/* Add details for all codecs */
|
||||||
foreach_sdp_audio_codec(codec, &sdp->audio_codecs) {
|
sdp_audio_codecs_foreach(codec, &sdp->audio_codecs) {
|
||||||
if (!sdp_audio_codec_is_set(codec))
|
if (!sdp_audio_codec_is_set(codec))
|
||||||
continue;
|
continue;
|
||||||
OSMO_STRBUF_PRINTF(sb, "a=rtpmap:%d %s/%d\r\n", codec->payload_type, codec->subtype_name,
|
OSMO_STRBUF_PRINTF(sb, "a=rtpmap:%d %s/%d\r\n", codec->payload_type, codec->subtype_name,
|
||||||
|
@ -624,7 +624,7 @@ int sdp_audio_codecs_to_str_buf(char *buf, size_t buflen, const struct sdp_audio
|
||||||
const struct sdp_audio_codec *codec;
|
const struct sdp_audio_codec *codec;
|
||||||
if (!ac->count)
|
if (!ac->count)
|
||||||
OSMO_STRBUF_PRINTF(sb, "(no-codecs)");
|
OSMO_STRBUF_PRINTF(sb, "(no-codecs)");
|
||||||
foreach_sdp_audio_codec(codec, ac) {
|
sdp_audio_codecs_foreach(codec, ac) {
|
||||||
bool first = (codec == ac->codec);
|
bool first = (codec == ac->codec);
|
||||||
if (!first)
|
if (!first)
|
||||||
OSMO_STRBUF_PRINTF(sb, ",");
|
OSMO_STRBUF_PRINTF(sb, ",");
|
||||||
|
|
|
@ -1214,7 +1214,7 @@ static bool validate_sdp(const char *func, const char *desc,
|
||||||
}
|
}
|
||||||
|
|
||||||
expect_pos = expected_codecs;
|
expect_pos = expected_codecs;
|
||||||
foreach_sdp_audio_codec(codec, &sdp.audio_codecs) {
|
sdp_audio_codecs_foreach(codec, &sdp.audio_codecs) {
|
||||||
char subtype_name_wo_pt[16];
|
char subtype_name_wo_pt[16];
|
||||||
if (!*expect_pos) {
|
if (!*expect_pos) {
|
||||||
BTW("%s: %s: ERROR: did not expect %s", func, desc, codec->subtype_name);
|
BTW("%s: %s: ERROR: did not expect %s", func, desc, codec->subtype_name);
|
||||||
|
|
Loading…
Reference in New Issue