summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorMatt Jordan <mjordan@digium.com>2015-07-13 12:54:00 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2015-07-13 12:54:00 -0500
commit66b57b10f65bee8600c01a0fc03fb491edb7ad76 (patch)
tree837e28b1f04284e1579c22bf5a325dcc278d61a2 /main
parent458715d088a9b9401a3c54180b8256a02430e099 (diff)
parent6ed58014f5013fd9267365a6122a7ea380677ecd (diff)
Merge "main/format_cap: Parse capabilities generated by ast_format_cap_get_names"
Diffstat (limited to 'main')
-rw-r--r--main/format_cap.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/main/format_cap.c b/main/format_cap.c
index 52262579c..224fe331f 100644
--- a/main/format_cap.c
+++ b/main/format_cap.c
@@ -293,7 +293,24 @@ int ast_format_cap_update_by_allow_disallow(struct ast_format_cap *cap, const ch
}
parse = ast_strdupa(list);
- while ((this = strsep(&parse, ","))) {
+
+ /* If the list is being fed to us as a result of ast_format_cap_get_names,
+ * strip off the paranthesis and immediately apply the inverse of the
+ * allowing option
+ */
+ if (parse[0] == '(' && parse[strlen(parse) - 1] == ')') {
+ parse++;
+ parse[strlen(parse) - 1] = '\0';
+
+ if (allowing) {
+ ast_format_cap_remove_by_type(cap, AST_MEDIA_TYPE_UNKNOWN);
+ } else {
+ ast_format_cap_append_by_type(cap, AST_MEDIA_TYPE_UNKNOWN);
+ }
+ }
+
+
+ while ((this = strsep(&parse, ",|"))) {
int framems = 0;
struct ast_format *format = NULL;