]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7504: allow <modname>.<codecname> support so multiple modules can exist for the...
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 19 Mar 2015 19:26:47 +0000 (14:26 -0500)
committerMichael Jerris <mike@jerris.com>
Thu, 28 May 2015 17:47:13 +0000 (12:47 -0500)
49 files changed:
libs/freetdm/mod_freetdm/mod_freetdm.c
libs/freetdm/mod_freetdm/tdm.c
src/fs_encode.c
src/include/switch_core.h
src/include/switch_core_media.h
src/include/switch_loadable_module.h
src/include/switch_module_interfaces.h
src/include/switch_types.h
src/mod/applications/mod_av/mod_av.c
src/mod/applications/mod_cluechoo/mod_cluechoo.c
src/mod/applications/mod_conference/mod_conference.c
src/mod/applications/mod_esf/mod_esf.c
src/mod/applications/mod_fsv/mod_fsv.c
src/mod/applications/mod_mp4/mod_mp4.cpp
src/mod/applications/mod_mp4v2/mod_mp4v2.c
src/mod/applications/mod_rss/mod_rss.c
src/mod/applications/mod_spandsp/mod_spandsp_dsp.c
src/mod/applications/mod_spandsp/mod_spandsp_fax.c
src/mod/applications/mod_spandsp/mod_spandsp_modem.c
src/mod/codecs/mod_openh264/mod_openh264.cpp
src/mod/endpoints/mod_alsa/mod_alsa.c
src/mod/endpoints/mod_dingaling/mod_dingaling.c
src/mod/endpoints/mod_gsmopen/alsa_nogsmlib_nocplusplus/mod_gsmopen/mod_gsmopen.c
src/mod/endpoints/mod_gsmopen/mod_gsmopen.cpp
src/mod/endpoints/mod_h323/mod_h323.cpp
src/mod/endpoints/mod_khomp/src/khomp_pvt.cpp
src/mod/endpoints/mod_loopback/mod_loopback.c
src/mod/endpoints/mod_opal/mod_opal.cpp
src/mod/endpoints/mod_portaudio/mod_portaudio.c
src/mod/endpoints/mod_rtmp/mod_rtmp.c
src/mod/endpoints/mod_skinny/mod_skinny.c
src/mod/endpoints/mod_skypopen/mod_skypopen.c
src/mod/endpoints/mod_sofia/rtp.c
src/mod/formats/mod_avformat/mod_avformat.c
src/mod/formats/mod_portaudio_stream/mod_portaudio_stream.c
src/mod/formats/mod_vlc/mod_vlc.c
src/mod/formats/mod_webm/mod_webm.cpp
src/mod/languages/mod_v8/src/fssession.cpp
src/mod/languages/mod_v8/src/fsteletone.cpp
src/switch_core_codec.c
src/switch_core_media.c
src/switch_core_session.c
src/switch_ivr.c
src/switch_ivr_async.c
src/switch_ivr_bridge.c
src/switch_ivr_originate.c
src/switch_ivr_play_say.c
src/switch_loadable_module.c
src/switch_rtp.c

index e8468c0394af7ad9a5ee26b9978935ff54cbec68..7ed2606fe6fdf480f777695dc5ad555273b9f384 100644 (file)
@@ -378,6 +378,7 @@ init_codecs:
        if (switch_core_codec_init(&tech_pvt->read_codec,
                                                           dname,
                                                           NULL,
+                                                          NULL,
                                                           srate,
                                                           interval,
                                                           1,
@@ -389,6 +390,7 @@ init_codecs:
                if (switch_core_codec_init(&tech_pvt->write_codec,
                                                                   dname,
                                                                   NULL,
+                                                                  NULL,
                                                                   srate,
                                                                   interval,
                                                                   1,
index ab49ece7aec6c743bd7325089a8d6d0de58b17f0..415e1efdcc9a23373fb7f9a2051791215e6adbf1 100644 (file)
@@ -435,6 +435,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
        if (switch_core_codec_init(&tech_pvt->read_codec,
                                                           dname,
                                                           NULL,
+                                                          NULL,
                                                           8000,
                                                           interval,
                                                           1,
@@ -446,6 +447,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                if (switch_core_codec_init(&tech_pvt->write_codec,
                                                                   dname,
                                                                   NULL,
+                                                                  NULL,
                                                                   8000,
                                                                   interval,
                                                                   1,
index 91eb33ef8ec01b8fbcce20b29ea0ad71505b3d8a..33811ebfe6ff5367a8ec5972ac51e374017684b9 100644 (file)
@@ -205,7 +205,7 @@ int main(int argc, char *argv[])
 
 
        if (out_asis) {
-               if (switch_core_codec_init_with_bitrate(&codec, format, fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE, NULL, pool) != SWITCH_STATUS_SUCCESS) {
+               if (switch_core_codec_init_with_bitrate(&codec, format, NULL, fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE, NULL, pool) != SWITCH_STATUS_SUCCESS) {
                        fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", format, rate, ptime);
                        goto end;
                }
@@ -215,12 +215,12 @@ int main(int argc, char *argv[])
                if ((p = strchr(input, '.'))) {
                        p++;
                }
-               if (!p || switch_core_codec_init_with_bitrate(&codec, p, fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE|SWITCH_CODEC_FLAG_DECODE, NULL, pool) != SWITCH_STATUS_SUCCESS) {
+               if (!p || switch_core_codec_init_with_bitrate(&codec, p, NULL, fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE|SWITCH_CODEC_FLAG_DECODE, NULL, pool) != SWITCH_STATUS_SUCCESS) {
                        fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", p, rate, ptime);
                        goto end;
                }
                
-               if (switch_core_codec_init_with_bitrate(&raw_codec, "L16", fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE|SWITCH_CODEC_FLAG_DECODE, NULL, pool) != SWITCH_STATUS_SUCCESS) {
+               if (switch_core_codec_init_with_bitrate(&raw_codec, "L16", NULL, fmtp, rate, ptime, channels, bitrate, SWITCH_CODEC_FLAG_ENCODE|SWITCH_CODEC_FLAG_DECODE, NULL, pool) != SWITCH_STATUS_SUCCESS) {
                fprintf(stderr, "Couldn't initialize codec for %s@%dh@%di\n", "L16", rate, ptime);
                goto end;
                }
index a2dddab6ee534983d08485fe816e8d6c3bd96169..e379cc8ff4945d5e049e158768bc8ae15d5579a8 100644 (file)
@@ -1567,17 +1567,20 @@ SWITCH_DECLARE(switch_status_t) switch_core_timer_destroy(switch_timer_t *timer)
   \param pool the memory pool to use
   \return SWITCH_STATUS_SUCCESS if the handle is allocated
 */
-#define switch_core_codec_init(_codec, _codec_name, _fmtp, _rate, _ms, _channels, _flags, _codec_settings, _pool) \
-       switch_core_codec_init_with_bitrate(_codec, _codec_name, _fmtp, _rate, _ms, _channels, 0, _flags, _codec_settings, _pool)
+#define switch_core_codec_init(_codec, _codec_name, _modname, _fmtp, _rate, _ms, _channels, _flags, _codec_settings, _pool) \
+       switch_core_codec_init_with_bitrate(_codec, _codec_name, _modname, _fmtp, _rate, _ms, _channels, 0, _flags, _codec_settings, _pool)
 SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec_t *codec,
-                                                                                                          const char *codec_name,
-                                                                                                          const char *fmtp,
-                                                                                                          uint32_t rate,
-                                                                                                          int ms,
-                                                                                                          int channels,
-                                                                                                          uint32_t bitrate,
-                                                                                                          uint32_t flags, const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool);
-
+                                                                                                                                       const char *codec_name,
+                                                                                                                                       const char *fmtp,
+                                                                                                                                       const char *modname,
+                                                                                                                                       uint32_t rate,
+                                                                                                                                       int ms,
+                                                                                                                                       int channels,
+                                                                                                                                       uint32_t bitrate,
+                                                                                                                                       uint32_t flags, 
+                                                                                                                                       const switch_codec_settings_t *codec_settings, 
+                                                                                                                                       switch_memory_pool_t *pool);
+                                                               
 SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, switch_codec_t *new_codec, 
                                                                                                           const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool);
 SWITCH_DECLARE(switch_status_t) switch_core_codec_parse_fmtp(const char *codec_name, const char *fmtp, uint32_t rate, switch_codec_fmtp_t *codec_fmtp);
index 46167543af0c248a72a6ff3d70fb6f6ff378ee0f..2238fc14b1cd7375da7ecca5c0811e4f3849e868 100644 (file)
@@ -278,6 +278,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core
 SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_session_t *session, 
                                                                                                                                  switch_media_type_t type,
                                                                                                                                  const char *name, 
+                                                                                                                                 const char *modname, 
                                                                                                                                  const char *fmtp,
                                                                                                                                  switch_sdp_type_t sdp_type,
                                                                                                                                  uint32_t pt, 
index f0ae57901c27c5c11d13af2347392abcabdc1cbd..54e51d95d635576762e2925cca182006c42f0625 100644 (file)
@@ -115,9 +115,9 @@ SWITCH_DECLARE(switch_endpoint_interface_t *) switch_loadable_module_get_endpoin
   \param name the name of the codec
   \return the desired codec interface
  */
-SWITCH_DECLARE(switch_codec_interface_t *) switch_loadable_module_get_codec_interface(const char *name);
+SWITCH_DECLARE(switch_codec_interface_t *) switch_loadable_module_get_codec_interface(const char *name, const char *modname);
 
-SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit, uint32_t *channels);
+SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit, uint32_t *channels, char **modname);
 
 /*!
   \brief Retrieve the dialplan interface by it's registered name
@@ -415,6 +415,7 @@ SWITCH_DECLARE(uint32_t) switch_core_codec_next_id(void);
 #define SWITCH_ADD_CODEC(codec_int, int_name) \
        for (;;) { \
                codec_int = (switch_codec_interface_t *)switch_loadable_module_create_interface(*module_interface, SWITCH_CODEC_INTERFACE); \
+               codec_int->modname = switch_core_strdup(pool, (*module_interface)->module_name);        \
                codec_int->interface_name = switch_core_strdup(pool, int_name); \
                codec_int->codec_id = switch_core_codec_next_id();                              \
                break;                                                                                                                  \
@@ -523,6 +524,7 @@ static inline void switch_core_codec_add_implementation(switch_memory_pool_t *po
                impl->codec_id = codec_interface->codec_id;
                impl->next = codec_interface->implementations;
                impl->impl_id = switch_core_codec_next_id();
+               impl->modname = codec_interface->modname;
                codec_interface->implementations = impl;
        } else {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Rejected codec name: %s rate: %u ptime: %d channels: %d\n",
@@ -571,6 +573,7 @@ static inline void switch_core_codec_add_video_implementation(switch_memory_pool
     impl->codec_id = codec_interface->codec_id;
     impl->next = codec_interface->implementations;
     impl->impl_id = switch_core_codec_next_id();
+       impl->modname = codec_interface->modname;
     codec_interface->implementations = impl;
 }
 
index 49328503c01b8f038c464db1c17b59e4692bf908..3a50709b4d170561e8934c26cecf1cd76c00fa04 100644 (file)
@@ -709,6 +709,7 @@ struct switch_codec_implementation {
        switch_core_codec_destroy_func_t destroy;
        uint32_t codec_id;
        uint32_t impl_id;
+       char *modname;
        struct switch_codec_implementation *next;
 };
 
@@ -724,6 +725,7 @@ struct switch_codec_interface {
        switch_thread_rwlock_t *rwlock;
        int refs;
        switch_mutex_t *reflock;
+       char *modname;
        switch_loadable_module_interface_t *parent;
        struct switch_codec_interface *next;
 };
index 848643916c3574fd8b330a43f3b0e1838b7776a8..7ee80e771a2475bce08d7256840204745b0cc92d 100644 (file)
@@ -2469,6 +2469,7 @@ typedef struct payload_map_s {
 
        char *rm_encoding;
        char *iananame;
+       char *modname;
        switch_payload_t pt;
        unsigned long rm_rate;
        unsigned long adv_rm_rate;
index ed6639a9f2d1b27d301d6c9d20238c011a255f48..adf02da48ae61a7a5808083bf27f7a3ab9ab0025 100644 (file)
@@ -1129,6 +1129,7 @@ SWITCH_STANDARD_APP(record_av_function)
        if (switch_core_codec_init(&codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           // read_impl.samples_per_second,
                                                           44100, // todo: not hard coded?
                                                           read_impl.microseconds_per_packet / 1000,
index c1012f127b89d6932c234413cfccc8a24a902fe0..36395d242714a836c29dd78ca4b2d3f38f8a96d5 100644 (file)
@@ -246,7 +246,7 @@ int vgo(int i, switch_core_session_t *session)
 
        if (switch_core_codec_init(&codec,
                                                           "L16",
-                                                          NULL, (int) read_impl.samples_per_second, read_impl.microseconds_per_packet / 1000,
+                                                          NULL, NULL, (int) read_impl.samples_per_second, read_impl.microseconds_per_packet / 1000,
                                                           1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
                                                           switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
                return -1;
index 4fa8a57121509b0ca760a5e19491fd193c103b32..10bf4fa9613d047215d0588454971d049927d2ea 100644 (file)
@@ -11049,7 +11049,7 @@ static int setup_media(conference_member_t *member, conference_obj_t *conference
        /* Setup a Signed Linear codec for reading audio. */
        if (switch_core_codec_init(&member->read_codec,
                                                           "L16",
-                                                          NULL, read_impl.actual_samples_per_second, read_impl.microseconds_per_packet / 1000,
+                                                          NULL, NULL, read_impl.actual_samples_per_second, read_impl.microseconds_per_packet / 1000,
                                                           read_impl.number_of_channels, 
                                                           SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, member->pool) == SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(member->session), SWITCH_LOG_DEBUG,
@@ -11094,6 +11094,7 @@ static int setup_media(conference_member_t *member, conference_obj_t *conference
        if (switch_core_codec_init(&member->write_codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           conference->rate,
                                                           read_impl.microseconds_per_packet / 1000,
                                                           read_impl.number_of_channels, 
index 82e50c21c0615c711078079306dd4376f13c748f..87cfba30fae1e0bd97655aa3ec472a730e4e5f72 100644 (file)
@@ -352,6 +352,7 @@ SWITCH_STANDARD_APP(bcast_function)
                        if (switch_core_codec_init(&codec,
                                                                           "L16",
                                                                           NULL,
+                                                                          NULL,
                                                                           read_rate,
                                                                           20,
                                                                           1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
@@ -366,6 +367,7 @@ SWITCH_STANDARD_APP(bcast_function)
                        if (switch_core_codec_init(&write_codec,
                                                                           codec_name,
                                                                           NULL,
+                                                                          NULL,
                                                                           8000,
                                                                           20,
                                                                           1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
index bc16bedca0f9074aabd4270ed5a3fffa7898ff5c..9d5c8064e7a4c3ddd410b7917fb460d507dc4b1a 100644 (file)
@@ -147,6 +147,7 @@ SWITCH_STANDARD_APP(record_fsv_function)
        if (switch_core_codec_init(&codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           read_impl.samples_per_second,
                                                           read_impl.microseconds_per_packet / 1000,
                                                           1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
@@ -339,6 +340,7 @@ SWITCH_STANDARD_APP(play_fsv_function)
        if (switch_core_codec_init(&codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           h.audio_rate,
                                                           h.audio_ptime,
                                                           1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
@@ -353,6 +355,7 @@ SWITCH_STANDARD_APP(play_fsv_function)
        if (switch_core_codec_init(&vid_codec,
                                                           h.video_codec_name,
                                                           NULL,
+                                                          NULL,
                                                           0,
                                                           0,
                                                           1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
index 7a39f8b9ab5ee53b870027ef9679372540e14e70..6617b8be29f329dee08400514c1f9e1791af5cff 100644 (file)
@@ -168,12 +168,13 @@ SWITCH_STANDARD_APP(record_mp4_function)
        MP4::Context ctx(reinterpret_cast<char*>(data), true);
 
        if (switch_core_codec_init(&codec,
-                       "L16",
-                       NULL,
-                       read_impl.samples_per_second,
-                       read_impl.microseconds_per_packet / 1000,
-                       1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
-                       NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS)
+                                                          "L16",
+                                                          NULL,
+                                                          NULL,
+                                                          read_impl.samples_per_second,
+                                                          read_impl.microseconds_per_packet / 1000,
+                                                          1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+                                                          NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS)
        {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Activation Success\n");
        } else {
@@ -440,24 +441,26 @@ SWITCH_STANDARD_APP(play_mp4_function)
                }
 
                if (switch_core_codec_init(&codec,
-                                                                       vc.audioTrack().codecName,
-                                                                       NULL,
-                                                                       vc.audioTrack().clock,
-                                                                       vc.audioTrack().packetLength,
-                                                                       1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
-                                                                       NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+                                                                  vc.audioTrack().codecName,
+                                                                  NULL,
+                                                                  NULL,
+                                                                  vc.audioTrack().clock,
+                                                                  vc.audioTrack().packetLength,
+                                                                  1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+                                                                  NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Audio Codec Activation Success\n");
                } else {
                        throw Exception("Audio Codec Activation Fail");
                }
 
                if (switch_core_codec_init(&vid_codec,
-                                                                       vc.videoTrack().track.codecName,
-                                                                       NULL,
-                                                                       0,
-                                                                       0,
-                                                                       1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
-                                                                       NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+                                                                  vc.videoTrack().track.codecName,
+                                                                  NULL,
+                                                                  NULL,
+                                                                  0,
+                                                                  0,
+                                                                  1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+                                                                  NULL, switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Video Codec Activation Success\n");
                } else
                {
index 22b6b4c0f734ea8604b28b05481923466902bc44..69b611c2a389d23c05f547df17387dfa4a9b99e7 100644 (file)
@@ -369,6 +369,7 @@ SWITCH_STANDARD_APP(record_mp4_function)
                if (switch_core_codec_init(&codec,
                                                                   "PCMU",
                                                                   NULL,
+                                                                  NULL,
                                                                   read_impl.samples_per_second,
                                                                   read_impl.microseconds_per_packet / 1000,
                                                                   read_impl.number_of_channels, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
@@ -669,6 +670,7 @@ static switch_status_t mp4_file_open(switch_file_handle_t *handle, const char *p
        if (switch_core_codec_init(&context->audio_codec,
                                                           get_audio_codec_name(context->audio_type),
                                                           NULL,
+                                                          NULL,
                                                           handle->samplerate,
                                                           20,//ms
                                                           handle->channels, SWITCH_CODEC_FLAG_ENCODE,
@@ -681,12 +683,13 @@ static switch_status_t mp4_file_open(switch_file_handle_t *handle, const char *p
 
        if (switch_test_flag(handle, SWITCH_FILE_FLAG_VIDEO)) {
                if (switch_core_codec_init(&context->video_codec,
-                                                          "H264",
-                                                          NULL,
-                                                          90000,
-                                                          0,//ms
-                                                          1, SWITCH_CODEC_FLAG_ENCODE,
-                                                          NULL, handle->memory_pool) == SWITCH_STATUS_SUCCESS) {
+                                                                  "H264",
+                                                                  NULL,
+                                                                  NULL,
+                                                                  90000,
+                                                                  0,//ms
+                                                                  1, SWITCH_CODEC_FLAG_ENCODE,
+                                                                  NULL, handle->memory_pool) == SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Video Codec H264 Activation Success\n");
                } else {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Video Codec H264 Activation Fail\n");
index c17e0a53aa8a4d3dd91afe6e610f9d20447e364b..c1e1e2803d66586e4bb19f3c0a8268c29277dcf2 100644 (file)
@@ -272,6 +272,7 @@ SWITCH_STANDARD_APP(rss_function)
        if (switch_core_codec_init(&speech_codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           (int) rate,
                                                           interval,
                                                           1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
index b2fb98313ae9b0090a5f6e6b12ee9e093393ef3b..561b9ad6f657c5e67b452a813d5cd2cf1003b420 100644 (file)
@@ -189,18 +189,19 @@ switch_status_t spandsp_tdd_send_session(switch_core_session_t *session, const c
        switch_core_session_get_read_impl(session, &read_impl);
 
        if (switch_core_codec_init(&write_codec,
-                               "L16",
-                               NULL,
-                               read_impl.actual_samples_per_second,
-                               read_impl.microseconds_per_packet / 1000,
-                               read_impl.number_of_channels,
-                               SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
-                               switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
-                               write_frame.data = write_buf;
-                               write_frame.buflen = sizeof(write_buf);
-                               write_frame.datalen = read_impl.decoded_bytes_per_packet;
-                               write_frame.samples = write_frame.datalen / 2;
-                               write_frame.codec = &write_codec;
+                               "L16",
+                               NULL,
+                               NULL,
+                               read_impl.actual_samples_per_second,
+                               read_impl.microseconds_per_packet / 1000,
+                               read_impl.number_of_channels,
+                               SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+                               switch_core_session_get_pool(session)) == SWITCH_STATUS_SUCCESS) {
+        write_frame.data = write_buf;
+        write_frame.buflen = sizeof(write_buf);
+        write_frame.datalen = read_impl.decoded_bytes_per_packet;
+        write_frame.samples = write_frame.datalen / 2;
+        write_frame.codec = &write_codec;
                switch_core_session_set_read_codec(session, &write_codec);
        } else {
                return SWITCH_STATUS_FALSE;
index 4a75b803ee8c39aef4fa34cb8726c908293bebd0..969a83abc3a2c904415be6f449fbef5e91ab7eee 100644 (file)
@@ -1440,6 +1440,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat
         */
        if (switch_core_codec_init(&read_codec,
                                                           "L16",
+                               NULL,
                                                           NULL,
                                                           read_impl.samples_per_second,
                                                           read_impl.microseconds_per_packet / 1000,
@@ -1457,6 +1458,7 @@ void mod_spandsp_fax_process_fax(switch_core_session_t *session, const char *dat
 
        if (switch_core_codec_init(&write_codec,
                                                           "L16",
+                               NULL,
                                                           NULL,
                                                           read_impl.samples_per_second,
                                                           read_impl.microseconds_per_packet / 1000,
@@ -1864,6 +1866,7 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi
 
        if (switch_core_codec_init(&read_codec,
                                                           "L16",
+                               NULL,
                                                           NULL,
                                                           read_impl.samples_per_second,
                                                           read_impl.microseconds_per_packet / 1000,
@@ -1880,6 +1883,7 @@ static switch_status_t t38_gateway_on_consume_media(switch_core_session_t *sessi
 
        if (switch_core_codec_init(&write_codec,
                                                           "L16",
+                               NULL,
                                                           NULL,
                                                           read_impl.samples_per_second,
                                                           read_impl.microseconds_per_packet / 1000,
index ee7405f90af116ee070afe8c756251d6e183f3c3..5ef01cd5c48f9943f5d997d8eb9f50025f2622be 100644 (file)
@@ -770,6 +770,7 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
 
        status = switch_core_codec_init(&tech_pvt->read_codec,
                                                                        iananame,
+                                    NULL,
                                                                        NULL,
                                                                        rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session));
 
@@ -779,6 +780,7 @@ static switch_status_t tech_init(private_t *tech_pvt, switch_core_session_t *ses
 
        status = switch_core_codec_init(&tech_pvt->write_codec,
                                                                        iananame,
+                                    NULL,
                                                                        NULL,
                                                                        rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session));
 
index 3e110c39d3aa7b38c874019386251c72f0445706..5847e32c7b39da3c790259c138be7229f31350ab 100644 (file)
@@ -756,6 +756,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_openh264_load)
        switch_core_codec_add_video_implementation(pool, codec_interface, 99, "H264", NULL,
                                                                                           switch_h264_init, switch_h264_encode, switch_h264_decode, switch_h264_control, switch_h264_destroy);
 
+
        /* indicate that the module should continue to be loaded */
        return SWITCH_STATUS_SUCCESS;
 }
index 61f2e38d97a4dc332a54b0498225839849bf96d9..f7d933b29e73346b485b6836498d77f6c12028c0 100644 (file)
@@ -562,6 +562,7 @@ static switch_status_t channel_read_frame(switch_core_session_t *session, switch
                                if (switch_core_codec_init(&tech_pvt->write_codec,
                                                                                   "L16",
                                                                                   NULL,
+                                                                                  NULL,
                                                                                   sample_rate,
                                                                                   codec_ms,
                                                                                   1,
@@ -989,13 +990,13 @@ static switch_status_t engage_device(unsigned int sample_rate, int codec_ms)
 
        if (switch_core_codec_init(&globals.read_codec,
                                                           "L16",
-                                                          NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
+                                                          NULL, NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
                return SWITCH_STATUS_FALSE;
        } else {
                if (switch_core_codec_init(&globals.write_codec,
                                                                   "L16",
-                                                                  NULL,
+                                                                  NULL, NULL,
                                                                   sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
                        switch_core_codec_destroy(&globals.read_codec);
index 05012fb3b5c33a23a86304d5c37e12932c99bfcb..e92ea57c1cf9581a1c5f1eb261319d3e3263846a 100644 (file)
@@ -1167,6 +1167,7 @@ static int activate_audio_rtp(struct private_object *tech_pvt)
                if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_RTP].read_codec,
                                                                   tech_pvt->transports[LDL_TPORT_RTP].codec_name,
                                                                   NULL,
+                                                                  NULL,
                                                                   tech_pvt->transports[LDL_TPORT_RTP].codec_rate,
                                                                   ms,
                                                                   1,
@@ -1188,6 +1189,7 @@ static int activate_audio_rtp(struct private_object *tech_pvt)
                if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_RTP].write_codec,
                                                                   tech_pvt->transports[LDL_TPORT_RTP].codec_name,
                                                                   NULL,
+                                                                  NULL,
                                                                   tech_pvt->transports[LDL_TPORT_RTP].codec_rate,
                                                                   ms,
                                                                   1,
@@ -1366,6 +1368,7 @@ static int activate_video_rtp(struct private_object *tech_pvt)
                if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].read_codec,
                                                                   tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name,
                                                                   NULL,
+                                                                  NULL,
                                                                   tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_rate,
                                                                   ms,
                                                                   1,
@@ -1384,6 +1387,7 @@ static int activate_video_rtp(struct private_object *tech_pvt)
                if (switch_core_codec_init(&tech_pvt->transports[LDL_TPORT_VIDEO_RTP].write_codec,
                                                                   tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_name,
                                                                   NULL,
+                                                                  NULL,
                                                                   tech_pvt->transports[LDL_TPORT_VIDEO_RTP].codec_rate,
                                                                   ms,
                                                                   1,
index fc45ab9294933254dde45431b51deb8834c6c322..16c83fa29ce290555986a44893601388fa0fddff 100644 (file)
@@ -217,14 +217,14 @@ static switch_status_t gsmopen_codec(private_t * tech_pvt, int sample_rate, int
        switch_core_session_t *session = NULL;
 
        if (switch_core_codec_init
-               (&tech_pvt->read_codec, "L16", NULL, sample_rate, codec_ms, 1,
+               (&tech_pvt->read_codec, "L16", NULL, NULL, sample_rate, codec_ms, 1,
                 SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                ERRORA("Can't load codec?\n", GSMOPEN_P_LOG);
                return SWITCH_STATUS_FALSE;
        }
 
        if (switch_core_codec_init
-               (&tech_pvt->write_codec, "L16", NULL, sample_rate, codec_ms, 1,
+               (&tech_pvt->write_codec, "L16", NULL, NULL, sample_rate, codec_ms, 1,
                 SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                ERRORA("Can't load codec?\n", GSMOPEN_P_LOG);
                switch_core_codec_destroy(&tech_pvt->read_codec);
index 7ad50e65e92e3be46d47abdb9272af4f39832d44..c1cf2800e266d0e93ffaebc72f63cdc7c6357eee 100644 (file)
@@ -156,14 +156,14 @@ static switch_status_t gsmopen_codec(private_t *tech_pvt, int sample_rate, int c
        switch_core_session_t *session = NULL;
 
        if (switch_core_codec_init
-               (&tech_pvt->read_codec, "L16", NULL, sample_rate, codec_ms, 1,
+               (&tech_pvt->read_codec, "L16", NULL, NULL, sample_rate, codec_ms, 1,
                 SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                ERRORA("Can't load codec?\n", GSMOPEN_P_LOG);
                return SWITCH_STATUS_FALSE;
        }
 
        if (switch_core_codec_init
-               (&tech_pvt->write_codec, "L16", NULL, sample_rate, codec_ms, 1,
+               (&tech_pvt->write_codec, "L16", NULL, NULL, sample_rate, codec_ms, 1,
                 SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                ERRORA("Can't load codec?\n", GSMOPEN_P_LOG);
                switch_core_codec_destroy(&tech_pvt->read_codec);
index a44de1407f1e9bee1303481aaf28fef5647979ad..514bff5a6e4b69413122db0b30d33575419d5f2a 100644 (file)
@@ -2071,12 +2071,12 @@ PBoolean FSH323_ExternalRTPChannel::Start()
        
        tech_pvt->read_frame.codec = &tech_pvt->read_codec; /* Set codec here - no need to set it every time a frame is read */
 
-       if (switch_core_codec_init(codec, GetH245CodecName(m_capability), NULL, // FMTP
+       if (switch_core_codec_init(codec, GetH245CodecName(m_capability), NULL, NULL, // FMTP
                8000, m_codec_ms, 1,  // Channels
                SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,   // Settings
                switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
         
-               if (switch_core_codec_init(codec, GetH245CodecName(m_capability), NULL, // FMTP
+               if (switch_core_codec_init(codec, GetH245CodecName(m_capability), NULL, NULL, // FMTP
                        8000, 0, 1,  // Channels
                        SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,   // Settings
                        switch_core_session_get_pool(m_fsSession)) != SWITCH_STATUS_SUCCESS) {
index e093d685013f6cdc4ff9565474ab06af8a353a6c..e60056fb9fe9f5ef64b266107c83353fc13ea9ec 100644 (file)
@@ -713,7 +713,7 @@ switch_status_t Board::KhompPvt::justAlloc(bool is_answering, switch_memory_pool
 
     switch_core_session_add_stream(session(), NULL);
 
-    if (switch_core_codec_init(&_read_codec, "PCMA", NULL, 8000, Globals::switch_packet_duration, 1,
+    if (switch_core_codec_init(&_read_codec, "PCMA", NULL, NULL, 8000, Globals::switch_packet_duration, 1,
             SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
                 (pool ? *pool : NULL)) != SWITCH_STATUS_SUCCESS)
     {
@@ -722,7 +722,7 @@ switch_status_t Board::KhompPvt::justAlloc(bool is_answering, switch_memory_pool
         return SWITCH_STATUS_FALSE;
     }
 
-    if (switch_core_codec_init(&_write_codec, "PCMA", NULL, 8000, Globals::switch_packet_duration, 1,
+    if (switch_core_codec_init(&_write_codec, "PCMA", NULL, NULL, 8000, Globals::switch_packet_duration, 1,
             SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
                 (pool ? *pool : NULL)) != SWITCH_STATUS_SUCCESS)
     {
index b0cde67f07d2bd236de23650ad3c5c53aac01de4..6724b0cea2237fb08d606b2de92822d2c4c5f172 100644 (file)
@@ -137,11 +137,12 @@ static switch_status_t tech_init(loopback_private_t *tech_pvt, switch_core_sessi
                interval = codec->implementation->microseconds_per_packet / 1000;
        } else {
                const char *var;
+               char *modname = NULL;
 
                if ((var = switch_channel_get_variable(channel, "loopback_initial_codec"))) {
                        char *dup = switch_core_session_strdup(session, var);
                        uint32_t bit, channels;
-                       iananame = switch_parse_codec_buf(dup, &interval, &rate, &bit, &channels);
+                       iananame = switch_parse_codec_buf(dup, &interval, &rate, &bit, &channels, &modname);
                }
                
        }
@@ -160,6 +161,7 @@ static switch_status_t tech_init(loopback_private_t *tech_pvt, switch_core_sessi
        status = switch_core_codec_init(&tech_pvt->read_codec,
                                                                        iananame,
                                                                        NULL,
+                                                                       NULL,
                                                                        rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session));
 
        if (status != SWITCH_STATUS_SUCCESS || !tech_pvt->read_codec.implementation || !switch_core_codec_ready(&tech_pvt->read_codec)) {
@@ -169,6 +171,7 @@ static switch_status_t tech_init(loopback_private_t *tech_pvt, switch_core_sessi
        status = switch_core_codec_init(&tech_pvt->write_codec,
                                                                        iananame,
                                                                        NULL,
+                                                                       NULL,
                                                                        rate, interval, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, switch_core_session_get_pool(session));
 
 
index c844df7052f6494aa4451a020907db78af1a14c8..70b540eddb24b987dab19d47ff7c8b64a1cebaa7 100644 (file)
@@ -1287,12 +1287,12 @@ PBoolean FSMediaStream::Open()
     }
 
     // The following is performed on two different instances of this object.
-    if (switch_core_codec_init(m_switchCodec, mediaFormat.GetEncodingName(), NULL, // FMTP
+    if (switch_core_codec_init(m_switchCodec, mediaFormat.GetEncodingName(), NULL, NULL, // FMTP
                                mediaFormat.GetClockRate(), ptime, 1,  // Channels
                                SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,   // Settings
                                switch_core_session_get_pool(fsSession)) != SWITCH_STATUS_SUCCESS) {
         // Could not select a codecs using negotiated frames/packet, so try using default.
-        if (switch_core_codec_init(m_switchCodec, mediaFormat.GetEncodingName(), NULL, // FMTP
+        if (switch_core_codec_init(m_switchCodec, mediaFormat.GetEncodingName(), NULL, NULL, // FMTP
                                    mediaFormat.GetClockRate(), 0, 1,  // Channels
                                    SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,   // Settings
                                    switch_core_session_get_pool(fsSession)) != SWITCH_STATUS_SUCCESS) {
index 4329be4cd399d2bc845737e5f6ded5b5a63be5ba..2dc40464201b488304680d7a67a3ec8e90ba1b25 100644 (file)
@@ -1217,15 +1217,15 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                }
 
                if (switch_core_codec_init(&endpoint->read_codec,
-                                       "L16", NULL, sample_rate, codec_ms, 1, 
-                                       SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
+                                                                  "L16", NULL, NULL, sample_rate, codec_ms, 1, 
+                                                                  SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
                        goto error;
                }
 
                if (switch_core_codec_init(&endpoint->write_codec,
-                                        "L16", NULL, sample_rate, codec_ms, 1, 
-                                        SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
+                                                                  "L16", NULL, NULL, sample_rate, codec_ms, 1, 
+                                                                  SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
                        goto error;
                }
@@ -2222,6 +2222,7 @@ static switch_status_t create_codecs(int restart)
        if (!switch_core_codec_ready(&globals.read_codec)) {
                if (switch_core_codec_init(&globals.read_codec,
                                                                   "L16",
+                                                                  NULL,
                                                                   NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
                                                                   NULL) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
@@ -2235,6 +2236,7 @@ static switch_status_t create_codecs(int restart)
                if (switch_core_codec_init(&globals.write_codec,
                                                                   "L16",
                                                                   NULL,
+                                                                  NULL,
                                                                   sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
                        switch_core_codec_destroy(&globals.read_codec);
index 2ec48628ae2a4973be38900cfb3df889705bcc95..cbd276a71acab830562befc460f2ea127f361596 100644 (file)
@@ -109,7 +109,7 @@ switch_status_t rtmp_tech_init(rtmp_private_t *tech_pvt, rtmp_session_t *rsessio
        tech_pvt->channel = switch_core_session_get_channel(session);
 
        /* Initialize read & write codecs */
-       if (switch_core_codec_init(&tech_pvt->read_codec, /* name */ "SPEEX", 
+       if (switch_core_codec_init(&tech_pvt->read_codec, /* name */ "SPEEX", /* modname */ NULL,
                 /* fmtp */ NULL,  /* rate */ 16000, /* ms */ 20, /* channels */ 1, 
                /* flags */ SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, 
                /* codec settings */ NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
@@ -118,7 +118,7 @@ switch_status_t rtmp_tech_init(rtmp_private_t *tech_pvt, rtmp_session_t *rsessio
                return SWITCH_STATUS_FALSE;
        }
 
-       if (switch_core_codec_init(&tech_pvt->write_codec, /* name */ "SPEEX", 
+       if (switch_core_codec_init(&tech_pvt->write_codec, /* name */ "SPEEX", /* modname */ NULL,
                 /* fmtp */ NULL,  /* rate */ 16000, /* ms */ 20, /* channels */ 1, 
                /* flags */ SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, 
                /* codec settings */ NULL, switch_core_session_get_pool(session)) != SWITCH_STATUS_SUCCESS) {
index 5925abebe47d310aeb63b6a3fae35fc12fee121d..7ef5aec3e24a3f3af17169a18a59343d01ef76be 100644 (file)
@@ -574,25 +574,27 @@ switch_status_t skinny_tech_set_codec(private_t *tech_pvt, int force)
        }
 
        if (switch_core_codec_init(&tech_pvt->read_codec,
-                               tech_pvt->iananame,
-                               tech_pvt->rm_fmtp,
-                               tech_pvt->rm_rate,
-                               tech_pvt->codec_ms,
-                               1,
-                               SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | 0 /* TODO tech_pvt->profile->codec_flags */,
-                               NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+                                                          tech_pvt->iananame,
+                                                          NULL,
+                                                          tech_pvt->rm_fmtp,
+                                                          tech_pvt->rm_rate,
+                                                          tech_pvt->codec_ms,
+                                                          1,
+                                                          SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | 0 /* TODO tech_pvt->profile->codec_flags */,
+                                                          NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n");
                switch_goto_status(SWITCH_STATUS_FALSE, end);
        }
 
        if (switch_core_codec_init(&tech_pvt->write_codec,
-                               tech_pvt->iananame,
-                               tech_pvt->rm_fmtp,
-                               tech_pvt->rm_rate,
-                               tech_pvt->codec_ms,
-                               1,
-                               SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | 0 /* TODO tech_pvt->profile->codec_flags */,
-                               NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+                                                          tech_pvt->iananame,
+                                                          NULL,
+                                                          tech_pvt->rm_fmtp,
+                                                          tech_pvt->rm_rate,
+                                                          tech_pvt->codec_ms,
+                                                          1,
+                                                          SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE | 0 /* TODO tech_pvt->profile->codec_flags */,
+                                                          NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(tech_pvt->session), SWITCH_LOG_ERROR, "Can't load codec?\n");
                switch_goto_status(SWITCH_STATUS_FALSE, end);
        }
index 277dc8c42856702c32ebdb3bae3a309053db90e0..d50f3727761cd747466737b9d7db934373dc35be 100644 (file)
@@ -212,14 +212,14 @@ static switch_status_t skypopen_codec(private_t *tech_pvt, int sample_rate, int
        switch_core_session_t *session = NULL;
 
        if (switch_core_codec_init
-               (&tech_pvt->read_codec, "L16", NULL, sample_rate, codec_ms, 1,
+               (&tech_pvt->read_codec, "L16", NULL, NULL, sample_rate, codec_ms, 1,
                 SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                ERRORA("skypopen_codec: Can't load codec?\n", SKYPOPEN_P_LOG);
                return SWITCH_STATUS_FALSE;
        }
 
        if (switch_core_codec_init
-               (&tech_pvt->write_codec, "L16", NULL, sample_rate, codec_ms, 1,
+               (&tech_pvt->write_codec, "L16", NULL, NULL, sample_rate, codec_ms, 1,
                 SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                ERRORA("skypopen_codec: Can't load codec?\n", SKYPOPEN_P_LOG);
                switch_core_codec_destroy(&tech_pvt->read_codec);
index 897534970efeb810452c3d136540ab16a8ff6131..b6a14974b0d944ced572388febc3daf9fa7a9285 100644 (file)
@@ -229,6 +229,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
        if (switch_core_codec_init(&tech_pvt->read_codec,
                                                           codec,
                                                           NULL,
+                                                          NULL,
                                                           rate,
                                                           ptime,
                                                           1,
@@ -240,6 +241,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
                if (switch_core_codec_init(&tech_pvt->write_codec,
                                                                   codec,
                                                                   NULL,
+                                                                  NULL,
                                                                   rate,
                                                                   ptime,
                                                                   1,
@@ -479,24 +481,26 @@ static switch_status_t channel_receive_event(switch_core_session_t *session, swi
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_CRIT, "Switching codec updating \n");
 
                if (switch_core_codec_init(&tech_pvt->read_codec,
-                                       codec,
-                                       NULL,
-                                       rate,
-                                       ptime,
-                                       1,
+                                                                  codec,
+                                                                  NULL,
+                                                                  NULL,
+                                                                  rate,
+                                                                  ptime,
+                                                                  1,
                                        /*SWITCH_CODEC_FLAG_ENCODE |*/ SWITCH_CODEC_FLAG_DECODE,
                                        NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
                        goto fail;
                } else {
                        if (switch_core_codec_init(&tech_pvt->write_codec,
-                                               codec,
-                                               NULL,
-                                               rate,
-                                               ptime,
-                                               1,
-                                               SWITCH_CODEC_FLAG_ENCODE /*| SWITCH_CODEC_FLAG_DECODE*/, 
-                                               NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
+                                                                          codec,
+                                                                          NULL,
+                                                                          NULL,
+                                                                          rate,
+                                                                          ptime,
+                                                                          1,
+                                                                          SWITCH_CODEC_FLAG_ENCODE /*| SWITCH_CODEC_FLAG_DECODE*/, 
+                                                                          NULL, switch_core_session_get_pool(tech_pvt->session)) != SWITCH_STATUS_SUCCESS) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
                                goto fail;
                        }
index 5c65df1d528ead579b7879864f1046dc5ac121e5..ab011b973090b1f2841e5510a91dcbda6c3ec5af 100644 (file)
@@ -550,6 +550,7 @@ SWITCH_STANDARD_APP(record_av_function)
        if (switch_core_codec_init(&codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           force_sample_rate,
                                                           read_impl.microseconds_per_packet / 1000,
                                                           read_impl.number_of_channels, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
index 29137754b2ecbb94118d4887fd428a5e4a85d331..1d2882ca7470e73257fc726e3b6e2a6c9c7e54d5 100644 (file)
@@ -174,7 +174,7 @@ static switch_status_t engage_device(portaudio_stream_source_t *source, int rest
        if (!switch_core_codec_ready(&source->read_codec)) {
                if (switch_core_codec_init(&source->read_codec,
                                                                   "L16",
-                                                                  NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
+                                                                  NULL, NULL, sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
                                                                   NULL) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
                        return SWITCH_STATUS_FALSE;
@@ -186,7 +186,7 @@ static switch_status_t engage_device(portaudio_stream_source_t *source, int rest
        if (!switch_core_codec_ready(&source->write_codec)) {
                if (switch_core_codec_init(&source->write_codec,
                                                                   "L16",
-                                                                  NULL,
+                                                                  NULL, NULL,
                                                                   sample_rate, codec_ms, 1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) != SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't load codec?\n");
                        switch_core_codec_destroy(&source->read_codec);
index 3edfcdd29fa1bc99fcc3032d2c8d488cbc9c1547..a0313a4703269b4ae80a3ce5882dc8bb3008d64f 100644 (file)
@@ -1417,6 +1417,7 @@ SWITCH_STANDARD_APP(play_video_function)
        if (switch_core_codec_init(&codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           read_impl.actual_samples_per_second,
                                                           read_impl.microseconds_per_packet/1000,
                                                           read_impl.number_of_channels, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
@@ -2301,6 +2302,7 @@ static switch_call_cause_t vlc_outgoing_channel(switch_core_session_t *session,
        if (switch_core_codec_init(&tech_pvt->read_codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           tech_pvt->read_impl.actual_samples_per_second,
                                                           tech_pvt->read_impl.microseconds_per_packet / 1000,
                                                           tech_pvt->read_impl.number_of_channels,
@@ -2312,6 +2314,7 @@ static switch_call_cause_t vlc_outgoing_channel(switch_core_session_t *session,
 
        if (switch_core_codec_init(&tech_pvt->write_codec,
                                                           tech_pvt->read_impl.iananame,
+                                                          tech_pvt->read_impl.modname,
                                                           NULL,
                                                           tech_pvt->read_impl.actual_samples_per_second,
                                                           tech_pvt->read_impl.microseconds_per_packet / 1000,
@@ -2337,12 +2340,13 @@ static switch_call_cause_t vlc_outgoing_channel(switch_core_session_t *session,
        }
 
        if (switch_core_codec_init(&tech_pvt->video_codec,
-                               codec_str,
-                               NULL,
-                               90000,
-                               0,
-                               1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
-                               NULL, switch_core_session_get_pool(tech_pvt->session)) == SWITCH_STATUS_SUCCESS) {
+                                                          codec_str,
+                                                          NULL,
+                                                          NULL,
+                                                          90000,
+                                                          0,
+                                                          1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
+                                                          NULL, switch_core_session_get_pool(tech_pvt->session)) == SWITCH_STATUS_SUCCESS) {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_DEBUG, "Video Codec Activation Success\n");
        } else {
                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(*new_session), SWITCH_LOG_ERROR, "Video Codec Activation Fail\n");
index 4d9c4ae41642a1127f3c997ae98c0f191ce3cc50..da804eac24e07ccfa254bb67c7ccb701a24af86f 100644 (file)
@@ -171,6 +171,7 @@ static switch_status_t webm_file_open(switch_file_handle_t *handle, const char *
 
        if (switch_core_codec_init(&context->audio_codec,
                                                           AUDIO_CODEC,
+                                                          NULL,
                                                           fmtp,
                                                           handle->samplerate,
                                                           20,//ms
@@ -186,6 +187,7 @@ static switch_status_t webm_file_open(switch_file_handle_t *handle, const char *
                if (switch_core_codec_init(&context->video_codec,
                                                           "VP8",
                                                           NULL,
+                                                          NULL,
                                                           90000,
                                                           0,//ms
                                                           1, SWITCH_CODEC_FLAG_ENCODE,
index dce66a053deedfecd330ddde4729b3ed7d45d417..260e52969623b45037f26ce554e339a4d6317df2 100644 (file)
@@ -972,6 +972,7 @@ switch_status_t FSSession::InitSpeechEngine(const char *engine, const char *voic
        if (switch_core_codec_init(&this->_speech->codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           rate,
                                                           interval,
                                                           1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
index c77edd5db5c0a2900f4a7f229f9478bce0e80a4e..aad8dc4bd8e523f64c7c196a6937f5e4a1dba711 100644 (file)
@@ -137,6 +137,7 @@ void *FSTeleTone::Construct(const v8::FunctionCallbackInfo<Value>& info)
        if (switch_core_codec_init(&tto->_codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           read_impl.actual_samples_per_second,
                                                           read_impl.microseconds_per_packet / 1000,
                                                           read_impl.number_of_channels, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
index 97a93fc29c84131ffefe82f795ebb3e95d35ab6d..8f1b921380bbc34dc02c451997b57c0dce2034cf 100644 (file)
@@ -593,7 +593,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_parse_fmtp(const char *codec_n
 
        memset(codec_fmtp, 0, sizeof(*codec_fmtp));
        
-       if ((codec_interface = switch_loadable_module_get_codec_interface(codec_name))) {
+       if ((codec_interface = switch_loadable_module_get_codec_interface(codec_name, NULL))) {
                if (codec_interface->parse_fmtp) {
                        codec_fmtp->actual_samples_per_second = rate;
                        status = codec_interface->parse_fmtp(fmtp, codec_fmtp);
@@ -624,6 +624,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, sw
        
        return switch_core_codec_init(new_codec, 
                                                                  codec->implementation->iananame,
+                                                                 codec->implementation->modname,
                                                                  codec->fmtp_in,
                                                                  codec->implementation->samples_per_second,
                                                                  codec->implementation->microseconds_per_packet / 1000,
@@ -634,7 +635,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_copy(switch_codec_t *codec, sw
        
 }
 
-SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec_t *codec, const char *codec_name, const char *fmtp,
+SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec_t *codec, const char *codec_name, const char *modname, const char *fmtp,
                                                                                                           uint32_t rate, int ms, int channels, uint32_t bitrate, uint32_t flags,
                                                                                                           const switch_codec_settings_t *codec_settings, switch_memory_pool_t *pool)
 {
@@ -650,7 +651,17 @@ SWITCH_DECLARE(switch_status_t) switch_core_codec_init_with_bitrate(switch_codec
                codec->session = switch_core_memory_pool_get_data(pool, "__session");
        }
 
-       if ((codec_interface = switch_loadable_module_get_codec_interface(codec_name)) == 0) {
+       if (strchr(codec_name, '.')) {
+               char *p = NULL;
+               codec_name = switch_core_strdup(pool, codec_name);
+               if ((p = strchr(codec_name, '.'))) {
+                       *p++ = '\0';
+                       modname = codec_name;
+                       codec_name = p;
+               }
+       }
+
+       if ((codec_interface = switch_loadable_module_get_codec_interface(codec_name, modname)) == 0) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid codec %s!\n", codec_name);
                return SWITCH_STATUS_GENERR;
        }
index 557ba8365a989a55bb0232ea6ec8a5d43bed65c9..0e7ec59e5f609464c00884e6042c909ba0262169 100644 (file)
@@ -656,6 +656,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_get_payload_code(switch_core
 SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_session_t *session, 
                                                                                                                                  switch_media_type_t type,
                                                                                                                                  const char *name, 
+                                                                                                                                 const char *modname, 
                                                                                                                                  const char *fmtp,
                                                                                                                                  switch_sdp_type_t sdp_type,
                                                                                                                                  uint32_t pt, 
@@ -728,6 +729,10 @@ SWITCH_DECLARE(payload_map_t *) switch_core_media_add_payload_map(switch_core_se
                pmap->channels = channels;
        }
 
+       if (modname) {
+               pmap->modname = switch_core_strdup(session->pool, modname);
+       }
+
        if (!zstr(fmtp) && (zstr(pmap->rm_fmtp) || strcmp(pmap->rm_fmtp, fmtp))) {
                pmap->rm_fmtp = switch_core_strdup(session->pool, fmtp);
        }
@@ -780,7 +785,7 @@ SWITCH_DECLARE(const char *)switch_core_media_get_codec_string(switch_core_sessi
                if (!(preferred = switch_channel_get_variable(session->channel, "absolute_codec_string"))) {
                        preferred = switch_channel_get_variable(session->channel, "codec_string");
                }
-       
+
                if (!preferred) {
                        if (switch_channel_direction(session->channel) == SWITCH_CALL_DIRECTION_OUTBOUND) {
                                preferred = smh->mparams->outbound_codec_string;
@@ -2491,6 +2496,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_se
 
        if (switch_core_codec_init(&v_engine->read_codec,
                                                           v_engine->cur_payload_map->rm_encoding,
+                                                          v_engine->cur_payload_map->modname,
                                                           v_engine->cur_payload_map->rm_fmtp,
                                                           v_engine->cur_payload_map->rm_rate,
                                                           0,
@@ -2502,6 +2508,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_video_codec(switch_core_se
        } else {
                if (switch_core_codec_init(&v_engine->write_codec,
                                                                   v_engine->cur_payload_map->rm_encoding,
+                                                                  v_engine->cur_payload_map->modname,
                                                                   v_engine->cur_payload_map->rm_fmtp,
                                                                   v_engine->cur_payload_map->rm_rate,
                                                                   0,
@@ -2628,6 +2635,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
 
        if (switch_core_codec_init_with_bitrate(&a_engine->read_codec,
                                                                                        a_engine->cur_payload_map->iananame,
+                                                                                       a_engine->cur_payload_map->modname,
                                                                                        a_engine->cur_payload_map->rm_fmtp,
                                                                                        a_engine->cur_payload_map->rm_rate,
                                                                                        a_engine->cur_payload_map->codec_ms,
@@ -2645,6 +2653,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_media_set_codec(switch_core_session_
 
        if (switch_core_codec_init_with_bitrate(&a_engine->write_codec,
                                                                                        a_engine->cur_payload_map->iananame,
+                                                                                       a_engine->cur_payload_map->modname,
                                                                                        a_engine->cur_payload_map->rm_fmtp,
                                                                                        a_engine->cur_payload_map->rm_rate,
                                                                                        a_engine->cur_payload_map->codec_ms,
@@ -4030,6 +4039,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        payload_map_t *pmap = switch_core_media_add_payload_map(session, 
                                                                                                                                                        SWITCH_MEDIA_TYPE_AUDIO,
                                                                                                                                                        matches[j].map->rm_encoding,
+                                                                                                                                                       matches[j].imp->modname,
                                                                                                                                                        matches[j].map->rm_fmtp,
                                                                                                                                                        sdp_type, 
                                                                                                                                                        matches[j].map->rm_pt,
@@ -4342,6 +4352,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                        payload_map_t *pmap = switch_core_media_add_payload_map(session, 
                                                                                                                                                        SWITCH_MEDIA_TYPE_VIDEO,
                                                                                                                                                        matches[j].map->rm_encoding, 
+                                                                                                                                                       matches[j].imp->modname,
                                                                                                                                                        matches[j].map->rm_fmtp,
                                                                                                                                                        sdp_type, 
                                                                                                                                                        matches[j].map->rm_pt,
@@ -4349,6 +4360,7 @@ SWITCH_DECLARE(uint8_t) switch_core_media_negotiate_sdp(switch_core_session_t *s
                                                                                                                                                        matches[j].imp->microseconds_per_packet / 1000,
                                                                                                                                                        matches[j].imp->number_of_channels,
                                                                                                                                                        SWITCH_TRUE);
+
                                        if (j == 0) {
                                                v_engine->cur_payload_map = pmap;
                                                v_engine->cur_payload_map->current = 1;
@@ -6900,6 +6912,7 @@ SWITCH_DECLARE(void) switch_core_media_gen_local_sdp(switch_core_session_t *sess
                                switch_core_media_add_payload_map(session,
                                                                                                  imp->codec_type == SWITCH_CODEC_TYPE_AUDIO ? SWITCH_MEDIA_TYPE_AUDIO : SWITCH_MEDIA_TYPE_VIDEO,
                                                                                                  imp->iananame,
+                                                                                                 imp->modname,
                                                                                                  NULL,
                                                                                                  sdp_type,
                                                                                                  smh->ianacodes[i],
@@ -7957,6 +7970,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session)
                                                                                                 SWITCH_MEDIA_TYPE_AUDIO,
                                                                                                 "PROXY",
                                                                                                 NULL,
+                                                                                                NULL,
                                                                                                 SDP_TYPE_RESPONSE,
                                                                                                 0,
                                                                                                 8000,
@@ -8113,6 +8127,7 @@ SWITCH_DECLARE(void) switch_core_media_patch_sdp(switch_core_session_t *session)
                                                                                                                 SWITCH_MEDIA_TYPE_AUDIO,
                                                                                                                 "PROXY-VID",
                                                                                                                 NULL,
+                                                                                                                NULL,
                                                                                                                 SDP_TYPE_RESPONSE,
                                                                                                                 0,
                                                                                                                 90000,
@@ -8949,7 +8964,7 @@ SWITCH_DECLARE(void) switch_core_media_set_sdp_codec_string(switch_core_session_
 }
 
 
-static void add_audio_codec(sdp_rtpmap_t *map, int ptime, char *buf, switch_size_t buflen)
+static void add_audio_codec(sdp_rtpmap_t *map, const switch_codec_implementation_t *imp, int ptime, char *buf, switch_size_t buflen)
 {
        int codec_ms = ptime;
        uint32_t map_bit_rate = 0, map_channels = 1;
@@ -9004,7 +9019,7 @@ static void add_audio_codec(sdp_rtpmap_t *map, int ptime, char *buf, switch_size
                switch_snprintf(bitstr, sizeof(bitstr), "@%dc", map_channels);
        }
 
-       switch_snprintf(buf + strlen(buf), buflen - strlen(buf), ",%s%s%s%s", map->rm_encoding, ratestr, ptstr, bitstr);
+       switch_snprintf(buf + strlen(buf), buflen - strlen(buf), ",%s.%s%s%s%s", imp->modname, map->rm_encoding, ratestr, ptstr, bitstr);
 
 }
 
@@ -9084,6 +9099,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess
                                switch_core_media_add_payload_map(session, 
                                                                                                  m->m_type == sdp_media_audio ? SWITCH_MEDIA_TYPE_AUDIO : SWITCH_MEDIA_TYPE_VIDEO,
                                                                                                  map->rm_encoding,
+                                                                                                 NULL,
                                                                                                  map->rm_fmtp,
                                                                                                  sdp_type,
                                                                                                  map->rm_pt,
@@ -9141,7 +9157,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess
                                                }
 
                                                if (match) {
-                                                       add_audio_codec(map, ptime, buf, sizeof(buf));
+                                                       add_audio_codec(map, imp, ptime, buf, sizeof(buf));
                                                        break;
                                                }
                                        
@@ -9171,7 +9187,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess
                                                }
 
                                                if (match) {
-                                                       add_audio_codec(map, ptime, buf, sizeof(buf));
+                                                       add_audio_codec(map, imp, ptime, buf, sizeof(buf));
                                                        break;
                                                }
                                        }
@@ -9190,7 +9206,6 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess
                        }
                        for (i = 0; i < num_codecs; i++) {
                                const switch_codec_implementation_t *imp = codecs[i];
-                               int channels;
 
                                if (imp->codec_type != SWITCH_CODEC_TYPE_VIDEO || imp->ianacode > 127 || already_did[imp->ianacode]) {
                                        continue;
@@ -9218,13 +9233,7 @@ static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *sess
                                        }
 
                                        if (match) {
-                                               channels = map->rm_params ? atoi(map->rm_params) : 1;
-                                               if (ptime > 0) {
-                                                       switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%di@%dc", imp->iananame, (unsigned int) map->rm_rate,
-                                                                                       ptime, channels);
-                                               } else {
-                                                       switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s@%uh@%dc", imp->iananame, (unsigned int) map->rm_rate, channels);
-                                               }
+                                               switch_snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), ",%s.%s", imp->modname, imp->iananame);
                                                already_did[imp->ianacode] = 1;
                                                break;
                                        }
@@ -9315,6 +9324,7 @@ SWITCH_DECLARE(void) switch_core_media_check_outgoing_proxy(switch_core_session_
                                                                                         SWITCH_MEDIA_TYPE_AUDIO,
                                                                                         "PROXY",
                                                                                         NULL,
+                                                                                        NULL,
                                                                                         SDP_TYPE_RESPONSE,
                                                                                         0,
                                                                                         8000,
@@ -9330,6 +9340,7 @@ SWITCH_DECLARE(void) switch_core_media_check_outgoing_proxy(switch_core_session_
                                                                                                 SWITCH_MEDIA_TYPE_AUDIO,
                                                                                                 "PROXY-VID",
                                                                                                 NULL,
+                                                                                                NULL,
                                                                                                 SDP_TYPE_RESPONSE,
                                                                                                 0,
                                                                                                 90000,
index e1ebce14d63ce5df8d31dbab43eadbdc5ffef189..a3cfacd82e8a127f3dd83f6975342208f4322fa8 100644 (file)
@@ -97,6 +97,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_set_codec_slin(switch_core_s
        if (switch_core_codec_init(&data->codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           read_impl.actual_samples_per_second,
                                                           interval,
                                                           read_impl.number_of_channels, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, NULL) == SWITCH_STATUS_SUCCESS) {
index c6e118abf91d82df4c57b8dda2e5f3c70fdd583c..beca50c3fa156b3978b869694bed5b2eca72dd71 100644 (file)
@@ -62,6 +62,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *ses
        if (switch_core_codec_init(&codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           imp.samples_per_second,
                                                           imp.microseconds_per_packet / 1000,
                                                           imp.number_of_channels,
@@ -179,6 +180,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_sleep(switch_core_session_t *session,
                if (switch_core_codec_init(&codec,
                                                                   "L16",
                                                                   NULL,
+                                                                  NULL,
                                                                   imp.actual_samples_per_second,
                                                                   imp.microseconds_per_packet / 1000,
                                                                   imp.number_of_channels,
@@ -436,6 +438,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_activate_unicast(switch_core_session_
                if (switch_core_codec_init(&conninfo->read_codec,
                                                                   "L16",
                                                                   NULL,
+                                                                  NULL,
                                                                   read_codec->implementation->actual_samples_per_second,
                                                                   read_codec->implementation->microseconds_per_packet / 1000,
                                                                   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
@@ -953,6 +956,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_park(switch_core_session_t *session,
                                if (switch_core_codec_init(&codec,
                                                                   "L16",
                                                                   NULL,
+                                                                  NULL,
                                                                   imp.actual_samples_per_second,
                                                                   imp.microseconds_per_packet / 1000,
                                                                   imp.number_of_channels,
@@ -1297,6 +1301,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_collect_digits_count(switch_core_sess
                if (switch_core_codec_init(&codec,
                                                                   "L16",
                                                                   NULL,
+                                                                  NULL,
                                                                   imp.samples_per_second,
                                                                   imp.microseconds_per_packet / 1000,
                                                                   imp.number_of_channels,
index cb38710d314850aa7eb3d4726cf21631924fbce6..76a9be6dd81aaef98713ff0dd9ce77b60f0a2682 100644 (file)
@@ -1843,6 +1843,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_eavesdrop_session(switch_core_session
                if (switch_core_codec_init(&codec,
                                                                   "L16",
                                                                   NULL,
+                                                                  NULL,
                                                                   tread_impl.actual_samples_per_second,
                                                                   tread_impl.microseconds_per_packet / 1000,
                                                                   tread_impl.number_of_channels,
index f4089a195a84539bde9a00ab936f57f9a5b0bedc..22bf827f269b0176beb938106351f4bfe1646361 100644 (file)
@@ -312,6 +312,7 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
                        if (switch_core_codec_init(&silence_codec,
                                                                           "L16",
                                                                           NULL,
+                                                                          NULL,
                                                                           read_impl.actual_samples_per_second,
                                                                           read_impl.microseconds_per_packet / 1000,
                                                                           1,
index 9e25ba0aef304e3bb13af7d1d82585932a7a8fd1..cacab48fc1846309f792dd6436ef9ef77b0c04d3 100644 (file)
@@ -922,6 +922,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
                        if (switch_core_codec_init(&write_codec,
                                                                           "L16",
                                                                           NULL,
+                                                                          NULL,
                                                                           read_codec->implementation->actual_samples_per_second,
                                                                           read_codec->implementation->microseconds_per_packet / 1000,
                                                                           1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
@@ -1240,6 +1241,7 @@ static switch_status_t setup_ringback(originate_global_t *oglobals, originate_st
                        if (switch_core_codec_init(write_codec,
                                                                           "L16",
                                                                           NULL,
+                                                                          NULL,
                                                                           peer_read_impl.actual_samples_per_second,
                                                                           peer_read_impl.microseconds_per_packet / 1000,
                                                                           1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
@@ -1776,6 +1778,7 @@ static void *SWITCH_THREAD_FUNC early_thread_run(switch_thread_t *thread, void *
                                                if (switch_core_codec_init(&read_codecs[i],
                                                                                                   "L16",
                                                                                                   NULL,
+                                                                                                  NULL,
                                                                                                   read_impl.actual_samples_per_second,
                                                                                                   read_impl.microseconds_per_packet / 1000,
                                                                                                   1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
index 8ca3769a797909662a8897217018f61c40bdf2a2..a691583a003a7a77cb83248b1fce53e3e1c11f73 100644 (file)
@@ -453,6 +453,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                if (switch_core_codec_init(&write_codec,
                                                                   "L16",
                                                                   NULL,
+                                                                  NULL,
                                                                   read_impl.actual_samples_per_second,
                                                                   read_impl.microseconds_per_packet / 1000,
                                                                   read_impl.number_of_channels,
@@ -600,6 +601,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_record_file(switch_core_session_t *se
                if (switch_core_codec_init(&codec,
                                                                   codec_name,
                                                                   NULL,
+                                                                  NULL,
                                                                   read_impl.actual_samples_per_second,
                                                                   read_impl.microseconds_per_packet / 1000,
                                                                   read_impl.number_of_channels,
@@ -873,6 +875,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_gentones(switch_core_session_t *sessi
        if (switch_core_codec_init(&write_codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           read_impl.actual_samples_per_second,
                                                           read_impl.microseconds_per_packet / 1000,
                                                           1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
@@ -1336,6 +1339,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                        if (switch_core_codec_init(&codec,
                                                                           codec_name,
                                                                           NULL,
+                                                                          NULL,
                                                                           fh->samplerate,
                                                                           interval, read_impl.number_of_channels, 
                                                                           SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL, pool) == SWITCH_STATUS_SUCCESS) {
@@ -1896,6 +1900,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_silence(switch_core_session_
        if (switch_core_codec_init(&raw_codec,
                                                           "L16",
                                                           NULL,
+                                                          NULL,
                                                           read_impl.actual_samples_per_second,
                                                           read_impl.microseconds_per_packet / 1000,
                                                           1, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE,
@@ -2605,6 +2610,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_speak_text(switch_core_session_t *ses
        if (need_create) {
                if (switch_core_codec_init(codec,
                                                                   codec_name,
+                                                                  NULL,
                                                                   NULL, (int) rate, interval, channels, SWITCH_CODEC_FLAG_ENCODE | SWITCH_CODEC_FLAG_DECODE, NULL,
                                                                   pool) == SWITCH_STATUS_SUCCESS) {
                        switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Raw Codec Activated\n");
index de9a42d81b65853f71dda3d895e913494f5e0808..193eb8fce0448fe4f1e12e15b5b83902d780ef7e 100644 (file)
@@ -46,6 +46,12 @@ typedef struct switch_file_node_s {
        const char *interface_name;
        struct switch_file_node_s *next;
 } switch_file_node_t;
+
+typedef struct switch_codec_node_s {
+       const switch_codec_interface_t *ptr;
+       const char *interface_name;
+       struct switch_codec_node_s *next;
+} switch_codec_node_t;
                                
 
 struct switch_loadable_module {
@@ -176,6 +182,8 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Failed to load codec interface from %s due to no interface name.\n", key);
                        } else {
                                unsigned load_interface = 1;
+                               switch_codec_node_t *node, *head;
+
                                for (impl = ptr->implementations; impl; impl = impl->next) {
                                        if (!impl->iananame) {
                                                load_interface = 0;
@@ -207,15 +215,23 @@ static switch_status_t switch_loadable_module_process(char *key, switch_loadable
                                                                                          impl->iananame, impl->ianacode,
                                                                                          ptr->interface_name, impl->actual_samples_per_second, impl->microseconds_per_packet / 1000);
                                                }
-                                               if (!switch_core_hash_find(loadable_modules.codec_hash, impl->iananame)) {
-                                                       switch_core_hash_insert(loadable_modules.codec_hash, impl->iananame, (const void *) ptr);
+
+                                               node = switch_core_alloc(new_module->pool, sizeof(*node));
+                                               node->ptr = ptr;
+                                               node->interface_name = switch_core_strdup(new_module->pool, new_module->module_interface->module_name);
+                                               if ((head = switch_core_hash_find(loadable_modules.codec_hash, impl->iananame))) {
+                                                       node->next = head;
                                                }
+
+                                               switch_core_hash_insert(loadable_modules.codec_hash, impl->iananame, (const void *) node);
                                        }
+
                                        if (switch_event_create(&event, SWITCH_EVENT_MODULE_LOAD) == SWITCH_STATUS_SUCCESS) {
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "codec");
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "key", new_module->key);
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "filename", new_module->filename);
+                                               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "module", new_module->module_interface->module_name);
                                                switch_event_fire(&event);
                                                added++;
                                        }
@@ -946,6 +962,7 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t
        if (old_module->module_interface->codec_interface) {
                const switch_codec_implementation_t *impl;
                const switch_codec_interface_t *ptr;
+               switch_codec_node_t *node, *head, *last = NULL;
 
                for (ptr = old_module->module_interface->codec_interface; ptr; ptr = ptr->next) {
                        if (ptr->interface_name) {
@@ -964,13 +981,31 @@ static switch_status_t switch_loadable_module_unprocess(switch_loadable_module_t
                                                                                  ptr->interface_name, impl->actual_samples_per_second, impl->microseconds_per_packet / 1000);
                                                switch_core_session_hupall_matching_var("read_codec", impl->iananame, SWITCH_CAUSE_MANAGER_REQUEST);
                                                switch_core_session_hupall_matching_var("write_codec", impl->iananame, SWITCH_CAUSE_MANAGER_REQUEST);
-                                               if (switch_core_hash_find(loadable_modules.codec_hash, impl->iananame)) {
-                                                       switch_core_hash_delete(loadable_modules.codec_hash, impl->iananame);
+
+                                               if ((head = switch_core_hash_find(loadable_modules.codec_hash, impl->iananame))) {
+                                                       for(node = head; node; node = node->next) {
+                                                               if (!strcmp(node->interface_name, old_module->module_interface->module_name)) {
+                                                                       if (node == head) {
+                                                                               if ((node = node->next)) {
+                                                                                       switch_core_hash_insert(loadable_modules.codec_hash, impl->iananame, (const void *) node);
+                                                                               } else {
+                                                                                       switch_core_hash_delete(loadable_modules.codec_hash, impl->iananame);
+                                                                               }
+                                                                       } else {
+                                                                               if (last) {
+                                                                                       last->next = node->next;
+                                                                               }
+                                                                       }
+                                                                       break;
+                                                               }
+                                                               last = node;
+                                                       }
                                                }
                                        }
                                        if (switch_event_create(&event, SWITCH_EVENT_MODULE_UNLOAD) == SWITCH_STATUS_SUCCESS) {
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "type", "codec");
                                                switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "name", ptr->interface_name);
+                                               switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "module", old_module->module_interface->module_name);
                                                switch_event_fire(&event);
                                                removed++;
                                        }
@@ -2106,24 +2141,26 @@ SWITCH_DECLARE(switch_file_interface_t *) switch_loadable_module_get_file_interf
        return i;
 }
 
-SWITCH_DECLARE(switch_codec_interface_t *) switch_loadable_module_get_codec_interface(const char *name)
+SWITCH_DECLARE(switch_codec_interface_t *) switch_loadable_module_get_codec_interface(const char *name, const char *modname)
 {
-       char altname[256] = "";
-       switch_codec_interface_t *codec;
-       switch_size_t x;
+       switch_codec_interface_t *codec = NULL;
+       switch_codec_node_t *node, *head;
 
        switch_mutex_lock(loadable_modules.mutex);
-       if (!(codec = switch_core_hash_find(loadable_modules.codec_hash, name))) {
-               for (x = 0; x < strlen(name); x++) {
-                       altname[x] = (char) toupper((int) name[x]);
-               }
-               if (!(codec = switch_core_hash_find(loadable_modules.codec_hash, altname))) {
-                       for (x = 0; x < strlen(name); x++) {
-                               altname[x] = (char) tolower((int) name[x]);
+       
+       if ((head = switch_core_hash_find(loadable_modules.codec_hash, name))) {
+               if (modname) {
+                       for (node = head; node; node = node->next) {
+                               if (!strcasecmp(node->interface_name, modname)) {
+                                       codec = (switch_codec_interface_t *) node->ptr;
+                                       break;
+                               }
                        }
-                       codec = switch_core_hash_find(loadable_modules.codec_hash, altname);
+               } else {
+                       codec = (switch_codec_interface_t *) head->ptr;
                }
        }
+
        switch_mutex_unlock(loadable_modules.mutex);
 
        if (codec) {
@@ -2259,29 +2296,35 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme
        switch_codec_interface_t *codec_interface;
        int i = 0;
        const switch_codec_implementation_t *imp;
+       switch_codec_node_t *node, *head;
 
        switch_mutex_lock(loadable_modules.mutex);
        for (hi = switch_core_hash_first(loadable_modules.codec_hash); hi; hi = switch_core_hash_next(&hi)) {
                switch_core_hash_this(hi, NULL, NULL, &val);
-               codec_interface = (switch_codec_interface_t *) val;
+               head = (switch_codec_node_t *) val;
                
-               /* Look for the default ptime of the codec because it's the safest choice */
-               for (imp = codec_interface->implementations; imp; imp = imp->next) {
-                       uint32_t default_ptime = switch_default_ptime(imp->iananame, imp->ianacode);
+               for (node = head; node; node = node->next) {
+                       codec_interface = (switch_codec_interface_t *) node->ptr;
 
-                       if (imp->microseconds_per_packet / 1000 == (int)default_ptime) {
-                               array[i++] = imp;
-                               goto found;
+                       /* Look for the default ptime of the codec because it's the safest choice */
+                       for (imp = codec_interface->implementations; imp; imp = imp->next) {
+                               uint32_t default_ptime = switch_default_ptime(imp->iananame, imp->ianacode);
+                               
+                               if (imp->microseconds_per_packet / 1000 == (int)default_ptime) {
+                                       array[i++] = imp;
+                                       goto found;
+                               }
                        }
+                       /* oh well we will use what we have */
+                       array[i++] = codec_interface->implementations;
                }
-               /* oh well we will use what we have */
-               array[i++] = codec_interface->implementations;
-
-         found:
 
+       found:
+                       
                if (i > arraylen) {
                        break;
                }
+               
        }
        switch_safe_free(hi);
 
@@ -2293,7 +2336,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs(const switch_codec_impleme
 
 }
 
-SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit, uint32_t *channels)
+SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uint32_t *rate, uint32_t *bit, uint32_t *channels, char **modname)
 {
        char *cur, *next = NULL, *name, *p;
 
@@ -2327,6 +2370,12 @@ SWITCH_DECLARE(char *) switch_parse_codec_buf(char *buf, uint32_t *interval, uin
                cur = next;
        }
        
+       if ((p = strchr(name, '.'))) {
+               *p++ = '\0';
+               *modname = name;
+               name = p;
+       }
+
        return name;
 }
 
@@ -2339,14 +2388,14 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
        switch_mutex_lock(loadable_modules.mutex);
 
        for (x = 0; x < preflen; x++) {
-               char *name, buf[256], jbuf[256];
+               char *name, buf[256], jbuf[256], *modname = NULL;
                uint32_t interval = 0, rate = 0, bit = 0, channels = 1;
 
                switch_copy_string(buf, prefs[x], sizeof(buf));
-               name = switch_parse_codec_buf(buf, &interval, &rate, &bit, &channels);
+               name = switch_parse_codec_buf(buf, &interval, &rate, &bit, &channels, &modname);
 
                for(j = 0; j < x; j++) {
-                       char *jname;
+                       char *jname, *jmodname = NULL;
                        uint32_t jinterval = 0, jrate = 0, jbit = 0, jchannels = 1;
                        uint32_t ointerval = interval, orate = rate, ochannels = channels;
 
@@ -2363,7 +2412,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
                        }
                        
                        switch_copy_string(jbuf, prefs[j], sizeof(jbuf));
-                       jname = switch_parse_codec_buf(jbuf, &jinterval, &jrate, &jbit, &jchannels);
+                       jname = switch_parse_codec_buf(jbuf, &jinterval, &jrate, &jbit, &jchannels, &jmodname);
 
                        if (jinterval == 0) {
                                jinterval = switch_default_ptime(jname, 0);
@@ -2382,7 +2431,7 @@ SWITCH_DECLARE(int) switch_loadable_module_get_codecs_sorted(const switch_codec_
                        }
                }
 
-               if ((codec_interface = switch_loadable_module_get_codec_interface(name)) != 0) {
+               if ((codec_interface = switch_loadable_module_get_codec_interface(name, modname)) != 0) {
                        /* If no specific codec interval is requested opt for the default above all else because lots of stuff assumes it */
                        for (imp = codec_interface->implementations; imp; imp = imp->next) {
                                uint32_t default_ptime = switch_default_ptime(imp->iananame, imp->ianacode);
index 60ad95a7ef76cf1dfeab7fcc149e9e5f7428f0c9..4ccc41cf5d1d81141c83c5d56fed7367278c412f 100644 (file)
@@ -7107,6 +7107,7 @@ SWITCH_DECLARE(switch_status_t) switch_rtp_enable_vad(switch_rtp_t *rtp_session,
 
        if (switch_core_codec_init(&rtp_session->vad_data.vad_codec,
                                                           codec->implementation->iananame,
+                                                          codec->implementation->modname,
                                                           NULL,
                                                           codec->implementation->samples_per_second,
                                                           codec->implementation->microseconds_per_packet / 1000,