From 6e1214ca493267e238ffd3bc318e36b9bd293255 Mon Sep 17 00:00:00 2001 From: Ghislain MARY Date: Thu, 16 Mar 2017 11:11:42 +0100 Subject: [PATCH] The plugin part is no longer a plugin and is now integrated in mediastreamer2. --- Bcg729Config.cmake => Bcg729Config.cmake.in | 2 + CMakeLists.txt | 83 +++----- Makefile.am | 6 +- README.md | 7 +- bcg729.spec.in | 6 +- build/wp8/bcg729/bcg729.sln | 99 --------- build/wp8/bcg729/bcg729.vcxproj | 140 ------------- config.h.cmake | 2 + configure.ac | 28 --- include/CMakeLists.txt | 37 ++++ include/bcg729/Makefile.am | 5 +- include/bcg729/decoder.h | 14 +- include/bcg729/encoder.h | 12 +- msbcg729/Android.mk | 17 -- msbcg729/CMakeLists.txt | 58 ------ msbcg729/Makefile.am | 15 -- msbcg729/bcg729_dec.c | 149 -------------- msbcg729/bcg729_enc.c | 216 -------------------- src/CMakeLists.txt | 60 +++--- test/CMakeLists.txt | 7 +- 20 files changed, 130 insertions(+), 833 deletions(-) rename Bcg729Config.cmake => Bcg729Config.cmake.in (93%) delete mode 100644 build/wp8/bcg729/bcg729.sln delete mode 100644 build/wp8/bcg729/bcg729.vcxproj create mode 100644 include/CMakeLists.txt delete mode 100644 msbcg729/Android.mk delete mode 100644 msbcg729/CMakeLists.txt delete mode 100644 msbcg729/Makefile.am delete mode 100644 msbcg729/bcg729_dec.c delete mode 100644 msbcg729/bcg729_enc.c diff --git a/Bcg729Config.cmake b/Bcg729Config.cmake.in similarity index 93% rename from Bcg729Config.cmake rename to Bcg729Config.cmake.in index 16738f2..a0b11be 100644 --- a/Bcg729Config.cmake +++ b/Bcg729Config.cmake.in @@ -26,10 +26,12 @@ # BCG729_FOUND - system has bcg729 # BCG729_INCLUDE_DIRS - the bcg729 include directory # BCG729_LIBRARIES - The libraries needed to use bcg729 +# BCG729_CPPFLAGS - The compilation flags needed to use bcg729 include("${CMAKE_CURRENT_LIST_DIR}/Bcg729Targets.cmake") get_filename_component(BCG729_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) set(BCG729_INCLUDE_DIRS "${BCG729_CMAKE_DIR}/../../../include") set(BCG729_LIBRARIES bcg729) +set(BCG729_CPPFLAGS @BCG729_CPPFLAGS@) set(BCG729_FOUND 1) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4644fe0..7de578b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,28 +37,9 @@ set(VERSION "${PACKAGE_VERSION}") option(ENABLE_SHARED "Build shared library." YES) option(ENABLE_STATIC "Build static library." YES) option(ENABLE_TESTS "Enable compilation of the tests." NO) -option(ENABLE_MSPLUGIN "Enable compilation of the mediastreamer2 plugin." YES) include(GNUInstallDirs) -if(ENABLE_MSPLUGIN) - if(LINPHONE_BUILDER_GROUP_EXTERNAL_SOURCE_PATH_BUILDERS) - include("${EP_ms2_CONFIG_DIR}/Mediastreamer2Config.cmake") - include("${EP_ortp_CONFIG_DIR}/ORTPConfig.cmake") - else() - find_package(Mediastreamer2) - find_package(ORTP) - endif() - - if(NOT MEDIASTREAMER2_FOUND) - message(WARNING "Could not find the mediastreamer2 libraries!") - set(ENABLE_MSPLUGIN OFF CACHE BOOL "Enable compilation of the mediastreamer2 plugin." FORCE) - endif() -endif() - - -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) - include_directories( include @@ -71,6 +52,12 @@ if(MSVC) include_directories(${MSVC_INCLUDE_DIR}) endif() +set(BCG729_CPPFLAGS ) +if(ENABLE_STATIC) + set(BCG729_STATIC 1) + list(APPEND BCG729_CPPFLAGS "-DBCG729_STATIC") +endif() + add_definitions(-DHAVE_CONFIG_H) if(MSVC) add_definitions("/W3") @@ -81,41 +68,39 @@ else() endif() endif() +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h) + +add_subdirectory(include) add_subdirectory(src) -if(ENABLE_MSPLUGIN) - add_subdirectory(msbcg729) -endif() -if(ENABLE_TESTS AND NOT ENABLE_MSPLUGIN) +if(ENABLE_TESTS) add_subdirectory(test) endif() -if (NOT ENABLE_MSPLUGIN) - include(CMakePackageConfigHelpers) - write_basic_package_version_file( - "${CMAKE_CURRENT_BINARY_DIR}/Bcg729ConfigVersion.cmake" - VERSION ${PACKAGE_VERSION} - COMPATIBILITY AnyNewerVersion - ) - export(EXPORT Bcg729Targets - FILE "${CMAKE_CURRENT_BINARY_DIR}/Bcg729Targets.cmake" - ) - configure_file(Bcg729Config.cmake - "${CMAKE_CURRENT_BINARY_DIR}/Bcg729Config.cmake" - COPYONLY - ) - - set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/Bcg729/cmake") - install(EXPORT Bcg729Targets - FILE Bcg729Targets.cmake - DESTINATION ${CONFIG_PACKAGE_LOCATION} - ) - install(FILES - "${CMAKE_CURRENT_BINARY_DIR}/Bcg729Config.cmake" - "${CMAKE_CURRENT_BINARY_DIR}/Bcg729ConfigVersion.cmake" - DESTINATION ${CONFIG_PACKAGE_LOCATION} - ) -endif() +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + "${CMAKE_CURRENT_BINARY_DIR}/Bcg729ConfigVersion.cmake" + VERSION ${PACKAGE_VERSION} + COMPATIBILITY AnyNewerVersion +) +export(EXPORT Bcg729Targets + FILE "${CMAKE_CURRENT_BINARY_DIR}/Bcg729Targets.cmake" +) +configure_file(Bcg729Config.cmake.in + "${CMAKE_CURRENT_BINARY_DIR}/Bcg729Config.cmake" + @ONLY +) + +set(CONFIG_PACKAGE_LOCATION "${CMAKE_INSTALL_DATADIR}/Bcg729/cmake") +install(EXPORT Bcg729Targets + FILE Bcg729Targets.cmake + DESTINATION ${CONFIG_PACKAGE_LOCATION} +) +install(FILES + "${CMAKE_CURRENT_BINARY_DIR}/Bcg729Config.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/Bcg729ConfigVersion.cmake" + DESTINATION ${CONFIG_PACKAGE_LOCATION} +) # CPack settings set(CPACK_PACKAGE_NAME "bcg729") diff --git a/Makefile.am b/Makefile.am index 84b77b9..24ad074 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,12 +1,8 @@ ACLOCAL_AMFLAGS = -I m4 -EXTRA_DIST = bcg729.spec Bcg729Config.cmake CMakeLists.txt config.h.cmake msbcg729/CMakeLists.txt src/CMakeLists.txt +EXTRA_DIST = bcg729.spec Bcg729Config.cmake CMakeLists.txt config.h.cmake src/CMakeLists.txt SUBDIRS = include src -if BUILD_MSBCG729 -SUBDIRS += msbcg729 -endif - if RUN_TESTS SUBDIRS += test endif diff --git a/README.md b/README.md index 8e32c25..7fcc306 100644 --- a/README.md +++ b/README.md @@ -23,8 +23,7 @@ Compilation ### Dependencies -If you want build bcg729 as Mediastreamer's plugin, you need to have *Mediastreamer[1]* installed on your system. -Otherwise, no dependency is requested. +No dependency is requested. ### Build procedure @@ -44,7 +43,6 @@ Building by Autotools way is deprecated. Use [CMake][cmake-website] to configure * `ENABLE_SHARED=NO` : do not build the shared library * `ENABLE_STATIC=NO` : do not build the static library * `ENABLE_TESTS=NO` : do not build non-regression tests -* `ENABLE_MSPLUGIN=NO` : do not build the Mediastreamer plugin version ### Note for packagers @@ -73,8 +71,5 @@ Tests suite --------------------------------------- -[1] Mediastreamer2: git://git.linphone.org/mediastreamer2.git *or* - - [bcg729-patern]: http://www.belledonne-communications.com/downloads/bcg729-patterns.zip [cmake-website]: https://cmake.org/ diff --git a/bcg729.spec.in b/bcg729.spec.in index ec42bb7..282ac4b 100644 --- a/bcg729.spec.in +++ b/bcg729.spec.in @@ -2,7 +2,7 @@ ## rpmbuild options -Summary: Bcg729 codec plugin for mediastreamer2 +Summary: Bcg729 codec implementation Name: bcg729 Version: 1.0 Release: 1 @@ -14,7 +14,7 @@ Source0: %{name}-%{version}.tar.gz Requires: bash >= 2.0 %description -BCG729 codec plugin for mediastreamer2. +BCG729 codec implementation. %package devel Summary: Development libraries for bcg729 @@ -22,7 +22,7 @@ Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel -BCG729 codec plugin for mediastreamer2. +BCG729 codec implementation. %prep %setup -q diff --git a/build/wp8/bcg729/bcg729.sln b/build/wp8/bcg729/bcg729.sln deleted file mode 100644 index 0439834..0000000 --- a/build/wp8/bcg729/bcg729.sln +++ /dev/null @@ -1,99 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Express 2012 for Windows Phone -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libmsbcg729", "bcg729.vcxproj", "{1DB09AFE-FC9B-472E-A746-0E33F8EF8883}" - ProjectSection(ProjectDependencies) = postProject - {027BAD0E-9179-48C1-9733-7AA7E2C2EC70} = {027BAD0E-9179-48C1-9733-7AA7E2C2EC70} - EndProjectSection -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mediastreamer2", "..\..\..\..\linphone\mediastreamer2\build\wp8\mediastreamer2\mediastreamer2.vcxproj", "{027BAD0E-9179-48C1-9733-7AA7E2C2EC70}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "oRTP", "..\..\..\..\linphone\oRTP\build\wp8\oRTP\oRTP.vcxproj", "{FFC7B532-0502-4D88-AC98-9E89071CBC97}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "srtp", "..\..\..\..\srtp\build\wp8\srtp\srtp.vcxproj", "{B4B96BC4-2B72-4964-98E4-7FD048A43363}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "speex", "..\..\..\..\speex\build\wp8\speex\speex.vcxproj", "{D5EC8C11-C1D9-47E3-BB82-A93C300FD902}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "speexdsp", "..\..\..\..\speex\build\wp8\speex\speexdsp.vcxproj", "{6BD78980-9C71-4341-8775-AD19E9EC7305}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gsm", "..\..\..\..\gsm\build\wp8\gsm\gsm.vcxproj", "{746EA080-5BA9-42C5-9E52-EA421C3F3AFD}" -EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "opus", "..\..\..\..\opus\build\wp8\opus\opus.vcxproj", "{D450EC75-DF02-48B0-A4FB-ACA79BD894AB}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|ARM = Debug|ARM - Debug|Win32 = Debug|Win32 - Release|ARM = Release|ARM - Release|Win32 = Release|Win32 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {1DB09AFE-FC9B-472E-A746-0E33F8EF8883}.Debug|ARM.ActiveCfg = Debug|ARM - {1DB09AFE-FC9B-472E-A746-0E33F8EF8883}.Debug|ARM.Build.0 = Debug|ARM - {1DB09AFE-FC9B-472E-A746-0E33F8EF8883}.Debug|Win32.ActiveCfg = Debug|Win32 - {1DB09AFE-FC9B-472E-A746-0E33F8EF8883}.Debug|Win32.Build.0 = Debug|Win32 - {1DB09AFE-FC9B-472E-A746-0E33F8EF8883}.Release|ARM.ActiveCfg = Release|ARM - {1DB09AFE-FC9B-472E-A746-0E33F8EF8883}.Release|ARM.Build.0 = Release|ARM - {1DB09AFE-FC9B-472E-A746-0E33F8EF8883}.Release|Win32.ActiveCfg = Release|Win32 - {1DB09AFE-FC9B-472E-A746-0E33F8EF8883}.Release|Win32.Build.0 = Release|Win32 - {027BAD0E-9179-48C1-9733-7AA7E2C2EC70}.Debug|ARM.ActiveCfg = Debug|ARM - {027BAD0E-9179-48C1-9733-7AA7E2C2EC70}.Debug|ARM.Build.0 = Debug|ARM - {027BAD0E-9179-48C1-9733-7AA7E2C2EC70}.Debug|Win32.ActiveCfg = Debug|Win32 - {027BAD0E-9179-48C1-9733-7AA7E2C2EC70}.Debug|Win32.Build.0 = Debug|Win32 - {027BAD0E-9179-48C1-9733-7AA7E2C2EC70}.Release|ARM.ActiveCfg = Release|ARM - {027BAD0E-9179-48C1-9733-7AA7E2C2EC70}.Release|ARM.Build.0 = Release|ARM - {027BAD0E-9179-48C1-9733-7AA7E2C2EC70}.Release|Win32.ActiveCfg = Release|Win32 - {027BAD0E-9179-48C1-9733-7AA7E2C2EC70}.Release|Win32.Build.0 = Release|Win32 - {FFC7B532-0502-4D88-AC98-9E89071CBC97}.Debug|ARM.ActiveCfg = Debug|ARM - {FFC7B532-0502-4D88-AC98-9E89071CBC97}.Debug|ARM.Build.0 = Debug|ARM - {FFC7B532-0502-4D88-AC98-9E89071CBC97}.Debug|Win32.ActiveCfg = Debug|Win32 - {FFC7B532-0502-4D88-AC98-9E89071CBC97}.Debug|Win32.Build.0 = Debug|Win32 - {FFC7B532-0502-4D88-AC98-9E89071CBC97}.Release|ARM.ActiveCfg = Release|ARM - {FFC7B532-0502-4D88-AC98-9E89071CBC97}.Release|ARM.Build.0 = Release|ARM - {FFC7B532-0502-4D88-AC98-9E89071CBC97}.Release|Win32.ActiveCfg = Release|Win32 - {FFC7B532-0502-4D88-AC98-9E89071CBC97}.Release|Win32.Build.0 = Release|Win32 - {B4B96BC4-2B72-4964-98E4-7FD048A43363}.Debug|ARM.ActiveCfg = Debug|ARM - {B4B96BC4-2B72-4964-98E4-7FD048A43363}.Debug|ARM.Build.0 = Debug|ARM - {B4B96BC4-2B72-4964-98E4-7FD048A43363}.Debug|Win32.ActiveCfg = Debug|Win32 - {B4B96BC4-2B72-4964-98E4-7FD048A43363}.Debug|Win32.Build.0 = Debug|Win32 - {B4B96BC4-2B72-4964-98E4-7FD048A43363}.Release|ARM.ActiveCfg = Release|ARM - {B4B96BC4-2B72-4964-98E4-7FD048A43363}.Release|ARM.Build.0 = Release|ARM - {B4B96BC4-2B72-4964-98E4-7FD048A43363}.Release|Win32.ActiveCfg = Release|Win32 - {B4B96BC4-2B72-4964-98E4-7FD048A43363}.Release|Win32.Build.0 = Release|Win32 - {D5EC8C11-C1D9-47E3-BB82-A93C300FD902}.Debug|ARM.ActiveCfg = Debug|ARM - {D5EC8C11-C1D9-47E3-BB82-A93C300FD902}.Debug|ARM.Build.0 = Debug|ARM - {D5EC8C11-C1D9-47E3-BB82-A93C300FD902}.Debug|Win32.ActiveCfg = Debug|Win32 - {D5EC8C11-C1D9-47E3-BB82-A93C300FD902}.Debug|Win32.Build.0 = Debug|Win32 - {D5EC8C11-C1D9-47E3-BB82-A93C300FD902}.Release|ARM.ActiveCfg = Release|ARM - {D5EC8C11-C1D9-47E3-BB82-A93C300FD902}.Release|ARM.Build.0 = Release|ARM - {D5EC8C11-C1D9-47E3-BB82-A93C300FD902}.Release|Win32.ActiveCfg = Release|Win32 - {D5EC8C11-C1D9-47E3-BB82-A93C300FD902}.Release|Win32.Build.0 = Release|Win32 - {6BD78980-9C71-4341-8775-AD19E9EC7305}.Debug|ARM.ActiveCfg = Debug|ARM - {6BD78980-9C71-4341-8775-AD19E9EC7305}.Debug|ARM.Build.0 = Debug|ARM - {6BD78980-9C71-4341-8775-AD19E9EC7305}.Debug|Win32.ActiveCfg = Debug|Win32 - {6BD78980-9C71-4341-8775-AD19E9EC7305}.Debug|Win32.Build.0 = Debug|Win32 - {6BD78980-9C71-4341-8775-AD19E9EC7305}.Release|ARM.ActiveCfg = Release|ARM - {6BD78980-9C71-4341-8775-AD19E9EC7305}.Release|ARM.Build.0 = Release|ARM - {6BD78980-9C71-4341-8775-AD19E9EC7305}.Release|Win32.ActiveCfg = Release|Win32 - {6BD78980-9C71-4341-8775-AD19E9EC7305}.Release|Win32.Build.0 = Release|Win32 - {746EA080-5BA9-42C5-9E52-EA421C3F3AFD}.Debug|ARM.ActiveCfg = Debug|ARM - {746EA080-5BA9-42C5-9E52-EA421C3F3AFD}.Debug|ARM.Build.0 = Debug|ARM - {746EA080-5BA9-42C5-9E52-EA421C3F3AFD}.Debug|Win32.ActiveCfg = Debug|Win32 - {746EA080-5BA9-42C5-9E52-EA421C3F3AFD}.Debug|Win32.Build.0 = Debug|Win32 - {746EA080-5BA9-42C5-9E52-EA421C3F3AFD}.Release|ARM.ActiveCfg = Release|ARM - {746EA080-5BA9-42C5-9E52-EA421C3F3AFD}.Release|ARM.Build.0 = Release|ARM - {746EA080-5BA9-42C5-9E52-EA421C3F3AFD}.Release|Win32.ActiveCfg = Release|Win32 - {746EA080-5BA9-42C5-9E52-EA421C3F3AFD}.Release|Win32.Build.0 = Release|Win32 - {D450EC75-DF02-48B0-A4FB-ACA79BD894AB}.Debug|ARM.ActiveCfg = Debug|ARM - {D450EC75-DF02-48B0-A4FB-ACA79BD894AB}.Debug|ARM.Build.0 = Debug|ARM - {D450EC75-DF02-48B0-A4FB-ACA79BD894AB}.Debug|Win32.ActiveCfg = Debug|Win32 - {D450EC75-DF02-48B0-A4FB-ACA79BD894AB}.Debug|Win32.Build.0 = Debug|Win32 - {D450EC75-DF02-48B0-A4FB-ACA79BD894AB}.Release|ARM.ActiveCfg = Release|ARM - {D450EC75-DF02-48B0-A4FB-ACA79BD894AB}.Release|ARM.Build.0 = Release|ARM - {D450EC75-DF02-48B0-A4FB-ACA79BD894AB}.Release|Win32.ActiveCfg = Release|Win32 - {D450EC75-DF02-48B0-A4FB-ACA79BD894AB}.Release|Win32.Build.0 = Release|Win32 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection -EndGlobal diff --git a/build/wp8/bcg729/bcg729.vcxproj b/build/wp8/bcg729/bcg729.vcxproj deleted file mode 100644 index 6e1645b..0000000 --- a/build/wp8/bcg729/bcg729.vcxproj +++ /dev/null @@ -1,140 +0,0 @@ - - - - - Debug - Win32 - - - Debug - ARM - - - Release - Win32 - - - Release - ARM - - - - {1db09afe-fc9b-472e-a746-0e33f8ef8883} - bcg729 - en-US - 11.0 - libmsbcg729 - - - - DynamicLibrary - true - v110_wp80 - false - - - DynamicLibrary - false - true - v110_wp80 - false - - - - - - - - $(SolutionDir)$(Platform)\$(Configuration)\ - $(SolutionDir)$(Platform)\$(Configuration)\$(TargetName)\ - - - false - - - - Level4 - $(ProjectDir)..\..\..\include;$(ProjectDir)..\..\..\..\linphone\ortp\include;$(ProjectDir)..\..\..\..\linphone\mediastreamer2\include;%(AdditionalIncludeDirectories) - WIN32;_WINDOWS;_WINRT_DLL;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions) - Default - NotUsing - false - $(WindowsSDK_MetadataPath);$(AdditionalUsingDirectories) - - - Console - false - false - ortp.lib;mediastreamer2.lib;%(AdditionalDependencies) - $(SolutionDir)$(Platform)\$(Configuration);%(AdditionalLibraryDirectories) - $(TargetDir)$(TargetName).lib - - - - - _DEBUG;%(PreprocessorDefinitions) - - - true - - - - - NDEBUG;%(PreprocessorDefinitions) - MaxSpeed - true - true - true - - - false - - - - - true - - - true - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - {027bad0e-9179-48c1-9733-7aa7e2c2ec70} - - - - - \ No newline at end of file diff --git a/config.h.cmake b/config.h.cmake index 2eb161e..935b7e0 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -28,3 +28,5 @@ #cmakedefine PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@" #cmakedefine PACKAGE_URL "@PACKAGE_URL@" #cmakedefine VERSION "@VERSION@" + +#cmakedefine BCG729_STATIC diff --git a/configure.ac b/configure.ac index 46b52fa..e4de116 100644 --- a/configure.ac +++ b/configure.ac @@ -24,39 +24,12 @@ AC_ARG_ENABLE([tests], AS_HELP_STRING([--disable-tests], [Disable the tests])) AM_CONDITIONAL([RUN_TESTS], [test "x$enable_tests" != "xno"]) -dnl configure option to disable mediastreamer plugin -AC_ARG_ENABLE([msplugin], - AS_HELP_STRING([--disable-msplugin], [Disable the mediastreamer plugin]), - enable_msplugin="$enableval", - enable_msplugin="yes" -) - CFLAGS="$CFLAGS -Wall" if test $GCC = yes && test $wall_werror = yes; then CFLAGS="$CFLAGS -Werror " fi -dnl check for libraries that have pkg-config files installed -PKG_CHECK_MODULES(ORTP, ortp >= 0.21.0,[found_ortp=true],foo=bar) -PKG_CHECK_MODULES(MEDIASTREAMER, mediastreamer >= 2.8.99,[found_ms2=true],foo=bar) - -if test x${found_ms2}x${found_ortp}x${enable_msplugin} = xtruextruexyes ; then - build_msbcg729=true -else - ORTP_CFLAGS= - ORTP_LIBS= - MEDIASTREAMER_CFLAGS= - MEDIASTREAMER_LIBS= -fi - -AC_SUBST(ORTP_CFLAGS) -AC_SUBST(ORTP_LIBS) -AC_SUBST(MEDIASTREAMER_CFLAGS) -AC_SUBST(MEDIASTREAMER_LIBS) - -AM_CONDITIONAL(BUILD_MSBCG729, test x$build_msbcg729 = xtrue) - VISIBILITY_CFLAGS= case "$target_os" in *mingw*) @@ -88,7 +61,6 @@ AC_CONFIG_FILES([ src/Makefile include/Makefile include/bcg729/Makefile - msbcg729/Makefile test/Makefile test/bin/Makefile libbcg729.pc diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt new file mode 100644 index 0000000..9ddf099 --- /dev/null +++ b/include/CMakeLists.txt @@ -0,0 +1,37 @@ +############################################################################ +# CMakeLists.txt +# Copyright (C) 2017 Belledonne Communications, Grenoble France +# +############################################################################ +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# +############################################################################ + +set(HEADER_FILES + decoder.h + encoder.h +) + +set(BCG729_HEADER_FILES ) +foreach(HEADER_FILE ${HEADER_FILES}) + list(APPEND BCG729_HEADER_FILES "${CMAKE_CURRENT_LIST_DIR}/bcg729/${HEADER_FILE}") +endforeach() +set(BCG729_HEADER_FILES ${BCG729_HEADER_FILES} PARENT_SCOPE) + +install(FILES ${BCG729_HEADER_FILES} + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bcg729 + PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ +) diff --git a/include/bcg729/Makefile.am b/include/bcg729/Makefile.am index 70b5521..bee5720 100644 --- a/include/bcg729/Makefile.am +++ b/include/bcg729/Makefile.am @@ -2,8 +2,5 @@ bcg729_includedir=$(includedir)/bcg729 public_headers=encoder.h decoder.h -bcg729_include_HEADERS= -if !BUILD_MSBCG729 -bcg729_include_HEADERS+=$(public_headers) -endif +bcg729_include_HEADERS=$(public_headers) diff --git a/include/bcg729/decoder.h b/include/bcg729/decoder.h index 759bb61..953a3b9 100644 --- a/include/bcg729/decoder.h +++ b/include/bcg729/decoder.h @@ -24,9 +24,17 @@ typedef struct bcg729DecoderChannelContextStruct_struct bcg729DecoderChannelCont #include #ifdef _WIN32 -#define BCG729_VISIBILITY + #ifdef BCG729_STATIC + #define BCG729_VISIBILITY + #else + #ifdef BCG729_EXPORTS + #define BCG729_VISIBILITY __declspec(dllexport) + #else + #define BCG729_VISIBILITY __declspec(dllimport) + #endif + #endif #else -#define BCG729_VISIBILITY __attribute__ ((visibility ("default"))) + #define BCG729_VISIBILITY __attribute__ ((visibility ("default"))) #endif /*****************************************************************************/ @@ -35,7 +43,7 @@ typedef struct bcg729DecoderChannelContextStruct_struct bcg729DecoderChannelCont /* - the decoder channel context data */ /* */ /*****************************************************************************/ -BCG729_VISIBILITY bcg729DecoderChannelContextStruct *initBcg729DecoderChannel(); +BCG729_VISIBILITY bcg729DecoderChannelContextStruct *initBcg729DecoderChannel(void); /*****************************************************************************/ /* closeBcg729DecoderChannel : free memory of context structure */ diff --git a/include/bcg729/encoder.h b/include/bcg729/encoder.h index fdc797e..6d8c176 100644 --- a/include/bcg729/encoder.h +++ b/include/bcg729/encoder.h @@ -24,9 +24,17 @@ typedef struct bcg729EncoderChannelContextStruct_struct bcg729EncoderChannelContextStruct; #ifdef _WIN32 -#define BCG729_VISIBILITY + #ifdef BCG729_STATIC + #define BCG729_VISIBILITY + #else + #ifdef BCG729_EXPORTS + #define BCG729_VISIBILITY __declspec(dllexport) + #else + #define BCG729_VISIBILITY __declspec(dllimport) + #endif + #endif #else -#define BCG729_VISIBILITY __attribute__ ((visibility ("default"))) + #define BCG729_VISIBILITY __attribute__ ((visibility ("default"))) #endif /*****************************************************************************/ diff --git a/msbcg729/Android.mk b/msbcg729/Android.mk deleted file mode 100644 index 9394f5e..0000000 --- a/msbcg729/Android.mk +++ /dev/null @@ -1,17 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := libmsbcg729 - - -LOCAL_SRC_FILES = bcg729_enc.c bcg729_dec.c - - -LOCAL_C_INCLUDES += \ - $(LOCAL_PATH)/../../linphone/oRTP/include \ - $(LOCAL_PATH)/../../linphone/mediastreamer2/include \ - $(LOCAL_PATH)/../include -LOCAL_STATIC_LIBRARIES = libbcg729 -include $(BUILD_STATIC_LIBRARY) - - diff --git a/msbcg729/CMakeLists.txt b/msbcg729/CMakeLists.txt deleted file mode 100644 index 5ed69ab..0000000 --- a/msbcg729/CMakeLists.txt +++ /dev/null @@ -1,58 +0,0 @@ -############################################################################ -# CMakeLists.txt -# Copyright (C) 2014 Belledonne Communications, Grenoble France -# -############################################################################ -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License -# as published by the Free Software Foundation; either version 2 -# of the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# -############################################################################ - -set(SOURCE_FILES - bcg729_dec.c - bcg729_enc.c -) - -include_directories(${MEDIASTREAMER2_INCLUDE_DIRS}) - -if(ENABLE_STATIC) - add_library(msbcg729-static STATIC ${BCG729_SOURCE_FILES} ${SOURCE_FILES}) - set_target_properties(msbcg729-static PROPERTIES OUTPUT_NAME msbcg729) - target_link_libraries(msbcg729-static ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES}) - install(TARGETS msbcg729-static - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/mediastreamer/plugins - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - ) -endif() -if(ENABLE_SHARED) - add_library(msbcg729 MODULE ${BCG729_SOURCE_FILES} ${SOURCE_FILES}) - set_target_properties(msbcg729 PROPERTIES SOVERSION 0) - target_link_libraries(msbcg729 ${MEDIASTREAMER2_LIBRARIES} ${ORTP_LIBRARIES}) - if(MSVC) - if(CMAKE_BUILD_TYPE STREQUAL "Debug") - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/Debug/libmsbcg729.pdb - DESTINATION ${CMAKE_INSTALL_BINDIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - ) - endif() - set_target_properties(msbcg729 PROPERTIES PREFIX "lib") - endif() - install(TARGETS msbcg729 - RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR}/mediastreamer/plugins - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/mediastreamer/plugins - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}/mediastreamer/plugins - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - ) -endif() diff --git a/msbcg729/Makefile.am b/msbcg729/Makefile.am deleted file mode 100644 index 6d1c39e..0000000 --- a/msbcg729/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ - -pluginsdir = $(libdir)/mediastreamer/plugins - -plugins_LTLIBRARIES=libmsbcg729.la - -libmsbcg729_la_SOURCES=bcg729_dec.c bcg729_enc.c - -libmsbcg729_la_LIBADD=\ - $(ORTP_LIBS) \ - $(MEDIASTREAMER_LIBS) \ - $(top_builddir)/src/libbcg729.la - -libmsbcg729_la_LDFLAGS=-module -no-undefined -AM_CPPFLAGS = -I$(top_srcdir)/include -libmsbcg729_la_CFLAGS= $(ORTP_CFLAGS) $(MEDIASTREAMER_CFLAGS) diff --git a/msbcg729/bcg729_dec.c b/msbcg729/bcg729_dec.c deleted file mode 100644 index 424ba65..0000000 --- a/msbcg729/bcg729_dec.c +++ /dev/null @@ -1,149 +0,0 @@ -/* - bcg729_dec.c - - Copyright (C) 2011 Belledonne Communications, Grenoble, France - Author : Jehan Monnier - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#include "mediastreamer2/mscodecutils.h" -#include "mediastreamer2/msfilter.h" -#include "mediastreamer2/msticker.h" -#include "bcg729/decoder.h" - -/* signal and bitstream frame size in byte */ -#define SIGNAL_FRAME_SIZE 160 -#define BITSTREAM_FRAME_SIZE 10 -#define NOISE_BITSTREAM_FRAME_SIZE 2 - -/* decoder struct: context for decoder channel and concealment */ -struct bcg729Decoder_struct { - bcg729DecoderChannelContextStruct *decoderChannelContext; - MSConcealerContext *concealer; -}; - -static void filter_init(MSFilter *f){ - f->data = ms_new0(struct bcg729Decoder_struct,1); -} - -static void filter_preprocess(MSFilter *f){ - struct bcg729Decoder_struct* obj= (struct bcg729Decoder_struct*) f->data; - obj->decoderChannelContext = initBcg729DecoderChannel(); /* initialize bcg729 decoder, return channel context */ - obj->concealer = ms_concealer_context_new(UINT32_MAX); -} - -static void filter_process(MSFilter *f){ - struct bcg729Decoder_struct* obj= (struct bcg729Decoder_struct*) f->data; - mblk_t *inputMessage, *outputMessage; - - while((inputMessage=ms_queue_get(f->inputs[0]))) { - while(inputMessage->b_rptrb_wptr) { - /* if remaining data in RTP payload have the size of a SID frame it must be one, see RFC3551 section 4.5.6 : any SID frame must be the last one of the RPT payload */ - uint8_t SIDFrameFlag = ((inputMessage->b_wptr-inputMessage->b_rptr)==NOISE_BITSTREAM_FRAME_SIZE)?1:0; - outputMessage = allocb(SIGNAL_FRAME_SIZE,0); - mblk_meta_copy(inputMessage, outputMessage); - bcg729Decoder(obj->decoderChannelContext, inputMessage->b_rptr, (SIDFrameFlag==1)?NOISE_BITSTREAM_FRAME_SIZE:BITSTREAM_FRAME_SIZE, 0, SIDFrameFlag, 0, (int16_t *)(outputMessage->b_wptr)); - outputMessage->b_wptr+=SIGNAL_FRAME_SIZE; - inputMessage->b_rptr += (SIDFrameFlag==1)?NOISE_BITSTREAM_FRAME_SIZE:BITSTREAM_FRAME_SIZE; - ms_queue_put(f->outputs[0],outputMessage); - ms_concealer_inc_sample_time(obj->concealer,f->ticker->time,10, 1); - } - freemsg(inputMessage); - } - - if (ms_concealer_context_is_concealement_required(obj->concealer, f->ticker->time)) { - outputMessage = allocb(SIGNAL_FRAME_SIZE,0); - bcg729Decoder(obj->decoderChannelContext, NULL, 0, 1, 0, 0, (int16_t *)(outputMessage->b_wptr)); - outputMessage->b_wptr+=SIGNAL_FRAME_SIZE; - mblk_set_plc_flag(outputMessage, 1); - ms_queue_put(f->outputs[0],outputMessage); - ms_concealer_inc_sample_time(obj->concealer,f->ticker->time,10, 0); - } -} - -static void filter_postprocess(MSFilter *f){ - struct bcg729Decoder_struct* obj= (struct bcg729Decoder_struct*) f->data; - ms_concealer_context_destroy(obj->concealer); - closeBcg729DecoderChannel(obj->decoderChannelContext); -} - -static void filter_uninit(MSFilter *f){ - ms_free(f->data); -} - -static int filter_have_plc(MSFilter *f, void *arg) -{ - *((int *)arg) = 1; - return 0; -} - -/*filter specific method*/ - -static MSFilterMethod filter_methods[]={ - { MS_DECODER_HAVE_PLC , filter_have_plc }, - { 0 , NULL } -}; - - -#define MS_BCG729_DEC_ID MS_FILTER_PLUGIN_ID -#define MS_BCG729_DEC_NAME "MSBCG729Dec" -#define MS_BCG729_DEC_DESCRIPTION "G729 audio decoder filter" -#define MS_BCG729_DEC_CATEGORY MS_FILTER_DECODER -#define MS_BCG729_DEC_ENC_FMT "G729" -#define MS_BCG729_DEC_NINPUTS 1 -#define MS_BCG729_DEC_NOUTPUTS 1 -#define MS_BCG729_DEC_FLAGS MS_FILTER_IS_PUMP - -#ifndef _MSC_VER - -MSFilterDesc ms_bcg729_dec_desc={ - .id=MS_BCG729_DEC_ID, - .name=MS_BCG729_DEC_NAME, - .text=MS_BCG729_DEC_DESCRIPTION, - .category=MS_BCG729_DEC_CATEGORY, - .enc_fmt=MS_BCG729_DEC_ENC_FMT, - .ninputs=MS_BCG729_DEC_NINPUTS, /*number of inputs*/ - .noutputs=MS_BCG729_DEC_NOUTPUTS, /*number of outputs*/ - .init=filter_init, - .preprocess=filter_preprocess, - .process=filter_process, - .postprocess=filter_postprocess, - .uninit=filter_uninit, - .methods=filter_methods, - .flags=MS_BCG729_DEC_FLAGS -}; - -#else - -MSFilterDesc ms_bcg729_dec_desc={ - MS_BCG729_DEC_ID, - MS_BCG729_DEC_NAME, - MS_BCG729_DEC_DESCRIPTION, - MS_BCG729_DEC_CATEGORY, - MS_BCG729_DEC_ENC_FMT, - MS_BCG729_DEC_NINPUTS, - MS_BCG729_DEC_NOUTPUTS, - filter_init, - filter_preprocess, - filter_process, - filter_postprocess, - filter_uninit, - filter_methods, - MS_BCG729_DEC_FLAGS -}; - -#endif - -MS_FILTER_DESC_EXPORT(ms_bcg729_dec_desc) diff --git a/msbcg729/bcg729_enc.c b/msbcg729/bcg729_enc.c deleted file mode 100644 index 1bfc609..0000000 --- a/msbcg729/bcg729_enc.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - bcg729_enc.c - - Copyright (C) 2011 Belledonne Communications, Grenoble, France - Author : Jehan Monnier - - This program is free software; you can redistribute it and/or - modify it under the terms of the GNU General Public License - as published by the Free Software Foundation; either version 2 - of the License, or (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -#include "mediastreamer2/msfilter.h" -#include "mediastreamer2/mscodecutils.h" -#include "bcg729/encoder.h" - -#ifdef HAVE_ms_bufferizer_fill_current_metas -#define ms_bufferizer_fill_current_metas(b,m) ms_bufferizer_fill_current_metas(b,m) -#else -#define ms_bufferizer_fill_current_metas(b,m) -#endif - -/*filter common method*/ -struct bcg729Encoder_struct { - bcg729EncoderChannelContextStruct *encoderChannelContext; - MSBufferizer *bufferizer; - unsigned char ptime; - unsigned char max_ptime; - uint32_t ts; - uint8_t enableVAD; -}; - -static void filter_init(MSFilter *f){ - struct bcg729Encoder_struct* obj; - f->data = ms_new0(struct bcg729Encoder_struct,1); - obj = (struct bcg729Encoder_struct*) f->data; - obj->ptime=20; - obj->max_ptime=100; - obj->enableVAD=0; -} - -static void filter_preprocess(MSFilter *f){ - struct bcg729Encoder_struct* obj= (struct bcg729Encoder_struct*) f->data; - - obj->encoderChannelContext = initBcg729EncoderChannel(obj->enableVAD); /* initialize bcg729 encoder, return context */ - obj->bufferizer=ms_bufferizer_new(); -} - -static void filter_process(MSFilter *f){ - struct bcg729Encoder_struct* obj= (struct bcg729Encoder_struct*) f->data; - mblk_t *inputMessage; - mblk_t *outputMessage=NULL; - uint8_t inputBuffer[160]; /* 2bytes per sample at 8000Hz -> 16 bytes per ms */ - uint8_t bufferIndex=0; - /* get all input data into a buffer */ - while((inputMessage=ms_queue_get(f->inputs[0]))!=NULL){ - ms_bufferizer_put(obj->bufferizer,inputMessage); - } - - /* process ptimes ms of data : (ptime in ms)/1000->ptime is seconds * 8000(sample rate) * 2(byte per sample) */ - while(ms_bufferizer_get_avail(obj->bufferizer)>=obj->ptime*16){ - uint16_t totalPacketDataLength = 0; - uint8_t bitStreamLength = 0; - outputMessage = allocb(obj->ptime,0); /* output bitStream is 80 bits long * number of samples */ - /* process buffer in 10 ms frames */ - /* RFC3551 section 4.5.6 we must end the RTP payload of G729 frames when transmitting a SID frame : bitStreamLength == 2 */ - for (bufferIndex=0; (bufferIndexptime) && (bitStreamLength!=2); bufferIndex+=10) { - ms_bufferizer_read(obj->bufferizer,inputBuffer,160); - bcg729Encoder(obj->encoderChannelContext, (int16_t *)inputBuffer, outputMessage->b_wptr, &bitStreamLength); - outputMessage->b_wptr+=bitStreamLength; - totalPacketDataLength+=bitStreamLength; - } - obj->ts+=bufferIndex*8; - /* do not enqueue the message if no data out (DTX untransmitted frames) */ - if (totalPacketDataLength>0) { - mblk_set_timestamp_info(outputMessage,obj->ts); - ms_bufferizer_fill_current_metas(obj->bufferizer, outputMessage); - ms_queue_put(f->outputs[0],outputMessage); - } - } - -} - -static void filter_postprocess(MSFilter *f){ - struct bcg729Encoder_struct* obj= (struct bcg729Encoder_struct*) f->data; - ms_bufferizer_destroy(obj->bufferizer); - closeBcg729EncoderChannel(obj->encoderChannelContext); -} - -static void filter_uninit(MSFilter *f){ - ms_free(f->data); -} - - -/*filter specific method*/ - -static int filter_add_fmtp(MSFilter *f, void *arg){ - char buf[64]; - struct bcg729Encoder_struct* obj= (struct bcg729Encoder_struct*) f->data; - const char *fmtp=(const char *)arg; - buf[0] ='\0'; - - if (fmtp_get_value(fmtp,"maxptime:",buf,sizeof(buf))){ - obj->max_ptime=atoi(buf); - if (obj->max_ptime <10 || obj->max_ptime >100 ) { - ms_warning("MSBCG729Enc: unknown value [%i] for maxptime, use default value (100) instead",obj->max_ptime); - obj->max_ptime=100; - } - ms_message("MSBCG729Enc: got maxptime=%i",obj->max_ptime); - } - - if (fmtp_get_value(fmtp,"ptime",buf,sizeof(buf))){ - obj->ptime=atoi(buf); - if (obj->ptime > obj->max_ptime) { - obj->ptime=obj->max_ptime; - } else if (obj->ptime%10) { - //if the ptime is not a mulptiple of 10, go to the next multiple - obj->ptime = obj->ptime - obj->ptime%10 + 10; - } - - ms_message("MSBCG729Enc: got ptime=%i",obj->ptime); - } - - if (fmtp_get_value(fmtp,"annexb",buf,sizeof(buf))){ - if (strncmp(buf, "yes",3) == 0) { - obj->enableVAD = 1; - ms_message("MSBCG729Enc: enable VAD/DTX - AnnexB"); - } - - } - /* parse annexB param here */ - return 0; -} - -static MSFilterMethod filter_methods[]={ - { MS_FILTER_ADD_FMTP , filter_add_fmtp }, - { 0, NULL} -}; - - -#define MS_BCG729_ENC_ID MS_FILTER_PLUGIN_ID -#define MS_BCG729_ENC_NAME "MSBCG729Enc" -#define MS_BCG729_ENC_DESCRIPTION "G729 audio encoder filter" -#define MS_BCG729_ENC_CATEGORY MS_FILTER_ENCODER -#define MS_BCG729_ENC_ENC_FMT "G729" -#define MS_BCG729_ENC_NINPUTS 1 -#define MS_BCG729_ENC_NOUTPUTS 1 -#define MS_BCG729_ENC_FLAGS 0 - -#ifndef _MSC_VER - -MSFilterDesc ms_bcg729_enc_desc={ - .id=MS_BCG729_ENC_ID, - .name=MS_BCG729_ENC_NAME, - .text=MS_BCG729_ENC_DESCRIPTION, - .category=MS_BCG729_ENC_CATEGORY, - .enc_fmt=MS_BCG729_ENC_ENC_FMT, - .ninputs=MS_BCG729_ENC_NINPUTS, /*number of inputs*/ - .noutputs=MS_BCG729_ENC_NOUTPUTS, /*number of outputs*/ - .init=filter_init, - .preprocess=filter_preprocess, - .process=filter_process, - .postprocess=filter_postprocess, - .uninit=filter_uninit, - .methods=filter_methods, - .flags=MS_BCG729_ENC_FLAGS -}; - -#else - -MSFilterDesc ms_bcg729_enc_desc={ - MS_BCG729_ENC_ID, - MS_BCG729_ENC_NAME, - MS_BCG729_ENC_DESCRIPTION, - MS_BCG729_ENC_CATEGORY, - MS_BCG729_ENC_ENC_FMT, - MS_BCG729_ENC_NINPUTS, - MS_BCG729_ENC_NOUTPUTS, - filter_init, - filter_preprocess, - filter_process, - filter_postprocess, - filter_uninit, - filter_methods, - MS_BCG729_ENC_FLAGS -}; - -#endif - -MS_FILTER_DESC_EXPORT(ms_bcg729_enc_desc) - -#ifdef _MSC_VER -#define MS_PLUGIN_DECLARE(type) __declspec(dllexport) type -#else -#define MS_PLUGIN_DECLARE(type) type -#endif - -extern MSFilterDesc ms_bcg729_dec_desc; - -#ifndef VERSION - #define VERSION "debug" -#endif - -MS_PLUGIN_DECLARE(void) libmsbcg729_init(MSFactory * factory){ - ms_factory_register_filter(factory, &ms_bcg729_enc_desc); - ms_factory_register_filter(factory, &ms_bcg729_dec_desc); - ms_message(" libmsbcg729 " VERSION " plugin loaded"); -} diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 09e41c0..9dc6d89 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -49,40 +49,32 @@ set(BCG729_SOURCE_FILES vad.c ) -if(NOT ENABLE_MSPLUGIN) - - if(ENABLE_STATIC) - add_library(bcg729-static STATIC ${BCG729_SOURCE_FILES}) - set_target_properties(bcg729-static PROPERTIES OUTPUT_NAME bcg729) - install(TARGETS bcg729-static EXPORT Bcg729Targets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - ) - endif() - if(ENABLE_SHARED) - add_library(bcg729 SHARED ${BCG729_SOURCE_FILES}) - set_target_properties(bcg729 PROPERTIES VERSION 0) - if(MSVC) - if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/libbcg729.pdb - DESTINATION ${CMAKE_INSTALL_BINDIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - ) - endif() - set_target_properties(bcg729 PROPERTIES PREFIX "lib") +if(ENABLE_STATIC) + add_library(bcg729-static STATIC ${BCG729_SOURCE_FILES}) + target_compile_definitions(bcg729-static PRIVATE "-DBCG729_EXPORTS") + set_target_properties(bcg729-static PROPERTIES OUTPUT_NAME bcg729) + install(TARGETS bcg729-static EXPORT Bcg729Targets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) +endif() +if(ENABLE_SHARED) + add_library(bcg729 SHARED ${BCG729_SOURCE_FILES}) + target_compile_definitions(bcg729 PRIVATE "-DBCG729_EXPORTS") + set_target_properties(bcg729 PROPERTIES VERSION 0) + if(MSVC) + if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}/libbcg729.pdb + DESTINATION ${CMAKE_INSTALL_BINDIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) endif() - install(TARGETS bcg729 EXPORT Bcg729Targets - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - ) + set_target_properties(bcg729 PROPERTIES PREFIX "lib") endif() + install(TARGETS bcg729 EXPORT Bcg729Targets + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + ) endif() - -set(ABS_BCG729_SOURCE_FILES ) -foreach(elem ${BCG729_SOURCE_FILES}) - list(APPEND ABS_BCG729_SOURCE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/${elem}") -endforeach() -set(BCG729_SOURCE_FILES ${ABS_BCG729_SOURCE_FILES} PARENT_SCOPE) - diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 5580925..49c27e1 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -19,11 +19,8 @@ # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # ############################################################################ -if(NOT ENABLE_MSPLUGIN) - set(BCG729_LIBRARY bcg729) -else() - set(BCG729_LIBRARY msbcg729) -endif() + +set(BCG729_LIBRARY bcg729) set(UTIL_SRC src/testUtils.c src/testUtils.h)