[asterisk-commits] dvossel: branch dvossel/fixtheworld_phase1_step1 r298340 - in /team/dvossel/f...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Dec 15 17:02:57 UTC 2010
Author: dvossel
Date: Wed Dec 15 11:02:54 2010
New Revision: 298340
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=298340
Log:
New format id system is tagged with FORMATNEW until format_t goes away.
Modified:
team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h
team/dvossel/fixtheworld_phase1_step1/tests/test_format_api.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=298340&r1=298339&r2=298340
==============================================================================
--- team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h (original)
+++ team/dvossel/fixtheworld_phase1_step1/include/asterisk/format.h Wed Dec 15 11:02:54 2010
@@ -24,97 +24,97 @@
* \author David Vossel <dvossel at digium.com>
*/
-#ifndef _AST_FORMAT2_H_
-#define _AST_FORMAT2_H_
-
-#define AST_FORMAT2_ATTR_SIZE 128
-
-#define AST_FORMAT2_INC 100000
+#ifndef _AST_FORMATNEW_H_
+#define _AST_FORMATNEW_H_
+
+#define AST_FORMATNEW_ATTR_SIZE 128
+
+#define AST_FORMATNEW_INC 100000
/*! This is the value that ends a var list of format attribute
* key value pairs. */
-#define AST_FORMAT2_ATTR_END -1
-
-/*! XXX TODO note, the FORMAT2 used in all of the following
- * enums is temporary and will be replaced by FORMAT once the
- * conversion from forat_t to ast_format takes place. */
+#define AST_FORMATNEW_ATTR_END -1
+
+/*! XXX TODO note, the FORMATNEW tag used in all of the following
+ * enums and defines is temporary and will be replaced by FORMAT once the
+ * conversion from format_t to ast_format takes place. */
/* \brief Format Categories*/
enum ast_format_type {
- AST_FORMAT2_TYPE_AUDIO = 1 * AST_FORMAT2_INC,
- AST_FORMAT2_TYPE_VIDEO = 2 * AST_FORMAT2_INC,
- AST_FORMAT2_TYPE_IMAGE = 3 * AST_FORMAT2_INC,
- AST_FORMAT2_TYPE_TEXT = 4 * AST_FORMAT2_INC,
+ AST_FORMATNEW_TYPE_AUDIO = 1 * AST_FORMATNEW_INC,
+ AST_FORMATNEW_TYPE_VIDEO = 2 * AST_FORMATNEW_INC,
+ AST_FORMATNEW_TYPE_IMAGE = 3 * AST_FORMATNEW_INC,
+ AST_FORMATNEW_TYPE_TEXT = 4 * AST_FORMATNEW_INC,
};
enum ast_format_id {
/*! G.723.1 compression */
- AST_FORMAT2_G723_1 = 1 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_G723_1 = 1 + AST_FORMATNEW_TYPE_AUDIO,
/*! GSM compression */
- AST_FORMAT2_GSM = 2 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_GSM = 2 + AST_FORMATNEW_TYPE_AUDIO,
/*! Raw mu-law data (G.711) */
- AST_FORMAT2_ULAW = 3 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_ULAW = 3 + AST_FORMATNEW_TYPE_AUDIO,
/*! Raw A-law data (G.711) */
- AST_FORMAT2_ALAW = 4 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_ALAW = 4 + AST_FORMATNEW_TYPE_AUDIO,
/*! ADPCM (G.726, 32kbps, AAL2 codeword packing) */
- AST_FORMAT2_G726_AAL2 = 5 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_G726_AAL2 = 5 + AST_FORMATNEW_TYPE_AUDIO,
/*! ADPCM (IMA) */
- AST_FORMAT2_ADPCM = 6 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_ADPCM = 6 + AST_FORMATNEW_TYPE_AUDIO,
/*! Raw 16-bit Signed Linear (8000 Hz) PCM */
- AST_FORMAT2_SLINEAR = 7 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_SLINEAR = 7 + AST_FORMATNEW_TYPE_AUDIO,
/*! LPC10, 180 samples/frame */
- AST_FORMAT2_LPC10 = 8 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_LPC10 = 8 + AST_FORMATNEW_TYPE_AUDIO,
/*! G.729A audio */
- AST_FORMAT2_G729A = 9 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_G729A = 9 + AST_FORMATNEW_TYPE_AUDIO,
/*! SpeeX Free Compression */
- AST_FORMAT2_SPEEX = 10 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_SPEEX = 10 + AST_FORMATNEW_TYPE_AUDIO,
/*! iLBC Free Compression */
- AST_FORMAT2_ILBC = 11 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_ILBC = 11 + AST_FORMATNEW_TYPE_AUDIO,
/*! ADPCM (G.726, 32kbps, RFC3551 codeword packing) */
- AST_FORMAT2_G726 = 12 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_G726 = 12 + AST_FORMATNEW_TYPE_AUDIO,
/*! G.722 */
- AST_FORMAT2_G722 = 13 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_G722 = 13 + AST_FORMATNEW_TYPE_AUDIO,
/*! G.722.1 (also known as Siren7, 32kbps assumed) */
- AST_FORMAT2_SIREN7 = 14 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_SIREN7 = 14 + AST_FORMATNEW_TYPE_AUDIO,
/*! G.722.1 Annex C (also known as Siren14, 48kbps assumed) */
- AST_FORMAT2_SIREN14 = 15 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_SIREN14 = 15 + AST_FORMATNEW_TYPE_AUDIO,
/*! Raw 16-bit Signed Linear (16000 Hz) PCM */
- AST_FORMAT2_SLINEAR16 = 16 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_SLINEAR16 = 16 + AST_FORMATNEW_TYPE_AUDIO,
/*! G.719 (64 kbps assumed) */
- AST_FORMAT2_G719 = 17 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_G719 = 17 + AST_FORMATNEW_TYPE_AUDIO,
/*! SpeeX Wideband (16kHz) Free Compression */
- AST_FORMAT2_SPEEX16 = 18 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_SPEEX16 = 18 + AST_FORMATNEW_TYPE_AUDIO,
/*! Raw mu-law data (G.711) */
- AST_FORMAT2_TESTLAW = 19 + AST_FORMAT2_TYPE_AUDIO,
+ AST_FORMATNEW_TESTLAW = 19 + AST_FORMATNEW_TYPE_AUDIO,
/*! H.261 Video */
- AST_FORMAT2_H261 = 1 + AST_FORMAT2_TYPE_VIDEO,
+ AST_FORMATNEW_H261 = 1 + AST_FORMATNEW_TYPE_VIDEO,
/*! H.263 Video */
- AST_FORMAT2_H263 = 2 + AST_FORMAT2_TYPE_VIDEO,
+ AST_FORMATNEW_H263 = 2 + AST_FORMATNEW_TYPE_VIDEO,
/*! H.263+ Video */
- AST_FORMAT2_H263_PLUS = 3 + AST_FORMAT2_TYPE_VIDEO,
+ AST_FORMATNEW_H263_PLUS = 3 + AST_FORMATNEW_TYPE_VIDEO,
/*! H.264 Video */
- AST_FORMAT2_H264 = 4 + AST_FORMAT2_TYPE_VIDEO,
+ AST_FORMATNEW_H264 = 4 + AST_FORMATNEW_TYPE_VIDEO,
/*! MPEG4 Video */
- AST_FORMAT2_MP4_VIDEO = 5 + AST_FORMAT2_TYPE_VIDEO,
+ AST_FORMATNEW_MP4_VIDEO = 5 + AST_FORMATNEW_TYPE_VIDEO,
/*! JPEG Images */
- AST_FORMAT2_JPEG = 1 + AST_FORMAT2_TYPE_IMAGE,
+ AST_FORMATNEW_JPEG = 1 + AST_FORMATNEW_TYPE_IMAGE,
/*! PNG Images */
- AST_FORMAT2_PNG = 2 + AST_FORMAT2_TYPE_IMAGE,
+ AST_FORMATNEW_PNG = 2 + AST_FORMATNEW_TYPE_IMAGE,
/*! T.140 RED Text format RFC 4103 */
- AST_FORMAT2_T140RED = 1 + AST_FORMAT2_TYPE_TEXT,
+ AST_FORMATNEW_T140RED = 1 + AST_FORMATNEW_TYPE_TEXT,
/*! T.140 Text format - ITU T.140, RFC 4103 */
- AST_FORMAT2_T140 = 2 + AST_FORMAT2_TYPE_TEXT,
+ AST_FORMATNEW_T140 = 2 + AST_FORMATNEW_TYPE_TEXT,
};
/* Determine what category a format type is in */
-#define AST_FORMAT2_GET_TYPE(format) (((enum ast_format_id) (format->uid / AST_FORMAT2_INC)) * AST_FORMAT2_INC)
+#define AST_FORMATNEW_GET_TYPE(format) (((enum ast_format_id) (format->uid / AST_FORMATNEW_INC)) * AST_FORMATNEW_INC)
/*! \brief This structure contains the buffer used for format attributes */
struct ast_format_attr {
- uint8_t format_attr[AST_FORMAT2_ATTR_SIZE];
+ uint8_t format_attr[AST_FORMATNEW_ATTR_SIZE];
};
/*! \brief Represents a media format within Asterisk. */
@@ -163,17 +163,17 @@
* \param format to set
* \param id, format id to set on format
* \param set_attributes, are there attributes to set on this format. 0 == false, 1 == True.
- * \param var list of attribute key value pairs, must end with AST_FORMAT2_ATTR_END;
+ * \param var list of attribute key value pairs, must end with AST_FORMATNEW_ATTR_END;
*
* \details Example usage.
- * ast_format_set(format, AST_FORMAT2_ULAW, 0); // no capability attributes are needed for ULAW
- *
- * ast_format_set(format, AST_FORMAT2_SILK, 1, // SILK has capability attributes.
- * AST_FORMAT2_SILK_ATTR_RATE, 24000,
- * AST_FORMAT2_SILK_ATTR_RATE, 16000,
- * AST_FORMAT2_SILK_ATTR_RATE, 12000,
- * AST_FORMAT2_SILK_ATTR_RATE, 8000,
- * AST_FORMAT2_ATTR_END);
+ * ast_format_set(format, AST_FORMATNEW_ULAW, 0); // no capability attributes are needed for ULAW
+ *
+ * ast_format_set(format, AST_FORMATNEW_SILK, 1, // SILK has capability attributes.
+ * AST_FORMATNEW_SILK_ATTR_RATE, 24000,
+ * AST_FORMATNEW_SILK_ATTR_RATE, 16000,
+ * AST_FORMATNEW_SILK_ATTR_RATE, 12000,
+ * AST_FORMATNEW_SILK_ATTR_RATE, 8000,
+ * AST_FORMATNEW_ATTR_END);
*
* \return Pointer to ast_format object, same pointer that is passed in
* by the first argument.
@@ -185,7 +185,7 @@
* with optional capability attributes represented by format specific key value pairs.
*
* \details Example usage. Is this SILK format capable of 8khz
- * is_8khz = ast_format_isset(format, AST_FORMAT2_SILK_CAP_RATE, 8000);
+ * is_8khz = ast_format_isset(format, AST_FORMATNEW_SILK_CAP_RATE, 8000);
*
* \return 0, The format key value pairs are within the capabilities defined in this structure.
* \return -1, The format key value pairs are _NOT_ within the capabilities of this structure.
@@ -226,4 +226,4 @@
*/
int ast_format_attr_unreg_interface(struct ast_format_attr_interface *interface);
-#endif /* _AST_FORMAT2_H */
+#endif /* _AST_FORMATNEW_H */
Modified: team/dvossel/fixtheworld_phase1_step1/tests/test_format_api.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/fixtheworld_phase1_step1/tests/test_format_api.c?view=diff&rev=298340&r1=298339&r2=298340
==============================================================================
--- team/dvossel/fixtheworld_phase1_step1/tests/test_format_api.c (original)
+++ team/dvossel/fixtheworld_phase1_step1/tests/test_format_api.c Wed Dec 15 11:02:54 2010
@@ -104,7 +104,7 @@
char *string;
for (key = va_arg(ap, int);
- key != AST_FORMAT2_ATTR_END;
+ key != AST_FORMATNEW_ATTR_END;
key = va_arg(ap, int))
{
switch (key) {
@@ -128,7 +128,7 @@
* This is just for the purpose of testing. We are guaranteed there
* will never exist a interface for uLaw already. */
static struct ast_format_attr_interface test_interface = {
- .id = AST_FORMAT2_TESTLAW,
+ .id = AST_FORMATNEW_TESTLAW,
.format_attr_cmp = test_cmp,
.format_attr_get_joint = test_getjoint,
.format_attr_set = test_set
@@ -164,43 +164,43 @@
}
/* set a format with a single attribute. */
- ast_format_set(&format1, AST_FORMAT2_TESTLAW, 1,
+ ast_format_set(&format1, AST_FORMATNEW_TESTLAW, 1,
TEST_ATTR_KEY_SAMP_RATE, TEST_ATTR_VAL_SAMP_8KHZ,
- AST_FORMAT2_ATTR_END);
- if (ast_format_isset(&format1, TEST_ATTR_KEY_SAMP_RATE, TEST_ATTR_VAL_SAMP_8KHZ, AST_FORMAT2_ATTR_END)) {
+ AST_FORMATNEW_ATTR_END);
+ if (ast_format_isset(&format1, TEST_ATTR_KEY_SAMP_RATE, TEST_ATTR_VAL_SAMP_8KHZ, AST_FORMATNEW_ATTR_END)) {
ast_test_status_update(test, "format1 did not set number attribute correctly.\n");
return AST_TEST_FAIL;
}
- if (!ast_format_isset(&format1, TEST_ATTR_KEY_SAMP_RATE, TEST_ATTR_VAL_SAMP_12KHZ, AST_FORMAT2_ATTR_END)) {
+ if (!ast_format_isset(&format1, TEST_ATTR_KEY_SAMP_RATE, TEST_ATTR_VAL_SAMP_12KHZ, AST_FORMATNEW_ATTR_END)) {
ast_test_status_update(test, "format1 did not determine isset on number correctly. \n");
return AST_TEST_FAIL;
}
/* append the string attribute to a format with previous attributes already set */
- ast_format_set(&format1, AST_FORMAT2_TESTLAW, 1,
+ ast_format_set(&format1, AST_FORMATNEW_TESTLAW, 1,
TEST_ATTR_KEY_STRING,"String",
- AST_FORMAT2_ATTR_END);
- if (ast_format_isset(&format1, TEST_ATTR_KEY_STRING, "String", AST_FORMAT2_ATTR_END)) {
+ AST_FORMATNEW_ATTR_END);
+ if (ast_format_isset(&format1, TEST_ATTR_KEY_STRING, "String", AST_FORMATNEW_ATTR_END)) {
ast_test_status_update(test, "format1 did not set string attribute correctly.\n");
return AST_TEST_FAIL;
}
- if (!ast_format_isset(&format1, TEST_ATTR_KEY_STRING, "Not a string", AST_FORMAT2_ATTR_END)) {
+ if (!ast_format_isset(&format1, TEST_ATTR_KEY_STRING, "Not a string", AST_FORMATNEW_ATTR_END)) {
ast_test_status_update(test, "format1 did not determine isset on string correctly. \n");
return AST_TEST_FAIL;
}
/* set format2 with both STRING and NUMBER at the same time */
- ast_format_set(&format2, AST_FORMAT2_TESTLAW, 1,
+ ast_format_set(&format2, AST_FORMATNEW_TESTLAW, 1,
TEST_ATTR_KEY_STRING, "MOOOoo",
TEST_ATTR_KEY_SAMP_RATE, TEST_ATTR_VAL_SAMP_8KHZ,
TEST_ATTR_KEY_SAMP_RATE, TEST_ATTR_VAL_SAMP_16KHZ,
- AST_FORMAT2_ATTR_END);
+ AST_FORMATNEW_ATTR_END);
/* perform isset with multiple key value pairs. */
if (ast_format_isset(&format2,
TEST_ATTR_KEY_STRING, "MOOOoo",
TEST_ATTR_KEY_SAMP_RATE, TEST_ATTR_VAL_SAMP_16KHZ,
- AST_FORMAT2_ATTR_END)) {
+ AST_FORMATNEW_ATTR_END)) {
ast_test_status_update(test, "format2 did not set attributes correctly.\n");
return AST_TEST_FAIL;
@@ -209,7 +209,7 @@
TEST_ATTR_KEY_STRING, "WRONG",
TEST_ATTR_KEY_SAMP_RATE, TEST_ATTR_VAL_SAMP_8KHZ,
TEST_ATTR_KEY_SAMP_RATE, TEST_ATTR_VAL_SAMP_16KHZ,
- AST_FORMAT2_ATTR_END)) {
+ AST_FORMATNEW_ATTR_END)) {
ast_test_status_update(test, "format2 did not deterine isset correctly.\n");
return AST_TEST_FAIL;
@@ -220,7 +220,7 @@
ast_test_status_update(test, "failed to get joint attributes.\n");
return AST_TEST_FAIL;
}
- if (ast_format_isset(&joint, TEST_ATTR_KEY_SAMP_RATE, TEST_ATTR_VAL_SAMP_8KHZ, AST_FORMAT2_ATTR_END)) {
+ if (ast_format_isset(&joint, TEST_ATTR_KEY_SAMP_RATE, TEST_ATTR_VAL_SAMP_8KHZ, AST_FORMATNEW_ATTR_END)) {
ast_test_status_update(test, "joint attribute was not what we expected.\n");
return AST_TEST_FAIL;
}
More information about the asterisk-commits
mailing list