[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step1 r298775 - in /team/dvossel/f...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Dec 17 18:13:11 UTC 2010
Author: dvossel
Date: Fri Dec 17 12:13:07 2010
New Revision: 298775
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=298775
Log:
ast_format iax2 conversion layer
Modified:
team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h
team/dvossel/fixtheworld_phase1_step1/include/asterisk/format_cap.h
team/dvossel/fixtheworld_phase1_step1/main/format.c
team/dvossel/fixtheworld_phase1_step1/main/format_cap.c
Modified: team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h?view=diff&rev=298775&r1=298774&r2=298775
==============================================================================
--- team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h (original)
+++ team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h Fri Dec 17 12:13:07 2010
@@ -210,10 +210,28 @@
int ast_format_joint(struct ast_format *format1, struct ast_format *format2, struct ast_format *result);
/*!
- *
* \brief copy format src into format dst.
*/
void ast_format_copy(struct ast_format *src, struct ast_format *dst);
+
+/*!
+ * \brief ast_format to iax2 bitfield format represenatation
+ *
+ * \note This is only to be used for IAX2 compatibility
+ *
+ * \retval iax2 representation of ast_format
+ * \retval 0, if no representation existis for iax2
+ */
+uint64_t ast_format_to_iax2(struct ast_format *format);
+
+/*!
+ * \brief convert iax2 bitfield format to ast_format represenatation
+ * \note This is only to be used for IAX2 compatibility
+ *
+ * \retval on success, pointer to the dst format in the input parameters
+ * \retval on failure, NULL
+ */
+struct ast_format *ast_format_from_iax2(uint64_t src, struct ast_format *dst);
/*! \brief register ast_format_attr_interface with core.
*
Modified: team/dvossel/fixtheworld_phase1_step1/include/asterisk/format_cap.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step1/include/asterisk/format_cap.h?view=diff&rev=298775&r1=298774&r2=298775
==============================================================================
--- team/dvossel/fixtheworld_phase1_step1/include/asterisk/format_cap.h (original)
+++ team/dvossel/fixtheworld_phase1_step1/include/asterisk/format_cap.h Fri Dec 17 12:13:07 2010
@@ -87,4 +87,20 @@
*/
struct ast_cap *ast_cap_get_type(struct ast_cap *cap, enum ast_format_type ftype);
+/*!
+ * \brief ast_cap to iax2 bitfield format represenatation
+ *
+ * \note This is only to be used for IAX2 compatibility
+ *
+ * \retval iax2 representation of ast_cap
+ * \retval 0, if no iax2 capabilities are present in ast_cap
+ */
+uint64_t ast_cap_to_iax2(struct ast_cap *cap);
+
+/*!
+ * \brief convert iax2 bitfield format to ast_cap represenatation
+ * \note This is only to be used for IAX2 compatibility
+ */
+void ast_cap_from_iax2(uint64_t src, struct ast_cap *dst);
+
#endif /* _AST_FORMATCAP_H */
Modified: team/dvossel/fixtheworld_phase1_step1/main/format.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step1/main/format.c?view=diff&rev=298775&r1=298774&r2=298775
==============================================================================
--- team/dvossel/fixtheworld_phase1_step1/main/format.c (original)
+++ team/dvossel/fixtheworld_phase1_step1/main/format.c Fri Dec 17 12:13:07 2010
@@ -283,6 +283,195 @@
return 0;
}
+uint64_t ast_format_to_iax2(struct ast_format *format)
+{
+ switch (format->id) {
+ /*! G.723.1 compression */
+ case AST_FORMATNEW_G723_1:
+ return (1ULL << 0);
+ /*! GSM compression */
+ case AST_FORMATNEW_GSM:
+ return (1ULL << 1);
+ /*! Raw mu-law data (G.711) */
+ case AST_FORMATNEW_ULAW:
+ return (1ULL << 2);
+ /*! Raw A-law data (G.711) */
+ case AST_FORMATNEW_ALAW:
+ return (1ULL << 3);
+ /*! ADPCM (G.726, 32kbps, AAL2 codeword packing) */
+ case AST_FORMATNEW_G726_AAL2:
+ return (1ULL << 4);
+ /*! ADPCM (IMA) */
+ case AST_FORMATNEW_ADPCM:
+ return (1ULL << 5);
+ /*! Raw 16-bit Signed Linear (8000 Hz) PCM */
+ case AST_FORMATNEW_SLINEAR:
+ return (1ULL << 6);
+ /*! LPC10, 180 samples/frame */
+ case AST_FORMATNEW_LPC10:
+ return (1ULL << 7);
+ /*! G.729A audio */
+ case AST_FORMATNEW_G729A:
+ return (1ULL << 8);
+ /*! SpeeX Free Compression */
+ case AST_FORMATNEW_SPEEX:
+ return (1ULL << 9);
+ /*! iLBC Free Compression */
+ case AST_FORMATNEW_ILBC:
+ return (1ULL << 10);
+ /*! ADPCM (G.726, 32kbps, RFC3551 codeword packing) */
+ case AST_FORMATNEW_G726:
+ return (1ULL << 11);
+ /*! G.722 */
+ case AST_FORMATNEW_G722:
+ return (1ULL << 12);
+ /*! G.722.1 (also known as Siren7, 32kbps assumed) */
+ case AST_FORMATNEW_SIREN7:
+ return (1ULL << 13);
+ /*! G.722.1 Annex C (also known as Siren14, 48kbps assumed) */
+ case AST_FORMATNEW_SIREN14:
+ return (1ULL << 14);
+ /*! Raw 16-bit Signed Linear (16000 Hz) PCM */
+ case AST_FORMATNEW_SLINEAR16:
+ return (1ULL << 15);
+ /*! G.719 (64 kbps assumed) */
+ case AST_FORMATNEW_G719:
+ return (1ULL << 32);
+ /*! SpeeX Wideband (16kHz) Free Compression */
+ case AST_FORMATNEW_SPEEX16:
+ return (1ULL << 33);
+ /*! Raw mu-law data (G.711) */
+ case AST_FORMATNEW_TESTLAW:
+ return (1ULL << 47);
+
+ /*! H.261 Video */
+ case AST_FORMATNEW_H261:
+ return (1ULL << 18);
+ /*! H.263 Video */
+ case AST_FORMATNEW_H263:
+ return (1ULL << 19);
+ /*! H.263+ Video */
+ case AST_FORMATNEW_H263_PLUS:
+ return (1ULL << 20);
+ /*! H.264 Video */
+ case AST_FORMATNEW_H264:
+ return (1ULL << 21);
+ /*! MPEG4 Video */
+ case AST_FORMATNEW_MP4_VIDEO:
+ return (1ULL << 22);
+
+ /*! JPEG Images */
+ case AST_FORMATNEW_JPEG:
+ return (1ULL << 16);
+ /*! PNG Images */
+ case AST_FORMATNEW_PNG:
+ return (1ULL << 17);
+
+ /*! T.140 RED Text format RFC 4103 */
+ case AST_FORMATNEW_T140RED:
+ return (1ULL << 26);
+ /*! T.140 Text format - ITU T.140, RFC 4103 */
+ case AST_FORMATNEW_T140:
+ return (1ULL << 27);
+ }
+
+ return 0;
+}
+struct ast_format *ast_format_from_iax2(uint64_t src, struct ast_format *dst)
+{
+ switch (src) {
+ /*! G.723.1 compression */
+ case (1ULL << 0):
+ return ast_format_set(dst, AST_FORMATNEW_G723_1, 0);
+ /*! GSM compression */
+ case (1ULL << 1):
+ return ast_format_set(dst, AST_FORMATNEW_GSM, 0);
+ /*! Raw mu-law data (G.711) */
+ case (1ULL << 2):
+ return ast_format_set(dst, AST_FORMATNEW_ULAW, 0);
+ /*! Raw A-law data (G.711) */
+ case (1ULL << 3):
+ return ast_format_set(dst, AST_FORMATNEW_ALAW, 0);
+ /*! ADPCM (G.726, 32kbps, AAL2 codeword packing) */
+ case (1ULL << 4):
+ return ast_format_set(dst, AST_FORMATNEW_G726_AAL2, 0);
+ /*! ADPCM (IMA) */
+ case (1ULL << 5):
+ return ast_format_set(dst, AST_FORMATNEW_ADPCM, 0);
+ /*! Raw 16-bit Signed Linear (8000 Hz) PCM */
+ case (1ULL << 6):
+ return ast_format_set(dst, AST_FORMATNEW_SLINEAR, 0);
+ /*! LPC10, 180 samples/frame */
+ case (1ULL << 7):
+ return ast_format_set(dst, AST_FORMATNEW_LPC10, 0);
+ /*! G.729A audio */
+ case (1ULL << 8):
+ return ast_format_set(dst, AST_FORMATNEW_G729A, 0);
+ /*! SpeeX Free Compression */
+ case (1ULL << 9):
+ return ast_format_set(dst, AST_FORMATNEW_SPEEX, 0);
+ /*! iLBC Free Compression */
+ case (1ULL << 10):
+ return ast_format_set(dst, AST_FORMATNEW_ILBC, 0);
+ /*! ADPCM (G.726, 32kbps, RFC3551 codeword packing) */
+ case (1ULL << 11):
+ return ast_format_set(dst, AST_FORMATNEW_G726, 0);
+ /*! G.722 */
+ case (1ULL << 12):
+ return ast_format_set(dst, AST_FORMATNEW_G722, 0);
+ /*! G.722.1 (also known as Siren7, 32kbps assumed) */
+ case (1ULL << 13):
+ return ast_format_set(dst, AST_FORMATNEW_SIREN7, 0);
+ /*! G.722.1 Annex C (also known as Siren14, 48kbps assumed) */
+ case (1ULL << 14):
+ return ast_format_set(dst, AST_FORMATNEW_SIREN14, 0);
+ /*! Raw 16-bit Signed Linear (16000 Hz) PCM */
+ case (1ULL << 15):
+ return ast_format_set(dst, AST_FORMATNEW_SLINEAR16, 0);
+ /*! G.719 (64 kbps assumed) */
+ case (1ULL << 32):
+ return ast_format_set(dst, AST_FORMATNEW_G719, 0);
+ /*! SpeeX Wideband (16kHz) Free Compression */
+ case (1ULL << 33):
+ return ast_format_set(dst, AST_FORMATNEW_SPEEX16, 0);
+ /*! Raw mu-law data (G.711) */
+ case (1ULL << 47):
+ return ast_format_set(dst, AST_FORMATNEW_TESTLAW, 0);
+
+ /*! H.261 Video */
+ case (1ULL << 18):
+ return ast_format_set(dst, AST_FORMATNEW_H261, 0);
+ /*! H.263 Video */
+ case (1ULL << 19):
+ return ast_format_set(dst, AST_FORMATNEW_H263, 0);
+ /*! H.263+ Video */
+ case (1ULL << 20):
+ return ast_format_set(dst, AST_FORMATNEW_H263_PLUS, 0);
+ /*! H.264 Video */
+ case (1ULL << 21):
+ return ast_format_set(dst, AST_FORMATNEW_H264, 0);
+ /*! MPEG4 Video */
+ case (1ULL << 22):
+ return ast_format_set(dst, AST_FORMATNEW_MP4_VIDEO, 0);
+
+ /*! JPEG Images */
+ case (1ULL << 16):
+ return ast_format_set(dst, AST_FORMATNEW_JPEG, 0);
+ /*! PNG Images */
+ case (1ULL << 17):
+ return ast_format_set(dst, AST_FORMATNEW_PNG, 0);
+
+ /*! T.140 RED Text format RFC 4103 */
+ case (1ULL << 26):
+ return ast_format_set(dst, AST_FORMATNEW_T140RED, 0);
+ /*! T.140 Text format - ITU T.140, RFC 4103 */
+ case (1ULL << 27):
+ return ast_format_set(dst, AST_FORMATNEW_T140, 0);
+ }
+
+ return NULL;
+}
+
int ast_format_attr_unreg_interface(struct ast_format_attr_interface *interface)
{
struct interface_ao2_wrapper *wrapper;
Modified: team/dvossel/fixtheworld_phase1_step1/main/format_cap.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step1/main/format_cap.c?view=diff&rev=298775&r1=298774&r2=298775
==============================================================================
--- team/dvossel/fixtheworld_phase1_step1/main/format_cap.c (original)
+++ team/dvossel/fixtheworld_phase1_step1/main/format_cap.c Fri Dec 17 12:13:07 2010
@@ -244,3 +244,14 @@
return NULL;
}
+uint64_t ast_cap_to_iax2(struct ast_cap *cap)
+{
+ uint64_t res = 0;
+
+ return res;
+}
+
+void ast_cap_from_iax2(uint64_t src, struct ast_cap *dst)
+{
+ return;
+}
More information about the asterisk-commits
mailing list