include/asterisk/format_compatibility.h

Go to the documentation of this file.
00001 /*
00002  * Asterisk -- An open source telephony toolkit.
00003  *
00004  * Copyright (C) 2014, Digium, Inc.
00005  *
00006  * Joshua Colp <jcolp@digium.com>
00007  *
00008  * See http://www.asterisk.org for more information about
00009  * the Asterisk project. Please do not directly contact
00010  * any of the maintainers of this project for assistance;
00011  * the project provides a web site, mailing lists and IRC
00012  * channels for your use.
00013  *
00014  * This program is free software, distributed under the terms of
00015  * the GNU General Public License Version 2. See the LICENSE file
00016  * at the top of the source tree.
00017  */
00018 
00019 /*!
00020  * \file
00021  * \brief Media Format Bitfield Compatibility API
00022  *
00023  * \author Joshua Colp <jcolp@digium.com>
00024  */
00025 
00026 #ifndef _AST_FORMAT_COMPATIBILITY_H_
00027 #define _AST_FORMAT_COMPATIBILITY_H_
00028 
00029 struct ast_format;
00030 struct ast_codec;
00031 
00032 /*
00033  * Legacy bitfields for specific formats
00034  */
00035 
00036 /*! G.723.1 compression */
00037 #define AST_FORMAT_G723 (1ULL << 0)
00038 /*! GSM compression */
00039 #define AST_FORMAT_GSM (1ULL << 1)
00040 /*! Raw mu-law data (G.711) */
00041 #define AST_FORMAT_ULAW (1ULL << 2)
00042 /*! Raw A-law data (G.711) */
00043 #define AST_FORMAT_ALAW (1ULL << 3)
00044 /*! ADPCM (G.726, 32kbps, AAL2 codeword packing) */
00045 #define AST_FORMAT_G726_AAL2 (1ULL << 4)
00046 /*! ADPCM (IMA) */
00047 #define AST_FORMAT_ADPCM (1ULL << 5)
00048 /*! Raw 16-bit Signed Linear (8000 Hz) PCM */
00049 #define AST_FORMAT_SLIN (1ULL << 6)
00050 /*! LPC10, 180 samples/frame */
00051 #define AST_FORMAT_LPC10 (1ULL << 7)
00052 /*! G.729A audio */
00053 #define AST_FORMAT_G729 (1ULL << 8)
00054 /*! SpeeX Free Compression */
00055 #define AST_FORMAT_SPEEX (1ULL << 9)
00056 /*! iLBC Free Compression */
00057 #define AST_FORMAT_ILBC (1ULL << 10)
00058 /*! ADPCM (G.726, 32kbps, RFC3551 codeword packing) */
00059 #define AST_FORMAT_G726 (1ULL << 11)
00060 /*! G.722 */
00061 #define AST_FORMAT_G722 (1ULL << 12)
00062 /*! G.722.1 (also known as Siren7, 32kbps assumed) */
00063 #define AST_FORMAT_SIREN7 (1ULL << 13)
00064 /*! G.722.1 Annex C (also known as Siren14, 48kbps assumed) */
00065 #define AST_FORMAT_SIREN14 (1ULL << 14)
00066 /*! Raw 16-bit Signed Linear (16000 Hz) PCM */
00067 #define AST_FORMAT_SLIN16 (1ULL << 15)
00068 /*! G.719 (64 kbps assumed) */
00069 #define AST_FORMAT_G719 (1ULL << 32)
00070 /*! SpeeX Wideband (16kHz) Free Compression */
00071 #define AST_FORMAT_SPEEX16 (1ULL << 33)
00072 /*! Opus audio (8kHz, 16kHz, 24kHz, 48Khz) */
00073 #define AST_FORMAT_OPUS (1ULL << 34)
00074 /*! Raw testing-law data (G.711) */
00075 #define AST_FORMAT_TESTLAW (1ULL << 47)
00076 /*! H.261 Video */
00077 #define AST_FORMAT_H261 (1ULL << 18)
00078 /*! H.263 Video */
00079 #define AST_FORMAT_H263 (1ULL << 19)
00080 /*! H.263+ Video */
00081 #define AST_FORMAT_H263P (1ULL << 20)
00082 /*! H.264 Video */
00083 #define AST_FORMAT_H264 (1ULL << 21)
00084 /*! MPEG4 Video */
00085 #define AST_FORMAT_MP4 (1ULL << 22)
00086 /*! VP8 Video */
00087 #define AST_FORMAT_VP8 (1ULL << 23)
00088 /*! JPEG Images */
00089 #define AST_FORMAT_JPEG (1ULL << 16)
00090 /*! PNG Images */
00091 #define AST_FORMAT_PNG (1ULL << 17)
00092 /*! T.140 RED Text format RFC 4103 */
00093 #define AST_FORMAT_T140_RED (1ULL << 26)
00094 /*! T.140 Text format - ITU T.140, RFC 4103 */
00095 #define AST_FORMAT_T140 (1ULL << 27)
00096 
00097 /*!
00098  * \brief Convert a format structure to its respective bitfield
00099  *
00100  * \param format The media format
00101  *
00102  * \retval non-zero success
00103  * \retval zero format not supported
00104  */
00105 uint64_t ast_format_compatibility_format2bitfield(const struct ast_format *format);
00106 
00107 /*!
00108  * \brief Convert a codec structure to its respective bitfield
00109  *
00110  * \param codec The media codec
00111  *
00112  * \retval non-zero success
00113  * \retval zero format not supported
00114  */
00115 uint64_t ast_format_compatibility_codec2bitfield(const struct ast_codec *codec);
00116 
00117 /*!
00118  * \brief Convert a bitfield to its respective format structure
00119  *
00120  * \param bitfield The bitfield for the media format
00121  *
00122  * \retval non-NULL success
00123  * \retval NULL failure (The format bitfield value is not supported)
00124  *
00125  * \note The reference count of the returned format is NOT incremented
00126  */
00127 struct ast_format *ast_format_compatibility_bitfield2format(uint64_t bitfield);
00128 
00129 #endif /* _AST_FORMAT_COMPATIBILITY_H */

Generated on Thu Apr 16 06:27:34 2015 for Asterisk - The Open Source Telephony Project by  doxygen 1.5.6