提交 8694a4a7 authored 作者: Michael Jerris's avatar Michael Jerris

add more modules to new mod loader macros/api.

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5406 d0543943-73ff-0310-b7d9-9358b9ac24b2
上级 4e434aff
差异被折叠。
......@@ -303,6 +303,14 @@ SWITCH_MOD_DECLARE(switch_status_t) switch_module_shutdown(void);
break; \
}
#define SWITCH_ADD_CODEC(codec_int, int_name, implementation) \
for (;;) { \
codec_int = (switch_codec_interface_t *)switch_loadable_module_create_interface(*module_interface, SWITCH_CODEC_INTERFACE); \
codec_int->implementations = implementation; \
codec_int->interface_name = int_name; \
break; \
}
///\}
SWITCH_END_EXTERN_C
......
......@@ -310,22 +310,9 @@ static switch_codec_implementation_t amr_implementation = {
/*.destroy */ switch_amr_destroy,
};
static switch_codec_interface_t amr_codec_interface = {
/*.interface_name */ "GSM-AMR",
/*.implementations */ &amr_implementation,
};
static switch_loadable_module_interface_t amr_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ &amr_codec_interface,
/*.application_interface */ NULL
};
SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load)
{
switch_codec_interface_t *codec_interface;
#ifndef AMR_PASSTHROUGH
char *cf = "amr.conf";
switch_xml_t cfg, xml, settings, param;
......@@ -347,7 +334,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amr_load)
#endif
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &amr_module_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "GSM-AMR", &amr_implementation);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
......
......@@ -392,33 +392,13 @@ static switch_codec_implementation_t g711a_8k_10ms_implementation = {
/*.next */ &g711a_8k_20ms_implementation
};
static switch_codec_interface_t g711a_codec_interface = {
/*.interface_name */ "g711 alaw",
/*.implementations */ &g711a_8k_10ms_implementation
};
static switch_codec_interface_t g711u_codec_interface = {
/*.interface_name */ "g711 ulaw",
/*.implementations */ &g711u_8k_10ms_implementation,
/*.next */ &g711a_codec_interface
};
static switch_loadable_module_interface_t g711_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ &g711u_codec_interface,
/*.application_interface */ NULL
};
SWITCH_MODULE_LOAD_FUNCTION(mod_g711_load)
{
switch_codec_interface_t *codec_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &g711_module_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "g711 ulaw", &g711u_8k_10ms_implementation);
SWITCH_ADD_CODEC(codec_interface, "g711 alaw", &g711a_8k_10ms_implementation);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
......
......@@ -159,24 +159,12 @@ static switch_codec_implementation_t g722_16k_implementation = {
/*.next */ &g722_8k_implementation
};
static switch_codec_interface_t g722_codec_interface = {
/*.interface_name */ "g722",
/*.implementations */ &g722_16k_implementation
};
static switch_loadable_module_interface_t g722_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ &g722_codec_interface,
/*.application_interface */ NULL
};
SWITCH_MODULE_LOAD_FUNCTION(mod_g722_load)
{
switch_codec_interface_t *codec_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &g722_module_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "g722", &g722_16k_implementation);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
......
......@@ -189,24 +189,12 @@ static switch_codec_implementation_t g723_1_implementation = {
/*.destroy */ switch_g723_destroy,
};
static switch_codec_interface_t g723_1_codec_interface = {
/*.interface_name */ "g723.1 6.3k",
/*.implementations */ &g723_1_implementation,
};
static switch_loadable_module_interface_t g723_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ &g723_1_codec_interface,
/*.application_interface */ NULL
};
SWITCH_MODULE_LOAD_FUNCTION(mod_g723_1_load)
{
switch_codec_interface_t *codec_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &g723_module_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "g723.1 6.3k", &g723_1_implementation);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
......
......@@ -368,68 +368,19 @@ static switch_codec_implementation_t aal2_g726_40k_implementation = {
/*.destroy */ switch_g726_destroy,
};
static switch_codec_interface_t g726_16k_codec_interface = {
/*.interface_name */ "G.726 16k",
/*.implementations */ &g726_16k_implementation,
};
static switch_codec_interface_t g726_24k_codec_interface = {
/*.interface_name */ "G.726 24k",
/*.implementations */ &g726_24k_implementation,
/*.next */ &g726_16k_codec_interface
};
static switch_codec_interface_t g726_32k_codec_interface = {
/*.interface_name */ "G.726 32k",
/*.implementations */ &g726_32k_implementation,
/*.next */ &g726_24k_codec_interface
};
static switch_codec_interface_t g726_40k_codec_interface = {
/*.interface_name */ "G.726 40k",
/*.implementations */ &g726_40k_implementation,
/*.next */ &g726_32k_codec_interface
};
static switch_codec_interface_t aal2_g726_16k_codec_interface = {
/*.interface_name */ "G.726 16k (aal2)",
/*.implementations */ &aal2_g726_16k_implementation,
/*.next */ &g726_40k_codec_interface
};
static switch_codec_interface_t aal2_g726_24k_codec_interface = {
/*.interface_name */ "G.726 24k (aal2)",
/*.implementations */ &aal2_g726_24k_implementation,
/*.next */ &aal2_g726_16k_codec_interface
};
static switch_codec_interface_t aal2_g726_32k_codec_interface = {
/*.interface_name */ "G.726 32k (aal2)",
/*.implementations */ &aal2_g726_32k_implementation,
/*.next */ &aal2_g726_24k_codec_interface
};
static switch_codec_interface_t aal2_g726_40k_codec_interface = {
/*.interface_name */ "G.726 40k (aal2)",
/*.implementations */ &aal2_g726_40k_implementation,
/*.next */ &aal2_g726_32k_codec_interface
};
static switch_loadable_module_interface_t g726_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ &aal2_g726_40k_codec_interface,
/*.application_interface */ NULL
};
SWITCH_MODULE_LOAD_FUNCTION(mod_g726_load)
{
switch_codec_interface_t *codec_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &g726_module_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "G.726 40k (aal2)", &aal2_g726_40k_implementation);
SWITCH_ADD_CODEC(codec_interface, "G.726 32k (aal2)", &aal2_g726_32k_implementation);
SWITCH_ADD_CODEC(codec_interface, "G.726 24k (aal2)", &aal2_g726_24k_implementation);
SWITCH_ADD_CODEC(codec_interface, "G.726 16k (aal2)", &aal2_g726_16k_implementation);
SWITCH_ADD_CODEC(codec_interface, "G.726 40k", &g726_40k_implementation);
SWITCH_ADD_CODEC(codec_interface, "G.726 32k", &g726_32k_implementation);
SWITCH_ADD_CODEC(codec_interface, "G.726 24k", &g726_24k_implementation);
SWITCH_ADD_CODEC(codec_interface, "G.726 16k", &g726_16k_implementation);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
......
......@@ -295,25 +295,12 @@ static switch_codec_implementation_t g729_8k_implementation = {
&g729_10ms_8k_implementation
};
static switch_codec_interface_t g729_codec_interface = {
/*.interface_name */ "g729",
/*.implementations */ &g729_8k_implementation,
/*.next */ NULL
};
static switch_loadable_module_interface_t g729_module_interface = {
/*.module_name */ "g729",
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ &g729_codec_interface,
/*.application_interface */ NULL
};
SWITCH_MODULE_LOAD_FUNCTION(mod_g729_load)
{
switch_codec_interface_t *codec_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &g729_module_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "g729", &g729_8k_implementation);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
......
......@@ -153,24 +153,13 @@ static switch_codec_implementation_t gsm_8k_implementation = {
/*.decode */ switch_gsm_decode,
/*.destroy */ switch_gsm_destroy,
};
static switch_codec_interface_t gsm_codec_interface = {
/*.interface_name */ "gsm",
/*.implementations */ &gsm_8k_implementation,
};
static switch_loadable_module_interface_t gsm_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ &gsm_codec_interface,
/*.application_interface */ NULL
};
SWITCH_MODULE_LOAD_FUNCTION(mod_gsm_load)
{
switch_codec_interface_t *codec_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &gsm_module_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "gsm", &gsm_8k_implementation);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
......
......@@ -117,25 +117,13 @@ static switch_codec_implementation_t h263_90000_implementation = {
/*.next = */&h264_90000_implementation
};
static switch_codec_interface_t h26x_codec_interface = {
/*.interface_name */ "h26x video (passthru)",
/*.implementations */ &h263_90000_implementation
};
static switch_loadable_module_interface_t h26x_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ &h26x_codec_interface,
/*.application_interface */ NULL,
/*.api_interface */ NULL,
};
SWITCH_MODULE_LOAD_FUNCTION(mod_h26x_load)
{
switch_codec_interface_t *codec_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &h26x_module_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "h26x video (passthru)", &h263_90000_implementation);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
......
......@@ -287,40 +287,14 @@ static switch_codec_implementation_t ilbc_8k_20ms_nonext_implementation = {
/*.destroy */ switch_ilbc_destroy
};
static switch_codec_interface_t ilbc_20ms_codec_interface = {
/*.interface_name */ "ilbc",
/*.implementations */ &ilbc_8k_20ms_nonext_implementation
};
static switch_codec_interface_t ilbc_102_codec_interface = {
/*.interface_name */ "ilbc",
/*.implementations */ &ilbc_102_8k_20ms_implementation,
/*.next */ &ilbc_20ms_codec_interface
};
static switch_codec_interface_t ilbc_codec_interface = {
/*.interface_name */ "ilbc",
/*.implementations */ &ilbc_8k_20ms_implementation,
/*.next */ &ilbc_102_codec_interface
};
static switch_loadable_module_interface_t ilbc_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ &ilbc_codec_interface,
/*.application_interface */ NULL
};
SWITCH_MODULE_LOAD_FUNCTION(mod_ilbc_load)
{
switch_codec_interface_t *codec_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &ilbc_module_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "ilbc", &ilbc_8k_20ms_implementation);
SWITCH_ADD_CODEC(codec_interface, "ilbc", &ilbc_102_8k_20ms_implementation);
SWITCH_ADD_CODEC(codec_interface, "ilbc", &ilbc_8k_20ms_nonext_implementation);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
......
......@@ -406,28 +406,12 @@ static switch_codec_implementation_t raw_8k_10ms_implementation = {
/*.next */ &raw_8k_20ms_implementation
};
static switch_codec_interface_t raw_codec_interface = {
/*.interface_name */ "raw signed linear (16 bit)",
/*.implementations */ &raw_8k_10ms_implementation
};
static switch_loadable_module_interface_t raw_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ &raw_codec_interface,
/*.application_interface */ NULL,
/*.api_interface */ NULL,
///*.file_interface*/ &raw_file_interface
};
SWITCH_MODULE_LOAD_FUNCTION(mod_l16_load)
{
switch_codec_interface_t *codec_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &raw_module_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "raw signed linear (16 bit)", &raw_8k_10ms_implementation);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
......
......@@ -390,24 +390,12 @@ static switch_codec_implementation_t speex_8k_20ms_implementation = {
/*.next */ &speex_8k_30ms_implementation
};
static switch_codec_interface_t speex_codec_interface = {
/*.interface_name */ "speex",
/*.implementations */ &speex_8k_20ms_implementation
};
static switch_loadable_module_interface_t speex_module_interface = {
/*.module_name */ modname,
/*.endpoint_interface */ NULL,
/*.timer_interface */ NULL,
/*.dialplan_interface */ NULL,
/*.codec_interface */ &speex_codec_interface,
/*.application_interface */ NULL
};
SWITCH_MODULE_LOAD_FUNCTION(mod_speex_load)
{
switch_codec_interface_t *codec_interface;
/* connect my internal structure to the blank pointer passed to me */
*module_interface = &speex_module_interface;
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
SWITCH_ADD_CODEC(codec_interface, "speex", &speex_8k_20ms_implementation);
/* indicate that the module should continue to be loaded */
return SWITCH_STATUS_SUCCESS;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论