[asterisk-commits] file: branch group/media_formats r406631 - in /team/group/media_formats: incl...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jan 27 07:31:00 CST 2014
Author: file
Date: Mon Jan 27 07:30:55 2014
New Revision: 406631
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=406631
Log:
Implement ast_format_cap_has_type.
Modified:
team/group/media_formats/include/asterisk/format_cap_ng.h
team/group/media_formats/main/format_cap_ng.c
Modified: team/group/media_formats/include/asterisk/format_cap_ng.h
URL: http://svnview.digium.com/svn/asterisk/team/group/media_formats/include/asterisk/format_cap_ng.h?view=diff&rev=406631&r1=406630&r2=406631
==============================================================================
--- team/group/media_formats/include/asterisk/format_cap_ng.h (original)
+++ team/group/media_formats/include/asterisk/format_cap_ng.h Mon Jan 27 07:30:55 2014
@@ -158,4 +158,13 @@
*/
int ast_format_cap_iscompatible(const struct ast_format_cap *cap, const struct ast_format *format);
+/*!
+ * \brief Find out if the capabilities structure has any formats
+ * of a specific type.
+ *
+ * \retval 1 true
+ * \retval 0 false, no formats of specific type.
+ */
+int ast_format_cap_has_type(const struct ast_format_cap *cap, enum ast_media_type type);
+
#endif /* _AST_FORMAT_CAP_H */
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=406631&r1=406630&r2=406631
==============================================================================
--- team/group/media_formats/main/format_cap_ng.c (original)
+++ team/group/media_formats/main/format_cap_ng.c Mon Jan 27 07:30:55 2014
@@ -294,4 +294,19 @@
}
return 0;
+}
+
+int ast_format_cap_has_type(const struct ast_format_cap *cap, enum ast_media_type type)
+{
+ int idx;
+
+ for (idx = 0; idx < AST_VECTOR_SIZE(&cap->preference_order); ++idx) {
+ struct format_cap_framed *framed = AST_VECTOR_GET(&cap->preference_order, idx);
+
+ if (framed->format->codec->type == type) {
+ return 1;
+ }
+ }
+
+ return 0;
}
More information about the asterisk-commits
mailing list