[asterisk-commits] file: branch group/media_formats r406633 - /team/group/media_formats/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 27 08:05:40 CST 2014


Author: file
Date: Mon Jan 27 08:05:37 2014
New Revision: 406633

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=406633
Log:
Implement ast_format_cap_remove_bytype.

Modified:
    team/group/media_formats/main/format_cap_ng.c

Modified: team/group/media_formats/main/format_cap_ng.c
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/main/format_cap_ng.c?view=diff&rev=406633&r1=406632&r2=406633
==============================================================================
--- team/group/media_formats/main/format_cap_ng.c (original)
+++ team/group/media_formats/main/format_cap_ng.c Mon Jan 27 08:05:37 2014
@@ -231,6 +231,24 @@
 
 void ast_format_cap_remove_bytype(struct ast_format_cap *cap, enum ast_media_type type)
 {
+	int idx;
+
+	for (idx = 0; idx < AST_VECTOR_SIZE(&cap->formats); ++idx) {
+		struct format_cap_framed_list *list = AST_VECTOR_GET_ADDR(&cap->formats, idx);
+		struct format_cap_framed *framed;
+
+		AST_LIST_TRAVERSE_SAFE_BEGIN(list, framed, entry) {
+			if (framed->format->codec->type != type) {
+				continue;
+			}
+
+			AST_LIST_REMOVE_CURRENT(entry);
+			AST_VECTOR_REMOVE_CMP_ORDERED(&cap->preference_order, framed->format,
+				FORMAT_CAP_FRAMED_ELEM_CMP, FORMAT_CAP_FRAMED_ELEM_CLEANUP);
+			ao2_ref(framed, -1);
+		}
+		AST_LIST_TRAVERSE_SAFE_END;
+	}
 }
 
 void ast_format_cap_remove_all(struct ast_format_cap *cap)




More information about the asterisk-commits mailing list