Asterisk - The Open Source Telephony Project GIT-master-f36a736
channels/iax2/include/format_compatibility.h
Go to the documentation of this file.
1/*
2 * Asterisk -- An open source telephony toolkit.
3 *
4 * Copyright (C) 2014, Digium, Inc.
5 *
6 * Joshua Colp <jcolp@digium.com>
7 *
8 * See http://www.asterisk.org for more information about
9 * the Asterisk project. Please do not directly contact
10 * any of the maintainers of this project for assistance;
11 * the project provides a web site, mailing lists and IRC
12 * channels for your use.
13 *
14 * This program is free software, distributed under the terms of
15 * the GNU General Public License Version 2. See the LICENSE file
16 * at the top of the source tree.
17 */
18
19/*!
20 * \file
21 * \brief Media Format Bitfield Compatibility API
22 *
23 * \author Joshua Colp <jcolp@digium.com>
24 */
25
26#ifndef _IAX2_FORMAT_COMPATIBILITY_H_
27#define _IAX2_FORMAT_COMPATIBILITY_H_
28
29struct ast_format;
30struct ast_format_cap;
31
32/*!
33 * \brief Convert a format capabilities structure to a bitfield
34 *
35 * \param cap Capabilities structure containing formats
36 *
37 * \retval non-zero success
38 * \retval zero no formats present or no formats supported
39 */
41
42/*!
43 * \brief Convert a bitfield to a format capabilities structure
44 *
45 * \param bitfield The bitfield for the media formats
46 * \param cap Capabilities structure to place formats into
47 *
48 * \retval 0 on success.
49 * \retval -1 on error.
50 *
51 * \note If failure occurs the capabilities structure may contain a partial set of formats
52 */
53int iax2_format_compatibility_bitfield2cap(uint64_t bitfield, struct ast_format_cap *cap);
54
55/*!
56 * \brief Pick the best format from the given bitfield formats.
57 *
58 * \param formats The bitfield for the media formats
59 *
60 * \retval non-zero Best format out of the given formats.
61 * \retval zero No formats present or no formats considered best.
62 */
64
65#endif /* _IAX2_FORMAT_COMPATIBILITY_H */
uint64_t iax2_format_compatibility_best(uint64_t formats)
Pick the best format from the given bitfield formats.
uint64_t iax2_format_compatibility_cap2bitfield(const struct ast_format_cap *cap)
Convert a format capabilities structure to a bitfield.
int iax2_format_compatibility_bitfield2cap(uint64_t bitfield, struct ast_format_cap *cap)
Convert a bitfield to a format capabilities structure.
Format capabilities structure, holds formats + preference order + etc.
Definition: format_cap.c:54
Definition of a media format.
Definition: format.c:43
Definition: file.c:69