summaryrefslogtreecommitdiff
path: root/include/asterisk/abstract_jb.h
diff options
context:
space:
mode:
authorDavid Vossel <dvossel@digium.com>2011-04-20 20:52:15 +0000
committerDavid Vossel <dvossel@digium.com>2011-04-20 20:52:15 +0000
commit18d591cb48730b8eeff0daa5946fbc6684285088 (patch)
tree06af1a8a399ca5ee4a8e7f72c41e07dfebd0c927 /include/asterisk/abstract_jb.h
parent3b52f36551331fbae62c82e5e0f7f1a250b6c17d (diff)
Introduction of the JITTERBUFFER dialplan function.
Review: https://reviewboard.asterisk.org/r/1157/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@314509 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'include/asterisk/abstract_jb.h')
-rw-r--r--include/asterisk/abstract_jb.h52
1 files changed, 51 insertions, 1 deletions
diff --git a/include/asterisk/abstract_jb.h b/include/asterisk/abstract_jb.h
index d51554b66..d1121cc5e 100644
--- a/include/asterisk/abstract_jb.h
+++ b/include/asterisk/abstract_jb.h
@@ -47,6 +47,19 @@ enum {
AST_JB_LOG = (1 << 2)
};
+enum ast_jb_type {
+ AST_JB_FIXED,
+ AST_JB_ADAPTIVE,
+};
+
+/*! Abstract return codes */
+enum {
+ AST_JB_IMPL_OK,
+ AST_JB_IMPL_DROP,
+ AST_JB_IMPL_INTERP,
+ AST_JB_IMPL_NOFRAME
+};
+
#define AST_JB_IMPL_NAME_SIZE 12
/*!
@@ -77,9 +90,44 @@ struct ast_jb_conf
#define AST_JB_CONF_IMPL "impl"
#define AST_JB_CONF_LOG "log"
+/* 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);
-struct ast_jb_impl;
+/*!
+ * \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 +272,8 @@ void ast_jb_get_config(const struct ast_channel *chan, struct ast_jb_conf *conf)
*/
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