diff options
author | Matt Jordan <mjordan@digium.com> | 2015-07-13 12:53:54 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2015-07-13 12:53:54 -0500 |
commit | 6176ef782caa03a79a67e7e9f7cb1d0c67aed461 (patch) | |
tree | 5a939c86db6dacd3a8950be3d12d0daa87bfee4d | |
parent | bb76b88bafebd69bba31d85acd24fa5d46f3d59a (diff) | |
parent | 5f13c2226a35f465ab70c8e25a885f1f3cdaa1c5 (diff) |
Merge "main/format_cap: Parse capabilities generated by ast_format_cap_get_names" into 13
-rw-r--r-- | main/format_cap.c | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/main/format_cap.c b/main/format_cap.c index cefad1316..b344f846e 100644 --- a/main/format_cap.c +++ b/main/format_cap.c @@ -324,7 +324,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; |