summaryrefslogtreecommitdiff
path: root/include/asterisk/format_cap.h
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2014-09-18 16:37:47 +0000
committerMark Michelson <mmichelson@digium.com>2014-09-18 16:37:47 +0000
commit23a375be5f27e5418b47d06a577b663dca5e62bc (patch)
tree082cebd4311a4d80054fc38d2c2bc62171695fba /include/asterisk/format_cap.h
parent5c5aee445879016765f2205015cd33b62175f9c6 (diff)
Add API call to determine if format capability structure is "empty".
Empty here means that there are no formats in the format_cap structure or the only format in it is the "none" format. I've added calls to check the emptiness of a format_cap in a few places in order to short-circuit operations that would otherwise be pointless as well as to prevent some assertions from being triggered in cases where channels with no formats are used. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@423414 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/format_cap.h')
-rw-r--r--include/asterisk/format_cap.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/asterisk/format_cap.h b/include/asterisk/format_cap.h
index f7d33fccd..94e81f869 100644
--- a/include/asterisk/format_cap.h
+++ b/include/asterisk/format_cap.h
@@ -321,4 +321,13 @@ int ast_format_cap_has_type(const struct ast_format_cap *cap, enum ast_media_typ
*/
const char *ast_format_cap_get_names(struct ast_format_cap *cap, struct ast_str **buf);
+/*!
+ * \brief Determine if a format cap has no formats in it.
+ *
+ * \param cap The format cap to check for emptiness
+ * \retval 1 The format cap has zero formats or only ast_format_none
+ * \retval 0 The format cap has at least one format
+ */
+int ast_format_cap_empty(struct ast_format_cap *cap);
+
#endif /* _AST_FORMAT_CAP_H */