[asterisk-commits] tilghman: branch group/codec_bits r112392 - in /team/group/codec_bits: apps/ ...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Apr 1 18:29:15 CDT 2008


Author: tilghman
Date: Tue Apr  1 18:29:14 2008
New Revision: 112392

URL: http://svn.digium.com/view/asterisk?view=rev&rev=112392
Log:
Lots more conversions

Modified:
    team/group/codec_bits/apps/app_meetme.c
    team/group/codec_bits/channels/chan_phone.c
    team/group/codec_bits/channels/chan_sip.c
    team/group/codec_bits/codecs/codec_lpc10.c
    team/group/codec_bits/codecs/codec_resample.c
    team/group/codec_bits/codecs/codec_speex.c
    team/group/codec_bits/codecs/codec_ulaw.c
    team/group/codec_bits/codecs/codec_zap.c
    team/group/codec_bits/formats/format_g723.c
    team/group/codec_bits/formats/format_g726.c
    team/group/codec_bits/formats/format_g729.c
    team/group/codec_bits/formats/format_gsm.c
    team/group/codec_bits/formats/format_h263.c
    team/group/codec_bits/formats/format_h264.c
    team/group/codec_bits/formats/format_ilbc.c
    team/group/codec_bits/formats/format_jpeg.c
    team/group/codec_bits/formats/format_ogg_vorbis.c
    team/group/codec_bits/include/asterisk/channel.h
    team/group/codec_bits/include/asterisk/frame.h
    team/group/codec_bits/include/asterisk/image.h
    team/group/codec_bits/include/asterisk/mod_format.h

Modified: team/group/codec_bits/apps/app_meetme.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/apps/app_meetme.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/apps/app_meetme.c (original)
+++ team/group/codec_bits/apps/app_meetme.c Tue Apr  1 18:29:14 2008
@@ -380,9 +380,9 @@
 	char pinadmin[MAX_PIN];                 /*!< If protected by a admin PIN */
 	char uniqueid[32];
 	long endtime;                           /*!< When to end the conf if scheduled */
-	struct ast_frame *transframe[32];
+	struct ast_frame *transframe[8][32];
 	struct ast_frame *origframe;
-	struct ast_trans_pvt *transpath[32];
+	struct ast_trans_pvt *transpath[8][32];
 	AST_LIST_HEAD_NOLOCK(, ast_conf_user) userlist;
 	AST_LIST_ENTRY(ast_conference) list;
 };
@@ -1319,7 +1319,7 @@
    We assume that this was called while holding conflock. */
 static int conf_free(struct ast_conference *conf)
 {
-	int x;
+	int x, y;
 	
 	AST_LIST_REMOVE(&confs, conf, list);
 	manager_event(EVENT_FLAG_CALL, "MeetmeEnd", "Meetme: %s\r\n", conf->confno);
@@ -1336,11 +1336,15 @@
 		}
 	}
 
-	for (x = 0; x < AST_FRAME_BITS; x++) {
-		if (conf->transframe[x])
-			ast_frfree(conf->transframe[x]);
-		if (conf->transpath[x])
-			ast_translator_free_path(conf->transpath[x]);
+	for (x = 0; x < sizeof(conf->transframe) / sizeof(conf->transframe[0]); x++) {
+		for (y = 0; y < sizeof(AST_FMT_SLINEAR.audio[0]) * 8; y++) {
+			if (conf->transframe[x][y]) {
+				ast_frfree(conf->transframe[x][y]);
+			}
+			if (conf->transpath[x][y]) {
+				ast_translator_free_path(conf->transpath[x][y]);
+			}
+		}
 	}
 	if (conf->origframe)
 		ast_frfree(conf->origframe);
@@ -2537,30 +2541,44 @@
 						((confflags & CONFFLAG_MONITOR) || 
 						 (user->adminflags & (ADMINFLAG_MUTED | ADMINFLAG_SELFMUTED)) ||
 						 (!user->talking)) ) {
-						int index;
-						for (index = 0; index < AST_FRAME_BITS; index++) {
-							if (chan->rawwriteformat & (1 << index)) {
+						int index, bit, found = 0;
+						struct ast_extended_codec sample = { { 0, }, };
+						for (index = 0; index < sizeof(fr.codec.audio) / sizeof(fr.codec.audio[0]); index++) {
+							for (bit = 0; bit < sizeof(fr.codec.audio[0]) * 8; bit++) {
+								sample.audio[index] = 1 << bit;
+								if (FMT_NZ(FMT_AND(chan->rawwriteformat, sample))) {
+									found = 1;
+									break;
+								}
+							}
+							if (found) {
 								break;
 							}
+							sample.audio[index] = 0;
 						}
-						if (index >= AST_FRAME_BITS)
+						if (index >= sizeof(fr.codec.audio) / sizeof(fr.codec.audio[0])) {
 							goto bailoutandtrynormal;
+						}
 						ast_mutex_lock(&conf->listenlock);
-						if (!conf->transframe[index]) {
+						if (conf->transframe[index][bit]) {
+							/* Build a translation path for every single codec that we ever receive */
 							if (conf->origframe) {
-								if (!conf->transpath[index])
-									conf->transpath[index] = ast_translator_build_path((1 << index), AST_FMT_SLINEAR);
-								if (conf->transpath[index]) {
-									conf->transframe[index] = ast_translate(conf->transpath[index], conf->origframe, 0);
-									if (!conf->transframe[index])
-										conf->transframe[index] = &ast_null_frame;
+								if (!conf->transpath[index][bit]) {
+									conf->transpath[index][bit] = ast_translator_build_path(sample, AST_FMT_SLINEAR);
+								}
+								if (conf->transpath[index][bit]) {
+									conf->transframe[index][bit] = ast_translate(conf->transpath[index][bit], conf->origframe, 0);
+									if (!conf->transframe[index][bit]) {
+										conf->transframe[index][bit] = &ast_null_frame;
+									}
 								}
 							}
 						}
 						if (conf->transframe[index]) {
- 							if (conf->transframe[index]->frametype != AST_FRAME_NULL) {
-	 							if (ast_write(chan, conf->transframe[index]))
+ 							if (conf->transframe[index][bit]->frametype != AST_FRAME_NULL) {
+	 							if (ast_write(chan, conf->transframe[index][bit])) {
 									ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", chan->name);
+								}
 							}
 						} else {
 							ast_mutex_unlock(&conf->listenlock);
@@ -2569,14 +2587,16 @@
 						ast_mutex_unlock(&conf->listenlock);
 					} else {
 bailoutandtrynormal:					
-						if (user->listen.actual)
+						if (user->listen.actual) {
 							ast_frame_adjust_volume(&fr, user->listen.actual);
+						}
 						if (ast_write(chan, &fr) < 0) {
 							ast_log(LOG_WARNING, "Unable to write frame to channel %s\n", chan->name);
 						}
 					}
-				} else 
+				} else {
 					ast_log(LOG_WARNING, "Failed to read frame: %s\n", strerror(errno));
+				}
 			}
 			lastmarked = currentmarked;
 		}
@@ -3570,7 +3590,7 @@
 	int flags;
 	struct ast_filestream *s = NULL;
 	int res = 0;
-	int x;
+	int x, y;
 	const char *oldrecordingfilename = NULL;
 
 	if (!cnf || !cnf->lchan) {
@@ -3600,11 +3620,13 @@
 		}
 		if (f->frametype == AST_FRAME_VOICE) {
 			ast_mutex_lock(&cnf->listenlock);
-			for (x = 0; x < AST_FRAME_BITS; x++) {
-				/* Free any translations that have occured */
-				if (cnf->transframe[x]) {
-					ast_frfree(cnf->transframe[x]);
-					cnf->transframe[x] = NULL;
+			for (x = 0; x < sizeof(cnf->transframe) / sizeof(cnf->transframe[0]); x++) {
+				for (y = 0; y < 32; y++) {
+					/* Free any translations that have occured */
+					if (cnf->transframe[x][y]) {
+						ast_frfree(cnf->transframe[x][y]);
+						cnf->transframe[x][y] = NULL;
+					}
 				}
 			}
 			if (cnf->origframe)

Modified: team/group/codec_bits/channels/chan_phone.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/channels/chan_phone.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/channels/chan_phone.c (original)
+++ team/group/codec_bits/channels/chan_phone.c Tue Apr  1 18:29:14 2008
@@ -84,7 +84,7 @@
 static const char tdesc[] = "Standard Linux Telephony API Driver";
 static const char config[] = "phone.conf";
 
-const struct ast_extended_codec all_codecs = { { -1, -1, -1, -1, -1, -1, -1, -1 }, { -1, -1, -1, -1, -1, -1, -1 }, -1 };
+const struct ast_extended_codec all_codecs = AST_FMT_FULL_MASK_INIT;
 
 /* Default context for dialtone mode */
 static char context[AST_MAX_EXTENSION] = "default";
@@ -206,16 +206,16 @@
 static int phone_indicate(struct ast_channel *chan, int condition, const void *data, size_t datalen)
 {
 	struct phone_pvt *p = chan->tech_pvt;
-	int res=-1;
+	int res = -1;
 	ast_debug(1, "Requested indication %d on channel %s\n", condition, chan->name);
 	switch(condition) {
 	case AST_CONTROL_FLASH:
 		ioctl(p->fd, IXJCTL_PSTN_SET_STATE, PSTN_ON_HOOK);
 		usleep(320000);
 		ioctl(p->fd, IXJCTL_PSTN_SET_STATE, PSTN_OFF_HOOK);
-			p->lastformat = all_codecs;
-			res = 0;
-			break;
+		p->lastformat = all_codecs;
+		res = 0;
+		break;
 	case AST_CONTROL_HOLD:
 		ast_moh_start(chan, data, NULL);
 		break;
@@ -1351,7 +1351,7 @@
 	int mode = MODE_IMMEDIATE;
 	int txgain = DEFAULT_GAIN, rxgain = DEFAULT_GAIN; /* default gain 1.0 */
 	struct ast_flags config_flags = { 0 };
-	const struct ast_extended_codec nonvoice = { { 0, }, { -1, -1, -1, -1, -1, -1, -1 }, -1 };
+	const struct ast_extended_codec nonvoice = { { 0, }, { -1, -1, -1, -1, -1, -1, -1 }, { -1 }, { -1 } };
 
 	cfg = ast_config_load(config, config_flags);
 

Modified: team/group/codec_bits/channels/chan_sip.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/channels/chan_sip.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/channels/chan_sip.c (original)
+++ team/group/codec_bits/channels/chan_sip.c Tue Apr  1 18:29:14 2008
@@ -8189,17 +8189,17 @@
 	}
 
 	/* Now send any other common audio and video codecs, and non-codec formats: */
-	for (page = 0; page < 8; page++) {
-		for (bit = 0; bit < 32; bit++) {
+	for (page = 0; page < sizeof(capability.audio) / sizeof(capability.audio[0]); page++) {
+		for (bit = 0; bit < sizeof(capability.audio[0]) * 8; bit++) {
 			struct ast_extended_codec codec[3] = { AST_FMT_NULL_MASK, AST_FMT_NULL_MASK, AST_FMT_NULL_MASK };
 			int i;
 
 			codec[0].audio[page] = 1 << bit;
-			if (page < 7) {
+			if (page < sizeof(capability.video) / sizeof(capability.video[0])) {
 				codec[1].video[page] = 1 << bit;
 			}
-			if (page == 0) {
-				codec[2].text = 1 << bit;
+			if (page < sizeof(capability.text) / sizeof(capability.text[0])) {
+				codec[2].text[page] = 1 << bit;
 			}
 
 			for (i = 0; i < 3; i++) {

Modified: team/group/codec_bits/codecs/codec_lpc10.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/codecs/codec_lpc10.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/codecs/codec_lpc10.c (original)
+++ team/group/codec_bits/codecs/codec_lpc10.c Tue Apr  1 18:29:14 2008
@@ -79,7 +79,8 @@
 {
 	static struct ast_frame f;
 	f.frametype = AST_FRAME_VOICE;
-	f.subclass = AST_FORMAT_SLINEAR;
+	f.subclass = 0;
+	f.codec = AST_FMT_SLINEAR;
 	f.datalen = sizeof(slin_lpc10_ex);
 	/* Assume 8000 Hz */
 	f.samples = LPC10_SAMPLES_PER_FRAME;
@@ -92,9 +93,9 @@
 
 static struct ast_frame *lpc10tolin_sample(void)
 {
-	static struct ast_frame f;
+	static struct ast_frame f = { .codec = { { AST_FORMAT_AUDIO_LPC10 } } };
 	f.frametype = AST_FRAME_VOICE;
-	f.subclass = AST_FORMAT_LPC10;
+	f.subclass = 0;
 	f.datalen = sizeof(lpc10_slin_ex);
 	/* All frames are 22 ms long (maybe a little more -- why did he choose
 	   LPC10_SAMPLES_PER_FRAME sample frames anyway?? */
@@ -109,7 +110,7 @@
 static void extract_bits(INT32 *bits, unsigned char *c)
 {
 	int x;
-	for (x=0;x<LPC10_BITS_IN_COMPRESSED_FRAME;x++) {
+	for (x = 0; x < LPC10_BITS_IN_COMPRESSED_FRAME; x++) {
 		if (*c & (0x80 >> (x & 7)))
 			bits[x] = 1;
 		else
@@ -224,8 +225,8 @@
 
 static struct ast_translator lpc10tolin = {
 	.name = "lpc10tolin", 
-	.srcfmt = AST_FORMAT_LPC10,
-	.dstfmt = AST_FORMAT_SLINEAR,
+	.srcfmt = { { AST_FORMAT_AUDIO_LPC10 } },
+	.dstfmt = { { AST_FORMAT_AUDIO_SLINEAR } },
 	.newpvt = lpc10_dec_new,
 	.framein = lpc10tolin_framein,
 	.destroy = lpc10_destroy,
@@ -238,8 +239,8 @@
 
 static struct ast_translator lintolpc10 = {
 	.name = "lintolpc10", 
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_LPC10,
+	.srcfmt = { { AST_FORMAT_AUDIO_SLINEAR } },
+	.dstfmt = { { AST_FORMAT_AUDIO_LPC10 } },
 	.newpvt = lpc10_enc_new,
 	.framein = lintolpc10_framein,
 	.frameout = lintolpc10_frameout,

Modified: team/group/codec_bits/codecs/codec_resample.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/codecs/codec_resample.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/codecs/codec_resample.c (original)
+++ team/group/codec_bits/codecs/codec_resample.c Tue Apr  1 18:29:14 2008
@@ -164,7 +164,8 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass = AST_FORMAT_SLINEAR16,
+		.subclass = 0,
+		.codec = { { AST_FORMAT_AUDIO_SLINEAR16 } },
 		.datalen = sizeof(slin16_slin8_ex),
 		.samples = sizeof(slin16_slin8_ex) / sizeof(slin16_slin8_ex[0]),
 		.src = __PRETTY_FUNCTION__,
@@ -178,7 +179,8 @@
 {
 	static struct ast_frame f = {
 		.frametype = AST_FRAME_VOICE,
-		.subclass = AST_FORMAT_SLINEAR,
+		.subclass = 0,
+		.codec = { { AST_FORMAT_AUDIO_SLINEAR } },
 		.datalen = sizeof(slin8_slin16_ex),
 		.samples = sizeof(slin8_slin16_ex) / sizeof(slin8_slin16_ex[0]),
 		.src = __PRETTY_FUNCTION__,
@@ -190,8 +192,8 @@
 
 static struct ast_translator slin16_to_slin8 = {
 	.name = "slin16_to_slin8",
-	.srcfmt = AST_FORMAT_SLINEAR16,
-	.dstfmt = AST_FORMAT_SLINEAR,
+	.srcfmt = { { AST_FORMAT_AUDIO_SLINEAR16 } },
+	.dstfmt = { { AST_FORMAT_AUDIO_SLINEAR } },
 	.newpvt = slin16_to_slin8_new,
 	.destroy = slin16_to_slin8_destroy,
 	.framein = slin16_to_slin8_framein,
@@ -203,8 +205,8 @@
 
 static struct ast_translator slin8_to_slin16 = {
 	.name = "slin8_to_slin16",
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_SLINEAR16,
+	.srcfmt = { { AST_FORMAT_AUDIO_SLINEAR } },
+	.dstfmt = { { AST_FORMAT_AUDIO_SLINEAR16 } },
 	.newpvt = slin8_to_slin16_new,
 	.destroy = slin8_to_slin16_destroy,
 	.framein = slin8_to_slin16_framein,

Modified: team/group/codec_bits/codecs/codec_speex.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/codecs/codec_speex.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/codecs/codec_speex.c (original)
+++ team/group/codec_bits/codecs/codec_speex.c Tue Apr  1 18:29:14 2008
@@ -157,7 +157,8 @@
 {
 	static struct ast_frame f;
 	f.frametype = AST_FRAME_VOICE;
-	f.subclass = AST_FORMAT_SLINEAR;
+	f.subclass = 0;
+	f.codec = AST_FMT_SLINEAR;
 	f.datalen = sizeof(slin_speex_ex);
 	/* Assume 8000 Hz */
 	f.samples = sizeof(slin_speex_ex)/2;
@@ -170,9 +171,9 @@
 
 static struct ast_frame *speextolin_sample(void)
 {
-	static struct ast_frame f;
+	static struct ast_frame f = { .codec = { { AST_FORMAT_AUDIO_SPEEX } } };
 	f.frametype = AST_FRAME_VOICE;
-	f.subclass = AST_FORMAT_SPEEX;
+	f.subclass = 0;
 	f.datalen = sizeof(speex_slin_ex);
 	/* All frames are 20 ms long */
 	f.samples = SPEEX_SAMPLES;
@@ -340,8 +341,8 @@
 
 static struct ast_translator speextolin = {
 	.name = "speextolin", 
-	.srcfmt = AST_FORMAT_SPEEX,
-	.dstfmt =  AST_FORMAT_SLINEAR,
+	.srcfmt = { { AST_FORMAT_AUDIO_SPEEX } },
+	.dstfmt =  { { AST_FORMAT_AUDIO_SLINEAR } },
 	.newpvt = speextolin_new,
 	.framein = speextolin_framein,
 	.destroy = speextolin_destroy,
@@ -354,8 +355,8 @@
 
 static struct ast_translator lintospeex = {
 	.name = "lintospeex", 
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_SPEEX,
+	.srcfmt = { { AST_FORMAT_AUDIO_SLINEAR } },
+	.dstfmt = { { AST_FORMAT_AUDIO_SPEEX } },
 	.newpvt = lintospeex_new,
 	.framein = lintospeex_framein,
 	.frameout = lintospeex_frameout,

Modified: team/group/codec_bits/codecs/codec_ulaw.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/codecs/codec_ulaw.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/codecs/codec_ulaw.c (original)
+++ team/group/codec_bits/codecs/codec_ulaw.c Tue Apr  1 18:29:14 2008
@@ -76,9 +76,9 @@
 /*!  * \brief ulawToLin_Sample */
 static struct ast_frame *ulawtolin_sample(void)
 {
-	static struct ast_frame f;
+	static struct ast_frame f = { .codec = { { AST_FORMAT_AUDIO_ULAW } } };
 	f.frametype = AST_FRAME_VOICE;
-	f.subclass = AST_FORMAT_ULAW;
+	f.subclass = 0;
 	f.datalen = sizeof(ulaw_slin_ex);
 	f.samples = sizeof(ulaw_slin_ex);
 	f.mallocd = 0;
@@ -94,9 +94,9 @@
 
 static struct ast_frame *lintoulaw_sample(void)
 {
-	static struct ast_frame f;
+	static struct ast_frame f = { .codec = { { AST_FORMAT_AUDIO_SLINEAR } } };
 	f.frametype = AST_FRAME_VOICE;
-	f.subclass = AST_FORMAT_SLINEAR;
+	f.subclass = 0;
 	f.datalen = sizeof(slin_ulaw_ex);
 	/* Assume 8000 Hz */
 	f.samples = sizeof(slin_ulaw_ex) / 2;
@@ -113,8 +113,8 @@
 
 static struct ast_translator ulawtolin = {
 	.name = "ulawtolin",
-	.srcfmt = AST_FORMAT_ULAW,
-	.dstfmt = AST_FORMAT_SLINEAR,
+	.srcfmt = { { AST_FORMAT_AUDIO_ULAW } },
+	.dstfmt = { { AST_FORMAT_AUDIO_SLINEAR } },
 	.framein = ulawtolin_framein,
 	.sample = ulawtolin_sample,
 	.buffer_samples = BUFFER_SAMPLES,
@@ -128,8 +128,8 @@
 
 static struct ast_translator lintoulaw = {
 	.name = "lintoulaw",
-	.srcfmt = AST_FORMAT_SLINEAR,
-	.dstfmt = AST_FORMAT_ULAW,
+	.srcfmt = { { AST_FORMAT_AUDIO_SLINEAR } },
+	.dstfmt = { { AST_FORMAT_AUDIO_ULAW } },
 	.framein = lintoulaw_framein,
 	.sample = lintoulaw_sample,
 	.buf_size = BUFFER_SAMPLES,

Modified: team/group/codec_bits/codecs/codec_zap.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/codecs/codec_zap.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/codecs/codec_zap.c (original)
+++ team/group/codec_bits/codecs/codec_zap.c Tue Apr  1 18:29:14 2008
@@ -51,6 +51,8 @@
 #include "asterisk/linkedlists.h"
 
 #define BUFFER_SAMPLES	8000
+
+static const struct ast_extended_codec either_codec = { { AST_FORMAT_AUDIO_G729A | AST_FORMAT_AUDIO_G723_1 } };
 
 static unsigned int global_useplc = 0;
 
@@ -213,14 +215,10 @@
 	if (ioctl(ztp->fd, ZT_TRANSCODE_OP, &x))
 		ast_log(LOG_WARNING, "Failed to release transcoder channel: %s\n", strerror(errno));
 
-	switch (ztp->hdr->dstfmt) {
-	case AST_FORMAT_G729A:
-	case AST_FORMAT_G723_1:
+	if (FMT_NZ(FMT_AND(ztp->hdr->dstfmt, either_codec))) {
 		ast_atomic_fetchadd_int(&channels.encoders, -1);
-		break;
-	default:
+	} else {
 		ast_atomic_fetchadd_int(&channels.decoders, -1);
-		break;
 	}
 
 	munmap(ztp->hdr, sizeof(*ztp->hdr));
@@ -274,14 +272,10 @@
 	ztp->fd = fd;
 	ztp->hdr = hdr;
 
-	switch (hdr->dstfmt) {
-	case AST_FORMAT_G729A:
-	case AST_FORMAT_G723_1:
+	if (FMT_NZ(FMT_AND(hdr->dstfmt, either_codec))) {
 		ast_atomic_fetchadd_int(&channels.encoders, +1);
-		break;
-	default:
+	} else {
 		ast_atomic_fetchadd_int(&channels.decoders, +1);
-		break;
 	}
 
 	return 0;

Modified: team/group/codec_bits/formats/format_g723.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/formats/format_g723.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/formats/format_g723.c (original)
+++ team/group/codec_bits/formats/format_g723.c Tue Apr  1 18:29:14 2008
@@ -39,6 +39,8 @@
 	unsigned short size;
 	int res;
 	int delay;
+	const struct ast_extended_codec g723 = { { AST_FORMAT_AUDIO_G723_1 } };
+
 	/* Read the delay for the next packet, and schedule again if necessary */
 	/* XXX is this ignored ? */
 	if (fread(&delay, 1, 4, s->f) == 4) 
@@ -61,7 +63,8 @@
 	}
 	/* Read the data into the buffer */
 	s->fr.frametype = AST_FRAME_VOICE;
-	s->fr.subclass = AST_FORMAT_G723_1;
+	s->fr.subclass = 0;
+	s->fr.codec = g723;
 	s->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, size);
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) != size) {
@@ -82,7 +85,7 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass != AST_FORMAT_G723_1) {
+	if (f->codec.audio[0] != AST_FORMAT_AUDIO_G723_1) {
 		ast_log(LOG_WARNING, "Asked to write non-g723 frame!\n");
 		return -1;
 	}
@@ -128,7 +131,7 @@
 static const struct ast_format g723_1_f = {
 	.name = "g723sf",
 	.exts = "g723|g723sf",
-	.format = AST_FORMAT_G723_1,
+	.format = { { AST_FORMAT_AUDIO_G723_1 } },
 	.write = g723_write,
 	.seek =	g723_seek,
 	.trunc = g723_trunc,

Modified: team/group/codec_bits/formats/format_g726.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/formats/format_g726.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/formats/format_g726.c (original)
+++ team/group/codec_bits/formats/format_g726.c Tue Apr  1 18:29:14 2008
@@ -116,10 +116,12 @@
 {
 	int res;
 	struct g726_desc *fs = (struct g726_desc *)s->_private;
+	const struct ast_extended_codec g726 = { { AST_FORMAT_AUDIO_G726 } };
 
 	/* Send a frame from the file to the appropriate channel */
 	s->fr.frametype = AST_FRAME_VOICE;
-	s->fr.subclass = AST_FORMAT_G726;
+	s->fr.subclass = 0;
+	s->fr.codec = g726;
 	s->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, frame_size[fs->rate]);
 	s->fr.samples = 8 * FRAME_TIME;
@@ -136,14 +138,15 @@
 {
 	int res;
 	struct g726_desc *fs = (struct g726_desc *)s->_private;
+	struct ast_str *str = ast_str_alloca(BITSTRING_SIZE);
 
 	if (f->frametype != AST_FRAME_VOICE) {
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass != AST_FORMAT_G726) {
-		ast_log(LOG_WARNING, "Asked to write non-G726 frame (%d)!\n", 
-						f->subclass);
+	if (f->codec.audio[0] != AST_FORMAT_AUDIO_G726) {
+		ast_log(LOG_WARNING, "Asked to write non-G726 frame (%s)!\n", 
+						ast_codec2bitstring(f->codec, &str));
 		return -1;
 	}
 	if (f->datalen % frame_size[fs->rate]) {
@@ -178,7 +181,7 @@
 	{
 		.name = "g726-40",
 		.exts = "g726-40",
-		.format = AST_FORMAT_G726,
+		.format = { { AST_FORMAT_AUDIO_G726 } },
 		.open = g726_40_open,
 		.rewrite = g726_40_rewrite,
 		.write = g726_write,
@@ -192,7 +195,7 @@
 	{
 		.name = "g726-32",
 		.exts = "g726-32",
-		.format = AST_FORMAT_G726,
+		.format = { { AST_FORMAT_AUDIO_G726 } },
 		.open = g726_32_open,
 		.rewrite = g726_32_rewrite,
 		.write = g726_write,
@@ -206,7 +209,7 @@
 	{
 		.name = "g726-24",
 		.exts = "g726-24",
-		.format = AST_FORMAT_G726,
+		.format = { { AST_FORMAT_AUDIO_G726 } },
 		.open = g726_24_open,
 		.rewrite = g726_24_rewrite,
 		.write = g726_write,
@@ -220,7 +223,7 @@
 	{
 		.name = "g726-16",
 		.exts = "g726-16",
-		.format = AST_FORMAT_G726,
+		.format = { { AST_FORMAT_AUDIO_G726 } },
 		.open = g726_16_open,
 		.rewrite = g726_16_rewrite,
 		.write = g726_write,
@@ -231,14 +234,14 @@
 		.buf_size = BUF_SIZE + AST_FRIENDLY_OFFSET,
 		.desc_size = sizeof(struct g726_desc),
 	},
-	{	.format = 0 }	/* terminator */
+	{	.format = { { 0 } } }	/* terminator */
 };
 
 static int load_module(void)
 {
 	int i;
 
-	for (i = 0; f[i].format ; i++) {
+	for (i = 0; FMT_NZ(f[i].format) ; i++) {
 		if (ast_format_register(&f[i])) {	/* errors are fatal */
 			ast_log(LOG_WARNING, "Failed to register format %s.\n", f[i].name);
 			return AST_MODULE_LOAD_FAILURE;
@@ -251,7 +254,7 @@
 {
 	int i;
 
-	for (i = 0; f[i].format ; i++) {
+	for (i = 0; FMT_NZ(f[i].format) ; i++) {
 		if (ast_format_unregister(f[i].name))
 			ast_log(LOG_WARNING, "Failed to unregister format %s.\n", f[i].name);
 	}

Modified: team/group/codec_bits/formats/format_g729.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/formats/format_g729.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/formats/format_g729.c (original)
+++ team/group/codec_bits/formats/format_g729.c Tue Apr  1 18:29:14 2008
@@ -44,9 +44,11 @@
 static struct ast_frame *g729_read(struct ast_filestream *s, int *whennext)
 {
 	int res;
+	struct ast_extended_codec g729 = { { AST_FORMAT_AUDIO_G729A } };
 	/* Send a frame from the file to the appropriate channel */
 	s->fr.frametype = AST_FRAME_VOICE;
-	s->fr.subclass = AST_FORMAT_G729A;
+	s->fr.subclass = 0;
+	s->fr.codec = g729;
 	s->fr.mallocd = 0;
 	s->fr.samples = G729A_SAMPLES;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
@@ -66,7 +68,7 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass != AST_FORMAT_G729A) {
+	if (f->codec.audio[0] != AST_FORMAT_AUDIO_G729A) {
 		ast_log(LOG_WARNING, "Asked to write non-G729 frame (%d)!\n", f->subclass);
 		return -1;
 	}
@@ -124,7 +126,7 @@
 static const struct ast_format g729_f = {
 	.name = "g729",
 	.exts = "g729",
-	.format = AST_FORMAT_G729A,
+	.format = { { AST_FORMAT_AUDIO_G729A } },
 	.write = g729_write,
 	.seek = g729_seek,
 	.trunc = g729_trunc,

Modified: team/group/codec_bits/formats/format_gsm.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/formats/format_gsm.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/formats/format_gsm.c (original)
+++ team/group/codec_bits/formats/format_gsm.c Tue Apr  1 18:29:14 2008
@@ -51,9 +51,11 @@
 static struct ast_frame *gsm_read(struct ast_filestream *s, int *whennext)
 {
 	int res;
+	const struct ast_extended_codec gsm = { { AST_FORMAT_AUDIO_GSM } };
 
 	s->fr.frametype = AST_FRAME_VOICE;
-	s->fr.subclass = AST_FORMAT_GSM;
+	s->fr.subclass = 0;
+	s->fr.codec = gsm;
 	AST_FRAME_SET_BUFFER(&(s->fr), s->buf, AST_FRIENDLY_OFFSET, GSM_FRAME_SIZE)
 	s->fr.mallocd = 0;
 	if ((res = fread(s->fr.data, 1, GSM_FRAME_SIZE, s->f)) != GSM_FRAME_SIZE) {
@@ -74,7 +76,7 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass != AST_FORMAT_GSM) {
+	if (f->codec.audio[0] != AST_FORMAT_AUDIO_GSM) {
 		ast_log(LOG_WARNING, "Asked to write non-GSM frame (%d)!\n", f->subclass);
 		return -1;
 	}
@@ -146,7 +148,7 @@
 static const struct ast_format gsm_f = {
 	.name = "gsm",
 	.exts = "gsm",
-	.format = AST_FORMAT_GSM,
+	.format = { { AST_FORMAT_AUDIO_GSM } },
 	.write = gsm_write,
 	.seek =	gsm_seek,
 	.trunc = gsm_trunc,

Modified: team/group/codec_bits/formats/format_h263.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/formats/format_h263.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/formats/format_h263.c (original)
+++ team/group/codec_bits/formats/format_h263.c Tue Apr  1 18:29:14 2008
@@ -68,6 +68,7 @@
 	unsigned short len;
 	unsigned int ts;
 	struct h263_desc *fs = (struct h263_desc *)s->_private;
+	const struct ast_extended_codec h263 = { .video = { AST_FORMAT_VIDEO_H263 } };
 
 	/* Send a frame from the file to the appropriate channel */
 	if ((res = fread(&len, 1, sizeof(len), s->f)) < 1)
@@ -80,7 +81,8 @@
 		return NULL;
 	}
 	s->fr.frametype = AST_FRAME_VIDEO;
-	s->fr.subclass = AST_FORMAT_H263;
+	s->fr.subclass = 0;
+	s->fr.codec = h263;
 	s->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
@@ -108,6 +110,8 @@
 	unsigned short len;
 	int subclass;
 	int mark=0;
+	struct ast_str *str = ast_str_alloca(BITSTRING_SIZE);
+
 	if (f->frametype != AST_FRAME_VIDEO) {
 		ast_log(LOG_WARNING, "Asked to write non-video frame!\n");
 		return -1;
@@ -116,8 +120,8 @@
 	if (subclass & 0x1)
 		mark=0x8000;
 	subclass &= ~0x1;
-	if (subclass != AST_FORMAT_H263) {
-		ast_log(LOG_WARNING, "Asked to write non-h263 frame (%d)!\n", f->subclass);
+	if (f->codec.video[0] != AST_FORMAT_VIDEO_H263) {
+		ast_log(LOG_WARNING, "Asked to write non-h263 frame (%s)!\n", ast_codec2bitstring(f->codec, &str));
 		return -1;
 	}
 	ts = htonl(f->samples);
@@ -160,7 +164,7 @@
 static const struct ast_format h263_f = {
 	.name = "h263",
 	.exts = "h263",
-	.format = AST_FORMAT_H263,
+	.format =  { .video = { AST_FORMAT_VIDEO_H263 } },
 	.open = h263_open,
 	.write = h263_write,
 	.seek = h263_seek,

Modified: team/group/codec_bits/formats/format_h264.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/formats/format_h264.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/formats/format_h264.c (original)
+++ team/group/codec_bits/formats/format_h264.c Tue Apr  1 18:29:14 2008
@@ -60,6 +60,7 @@
 	unsigned short len;
 	unsigned int ts;
 	struct h264_desc *fs = (struct h264_desc *)s->_private;
+	const struct ast_extended_codec h264 = { .video = { AST_FORMAT_VIDEO_H264 } };
 
 	/* Send a frame from the file to the appropriate channel */
 	if ((res = fread(&len, 1, sizeof(len), s->f)) < 1)
@@ -72,7 +73,8 @@
 		len = BUF_SIZE;	/* XXX truncate */
 	}
 	s->fr.frametype = AST_FRAME_VIDEO;
-	s->fr.subclass = AST_FORMAT_H264;
+	s->fr.subclass = 0;
+	s->fr.codec = h264;
 	s->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, len);
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
@@ -105,7 +107,7 @@
 		return -1;
 	}
 	mark = (f->subclass & 0x1) ? 0x8000 : 0;
-	if ((f->subclass & ~0x1) != AST_FORMAT_H264) {
+	if (f->codec.video[0] != AST_FORMAT_VIDEO_H264) {
 		ast_log(LOG_WARNING, "Asked to write non-h264 frame (%d)!\n", f->subclass);
 		return -1;
 	}
@@ -149,7 +151,7 @@
 static const struct ast_format h264_f = {
 	.name = "h264",
 	.exts = "h264",
-	.format = AST_FORMAT_H264,
+	.format = { .video = { AST_FORMAT_VIDEO_H264 } },
 	.open = h264_open,
 	.write = h264_write,
 	.seek = h264_seek,

Modified: team/group/codec_bits/formats/format_ilbc.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/formats/format_ilbc.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/formats/format_ilbc.c (original)
+++ team/group/codec_bits/formats/format_ilbc.c Tue Apr  1 18:29:14 2008
@@ -43,9 +43,12 @@
 static struct ast_frame *ilbc_read(struct ast_filestream *s, int *whennext)
 {
 	int res;
+	const struct ast_extended_codec ilbc = { { AST_FORMAT_AUDIO_ILBC } };
+
 	/* Send a frame from the file to the appropriate channel */
 	s->fr.frametype = AST_FRAME_VOICE;
-	s->fr.subclass = AST_FORMAT_ILBC;
+	s->fr.subclass = 0;
+	s->fr.codec = ilbc;
 	s->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&s->fr, s->buf, AST_FRIENDLY_OFFSET, ILBC_BUF_SIZE);
 	if ((res = fread(s->fr.data, 1, s->fr.datalen, s->f)) != s->fr.datalen) {
@@ -64,7 +67,7 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass != AST_FORMAT_ILBC) {
+	if (f->codec.audio[0] != AST_FORMAT_AUDIO_ILBC) {
 		ast_log(LOG_WARNING, "Asked to write non-iLBC frame (%d)!\n", f->subclass);
 		return -1;
 	}
@@ -122,7 +125,7 @@
 static const struct ast_format ilbc_f = {
 	.name = "iLBC",
 	.exts = "ilbc",
-	.format = AST_FORMAT_ILBC,
+	.format = { .audio = { AST_FORMAT_AUDIO_ILBC } },
 	.write = ilbc_write,
 	.seek = ilbc_seek,
 	.trunc = ilbc_trunc,

Modified: team/group/codec_bits/formats/format_jpeg.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/formats/format_jpeg.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/formats/format_jpeg.c (original)
+++ team/group/codec_bits/formats/format_jpeg.c Tue Apr  1 18:29:14 2008
@@ -38,6 +38,8 @@
 	struct ast_frame fr;
 	int res;
 	char buf[65536];
+	struct ast_extended_codec jpeg = { .image = { AST_FORMAT_IMAGE_JPEG } };
+
 	if (len > sizeof(buf) || len < 0) {
 		ast_log(LOG_WARNING, "JPEG image too large to read\n");
 		return NULL;
@@ -48,7 +50,8 @@
 	}
 	memset(&fr, 0, sizeof(fr));
 	fr.frametype = AST_FRAME_IMAGE;
-	fr.subclass = AST_FORMAT_JPEG;
+	fr.subclass = 0;
+	fr.codec = jpeg;
 	fr.data = buf;
 	fr.src = "JPEG Read";
 	fr.datalen = len;
@@ -74,7 +77,7 @@
 		ast_log(LOG_WARNING, "Not an image\n");
 		return -1;
 	}
-	if (fr->subclass != AST_FORMAT_JPEG) {
+	if (fr->codec.image[0] != AST_FORMAT_IMAGE_JPEG) {
 		ast_log(LOG_WARNING, "Not a jpeg image\n");
 		return -1;
 	}
@@ -92,7 +95,7 @@
 	.name = "jpg",
 	.desc = "JPEG (Joint Picture Experts Group)",
 	.exts = "jpg|jpeg",
-	.format = AST_FORMAT_JPEG,
+	.format = { .image = { AST_FORMAT_IMAGE_JPEG } },
 	.read_image = jpeg_read_image,
 	.identify = jpeg_identify,
 	.write_image = jpeg_write_image,

Modified: team/group/codec_bits/formats/format_ogg_vorbis.c
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/formats/format_ogg_vorbis.c?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/formats/format_ogg_vorbis.c (original)
+++ team/group/codec_bits/formats/format_ogg_vorbis.c Tue Apr  1 18:29:14 2008
@@ -273,6 +273,7 @@
 	float **buffer;
 	short *data;
 	struct vorbis_desc *s = (struct vorbis_desc *)fs->_private;
+	struct ast_str *str = ast_str_alloca(BITSTRING_SIZE);
 
 	if (!s->writing) {
 		ast_log(LOG_ERROR, "This stream is not set up for writing!\n");
@@ -283,9 +284,9 @@
 		ast_log(LOG_WARNING, "Asked to write non-voice frame!\n");
 		return -1;
 	}
-	if (f->subclass != AST_FORMAT_SLINEAR) {
-		ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%d)!\n",
-				f->subclass);
+	if (f->codec.audio[0] != AST_FORMAT_AUDIO_SLINEAR) {
+		ast_log(LOG_WARNING, "Asked to write non-SLINEAR frame (%s)!\n",
+				ast_codec2bitstring(f->codec, &str));
 		return -1;
 	}
 	if (!f->datalen)
@@ -430,7 +431,8 @@
 	short *buf;	/* SLIN data buffer */
 
 	fs->fr.frametype = AST_FRAME_VOICE;
-	fs->fr.subclass = AST_FORMAT_SLINEAR;
+	fs->fr.subclass = 0;
+	fs->fr.codec = AST_FMT_SLINEAR;
 	fs->fr.mallocd = 0;
 	AST_FRAME_SET_BUFFER(&fs->fr, fs->buf, AST_FRIENDLY_OFFSET, BUF_SIZE);
 	buf = (short *)(fs->fr.data);	/* SLIN data buffer */
@@ -523,7 +525,7 @@
 static const struct ast_format vorbis_f = {
 	.name = "ogg_vorbis",
 	.exts = "ogg",
-	.format = AST_FORMAT_SLINEAR,
+	.format = { .audio = { AST_FORMAT_AUDIO_SLINEAR } },
 	.open = ogg_vorbis_open,
 	.rewrite = ogg_vorbis_rewrite,
 	.write = ogg_vorbis_write,

Modified: team/group/codec_bits/include/asterisk/channel.h
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/include/asterisk/channel.h?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/include/asterisk/channel.h (original)
+++ team/group/codec_bits/include/asterisk/channel.h Tue Apr  1 18:29:14 2008
@@ -1323,10 +1323,6 @@
 /* Choose the best codec...  Uhhh...   Yah. */
 struct ast_extended_codec ast_best_codec(struct ast_extended_codec ecodec);
 
-/*! Convert the bitfield into an array of integers, for printing */
-const char *ast_codec2bitstring(struct ast_extended_codec ecodec, struct ast_str **str);
-#define BITSTRING_SIZE	60
-
 /*! Checks the value of an option */
 /*! 
  * Query the value of an option

Modified: team/group/codec_bits/include/asterisk/frame.h
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/include/asterisk/frame.h?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/include/asterisk/frame.h (original)
+++ team/group/codec_bits/include/asterisk/frame.h Tue Apr  1 18:29:14 2008
@@ -42,8 +42,8 @@
 struct ast_extended_codec {
 	int audio[8];	/* 256 bits */
 	int video[7];	/* 224 bits */
-	int image;		/* 32 bits */
-	int text;		/* 32 bits */
+	int image[1];	/* 32 bits */
+	int text[1];	/* 32 bits */
 };
 
 /*! \page Def_Frame AST Multimedia and signalling frames
@@ -287,13 +287,13 @@
 extern const struct ast_extended_codec AST_FMT_IMAGE_MASK;
 extern const struct ast_extended_codec AST_FMT_TEXT_MASK;
 extern const struct ast_extended_codec AST_FMT_NULL_MASK;
-#define AST_FMT_ULAW_INIT	{ { AST_FORMAT_AUDIO_ULAW, }, { 0, }, 0, 0 }
-#define AST_FMT_SLINEAR_INIT	{ { AST_FORMAT_AUDIO_SLINEAR, }, { 0, }, 0, 0 }
+#define AST_FMT_ULAW_INIT	{ { AST_FORMAT_AUDIO_ULAW, }, }
+#define AST_FMT_SLINEAR_INIT	{ { AST_FORMAT_AUDIO_SLINEAR, }, }
 #define AST_FMT_AUDIO_MASK_INIT	{ { -1, -1, -1, -1, -1, -1, -1, -1 }, }
-#define AST_FMT_VIDEO_MASK_INIT	{ { 0, }, { -1, -1, -1, -1, -1, -1, -1 }, }
-#define AST_FMT_IMAGE_MASK_INIT	{ { 0, }, { 0 }, -1, }
-#define AST_FMT_TEXT_MASK_INIT	{ { 0, }, { 0 }, 0, -1, }
-#define AST_FMT_FULL_MASK_INIT	{ { -1, -1, -1, -1, -1, -1, -1, -1 }, { -1, -1, -1, -1, -1, -1, -1 }, -1, -1 }
+#define AST_FMT_VIDEO_MASK_INIT	{ .video = { -1, -1, -1, -1, -1, -1, -1 }, }
+#define AST_FMT_IMAGE_MASK_INIT	{ .image = { -1 }, }
+#define AST_FMT_TEXT_MASK_INIT	{ .text = { -1 }, }
+#define AST_FMT_FULL_MASK_INIT	{ { -1, -1, -1, -1, -1, -1, -1, -1 }, { -1, -1, -1, -1, -1, -1, -1 }, { -1 }, { -1 } }
 #define AST_FMT_NULL_MASK_INIT	{ { 0, } }
 
 enum ast_control_frame_type {
@@ -647,6 +647,10 @@
 	return 8000;
 }
 
+/*! Convert the bitfield into an array of integers, for printing */
+const char *ast_codec2bitstring(struct ast_extended_codec ecodec, struct ast_str **str);
+#define BITSTRING_SIZE	60
+
 /*! Common bitwise operations, now that codec is no longer a 32-bit integer. */
 int ast_extended_codec_not(struct ast_extended_codec format);
 int ast_extended_codec_nonzero(struct ast_extended_codec format);

Modified: team/group/codec_bits/include/asterisk/image.h
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/include/asterisk/image.h?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/include/asterisk/image.h (original)
+++ team/group/codec_bits/include/asterisk/image.h Tue Apr  1 18:29:14 2008
@@ -23,12 +23,14 @@
 #ifndef _ASTERISK_IMAGE_H
 #define _ASTERISK_IMAGE_H
 
+#include "asterisk/frame.h"
+
 /*! \brief structure associated with registering an image format */
 struct ast_imager {
 	char *name;			/*!< Name */
 	char *desc;			/*!< Description */
 	char *exts;			/*!< Extension(s) (separated by '|' ) */
-	int format;			/*!< Image format */
+	struct ast_extended_codec format;	/*!< Image format */
 	struct ast_frame *(*read_image)(int fd, int len);	/*!< Read an image from a file descriptor */
 	int (*identify)(int fd);				/*!< Identify if this is that type of file */
 	int (*write_image)(int fd, struct ast_frame *frame);	/*!< Returns length written */

Modified: team/group/codec_bits/include/asterisk/mod_format.h
URL: http://svn.digium.com/view/asterisk/team/group/codec_bits/include/asterisk/mod_format.h?view=diff&rev=112392&r1=112391&r2=112392
==============================================================================
--- team/group/codec_bits/include/asterisk/mod_format.h (original)
+++ team/group/codec_bits/include/asterisk/mod_format.h Tue Apr  1 18:29:14 2008
@@ -44,7 +44,7 @@
 	char name[80];		/*!< Name of format */
 	char exts[80];		/*!< Extensions (separated by | if more than one) 
 	    			this format can read.  First is assumed for writing (e.g. .mp3) */
-	int format;		/*!< Format of frames it uses/provides (one only) */
+	struct ast_extended_codec format;		/*!< Format of frames it uses/provides (one only) */
 	/*! 
 	 * \brief Prepare an input stream for playback. 
 	 * \return 0 on success, -1 on error.




More information about the asterisk-commits mailing list