[asterisk-commits] mjordan: branch group/media_formats-reviewed-trunk r417801 - in /team/group/m...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Jul 3 06:42:26 CDT 2014
Author: mjordan
Date: Thu Jul 3 06:42:14 2014
New Revision: 417801
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=417801
Log:
Media formats: Rename certain functions in the API
This patch performs the renaming discussed on the asterisk-dev list [1]. It
also includes some parts of Corey Farrell's memory leak cleanups as well.
[1] http://lists.digium.com/pipermail/asterisk-dev/2014-June/068133.html
The great renaming:
* ast_format_cap_add => ast_format_cap_append
* ast_format_cap_add_all_by_type => ast_format_cap_append_all_by_type
* ast_parse_allow_disallow => ast_format_cap_update_by_allow_disallow
* ast_cap_remove_bytype => ast_format_cap_remove_by_type
* ast_getformatname_multiple => ast_format_cap_get_names, and now uses an
ast_str ** instead of a char *buf/size_t
len
* ast_format_sdp_generate => ast_format_generate_sdp_fmtp
* ast_format_sdp_parse => ast_format_parse_sdp_fmtp
Functions removed:
* ast_format_compatibility_get_original_id - no longer used
Note that chan_h323, chan_gtalk, and chan_jingle did not get all of the
re-namings (particularly ast_getformatname_multiple =>
ast_format_cap_get_names), and will not compile with this patch. These modules
should be removed, per the discussion on the -dev list.
Functions that support REF_DEBUG:
* ast_format_cap_alloc
* ast_format_cap_append
* ast_format_cache_get
Memory leak cleanups (many of which came from Corey's patches):
* Channel technology struct capabilities leak their format capabilities on off
nominal exit paths (chan_motif, chan_pjsip, chan_unistim, chan_skinny)
* Format capabilities leak in chan_pjsip_new nominal path
* Leak of nativeformats format_cap in nominal path of channel.c's
ast_channel_alloc
* Leak of format_cap in channel.c's set_format
* Leak of format_cap in channel.c's ast_request
* Usage of ao2_replace in translate.c to avoid overwriting a ref
* Clean up of frame format cache in RTP instance in res_rtp_asterisk
destructor
Unit tests
* Remove test for ast_getformatname_multiple, add test for
ast_format_cap_get_names
Review: https://reviewboard.asterisk.org/r/3689/
ASTERISK-23715 #close
Modified:
team/group/media_formats-reviewed-trunk/addons/chan_mobile.c
team/group/media_formats-reviewed-trunk/addons/chan_ooh323.c
team/group/media_formats-reviewed-trunk/apps/app_confbridge.c
team/group/media_formats-reviewed-trunk/apps/app_dumpchan.c
team/group/media_formats-reviewed-trunk/apps/app_meetme.c
team/group/media_formats-reviewed-trunk/apps/app_originate.c
team/group/media_formats-reviewed-trunk/apps/app_voicemail.c
team/group/media_formats-reviewed-trunk/apps/confbridge/conf_chan_record.c
team/group/media_formats-reviewed-trunk/bridges/bridge_holding.c
team/group/media_formats-reviewed-trunk/bridges/bridge_native_rtp.c
team/group/media_formats-reviewed-trunk/bridges/bridge_simple.c
team/group/media_formats-reviewed-trunk/bridges/bridge_softmix.c
team/group/media_formats-reviewed-trunk/channels/chan_alsa.c
team/group/media_formats-reviewed-trunk/channels/chan_bridge_media.c
team/group/media_formats-reviewed-trunk/channels/chan_console.c
team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c
team/group/media_formats-reviewed-trunk/channels/chan_gtalk.c
team/group/media_formats-reviewed-trunk/channels/chan_h323.c
team/group/media_formats-reviewed-trunk/channels/chan_iax2.c
team/group/media_formats-reviewed-trunk/channels/chan_jingle.c
team/group/media_formats-reviewed-trunk/channels/chan_mgcp.c
team/group/media_formats-reviewed-trunk/channels/chan_misdn.c
team/group/media_formats-reviewed-trunk/channels/chan_motif.c
team/group/media_formats-reviewed-trunk/channels/chan_multicast_rtp.c
team/group/media_formats-reviewed-trunk/channels/chan_nbs.c
team/group/media_formats-reviewed-trunk/channels/chan_oss.c
team/group/media_formats-reviewed-trunk/channels/chan_phone.c
team/group/media_formats-reviewed-trunk/channels/chan_pjsip.c
team/group/media_formats-reviewed-trunk/channels/chan_sip.c
team/group/media_formats-reviewed-trunk/channels/chan_skinny.c
team/group/media_formats-reviewed-trunk/channels/chan_unistim.c
team/group/media_formats-reviewed-trunk/channels/dahdi/bridge_native_dahdi.c
team/group/media_formats-reviewed-trunk/channels/pjsip/dialplan_functions.c
team/group/media_formats-reviewed-trunk/funcs/func_channel.c
team/group/media_formats-reviewed-trunk/include/asterisk/format.h
team/group/media_formats-reviewed-trunk/include/asterisk/format_cache.h
team/group/media_formats-reviewed-trunk/include/asterisk/format_cap.h
team/group/media_formats-reviewed-trunk/include/asterisk/format_compatibility.h
team/group/media_formats-reviewed-trunk/include/asterisk/rtp_engine.h
team/group/media_formats-reviewed-trunk/main/bridge.c
team/group/media_formats-reviewed-trunk/main/bridge_basic.c
team/group/media_formats-reviewed-trunk/main/ccss.c
team/group/media_formats-reviewed-trunk/main/channel.c
team/group/media_formats-reviewed-trunk/main/cli.c
team/group/media_formats-reviewed-trunk/main/config_options.c
team/group/media_formats-reviewed-trunk/main/core_local.c
team/group/media_formats-reviewed-trunk/main/core_unreal.c
team/group/media_formats-reviewed-trunk/main/dial.c
team/group/media_formats-reviewed-trunk/main/file.c
team/group/media_formats-reviewed-trunk/main/format.c
team/group/media_formats-reviewed-trunk/main/format_cache.c
team/group/media_formats-reviewed-trunk/main/format_cap.c
team/group/media_formats-reviewed-trunk/main/format_compatibility.c
team/group/media_formats-reviewed-trunk/main/manager.c
team/group/media_formats-reviewed-trunk/main/media_index.c
team/group/media_formats-reviewed-trunk/main/rtp_engine.c
team/group/media_formats-reviewed-trunk/main/sorcery.c
team/group/media_formats-reviewed-trunk/main/translate.c
team/group/media_formats-reviewed-trunk/pbx/pbx_spool.c
team/group/media_formats-reviewed-trunk/res/ari/resource_bridges.c
team/group/media_formats-reviewed-trunk/res/ari/resource_channels.c
team/group/media_formats-reviewed-trunk/res/parking/parking_applications.c
team/group/media_formats-reviewed-trunk/res/res_agi.c
team/group/media_formats-reviewed-trunk/res/res_calendar.c
team/group/media_formats-reviewed-trunk/res/res_clioriginate.c
team/group/media_formats-reviewed-trunk/res/res_pjsip/pjsip_configuration.c
team/group/media_formats-reviewed-trunk/res/res_pjsip_sdp_rtp.c
team/group/media_formats-reviewed-trunk/res/res_pjsip_session.c
team/group/media_formats-reviewed-trunk/res/res_rtp_asterisk.c
team/group/media_formats-reviewed-trunk/res/res_stasis.c
team/group/media_formats-reviewed-trunk/res/res_stasis_snoop.c
team/group/media_formats-reviewed-trunk/tests/test_config.c
team/group/media_formats-reviewed-trunk/tests/test_core_format.c
team/group/media_formats-reviewed-trunk/tests/test_format_api.c
team/group/media_formats-reviewed-trunk/tests/test_format_cap.c
team/group/media_formats-reviewed-trunk/tests/test_voicemail_api.c
Modified: team/group/media_formats-reviewed-trunk/addons/chan_mobile.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/addons/chan_mobile.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/addons/chan_mobile.c (original)
+++ team/group/media_formats-reviewed-trunk/addons/chan_mobile.c Thu Jul 3 06:42:14 2014
@@ -902,8 +902,8 @@
}
if (ast_format_cap_iscompatible_format(cap, DEVICE_FRAME_FORMAT) == AST_FORMAT_CMP_NOT_EQUAL) {
- char tmp[256];
- ast_log(LOG_WARNING, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(tmp, sizeof(tmp), cap));
+ struct ast_str *codec_buf = ast_str_alloca(64);
+ ast_log(LOG_WARNING, "Asked to get a channel of unsupported format '%s'\n", ast_format_cap_get_names(cap, &codec_buf));
*cause = AST_CAUSE_FACILITY_NOT_IMPLEMENTED;
return NULL;
}
@@ -4711,7 +4711,7 @@
return AST_MODULE_LOAD_DECLINE;
}
- ast_format_cap_add(mbl_tech.capabilities, DEVICE_FRAME_FORMAT, 0);
+ ast_format_cap_append(mbl_tech.capabilities, DEVICE_FRAME_FORMAT, 0);
/* Check if we have Bluetooth, no point loading otherwise... */
dev_id = hci_get_route(NULL);
s = hci_open_dev(dev_id);
Modified: team/group/media_formats-reviewed-trunk/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/addons/chan_ooh323.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/addons/chan_ooh323.c (original)
+++ team/group/media_formats-reviewed-trunk/addons/chan_ooh323.c Thu Jul 3 06:42:14 2014
@@ -392,7 +392,7 @@
tmpfmt = ast_format_cap_get_format(i->cap, 0);
}
- ast_format_cap_add(caps, tmpfmt, 0);
+ ast_format_cap_append(caps, tmpfmt, 0);
ast_channel_nativeformats_set(ch, caps);
ao2_ref(caps, -1);
@@ -550,7 +550,7 @@
ast_copy_string(pvt->accountcode, gAccountcode, sizeof(pvt->accountcode));
pvt->amaflags = gAMAFLAGS;
- ast_format_cap_append_by_type(pvt->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_from_cap(pvt->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
pvt->aniasdni = gANIasDNI;
@@ -576,21 +576,21 @@
const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
{
+ struct ast_str *codec_buf = ast_str_alloca(64);
struct ast_channel *chan = NULL;
struct ooh323_pvt *p = NULL;
struct ooh323_peer *peer = NULL;
char *dest = NULL;
char *ext = NULL;
char tmp[256];
- char formats[FORMAT_STRING_SIZE];
int port = 0;
- if (gH323Debug)
- ast_verb(0, "--- ooh323_request - data %s format %s\n", data,
- ast_getformatname_multiple(formats,FORMAT_STRING_SIZE,cap));
+ if (gH323Debug) {
+ ast_verb(0, "--- ooh323_request - data %s format %s\n", data, ast_format_cap_get_names(cap, &codec_buf));
+ }
if (!(ast_format_cap_has_type(cap, AST_MEDIA_TYPE_AUDIO))) {
- ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_getformatname_multiple(formats,FORMAT_STRING_SIZE,cap));
+ ast_log(LOG_NOTICE, "Asked to get a channel of unsupported format '%s'\n", ast_format_cap_get_names(cap, &codec_buf));
return NULL;
}
@@ -654,7 +654,7 @@
if (ext)
ast_copy_string(p->exten, ext, sizeof(p->exten));
- ast_format_cap_append_by_type(p->cap, peer->cap, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_from_cap(p->cap, peer->cap, AST_MEDIA_TYPE_UNKNOWN);
p->g729onlyA = peer->g729onlyA;
p->dtmfmode |= peer->dtmfmode;
p->dtmfcodec = peer->dtmfcodec;
@@ -699,7 +699,7 @@
p->t38support = gT38Support;
p->rtptimeout = gRTPTimeout;
p->nat = gNat;
- ast_format_cap_append_by_type(p->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_from_cap(p->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
p->rtdrinterval = gRTDRInterval;
p->rtdrcount = gRTDRCount;
p->faststart = gFastStart;
@@ -1165,7 +1165,6 @@
{
struct ooh323_pvt *p = ast_channel_tech_pvt(ast);
int res = 0;
- char buf[256];
if (p) {
ast_mutex_lock(&p->lock);
@@ -1193,10 +1192,11 @@
if (ast_format_cap_iscompatible_format(ast_channel_nativeformats(ast), f->subclass.format) == AST_FORMAT_CMP_NOT_EQUAL) {
if (ast_format_cap_count(ast_channel_nativeformats(ast))) {
+ struct ast_str *codec_buf = ast_str_alloca(64);
ast_log(LOG_WARNING,
"Asked to transmit frame type %s, while native formats is %s (read/write = %s/%s)\n",
ast_format_get_name(f->subclass.format),
- ast_getformatname_multiple(buf, sizeof(buf), ast_channel_nativeformats(ast)),
+ ast_format_cap_get_names(ast_channel_nativeformats(ast), &codec_buf),
ast_format_get_name(ast_channel_readformat(ast)),
ast_format_get_name(ast_channel_writeformat(ast)));
@@ -1509,7 +1509,6 @@
void ooh323_set_write_format(ooCallData *call, struct ast_format *fmt, int txframes)
{
struct ooh323_pvt *p = NULL;
- char formats[FORMAT_STRING_SIZE];
if (gH323Debug)
ast_verb(0, "--- ooh323_update_writeformat %s/%d\n",
@@ -1544,10 +1543,12 @@
ao2_ref(caps, -1);
return;
}
- if (gH323Debug)
- ast_verb(0, "Writeformat before update %s/%s\n",
+ if (gH323Debug) {
+ struct ast_str *codec_buf = ast_str_alloca(64);
+ ast_verb(0, "Writeformat before update %s/%s\n",
ast_format_get_name(ast_channel_writeformat(p->owner)),
- ast_getformatname_multiple(formats, sizeof(formats), ast_channel_nativeformats(p->owner)));
+ ast_format_cap_get_names(ast_channel_nativeformats(p->owner), &codec_buf));
+ }
if (p->dtmfmode & H323_DTMF_RFC2833 && p->dtmfcodec) {
ast_rtp_codecs_payloads_set_rtpmap_type(ast_rtp_instance_get_codecs(p->rtp),
@@ -1561,7 +1562,7 @@
if (txframes) {
ast_format_cap_set_framing(caps, txframes);
}
- ast_format_cap_add(caps, fmt, 0);
+ ast_format_cap_append(caps, fmt, 0);
ast_channel_nativeformats_set(p->owner, caps);
ao2_ref(caps, -1);
ast_set_write_format(p->owner, ast_channel_writeformat(p->owner));
@@ -1615,13 +1616,14 @@
return;
}
- if (gH323Debug)
- ast_verb(0, "Readformat before update %s\n",
- ast_format_get_name(ast_channel_readformat(p->owner)));
- ast_format_cap_add(caps, fmt, 0);
- ast_channel_nativeformats_set(p->owner, caps);
- ao2_ref(caps, -1);
- ast_set_read_format(p->owner, ast_channel_readformat(p->owner));
+ if (gH323Debug) {
+ ast_verb(0, "Readformat before update %s\n",
+ ast_format_get_name(ast_channel_readformat(p->owner)));
+ }
+ ast_format_cap_append(caps, fmt, 0);
+ ast_channel_nativeformats_set(p->owner, caps);
+ ao2_ref(caps, -1);
+ ast_set_read_format(p->owner, ast_channel_readformat(p->owner));
ast_channel_unlock(p->owner);
} else
ast_log(LOG_ERROR, "No owner found\n");
@@ -1878,7 +1880,7 @@
ast_copy_string(p->context, user->context, sizeof(p->context));
ast_copy_string(p->accountcode, user->accountcode, sizeof(p->accountcode));
p->amaflags = user->amaflags;
- ast_format_cap_append_by_type(p->cap, user->cap, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_from_cap(p->cap, user->cap, AST_MEDIA_TYPE_UNKNOWN);
p->g729onlyA = user->g729onlyA;
p->dtmfmode |= user->dtmfmode;
p->dtmfcodec = user->dtmfcodec;
@@ -2111,11 +2113,11 @@
}
if (gH323Debug) {
- char formats[FORMAT_STRING_SIZE];
+ struct ast_str *codec_buf = ast_str_alloca(64);
ast_verb(0, " Outgoing call %s(%s) - Codec prefs - %s\n",
p->username?p->username:"NULL", call->callToken,
- ast_getformatname_multiple(formats,FORMAT_STRING_SIZE,p->cap));
+ ast_format_cap_get_names(p->cap, &codec_buf));
}
ooh323c_set_capability_for_call(call, p->cap,
@@ -2335,7 +2337,7 @@
}
ast_mutex_init(&user->lock);
ast_copy_string(user->name, name, sizeof(user->name));
- ast_format_cap_append_by_type(user->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_from_cap(user->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
user->rtptimeout = gRTPTimeout;
user->nat = gNat;
user->dtmfmode = gDTMFMode;
@@ -2390,13 +2392,13 @@
sizeof(user->rtpmaskstr));
} else user->rtpmask = NULL;
} else if (!strcasecmp(v->name, "disallow")) {
- ast_parse_allow_disallow(user->cap, v->value, 0);
+ ast_format_cap_update_by_allow_disallow(user->cap, v->value, 0);
} else if (!strcasecmp(v->name, "allow")) {
const char* tcodecs = v->value;
if (!strcasecmp(v->value, "all")) {
tcodecs = "ulaw,alaw,g729,g723,gsm";
}
- ast_parse_allow_disallow(user->cap, tcodecs, 1);
+ ast_format_cap_update_by_allow_disallow(user->cap, tcodecs, 1);
} else if (!strcasecmp(v->name, "amaflags")) {
user->amaflags = ast_channel_string2amaflag(v->value);
} else if (!strcasecmp(v->name, "ip") || !strcasecmp(v->name, "host")) {
@@ -2482,7 +2484,7 @@
}
ast_mutex_init(&peer->lock);
ast_copy_string(peer->name, name, sizeof(peer->name));
- ast_format_cap_append_by_type(peer->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_from_cap(peer->cap, gCap, AST_MEDIA_TYPE_UNKNOWN);
peer->rtptimeout = gRTPTimeout;
peer->nat = gNat;
ast_copy_string(peer->accountcode, gAccountcode, sizeof(peer->accountcode));
@@ -2585,13 +2587,13 @@
sizeof(peer->rtpmaskstr));
} else peer->rtpmask = NULL;
} else if (!strcasecmp(v->name, "disallow")) {
- ast_parse_allow_disallow(peer->cap, v->value, 0);
+ ast_format_cap_update_by_allow_disallow(peer->cap, v->value, 0);
} else if (!strcasecmp(v->name, "allow")) {
const char* tcodecs = v->value;
if (!strcasecmp(v->value, "all")) {
tcodecs = "ulaw,alaw,g729,g723,gsm";
}
- ast_parse_allow_disallow(peer->cap, tcodecs, 1);
+ ast_format_cap_update_by_allow_disallow(peer->cap, tcodecs, 1);
} else if (!strcasecmp(v->name, "amaflags")) {
peer->amaflags = ast_channel_string2amaflag(v->value);
} else if (!strcasecmp(v->name, "roundtrip")) {
@@ -2807,8 +2809,8 @@
gPort = 1720;
gIP[0] = '\0';
strcpy(gCallerID, DEFAULT_H323ID);
- ast_format_cap_remove_bytype(gCap, AST_MEDIA_TYPE_UNKNOWN);
- ast_format_cap_add(gCap, ast_format_ulaw, 0);
+ ast_format_cap_remove_by_type(gCap, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append(gCap, ast_format_ulaw, 0);
gDTMFMode = H323_DTMF_RFC2833;
gDTMFCodec = 101;
gFAXdetect = FAXDETECT_CNG;
@@ -3009,13 +3011,13 @@
} else if (!strcasecmp(v->name, "accountcode")) {
ast_copy_string(gAccountcode, v->value, sizeof(gAccountcode));
} else if (!strcasecmp(v->name, "disallow")) {
- ast_parse_allow_disallow(gCap, v->value, 0);
+ ast_format_cap_update_by_allow_disallow(gCap, v->value, 0);
} else if (!strcasecmp(v->name, "allow")) {
const char* tcodecs = v->value;
if (!strcasecmp(v->value, "all")) {
tcodecs = "ulaw,alaw,g729,g723,gsm";
}
- ast_parse_allow_disallow(gCap, tcodecs, 1);
+ ast_format_cap_update_by_allow_disallow(gCap, tcodecs, 1);
} else if (!strcasecmp(v->name, "dtmfmode")) {
if (!strcasecmp(v->value, "inband"))
gDTMFMode = H323_DTMF_INBAND;
@@ -3228,7 +3230,7 @@
static char *handle_cli_ooh323_show_peers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct ooh323_peer *prev = NULL, *peer = NULL;
- char formats[FORMAT_STRING_SIZE];
+ struct ast_str *codec_buf = ast_str_alloca(64);
char ip_port[30];
#define FORMAT "%-15.15s %-15.15s %-23.23s %-s\n"
@@ -3253,10 +3255,10 @@
while (peer) {
ast_mutex_lock(&peer->lock);
snprintf(ip_port, sizeof(ip_port), "%s:%d", peer->ip, peer->port);
- ast_cli(a->fd, FORMAT, peer->name,
+ ast_cli(a->fd, FORMAT, peer->name,
peer->accountcode,
ip_port,
- ast_getformatname_multiple(formats,FORMAT_STRING_SIZE,peer->cap));
+ ast_format_cap_get_names(peer->cap, &codec_buf));
prev = peer;
peer = peer->next;
ast_mutex_unlock(&prev->lock);
@@ -3367,7 +3369,7 @@
static char *handle_cli_ooh323_show_users(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
struct ooh323_user *prev = NULL, *user = NULL;
- char formats[FORMAT_STRING_SIZE];
+ struct ast_str *codec_buf = ast_str_alloca(64);
#define FORMAT1 "%-15.15s %-15.15s %-15.15s %-s\n"
switch (cmd) {
@@ -3394,7 +3396,7 @@
ast_mutex_lock(&user->lock);
ast_cli(a->fd, FORMAT1, user->name,
user->accountcode, user->context,
- ast_getformatname_multiple(formats, FORMAT_STRING_SIZE, user->cap));
+ ast_format_cap_get_names(user->cap, &codec_buf));
prev = user;
user = user->next;
ast_mutex_unlock(&prev->lock);
@@ -3501,6 +3503,7 @@
static char *handle_cli_ooh323_show_config(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
{
char value[FORMAT_STRING_SIZE];
+ struct ast_str *codec_buf = ast_str_alloca(64);
ooAliases *pAlias = NULL, *pAliasNext = NULL;;
switch (cmd) {
@@ -3549,7 +3552,7 @@
ast_cli(a->fd, "%-20s%s\n", "H.323 LogFile:", gLogFile);
ast_cli(a->fd, "%-20s%s\n", "Context:", gContext);
ast_cli(a->fd, "%-20s%s\n", "Capability:",
- ast_getformatname_multiple(value,FORMAT_STRING_SIZE,gCap));
+ ast_format_cap_get_names(gCap, &codec_buf));
ast_cli(a->fd, "%-20s", "DTMF Mode: ");
if (gDTMFMode & H323_DTMF_CISCO) {
ast_cli(a->fd, "%s\n", "cisco");
@@ -3753,8 +3756,8 @@
gCap = NULL;
return AST_MODULE_LOAD_FAILURE;
}
- ast_format_cap_add(gCap, ast_format_ulaw, 0);
- ast_format_cap_add_all_by_type(ooh323_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append(gCap, ast_format_ulaw, 0);
+ ast_format_cap_append_by_type(ooh323_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN);
myself = ast_module_info->self;
@@ -4367,9 +4370,9 @@
if (p) {
if (ast_format_cap_count(ast_channel_nativeformats(chan))) {
- ast_format_cap_append_by_type(result, ast_channel_nativeformats(chan), AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_from_cap(result, ast_channel_nativeformats(chan), AST_MEDIA_TYPE_UNKNOWN);
} else if (ast_format_cap_count(p->cap)) {
- ast_format_cap_append_by_type(result, p->cap, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_from_cap(result, p->cap, AST_MEDIA_TYPE_UNKNOWN);
}
}
@@ -4959,7 +4962,7 @@
caps = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
if (caps) {
- ast_format_cap_add(caps, f->subclass.format, 0);
+ ast_format_cap_append(caps, f->subclass.format, 0);
ast_channel_nativeformats_set(p->owner, caps);
ao2_ref(caps, -1);
}
Modified: team/group/media_formats-reviewed-trunk/apps/app_confbridge.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_confbridge.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_confbridge.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_confbridge.c Thu Jul 3 06:42:14 2014
@@ -692,7 +692,7 @@
return -1;
}
- ast_format_cap_add(cap, ast_format_slin, 0);
+ ast_format_cap_append(cap, ast_format_slin, 0);
conference->record_chan = ast_request("CBRec", cap, NULL, NULL,
conference->name, NULL);
@@ -1379,7 +1379,7 @@
if (!cap) {
return -1;
}
- ast_format_cap_add(cap, ast_format_slin, 0);
+ ast_format_cap_append(cap, ast_format_slin, 0);
conference->playback_chan = ast_request("CBAnn", cap, NULL, NULL,
conference->name, NULL);
ao2_ref(cap, -1);
@@ -3256,7 +3256,7 @@
if (!tech->capabilities) {
return -1;
}
- ast_format_cap_add_all_by_type(tech->capabilities, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_by_type(tech->capabilities, AST_MEDIA_TYPE_UNKNOWN);
if (ast_channel_register(tech)) {
ast_log(LOG_ERROR, "Unable to register channel technology %s(%s).\n",
tech->type, tech->description);
Modified: team/group/media_formats-reviewed-trunk/apps/app_dumpchan.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_dumpchan.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_dumpchan.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_dumpchan.c Thu Jul 3 06:42:14 2014
@@ -72,7 +72,7 @@
{
long elapsed_seconds = 0;
int hour = 0, min = 0, sec = 0;
- char nf[256];
+ struct ast_str *format_buf = ast_str_alloca(64);
char cgrp[256];
char pgrp[256];
struct ast_str *write_transpath = ast_str_alloca(256);
@@ -143,7 +143,7 @@
ast_state2str(ast_channel_state(c)),
ast_channel_state(c),
ast_channel_rings(c),
- ast_getformatname_multiple(nf, sizeof(nf), ast_channel_nativeformats(c)),
+ ast_format_cap_get_names(ast_channel_nativeformats(c), &format_buf),
ast_format_get_name(ast_channel_writeformat(c)),
ast_format_get_name(ast_channel_readformat(c)),
ast_format_get_name(ast_channel_rawwriteformat(c)),
Modified: team/group/media_formats-reviewed-trunk/apps/app_meetme.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_meetme.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_meetme.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_meetme.c Thu Jul 3 06:42:14 2014
@@ -1619,7 +1619,7 @@
if (cnf || (!make && !dynamic) || !cap_slin)
goto cnfout;
- ast_format_cap_add(cap_slin, ast_format_slin, 0);
+ ast_format_cap_append(cap_slin, ast_format_slin, 0);
/* Make a new one */
if (!(cnf = ast_calloc(1, sizeof(*cnf))) ||
!(cnf->usercontainer = ao2_container_alloc(1, NULL, user_no_cmp))) {
@@ -3222,7 +3222,7 @@
if (!cap_slin) {
goto conf_run_cleanup;
}
- ast_format_cap_add(cap_slin, ast_format_slin, 0);
+ ast_format_cap_append(cap_slin, ast_format_slin, 0);
if (!(user = ao2_alloc(sizeof(*user), NULL))) {
goto conf_run_cleanup;
Modified: team/group/media_formats-reviewed-trunk/apps/app_originate.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_originate.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_originate.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_originate.c Thu Jul 3 06:42:14 2014
@@ -120,15 +120,15 @@
goto return_cleanup;
}
- ast_format_cap_add(cap_slin, ast_format_slin, 0);
- ast_format_cap_add(cap_slin, ast_format_slin12, 0);
- ast_format_cap_add(cap_slin, ast_format_slin16, 0);
- ast_format_cap_add(cap_slin, ast_format_slin24, 0);
- ast_format_cap_add(cap_slin, ast_format_slin32, 0);
- ast_format_cap_add(cap_slin, ast_format_slin44, 0);
- ast_format_cap_add(cap_slin, ast_format_slin48, 0);
- ast_format_cap_add(cap_slin, ast_format_slin96, 0);
- ast_format_cap_add(cap_slin, ast_format_slin192, 0);
+ ast_format_cap_append(cap_slin, ast_format_slin, 0);
+ ast_format_cap_append(cap_slin, ast_format_slin12, 0);
+ ast_format_cap_append(cap_slin, ast_format_slin16, 0);
+ ast_format_cap_append(cap_slin, ast_format_slin24, 0);
+ ast_format_cap_append(cap_slin, ast_format_slin32, 0);
+ ast_format_cap_append(cap_slin, ast_format_slin44, 0);
+ ast_format_cap_append(cap_slin, ast_format_slin48, 0);
+ ast_format_cap_append(cap_slin, ast_format_slin96, 0);
+ ast_format_cap_append(cap_slin, ast_format_slin192, 0);
if (ast_strlen_zero(data)) {
ast_log(LOG_ERROR, "Originate() requires arguments\n");
Modified: team/group/media_formats-reviewed-trunk/apps/app_voicemail.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/app_voicemail.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/app_voicemail.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/app_voicemail.c Thu Jul 3 06:42:14 2014
@@ -14059,7 +14059,7 @@
if (!capabilities) {
goto exit_vmsayname_test;
}
- ast_format_cap_add(capabilities, ast_format_gsm, 0);
+ ast_format_cap_append(capabilities, ast_format_gsm, 0);
ast_channel_nativeformats_set(test_channel1, capabilities);
ao2_ref(capabilities, -1);
ast_channel_set_writeformat(test_channel1, ast_format_gsm);
Modified: team/group/media_formats-reviewed-trunk/apps/confbridge/conf_chan_record.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/apps/confbridge/conf_chan_record.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/apps/confbridge/conf_chan_record.c (original)
+++ team/group/media_formats-reviewed-trunk/apps/confbridge/conf_chan_record.c Thu Jul 3 06:42:14 2014
@@ -64,7 +64,7 @@
if (!capabilities) {
return NULL;
}
- ast_format_cap_add_all_by_type(capabilities, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_by_type(capabilities, AST_MEDIA_TYPE_UNKNOWN);
chan = ast_channel_alloc(1, AST_STATE_UP, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0,
"CBRec/conf-%s-uid-%d",
Modified: team/group/media_formats-reviewed-trunk/bridges/bridge_holding.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/bridges/bridge_holding.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/bridges/bridge_holding.c (original)
+++ team/group/media_formats-reviewed-trunk/bridges/bridge_holding.c Thu Jul 3 06:42:14 2014
@@ -438,9 +438,9 @@
if (!(holding_bridge.format_capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
return AST_MODULE_LOAD_DECLINE;
}
- ast_format_cap_add_all_by_type(holding_bridge.format_capabilities, AST_MEDIA_TYPE_AUDIO);
- ast_format_cap_add_all_by_type(holding_bridge.format_capabilities, AST_MEDIA_TYPE_VIDEO);
- ast_format_cap_add_all_by_type(holding_bridge.format_capabilities, AST_MEDIA_TYPE_TEXT);
+ ast_format_cap_append_by_type(holding_bridge.format_capabilities, AST_MEDIA_TYPE_AUDIO);
+ ast_format_cap_append_by_type(holding_bridge.format_capabilities, AST_MEDIA_TYPE_VIDEO);
+ ast_format_cap_append_by_type(holding_bridge.format_capabilities, AST_MEDIA_TYPE_TEXT);
return ast_bridge_technology_register(&holding_bridge);
}
Modified: team/group/media_formats-reviewed-trunk/bridges/bridge_native_rtp.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/bridges/bridge_native_rtp.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/bridges/bridge_native_rtp.c (original)
+++ team/group/media_formats-reviewed-trunk/bridges/bridge_native_rtp.c Thu Jul 3 06:42:14 2014
@@ -375,11 +375,10 @@
glue1->get_codec(c1->chan, cap1);
}
if (ast_format_cap_count(cap0) != 0 && ast_format_cap_count(cap1) != 0 && !ast_format_cap_iscompatible(cap0, cap1)) {
- char tmp0[256] = { 0, }, tmp1[256] = { 0, };
-
+ struct ast_str *codec_buf0 = ast_str_alloca(64);
+ struct ast_str *codec_buf1 = ast_str_alloca(64);
ast_debug(1, "Channel codec0 = %s is not codec1 = %s, cannot native bridge in RTP.\n",
- ast_getformatname_multiple(tmp0, sizeof(tmp0), cap0),
- ast_getformatname_multiple(tmp1, sizeof(tmp1), cap1));
+ ast_format_cap_get_names(cap0, &codec_buf0), ast_format_cap_get_names(cap1, &codec_buf1));
return 0;
}
@@ -526,9 +525,9 @@
if (!(native_rtp_bridge.format_capabilities = ast_format_cap_alloc(0))) {
return AST_MODULE_LOAD_DECLINE;
}
- ast_format_cap_add_all_by_type(native_rtp_bridge.format_capabilities, AST_MEDIA_TYPE_AUDIO);
- ast_format_cap_add_all_by_type(native_rtp_bridge.format_capabilities, AST_MEDIA_TYPE_VIDEO);
- ast_format_cap_add_all_by_type(native_rtp_bridge.format_capabilities, AST_MEDIA_TYPE_TEXT);
+ ast_format_cap_append_by_type(native_rtp_bridge.format_capabilities, AST_MEDIA_TYPE_AUDIO);
+ ast_format_cap_append_by_type(native_rtp_bridge.format_capabilities, AST_MEDIA_TYPE_VIDEO);
+ ast_format_cap_append_by_type(native_rtp_bridge.format_capabilities, AST_MEDIA_TYPE_TEXT);
return ast_bridge_technology_register(&native_rtp_bridge);
}
Modified: team/group/media_formats-reviewed-trunk/bridges/bridge_simple.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/bridges/bridge_simple.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/bridges/bridge_simple.c (original)
+++ team/group/media_formats-reviewed-trunk/bridges/bridge_simple.c Thu Jul 3 06:42:14 2014
@@ -86,9 +86,9 @@
if (!(simple_bridge.format_capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
return AST_MODULE_LOAD_DECLINE;
}
- ast_format_cap_add_all_by_type(simple_bridge.format_capabilities, AST_MEDIA_TYPE_AUDIO);
- ast_format_cap_add_all_by_type(simple_bridge.format_capabilities, AST_MEDIA_TYPE_VIDEO);
- ast_format_cap_add_all_by_type(simple_bridge.format_capabilities, AST_MEDIA_TYPE_TEXT);
+ ast_format_cap_append_by_type(simple_bridge.format_capabilities, AST_MEDIA_TYPE_AUDIO);
+ ast_format_cap_append_by_type(simple_bridge.format_capabilities, AST_MEDIA_TYPE_VIDEO);
+ ast_format_cap_append_by_type(simple_bridge.format_capabilities, AST_MEDIA_TYPE_TEXT);
return ast_bridge_technology_register(&simple_bridge);
}
Modified: team/group/media_formats-reviewed-trunk/bridges/bridge_softmix.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/bridges/bridge_softmix.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/bridges/bridge_softmix.c (original)
+++ team/group/media_formats-reviewed-trunk/bridges/bridge_softmix.c Thu Jul 3 06:42:14 2014
@@ -1169,7 +1169,7 @@
if (!(softmix_bridge.format_capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
return AST_MODULE_LOAD_DECLINE;
}
- ast_format_cap_add(softmix_bridge.format_capabilities, ast_format_slin, 0);
+ ast_format_cap_append(softmix_bridge.format_capabilities, ast_format_slin, 0);
return ast_bridge_technology_register(&softmix_bridge);
}
Modified: team/group/media_formats-reviewed-trunk/channels/chan_alsa.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/channels/chan_alsa.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_alsa.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_alsa.c Thu Jul 3 06:42:14 2014
@@ -617,11 +617,11 @@
static struct ast_channel *alsa_request(const char *type, struct ast_format_cap *cap, const struct ast_assigned_ids *assignedids, const struct ast_channel *requestor, const char *data, int *cause)
{
- char buf[256];
struct ast_channel *tmp = NULL;
if (ast_format_cap_iscompatible_format(cap, ast_format_slin) == AST_FORMAT_CMP_NOT_EQUAL) {
- ast_log(LOG_NOTICE, "Asked to get a channel of format '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), cap));
+ struct ast_str *codec_buf = ast_str_alloca(64);
+ ast_log(LOG_NOTICE, "Asked to get a channel of format '%s'\n", ast_format_cap_get_names(cap, &codec_buf));
return NULL;
}
@@ -961,7 +961,7 @@
if (!(alsa_tech.capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
return AST_MODULE_LOAD_DECLINE;
}
- ast_format_cap_add(alsa_tech.capabilities, ast_format_slin, 0);
+ ast_format_cap_append(alsa_tech.capabilities, ast_format_slin, 0);
/* Copy the default jb config over global_jbconf */
memcpy(&global_jbconf, &default_jbconf, sizeof(struct ast_jb_conf));
Modified: team/group/media_formats-reviewed-trunk/channels/chan_bridge_media.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/channels/chan_bridge_media.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_bridge_media.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_bridge_media.c Thu Jul 3 06:42:14 2014
@@ -194,8 +194,8 @@
return AST_MODULE_LOAD_DECLINE;
}
- ast_format_cap_add_all_by_type(announce_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN);
- ast_format_cap_add_all_by_type(record_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_by_type(announce_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN);
+ ast_format_cap_append_by_type(record_tech.capabilities, AST_MEDIA_TYPE_UNKNOWN);
if (ast_channel_register(&announce_tech)) {
ast_log(LOG_ERROR, "Unable to register channel technology %s(%s).\n",
Modified: team/group/media_formats-reviewed-trunk/channels/chan_console.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/channels/chan_console.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_console.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_console.c Thu Jul 3 06:42:14 2014
@@ -441,7 +441,7 @@
ast_channel_tech_set(chan, &console_tech);
ast_channel_set_readformat(chan, ast_format_slin16);
ast_channel_set_writeformat(chan, ast_format_slin16);
- ast_format_cap_add(caps, ast_format_slin16, 0);
+ ast_format_cap_append(caps, ast_format_slin16, 0);
ast_channel_nativeformats_set(chan, caps);
ao2_ref(caps, -1);
ast_channel_tech_pvt_set(chan, ref_pvt(pvt));
@@ -472,7 +472,6 @@
{
struct ast_channel *chan = NULL;
struct console_pvt *pvt;
- char buf[512];
if (!(pvt = find_pvt(data))) {
ast_log(LOG_ERROR, "Console device '%s' not found\n", data);
@@ -480,7 +479,9 @@
}
if (!(ast_format_cap_iscompatible(cap, console_tech.capabilities))) {
- ast_log(LOG_NOTICE, "Channel requested with unsupported format(s): '%s'\n", ast_getformatname_multiple(buf, sizeof(buf), cap));
+ struct ast_str *cap_buf = ast_str_alloca(64);
+ ast_log(LOG_NOTICE, "Channel requested with unsupported format(s): '%s'\n",
+ ast_format_cap_get_names(cap, &cap_buf));
goto return_unref;
}
@@ -1511,7 +1512,7 @@
if (!(console_tech.capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
return AST_MODULE_LOAD_DECLINE;
}
- ast_format_cap_add(console_tech.capabilities, ast_format_slin16, 0);
+ ast_format_cap_append(console_tech.capabilities, ast_format_slin16, 0);
init_pvt(&globals, NULL);
Modified: team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c?view=diff&rev=417801&r1=417800&r2=417801
==============================================================================
--- team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c (original)
+++ team/group/media_formats-reviewed-trunk/channels/chan_dahdi.c Thu Jul 3 06:42:14 2014
@@ -9037,7 +9037,7 @@
}
}
ast_channel_set_fd(tmp, 0, i->subs[idx].dfd);
- ast_format_cap_add(caps, deflaw, 0);
+ ast_format_cap_append(caps, deflaw, 0);
ast_channel_nativeformats_set(tmp, caps);
ao2_ref(caps, -1);
/* Start out assuming ulaw since it's smaller :) */
@@ -19305,9 +19305,9 @@
if (!(dahdi_tech.capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
return AST_MODULE_LOAD_FAILURE;
}
- ast_format_cap_add(dahdi_tech.capabilities, ast_format_slin, 0);
- ast_format_cap_add(dahdi_tech.capabilities, ast_format_ulaw, 0);
- ast_format_cap_add(dahdi_tech.capabilities, ast_format_alaw, 0);
+ ast_format_cap_append(dahdi_tech.capabilities, ast_format_slin, 0);
+ ast_format_cap_append(dahdi_tech.capabilities, ast_format_ulaw, 0);
+ ast_format_cap_append(dahdi_tech.capabilities, ast_format_alaw, 0);
if (dahdi_native_load(ast_module_info->self, &dahdi_tech)) {
return AST_MODULE_LOAD_FAILURE;
Modified: team/group/media_formats-reviewed-trunk/channels/chan_gtalk.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats-reviewed-trunk/channels/chan_gtalk.c?view=diff&rev=417801&r1=417800&r2=417801
[... 4343 lines stripped ...]
More information about the asterisk-commits
mailing list