[svn-commits] dvossel: branch dvossel/jb_ftw r311859 - in /team/dvossel/jb_ftw: funcs/ incl...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 29 17:28:19 CDT 2011


Author: dvossel
Date: Tue Mar 29 17:28:15 2011
New Revision: 311859

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311859
Log:
Expose the jb implementations outside of abstract jb.

I don't know if this is a good idea or not yet, just experimenting

Modified:
    team/dvossel/jb_ftw/funcs/func_jitterbuffer.c
    team/dvossel/jb_ftw/include/asterisk/abstract_jb.h
    team/dvossel/jb_ftw/main/abstract_jb.c

Modified: team/dvossel/jb_ftw/funcs/func_jitterbuffer.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/jb_ftw/funcs/func_jitterbuffer.c?view=diff&rev=311859&r1=311858&r2=311859
==============================================================================
--- team/dvossel/jb_ftw/funcs/func_jitterbuffer.c (original)
+++ team/dvossel/jb_ftw/funcs/func_jitterbuffer.c Tue Mar 29 17:28:15 2011
@@ -34,10 +34,10 @@
 #include "asterisk/framehook.h"
 #include "asterisk/pbx.h"
 
-
 struct jb_framedata {
 	/*jb stuff todohere, don't know what this is yet */
-	int data;
+	struct ast_jb_impl *jb_impl;
+	void *data;
 };
 
 static void datastore_destroy_cb(void *data) {
@@ -70,7 +70,7 @@
 		.event_cb = hook_event_cb,
 		.destroy_cb = hook_destroy_cb,
 	};
-	int i  = 0;
+	int i = 0;
 
 	if (!(framedata = ast_calloc(1, sizeof(*framedata)))) {
 		return 0;

Modified: team/dvossel/jb_ftw/include/asterisk/abstract_jb.h
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/jb_ftw/include/asterisk/abstract_jb.h?view=diff&rev=311859&r1=311858&r2=311859
==============================================================================
--- team/dvossel/jb_ftw/include/asterisk/abstract_jb.h (original)
+++ team/dvossel/jb_ftw/include/asterisk/abstract_jb.h Tue Mar 29 17:28:15 2011
@@ -45,6 +45,11 @@
 	AST_JB_ENABLED = (1 << 0),
 	AST_JB_FORCED =  (1 << 1),
 	AST_JB_LOG =     (1 << 2)
+};
+
+enum ast_jb_type {
+	AST_JB_FIXED,
+	AST_JB_ADAPTIVE,
 };
 
 #define AST_JB_IMPL_NAME_SIZE 12
@@ -77,9 +82,44 @@
 #define AST_JB_CONF_IMPL "impl"
 #define AST_JB_CONF_LOG "log"
 
-
-struct ast_jb_impl;
-
+/* Hooks for the abstract jb implementation */
+/*! \brief Create */
+typedef void * (*jb_create_impl)(struct ast_jb_conf *general_config, long resynch_threshold);
+/*! \brief Destroy */
+typedef void (*jb_destroy_impl)(void *jb);
+/*! \brief Put first frame */
+typedef int (*jb_put_first_impl)(void *jb, struct ast_frame *fin, long now);
+/*! \brief Put frame */
+typedef int (*jb_put_impl)(void *jb, struct ast_frame *fin, long now);
+/*! \brief Get frame for now */
+typedef int (*jb_get_impl)(void *jb, struct ast_frame **fout, long now, long interpl);
+/*! \brief Get next */
+typedef long (*jb_next_impl)(void *jb);
+/*! \brief Remove first frame */
+typedef int (*jb_remove_impl)(void *jb, struct ast_frame **fout);
+/*! \brief Force resynch */
+typedef void (*jb_force_resynch_impl)(void *jb);
+/*! \brief Empty and reset jb */
+typedef void (*jb_empty_and_reset_impl)(void *jb);
+
+
+/*!
+ * \brief Jitterbuffer implementation struct.
+ */
+struct ast_jb_impl
+{
+	char name[AST_JB_IMPL_NAME_SIZE];
+	enum ast_jb_type type;
+	jb_create_impl create;
+	jb_destroy_impl destroy;
+	jb_put_first_impl put_first;
+	jb_put_impl put;
+	jb_get_impl get;
+	jb_next_impl next;
+	jb_remove_impl remove;
+	jb_force_resynch_impl force_resync;
+	jb_empty_and_reset_impl empty_and_reset;
+};
 
 /*!
  * \brief General jitterbuffer state.
@@ -224,6 +264,8 @@
  */
 void ast_jb_empty_and_reset(struct ast_channel *c0, struct ast_channel *c1);
 
+const struct ast_jb_impl *ast_jb_get_impl(enum ast_jb_type type);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/dvossel/jb_ftw/main/abstract_jb.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/jb_ftw/main/abstract_jb.c?view=diff&rev=311859&r1=311858&r2=311859
==============================================================================
--- team/dvossel/jb_ftw/main/abstract_jb.c (original)
+++ team/dvossel/jb_ftw/main/abstract_jb.c Tue Mar 29 17:28:15 2011
@@ -49,43 +49,6 @@
 	JB_CREATED =              (1 << 2)
 };
 
-/* Hooks for the abstract jb implementation */
-
-/*! \brief Create */
-typedef void * (*jb_create_impl)(struct ast_jb_conf *general_config, long resynch_threshold);
-/*! \brief Destroy */
-typedef void (*jb_destroy_impl)(void *jb);
-/*! \brief Put first frame */
-typedef int (*jb_put_first_impl)(void *jb, struct ast_frame *fin, long now);
-/*! \brief Put frame */
-typedef int (*jb_put_impl)(void *jb, struct ast_frame *fin, long now);
-/*! \brief Get frame for now */
-typedef int (*jb_get_impl)(void *jb, struct ast_frame **fout, long now, long interpl);
-/*! \brief Get next */
-typedef long (*jb_next_impl)(void *jb);
-/*! \brief Remove first frame */
-typedef int (*jb_remove_impl)(void *jb, struct ast_frame **fout);
-/*! \brief Force resynch */
-typedef void (*jb_force_resynch_impl)(void *jb);
-/*! \brief Empty and reset jb */
-typedef void (*jb_empty_and_reset_impl)(void *jb);
-
-/*!
- * \brief Jitterbuffer implementation private struct.
- */
-struct ast_jb_impl
-{
-	char name[AST_JB_IMPL_NAME_SIZE];
-	jb_create_impl create;
-	jb_destroy_impl destroy;
-	jb_put_first_impl put_first;
-	jb_put_impl put;
-	jb_get_impl get;
-	jb_next_impl next;
-	jb_remove_impl remove;
-	jb_force_resynch_impl force_resync;
-	jb_empty_and_reset_impl empty_and_reset;
-};
 
 /* Implementation functions */
 /* fixed */
@@ -113,6 +76,7 @@
 static const struct ast_jb_impl avail_impl[] = {
 	{
 		.name = "fixed",
+		.type = AST_JB_FIXED,
 		.create = jb_create_fixed,
 		.destroy = jb_destroy_fixed,
 		.put_first = jb_put_first_fixed,
@@ -125,6 +89,7 @@
 	},
 	{
 		.name = "adaptive",
+		.type = AST_JB_ADAPTIVE,
 		.create = jb_create_adaptive,
 		.destroy = jb_destroy_adaptive,
 		.put_first = jb_put_first_adaptive,
@@ -831,3 +796,14 @@
 
 	jb_reset(adaptivejb);
 }
+
+const struct ast_jb_impl *ast_jb_get_impl(enum ast_jb_type type)
+{
+	int i;
+	for (i = 0; i < ARRAY_LEN(avail_impl); i++) {
+		if (avail_impl[i].type == type) {
+			return &avail_impl[i];
+		}
+	}
+	return NULL;
+}




More information about the svn-commits mailing list