]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
[Core] Fix use of private headers.
authorAndrey Volk <andywolk@gmail.com>
Fri, 5 Nov 2021 20:59:57 +0000 (23:59 +0300)
committerAndrey Volk <andywolk@gmail.com>
Wed, 10 Nov 2021 18:46:29 +0000 (21:46 +0300)
19 files changed:
Makefile.am
build/modmake.rules.in
libs/.gitignore
src/include/private/switch_apr_pvt.h [new file with mode: 0644]
src/include/private/switch_core_pvt.h
src/include/switch.h
src/include/switch_spandsp.h [new file with mode: 0644]
src/include/switch_types.h
src/switch.c
src/switch_core.c
src/switch_core_io.c
src/switch_core_media.c
src/switch_core_memory.c
src/switch_core_session.c
src/switch_spandsp.c [new file with mode: 0644]
src/switch_time.c
src/switch_utils.c
tests/unit/.gitignore
w32/Library/FreeSwitchCore.2017.vcxproj

index 3bf9cbd0484a116b6ab1349278afd618fb87b35c..739bd29ecb07df28597cf2b52577edbf150b2c7f 100644 (file)
@@ -310,6 +310,7 @@ library_include_HEADERS = \
        src/include/switch_jitterbuffer.h \
        src/include/switch_estimators.h \
        src/include/switch_rtcp_frame.h \
+       src/include/switch_spandsp.h \
        src/include/switch_stun.h \
        src/include/switch_nat.h \
        src/include/switch_log.h \
@@ -385,6 +386,7 @@ libfreeswitch_la_SOURCES = \
        src/switch_ivr_say.c \
        src/switch_ivr_menu.c \
        src/switch_ivr.c \
+       src/switch_spandsp.c \
        src/switch_stun.c \
        src/switch_nat.c \
        src/switch_log.c \
index dbce9bd48ecab7c9e90d58b676d947df529d5417..7f880b86f906fed1d2081b4272fa7055d359141d 100644 (file)
@@ -188,7 +188,7 @@ $(MODNAME).o: $(MODDIR)/$(SOURCEFILE) \
   $(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \
   $(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \
   $(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \
-  $(switch_srcdir)/src/include/switch_xml.h
+  $(switch_srcdir)/src/include/switch_xml.h $(switch_srcdir)/src/include/switch_spandsp.h
        @echo Compiling $<...
        if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
                if test ! -z $(VERBOSE) ; then echo $(COMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
@@ -211,7 +211,7 @@ $(MODNAME).lo: $(MODDIR)/$(SOURCEFILE) \
   $(switch_srcdir)/src/include/switch_event.h $(switch_srcdir)/src/include/switch_resample.h \
   $(switch_srcdir)/src/include/switch_ivr.h $(switch_srcdir)/src/include/switch_rtp.h \
   $(switch_srcdir)/src/include/switch_stun.h $(switch_srcdir)/src/include/switch_log.h \
-  $(switch_srcdir)/src/include/switch_xml.h
+  $(switch_srcdir)/src/include/switch_xml.h $(switch_srcdir)/src/include/switch_spandsp.h
        @echo Compiling $<...
        if test -f "$(CSOURCEFILE)" -o -f "$(MODDIR)/$(CSOURCEFILE)"; then \
                if test ! -z $(VERBOSE) ; then echo $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(MODDIR)/'`$< ; fi ;\
@@ -261,6 +261,8 @@ $(switch_srcdir)/src/include/switch_ivr.h:
 
 $(switch_srcdir)/src/include/switch_rtp.h:
 
+$(switch_srcdir)/src/include/switch_spandsp.h:
+
 $(switch_srcdir)/src/include/switch_stun.h:
 
 $(switch_srcdir)/src/include/switch_log.h:
index 5a83438d9215da4f13658c2a1fe3379676a4b865..355bae9a6d110c2cb0df55717ba76d99bf659184 100644 (file)
@@ -793,4 +793,5 @@ mariadb-connector-c-*/
 mariadb-connector-c-*
 /spandsp*/
 /spandsp*
-win32/spandsp/spandsp.h
\ No newline at end of file
+win32/spandsp/spandsp.h
+win32/spandsp/win32
\ No newline at end of file
diff --git a/src/include/private/switch_apr_pvt.h b/src/include/private/switch_apr_pvt.h
new file mode 100644 (file)
index 0000000..ae4dc9c
--- /dev/null
@@ -0,0 +1,66 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2021, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Andrey Volk <andywolk@gmail.com>
+ *
+ *
+ * switch_apr_pvt.h - APR
+ *
+ */
+
+#ifndef __SWITCH_APR_PVT_H__
+#define __SWITCH_APR_PVT_H__
+
+/* for apr_pool_create and apr_pool_destroy */
+/* functions only used in this file so not exposed */
+#include <apr_pools.h>
+
+/* for apr_hash_make, apr_hash_pool_get, apr_hash_set */
+/* functions only used in this file so not exposed */
+#include <apr_hash.h>
+
+/* for apr_pvsprintf */
+/* function only used in this file so not exposed */
+#include <apr_strings.h>
+
+/* for apr_initialize and apr_terminate */
+/* function only used in this file so not exposed */
+#include <apr_general.h>
+
+#include <apr_portable.h>
+
+#endif // __SWITCH_APR_PVT_H__
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
+ */
index aece2e7e173e6e55b27355b68387e2d3fd8d25f3..af6a4f53bdefdb64b69e55cfe131c88552947cea 100644 (file)
  * this file does not exist!!!!
  *
  */
-#define SPANDSP_NO_TIFF 1
-#include "spandsp.h"
 #include "switch_profile.h"
 
 #ifndef WIN32
 #include <switch_private.h>
 #endif
 
-/* for apr_pool_create and apr_pool_destroy */
-/* functions only used in this file so not exposed */
-#include <apr_pools.h>
-
-/* for apr_hash_make, apr_hash_pool_get, apr_hash_set */
-/* functions only used in this file so not exposed */
-#include <apr_hash.h>
-
-/* for apr_pvsprintf */
-/* function only used in this file so not exposed */
-#include <apr_strings.h>
-
-/* for apr_initialize and apr_terminate */
-/* function only used in this file so not exposed */
-#include <apr_general.h>
-
-#include <apr_portable.h>
-
 #ifdef HAVE_MLOCKALL
 #include <sys/mman.h>
 #endif
@@ -175,7 +155,7 @@ struct switch_core_session {
        switch_log_level_t loglevel;
        uint32_t soft_lock;
        switch_ivr_dmachine_t *dmachine[2];
-       plc_state_t *plc;
+       switch_plc_state_t *plc;
 
        switch_media_handle_t *media_handle;
        uint32_t decoder_errors;
index 461914c93b739d70e8d17d21a1616f1f4a450a18..b7bae46c0edcb46cffcfc72cc0ceb2f94e766bc5 100644 (file)
 #include "switch_platform.h"
 #include "switch_types.h"
 #include "switch_apr.h"
+#include "switch_spandsp.h"
 #include "switch_mprintf.h"
 #include "switch_core_db.h"
 #include "switch_dso.h"
diff --git a/src/include/switch_spandsp.h b/src/include/switch_spandsp.h
new file mode 100644 (file)
index 0000000..1818a00
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2014, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Anthony Minessale II <anthm@freeswitch.org>
+ * Andrey Volk <andrey@signalwire.com>
+ *
+ * switch_spandsp.h -- SpanDSP includes header
+ *
+ */
+#ifndef SWITCH_SPANDSP_H
+#define SWITCH_SPANDSP_H
+
+SWITCH_BEGIN_EXTERN_C
+
+SWITCH_DECLARE(switch_plc_state_t *) switch_plc_init(switch_plc_state_t *s);
+SWITCH_DECLARE(int) switch_plc_free(switch_plc_state_t *s);
+SWITCH_DECLARE(int) switch_plc_rx(switch_plc_state_t *s, int16_t amp[], int len);
+SWITCH_DECLARE(int) switch_plc_fillin(switch_plc_state_t *s, int16_t amp[], int len);
+
+SWITCH_END_EXTERN_C
+#endif
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
+ */
index bb06cfa0ea1f3acf89b3890bb9a28f49517b160b..b8405511d8314fa45588252ea4ee098af851c718 100644 (file)
@@ -2324,6 +2324,7 @@ typedef int switch_os_socket_t;
 #endif
 
 typedef struct apr_pool_t switch_memory_pool_t;
+typedef void* switch_plc_state_t;
 typedef uint16_t switch_port_t;
 typedef uint8_t switch_payload_t;
 typedef struct switch_app_log switch_app_log_t;
index d10994c4c25b0769ff593b7cc2599462cdc4aa94..2f5274099e7c52def203df1fe0267f4f4e5d1a75 100644 (file)
@@ -49,6 +49,7 @@
 #endif
 
 #include <switch.h>
+#include "private/switch_apr_pvt.h"
 #include "private/switch_core_pvt.h"
 
 /* pid filename: Stores the process id of the freeswitch process */
index 50ce348c95c1e2e3935efc01eefdbc8dbf02f225..4953964a3884f94eb2908695996a45c3c5644635 100644 (file)
@@ -41,6 +41,7 @@
 #include <switch_ssl.h>
 #include <switch_stun.h>
 #include <switch_nat.h>
+#include "private/switch_apr_pvt.h"
 #include "private/switch_core_pvt.h"
 #include <switch_curl.h>
 #include <switch_msrp.h>
index 13054b5b089c0a25df8b76a0dd93ed4566949854..9931f0f3ef7eae22240d9bd695bf88d2c642e7eb 100644 (file)
@@ -422,7 +422,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
 
                        if (is_cng) {
                                if (session->plc) {
-                                       plc_fillin(session->plc, session->raw_read_frame.data, read_frame->codec->implementation->decoded_bytes_per_packet / 2);
+                                       switch_plc_fillin(session->plc, session->raw_read_frame.data, read_frame->codec->implementation->decoded_bytes_per_packet / 2);
                                        is_cng = 0;
                                        flag &= ~SFF_CNG;
                                } else {
@@ -470,7 +470,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                if (!switch_test_flag(read_frame->codec, SWITCH_CODEC_FLAG_HAS_PLC) &&
                                        (switch_channel_test_flag(session->channel, CF_JITTERBUFFER_PLC) ||
                                         switch_channel_test_flag(session->channel, CF_CNG_PLC)) && !session->plc) {
-                                       session->plc = plc_init(NULL);
+                                       session->plc = switch_plc_init(NULL);
                                }
 
                                if (!switch_test_flag(read_frame->codec, SWITCH_CODEC_FLAG_HAS_PLC) && session->plc && switch_test_flag(read_frame, SFF_PLC)) {
@@ -519,10 +519,10 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_frame(switch_core_sessi
                                if (status == SWITCH_STATUS_SUCCESS && session->read_impl.number_of_channels == 1) {
                                        if (session->plc) {
                                                if (switch_test_flag(read_frame, SFF_PLC)) {
-                                                       plc_fillin(session->plc, session->raw_read_frame.data, session->raw_read_frame.datalen / 2);
+                                                       switch_plc_fillin(session->plc, session->raw_read_frame.data, session->raw_read_frame.datalen / 2);
                                                        switch_clear_flag(read_frame, SFF_PLC);
                                                } else {
-                                                       plc_rx(session->plc, session->raw_read_frame.data, session->raw_read_frame.datalen / 2);
+                                                       switch_plc_rx(session->plc, session->raw_read_frame.data, session->raw_read_frame.datalen / 2);
                                                }
                                        }
                                }
index 087a15157078a73bc65f13d6d813f8a77683e8be..0b337082b831fe50ef59be08cf8c3787dc7b6f64 100644 (file)
@@ -40,6 +40,8 @@
 #include <sofia-sip/sdp.h>
 #include <sofia-sip/su.h>
 
+#include <stdbool.h>
+
 static switch_t38_options_t * switch_core_media_process_udptl(switch_core_session_t *session, sdp_session_t *sdp, sdp_media_t *m);
 static void switch_core_media_find_zrtp_hash(switch_core_session_t *session, sdp_session_t *sdp);
 static void switch_core_media_set_r_sdp_codec_string(switch_core_session_t *session, const char *codec_string, sdp_session_t *sdp, switch_sdp_type_t sdp_type);
index 3685956257bb4a1d180953e7f54a86dd79204291..f005a9245eda5026262dec5cb585518c70f73380 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 #include <switch.h>
+#include "private/switch_apr_pvt.h"
 #include "private/switch_core_pvt.h"
 
 //#define DEBUG_ALLOC
index 147900e784f239e544d9f973d389ca0f7a455f84..32139ac98a4f556007c159a53e62d4594b4dbae8 100644 (file)
@@ -1585,7 +1585,7 @@ SWITCH_DECLARE(void) switch_core_session_perform_destroy(switch_core_session_t *
        switch_mutex_unlock(runtime.session_hash_mutex);
 
        if ((*session)->plc) {
-               plc_free((*session)->plc);
+               switch_plc_free((*session)->plc);
                (*session)->plc = NULL;
        }
 
diff --git a/src/switch_spandsp.c b/src/switch_spandsp.c
new file mode 100644 (file)
index 0000000..397717d
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ * Copyright (C) 2005-2015, Anthony Minessale II <anthm@freeswitch.org>
+ *
+ * Version: MPL 1.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/F
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
+ *
+ * The Initial Developer of the Original Code is
+ * Michael Jerris <mike@jerris.com>
+ * Portions created by the Initial Developer are Copyright (C)
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *
+ * Michael Jerris <mike@jerris.com>
+ * Andrey Volk <andrey@signalwrie.com>
+ *
+ * switch_spandsp.c -- spandsp wrappers and extensions
+ *
+ */
+
+#include <switch.h>
+
+#define SPANDSP_NO_TIFF 1
+#include "spandsp.h"
+
+SWITCH_DECLARE(switch_plc_state_t *) switch_plc_init(switch_plc_state_t *s) {
+       return (switch_plc_state_t *)plc_init((plc_state_t *)s);
+}
+
+SWITCH_DECLARE(int) switch_plc_free(switch_plc_state_t *s) {
+       return plc_free((plc_state_t *)s);
+}
+
+SWITCH_DECLARE(int) switch_plc_fillin(switch_plc_state_t *s, int16_t amp[], int len) {
+       return plc_fillin((plc_state_t *)s, amp, len);
+}
+
+SWITCH_DECLARE(int) switch_plc_rx(switch_plc_state_t* s, int16_t amp[], int len)
+{
+       return plc_rx((plc_state_t*)s, amp, len);
+}
+
+
+/* For Emacs:
+ * Local Variables:
+ * mode:c
+ * indent-tabs-mode:t
+ * tab-width:4
+ * c-basic-offset:4
+ * End:
+ * For VIM:
+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4 noet:
+ */
index fc94b48ee4f1a0e28214e171bc01acc02f68b5ca..182d9ad6bdf6d1e0e332f199e794f035e5e09e97 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <switch.h>
 #include <stdio.h>
+#include "private/switch_apr_pvt.h"
 #include "private/switch_core_pvt.h"
 
 #ifdef HAVE_TIMERFD_CREATE
index 107d1a86436ed1a15e489f44f4de4bd0b43f156b..d869ddfda4a3f3b63001779ac4e0316ea6508f26 100644 (file)
@@ -33,6 +33,7 @@
  */
 
 #include <switch.h>
+#include "private/switch_apr_pvt.h"
 #ifndef WIN32
 #include <arpa/inet.h>
 #if defined(HAVE_SYS_TIME_H) && defined(HAVE_SYS_RESOURCE_H)
index 4c7b7466c41ebd981b189c5d42b33a0cd9f595ae..470c5ded12a76ba3f0a9ac99fcaf4c3231500673 100644 (file)
@@ -48,3 +48,6 @@ Makefile
 conf/*/
 conf_playsay/*/
 conf_async/*/
+x64
+win32
+*.vcxproj.user
\ No newline at end of file
index 9d7098ee5e0b31c2e7f558e1076e7f0efd5213d9..68450d79dde1cf6fe2494794a7aaceca78ad4983 100644 (file)
@@ -407,6 +407,7 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\"
     <ClCompile Include="..\..\src\switch_rtp.c" />\r
     <ClCompile Include="..\..\src\switch_scheduler.c" />\r
     <ClCompile Include="..\..\src\switch_sdp.c" />\r
+    <ClCompile Include="..\..\src\switch_spandsp.c" />\r
     <ClCompile Include="..\..\src\switch_stun.c" />\r
     <ClCompile Include="..\..\src\switch_time.c" />\r
     <ClCompile Include="..\..\src\switch_utils.c" />\r
@@ -742,6 +743,7 @@ if not exist "$(OutDir)fonts" xcopy "$(SolutionDir)fonts\*.*" "$(OutDir)fonts\"
     <ClInclude Include="..\..\src\include\switch_resample.h" />\r
     <ClInclude Include="..\..\src\include\switch_rtp.h" />\r
     <ClInclude Include="..\..\src\include\switch_scheduler.h" />\r
+    <ClInclude Include="..\..\src\include\switch_spandsp.h" />\r
     <ClInclude Include="..\..\src\include\switch_stun.h" />\r
     <ClInclude Include="..\..\src\include\switch_types.h" />\r
     <ClInclude Include="..\..\src\include\switch_utils.h" />\r