diff options
author | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-04-20 20:52:15 +0000 |
---|---|---|
committer | dvossel <dvossel@f38db490-d61c-443f-a65b-d21fe96a405b> | 2011-04-20 20:52:15 +0000 |
commit | c9a36282b5c473da344e17f63324abe1569935e2 (patch) | |
tree | 06af1a8a399ca5ee4a8e7f72c41e07dfebd0c927 /include | |
parent | a14ce25e4ae4ea1fae6e03c1a4ff43c64729155f (diff) |
Introduction of the JITTERBUFFER dialplan function.
Review: https://reviewboard.asterisk.org/r/1157/
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@314509 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'include')
-rw-r--r-- | include/asterisk/abstract_jb.h | 52 | ||||
-rw-r--r-- | include/asterisk/channel.h | 3 |
2 files changed, 53 insertions, 2 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 diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h index 2959aa980..88e9db4bb 100644 --- a/include/asterisk/channel.h +++ b/include/asterisk/channel.h @@ -154,7 +154,7 @@ extern "C" { #define DATASTORE_INHERIT_FOREVER INT_MAX -#define AST_MAX_FDS 10 +#define AST_MAX_FDS 11 /* * We have AST_MAX_FDS file descriptors in a channel. * Some of them have a fixed use: @@ -163,6 +163,7 @@ extern "C" { #define AST_TIMING_FD (AST_MAX_FDS-2) /*!< used for timingfd */ #define AST_AGENT_FD (AST_MAX_FDS-3) /*!< used by agents for pass through */ #define AST_GENERATOR_FD (AST_MAX_FDS-4) /*!< used by generator */ +#define AST_JITTERBUFFER_FD (AST_MAX_FDS-5) /*!< used by generator */ enum ast_bridge_result { AST_BRIDGE_COMPLETE = 0, |