[asterisk-commits] dvossel: branch dvossel/celt_codec_ftw r313140 - /team/dvossel/celt_codec_ftw...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 8 14:39:22 CDT 2011


Author: dvossel
Date: Fri Apr  8 14:39:19 2011
New Revision: 313140

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=313140
Log:
Another CELT translator update

Modified:
    team/dvossel/celt_codec_ftw/codecs/Makefile
    team/dvossel/celt_codec_ftw/codecs/codec_celt.c

Modified: team/dvossel/celt_codec_ftw/codecs/Makefile
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/celt_codec_ftw/codecs/Makefile?view=diff&rev=313140&r1=313139&r2=313140
==============================================================================
--- team/dvossel/celt_codec_ftw/codecs/Makefile (original)
+++ team/dvossel/celt_codec_ftw/codecs/Makefile Fri Apr  8 14:39:19 2011
@@ -63,3 +63,6 @@
 
 $(if $(filter codec_resample,$(EMBEDDED_MODS)),modules.link,codec_resample.so): speex/resample.o
 speex/resample.o: _ASTCFLAGS+=$(call MOD_ASTCFLAGS,codec_resample) $(SPEEX_RESAMPLE_CFLAGS)
+
+$(if $(filter codec_celt,$(EMBEDDED_MODS)),modules.link,codec_celt.so): speex/resample.o /usr/local/lib/libcelt0.so
+speex/resample.o: _ASTCFLAGS+= $(call MOD_ASTCFLAGS,codec_celt) $(SPEEX_RESAMPLE_CFLAGS)

Modified: team/dvossel/celt_codec_ftw/codecs/codec_celt.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/celt_codec_ftw/codecs/codec_celt.c?view=diff&rev=313140&r1=313139&r2=313140
==============================================================================
--- team/dvossel/celt_codec_ftw/codecs/codec_celt.c (original)
+++ team/dvossel/celt_codec_ftw/codecs/codec_celt.c Fri Apr  8 14:39:19 2011
@@ -38,6 +38,8 @@
 #include "asterisk/utils.h"
 
 #define OUTBUF_SIZE   8096
+
+#define MAX_ENC_RETURN_FRAMES 8
 
 static struct ast_translator *translators;
 static int trans_size;
@@ -56,6 +58,11 @@
 	CELTMode *mode;
 	CELTEncoder *enc;
 	SpeexResamplerState *resamp;
+
+	/*! Number of current valid out frame buffers */
+	unsigned int frame_offsets_num;
+	/* Pointers to the beginning of each valid outframe */
+	char *frame_offsets[MAX_ENC_RETURN_FRAMES];
 };
 struct celt_decoder_pvt {
 	int init;
@@ -169,6 +176,32 @@
 	}
 }
 
+
+static int celt_enc_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
+{
+	struct celt_decoder_pvt *enc = pvt->pvt;
+
+	if (!enc->init) {
+		celt_enc_set(pvt, &f->subclass.format);
+	}
+
+	/* TODO make awesome stuff happen here */
+	return 0;
+}
+
+static struct ast_frame *celt_enc_frameout(struct ast_trans_pvt *pvt)
+{
+	struct celt_encoder_pvt *enc = pvt->pvt;
+	struct ast_frame *frame = NULL;
+
+	/* TODO make frame here.  It is possible multiple CELT frames will get returned. */
+	memset(enc->frame_offsets, 0, sizeof(enc->frame_offsets));
+	enc->frame_offsets_num = 0;
+
+	return frame;
+}
+
+
 static int celt_dec_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
 {
 	struct celt_decoder_pvt *dec = pvt->pvt;
@@ -180,18 +213,16 @@
 	return 0;
 }
 
-static int celt_enc_framein(struct ast_trans_pvt *pvt, struct ast_frame *f)
-{
-	struct celt_decoder_pvt *enc = pvt->pvt;
-
-	if (!enc->init) {
-		celt_enc_set(pvt, &f->subclass.format);
-	}
-
-
-	/* TODO make awesome stuff happen here */
-	return 0;
-}
+
+static struct ast_frame *celt_dec_frameout(struct ast_trans_pvt *pvt)
+{
+	//struct celt_decoder_pvt *dec = pvt->pvt;
+	struct ast_frame *frame = NULL;
+
+	/* TODO make  slin frame here. */
+	return frame;
+}
+
 
 static int unload_module(void)
 {
@@ -223,6 +254,7 @@
 		translators[idx].newpvt = NULL; /* ENC is created on first frame */
 		translators[idx].destroy = celt_enc_destroy;
 		translators[idx].framein = celt_enc_framein;
+		translators[idx].frameout = celt_enc_frameout;
 		translators[idx].desc_size = sizeof(struct celt_encoder_pvt);
 		translators[idx].buffer_samples = (OUTBUF_SIZE / sizeof(int16_t));
 		translators[idx].buf_size = OUTBUF_SIZE;
@@ -238,6 +270,7 @@
 		translators[idx].newpvt = NULL; /* DEC is created on first frame */
 		translators[idx].destroy = celt_dec_destroy;
 		translators[idx].framein = celt_dec_framein;
+		translators[idx].frameout = celt_dec_frameout;
 		translators[idx].desc_size = sizeof(struct celt_decoder_pvt);
 		translators[idx].buffer_samples = (OUTBUF_SIZE / sizeof(int16_t));
 		translators[idx].buf_size = OUTBUF_SIZE;




More information about the asterisk-commits mailing list