Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
143 commits
Select commit Hold shift + click to select a range
cfb6c1b
Import of version 3.0.1
j0r1 Dec 3, 2016
ff3e4a0
Import of version 3.0.2
j0r1 Dec 3, 2016
d973e69
Import of version 3.1.0
j0r1 Dec 3, 2016
99bbc76
Import of version 3.2.0
j0r1 Dec 3, 2016
75c0711
Import of version 3.2.1
j0r1 Dec 3, 2016
a4fbef8
Import of version 3.3.0
j0r1 Dec 3, 2016
9fd0a24
Import of version 3.4.0
j0r1 Dec 3, 2016
c2da694
Import of version 3.5.0
j0r1 Dec 3, 2016
663ce7f
Import of version 3.5.1
j0r1 Dec 3, 2016
7779758
Import of version 3.5.2
j0r1 Dec 3, 2016
fbf28fe
Import of version 3.6.0
j0r1 Dec 3, 2016
3aaa7ef
Import of version 3.7.0
j0r1 Dec 3, 2016
5d75c32
Import of version 3.7.1
j0r1 Dec 3, 2016
e77dcc7
Import of version 3.8.0
j0r1 Dec 3, 2016
5a0df19
Import of version 3.8.1
j0r1 Dec 3, 2016
99e884d
Import of version 3.8.2
j0r1 Dec 3, 2016
3526e2f
Import of version 3.9.0
j0r1 Dec 3, 2016
0b3ea2f
Import of version 3.9.1
j0r1 Dec 3, 2016
05abf50
Import of version 3.9.2
j0r1 Dec 3, 2016
81a11d8
Added some files from internal repository
j0r1 Dec 4, 2016
4285c01
Using markdown in docs and changed sphinx script to set version in Do…
j0r1 Dec 4, 2016
d95dfef
Updated the README, and switched to markdown
j0r1 Dec 4, 2016
07a3d0f
Added a list of things to do
j0r1 Dec 4, 2016
e388beb
Set CMP0026 policy to OLD in CMakeLists.txt
j0r1 Dec 4, 2016
d9df958
Added OnChangeRTPOrRTCPData to change the outgoing packet
j0r1 Dec 4, 2016
abcf682
Callbacks for changing incoming data and validated RTP packets
j0r1 Dec 4, 2016
788a6b9
Added callbacks for various RTCP info
j0r1 Dec 4, 2016
6668529
Detecting several features in cmake script to avoid 'ifdef WIN32' test
j0r1 Dec 4, 2016
03e2791
Preliminary code for RTCP multiplexing in UDPv4 transmitter
j0r1 Dec 5, 2016
e1b8485
Specific RTCP port can be used, and can be sent to
j0r1 Dec 6, 2016
fe2ea16
UDPv4 transmitter can now use pre-created sockets
j0r1 Dec 6, 2016
d79ada4
Doc when specifying sockets: explained that _you_ need to close them
j0r1 Dec 7, 2016
9082745
Moved some common socket stuff to common files
j0r1 Dec 7, 2016
cd50d87
Cleaning examples and tests a bit
j0r1 Dec 7, 2016
bd8f033
Minor change to get it to compile on windows
j0r1 Dec 7, 2016
8ae4745
Added a function to send raw data directly.
j0r1 Dec 7, 2016
ff7d0ae
Added RTPSession::GetNextSequenceNumber
j0r1 Dec 7, 2016
6b1a69c
Portbase 0 now chooses port(s) by itself.
j0r1 Dec 7, 2016
189cede
Small update of README
j0r1 Dec 7, 2016
d89a7ac
Bugfix and added SetSenderAddress to RTPRawPacket
j0r1 Dec 8, 2016
c988d8b
Merge branch 'master' into mingwcompilation
j0r1 Dec 9, 2016
0313a90
Many ifdef WIN32 tests have been replaced
j0r1 Dec 9, 2016
f87c7ec
Varous fixes by testing compilation on windows
j0r1 Dec 9, 2016
b76ff19
Re-added option to build tests (got lost during a merge)
j0r1 Dec 9, 2016
6f0ce98
Forgot an error description
j0r1 Dec 9, 2016
b6016ca
Added SRTP detection
j0r1 Dec 9, 2016
f659ce0
Getting some first results with libsrtp
j0r1 Dec 10, 2016
a7684fa
Further testing...
j0r1 Dec 10, 2016
b9c0a3b
Working on base class for SRTP session
j0r1 Dec 11, 2016
c7c3399
Created base class for SRTP, working on example with single key
j0r1 Dec 11, 2016
4f1b286
Bugfix: forgot to set the changed length field for RTCP packets
j0r1 Dec 11, 2016
427f3da
Test/example works
j0r1 Dec 11, 2016
f3e53da
No longer need this first test class
j0r1 Dec 11, 2016
8d034d1
Writing encrypted and decrypted data to file
j0r1 Dec 11, 2016
b1ea6be
Added SRTP example based on the srtptest.cpp file
j0r1 Dec 11, 2016
819f93f
Updated todo list
j0r1 Dec 11, 2016
5cfa318
Updating the docs
j0r1 Dec 11, 2016
78ad6d9
Update to the documentation
j0r1 Dec 11, 2016
753b171
Cleaned error codes
j0r1 Dec 12, 2016
d4fde29
Updated ChangeLog and version (3.10.0)
j0r1 Dec 12, 2016
b15eb07
Compiled again with -DRTPDEBUG (without memory management)
j0r1 Dec 12, 2016
75ef72e
Added two tests to debug the negative time problem
j0r1 Dec 13, 2016
a4f4804
Added ack to ChangeLog
j0r1 Dec 16, 2016
743284b
Switched to using a double representation internally for RTPTime
j0r1 Dec 17, 2016
35945a3
If possible, using clock_gettime instead of gettimeofday
j0r1 Dec 17, 2016
599ded7
Using a mutex if available in the debug 'new' and 'delete'
j0r1 Dec 18, 2016
fc1c622
Added OnValidatedRTPPacket to discard (the unused) incoming RTP data
j0r1 Dec 18, 2016
6d9a053
Set the date in the ChangeLog, preparing for a new release
j0r1 Dec 19, 2016
1b4be52
Compilation fix in case SRTP is not supported
j0r1 Dec 19, 2016
86ea515
Tweaks regarding libsrtp finding and using
j0r1 Dec 19, 2016
9b25a35
Moving the abort descriptor stuff to a common class
j0r1 Dec 30, 2016
fab3247
Changes to support single poll thread for multiple sessions
j0r1 Dec 30, 2016
c5c2c40
Added todo's
j0r1 Dec 30, 2016
de3b60e
Tests to see if 'poll' or 'WSAPoll' is available
j0r1 Dec 31, 2016
d6b73e2
Changed code so that RTPSelect is used instead of select
j0r1 Dec 31, 2016
6bf2a0d
Bugfix in example: needed to call poll for sending RTCP packets as well
j0r1 Dec 31, 2016
1033cf5
Moved the code to create the default rndgen to a function in RTPRandom
j0r1 Dec 31, 2016
8ad5bdc
All sessions in example8 use the same random number generator
j0r1 Dec 31, 2016
f45818a
RTPSelect can now use poll or WSAPoll if available
j0r1 Dec 31, 2016
01ea415
Various fixes for windows compilation
j0r1 Dec 31, 2016
a3b7722
Updated changelog
j0r1 Jan 1, 2017
b917942
Documentation for RTPAbortDescriptors
j0r1 Jan 1, 2017
160358d
Cleanup of error codes and added descriptions for new errors
j0r1 Jan 1, 2017
872030f
Updated todo
j0r1 Jan 1, 2017
23634d4
Can specify abort descr in IPv6, can get port numbers
j0r1 Jan 8, 2017
996674d
Added same example as example8, but using IPv6
j0r1 Jan 8, 2017
88c67e5
Forgot the (empty) implementation of AbortWait
j0r1 Jan 10, 2017
45be97c
Using int8_t flags instead of bool flags in RTPSelect
j0r1 Feb 19, 2017
cc98738
Initial version of a TCP transmitter
j0r1 Feb 18, 2017
e31b686
TCP test also tests zero-length packet
j0r1 Feb 19, 2017
7a73cb4
Fixes for compiling and running on windows
j0r1 Mar 3, 2017
dd909f8
Replaced some WIN32 ifdefs with RTP_SOCKETTYPE_WINSOCK
j0r1 Mar 4, 2017
b3ceabe
jrtplib now builds using GCC with -Wall -Wextra -Werror
lbakman Mar 6, 2017
da04fe0
Removed .gitignore file
Mar 6, 2017
8879aa6
Merge pull request #2 from lbakman/master
j0r1 Mar 6, 2017
030d977
Slight modifications to get rid of the LOCATION issue
j0r1 Mar 9, 2017
deac872
Added JRTPLIB_UNUSED necessary depending on the options in cmake
j0r1 Mar 9, 2017
7f2127f
Made the warnings as errors flags optional (but enabled by default)
j0r1 Mar 9, 2017
0322d73
Updated ChangeLog and TODO
j0r1 Mar 10, 2017
95e2756
Added cross-compilation instructions for Android
j0r1 Mar 10, 2017
1e74890
Reformatted error header file and added error descriptions (TCP trans)
j0r1 Mar 11, 2017
da4fa89
Tested closing tcp connections, updated docs
j0r1 Mar 15, 2017
4748db5
Changed 'UNIX' to 'NOT MSVC'
j0r1 Mar 17, 2017
569a6f6
Fixed an unused variable that occurred with MinGW
j0r1 Mar 17, 2017
416eee6
Appending ws2_32 if winsock was detected
j0r1 Mar 17, 2017
d892a0f
Only including rtpfaketransmitter if not using winsock
j0r1 Mar 17, 2017
aa8ff5d
Fixed winsock detection
j0r1 Mar 17, 2017
198cc7e
Setting policy CMP0042 (rpath on OS X) to NEW if available
j0r1 Mar 17, 2017
157f696
Testing to see if MSG_NOSIGNAL can be used
j0r1 Mar 17, 2017
c85dc53
Changed ifdef WIN32 to ifdef RTP_SOCKETTYPE_WINSOCK
j0r1 Mar 17, 2017
bd41a92
Setting CMAKE_PREFIX_PATH helps find right JThread
j0r1 Mar 18, 2017
e6746f7
Set version to 3.11.0, updated TODO, updated version in ChangeLog
j0r1 Mar 22, 2017
983304f
Removed commented debug code, marked as 'todo'
j0r1 Mar 22, 2017
0125871
Removed warnings when compiling with -DRTPDEBUG enabled
j0r1 Mar 22, 2017
051f6db
Updated year in copyright line to 2017
j0r1 Mar 22, 2017
bf0c782
Caching the CSRC values because 'rtppack' may be deleted already
j0r1 Mar 27, 2017
c18a45f
Making sure the stored CSRCs don't go out of bounds
j0r1 Mar 28, 2017
10c691d
Updated version to 3.11.1
j0r1 Mar 28, 2017
fd0dfba
Handling EINTR in nanosleep call
j0r1 Apr 8, 2017
7b3ac83
Ignoring EINTR in poll and select calls
j0r1 Apr 8, 2017
37ca846
Test to cause EINTR in poll/select
j0r1 Apr 8, 2017
4e12581
Updated ChangeLog
j0r1 Apr 9, 2017
ab0d6df
Added test program that shows bug in external transmitter
j0r1 Jul 2, 2017
0ec6259
Tried to fix the abort socket buffer filling up
j0r1 Jul 2, 2017
fbc8754
Testing getifaddrs/freeifaddrs availability as well as header file
j0r1 Apr 24, 2018
5315a71
Explicitly disabled copy constructor/assignment operator
j0r1 Jun 24, 2018
47884e2
Made RTCPCompoundPacket::GetCompoundPacketLength const
j0r1 Aug 3, 2018
863b208
Fix rtpsecuresession.cpp when thread is not supported
wegylexy Aug 21, 2018
e08df9e
Merge pull request #1 from wegylexy/patch-srtp
wegylexy Aug 21, 2018
15651ec
Merge pull request #18 from wegylexy/master
j0r1 Aug 21, 2018
9c2e90c
Added RTPRawPacket constructor which determines RTP/RTCP automatically
j0r1 Aug 4, 2018
c55b8a2
Avoid `using namespace std` to allow c++14 compilation
MatanShahar Nov 15, 2018
7113534
Merge pull request #25 from getnexar/enable-cpp14
j0r1 Mar 2, 2019
ed57b75
Added CMake option to compile without examples
j0r1 Mar 3, 2019
c8412d1
Added support for libsrtp2
j0r1 Mar 9, 2018
d2eb1f9
Cmake file to find libsrtp2
j0r1 Mar 10, 2018
5aaf096
Fix typos in src/rtperrors.cpp
linrock Jan 28, 2020
da6067e
Merge pull request #42 from linrock/master-with-srtp2
j0r1 Mar 20, 2020
2b49da3
Merge pull request #43 from linrock/fix-typos
j0r1 Mar 20, 2020
fd2c0e1
Updated changelog and version number for 3.11.2
j0r1 Apr 18, 2020
c5c3911
End of development notice...
j0r1 Apr 18, 2020
d43c112
Modifications for changed build on readthedocs
j0r1 Nov 22, 2023
bebae7e
recevice rtp always drop first packet
Guanges Jul 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details

# Required
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
apt_packages:
- doxygen
- graphviz
tools:
python: "3.11"

# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: sphinxdoc/source/conf.py

# We recommend specifying your dependencies to enable reproducible builds:
# https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
# python:
# install:
# - requirements: docs/requirements.txt
258 changes: 258 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,258 @@
cmake_minimum_required(VERSION 2.8)
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()

project(jrtplib)
set(VERSION_MAJOR 3)
set(VERSION_MINOR 11)
set(VERSION_DEBUG 2)
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_DEBUG}")

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake")
if (CMAKE_INSTALL_PREFIX AND NOT CMAKE_PREFIX_PATH)
#message("Setting CMAKE_PREFIX_PATH to ${CMAKE_INSTALL_PREFIX}")
file(TO_CMAKE_PATH "${CMAKE_INSTALL_PREFIX}" CMAKE_PREFIX_PATH)
endif()

set (_DEFAULT_LIBRARY_INSTALL_DIR lib)
if (EXISTS "${CMAKE_INSTALL_PREFIX}/lib32/" AND CMAKE_SIZEOF_VOID_P EQUAL 4)
set (_DEFAULT_LIBRARY_INSTALL_DIR lib32)
elseif (EXISTS "${CMAKE_INSTALL_PREFIX}/lib64/" AND CMAKE_SIZEOF_VOID_P EQUAL 8)
set (_DEFAULT_LIBRARY_INSTALL_DIR lib64)
endif ()

set(LIBRARY_INSTALL_DIR "${_DEFAULT_LIBRARY_INSTALL_DIR}" CACHE PATH "Library installation directory")
if(NOT IS_ABSOLUTE "${LIBRARY_INSTALL_DIR}")
set(LIBRARY_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${LIBRARY_INSTALL_DIR}")
endif()

include(CheckCXXCompilerFlag)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckCXXSourceCompiles)
include(TestBigEndian)
include(${PROJECT_SOURCE_DIR}/cmake/Macros.cmake)

find_package(JThread)

set(JRTPLIB_LINK_LIBS "")
set(JRTPLIB_INTERNAL_INCLUDES "")
set(JRTPLIB_EXTERNAL_INCLUDES "")

add_additional_stuff(JRTPLIB_EXTERNAL_INCLUDES JRTPLIB_LINK_LIBS)

jrtplib_support_option("Support SDES PRIV items" JRTPLIB_SUPPORT_SDESPRIV RTP_SUPPORT_SDESPRIV ON "// No support for SDES PRIV items")
jrtplib_support_option("Support the probation mechanism for a new source" JRTPLIB_SUPPORT_PROBATION RTP_SUPPORT_PROBATION ON "// Do not wait for a number of consecutive packets to validate source")
jrtplib_support_option("Support sending RTCP APP packets" JRTPLIB_SUPPORT_SENDAPP RTP_SUPPORT_SENDAPP ON "// No direct support for sending RTCP APP packets")
jrtplib_support_option("Support sending unknown RTCP packets" JRTPLIB_SUPPORT_RTCPUNKNOWN RTP_SUPPORT_RTCPUNKNOWN OFF "// No support for sending unknown RTCP packets")
jrtplib_support_option("Support memory management mechanism" JRTPLIB_SUPPORT_MEMORYMGMT RTP_SUPPORT_MEMORYMANAGEMENT ON "// No memory management support")

jrtplib_include_test(sys/filio.h RTP_HAVE_SYS_FILIO "// Don't have <sys/filio.h>")
jrtplib_include_test(sys/sockio.h RTP_HAVE_SYS_SOCKIO "// Don't have <sys/sockio.h>")
jrtplib_include_test(netinet/in.h RTP_SUPPORT_NETINET_IN "// Don't have <netinet/in.h>")

if (JTHREAD_FOUND)
set(V "ON")
else (JTHREAD_FOUND)
set(V "OFF")
endif (JTHREAD_FOUND)

option(JTHREAD_ENABLED "Thread support" ${V})
if (JTHREAD_ENABLED)
set (RTP_SUPPORT_THREAD "#define RTP_SUPPORT_THREAD")
if (JTHREAD_FOUND)
save_paths(JRTPLIB_EXTERNAL_INCLUDES "${JTHREAD_INCLUDE_DIRS}")
save_paths(JRTPLIB_LINK_LIBS "${JTHREAD_LIBRARIES}")
endif(JTHREAD_FOUND)
else (JTHREAD_ENABLED)
set (RTP_SUPPORT_THREAD "// No support for JThread was enabled")
endif (JTHREAD_ENABLED)

find_package(LIBSRTP)
if (LIBSRTP_FOUND)
set(V "ON")
else (LIBSRTP_FOUND)
set(V "OFF")
endif (LIBSRTP_FOUND)

option(SRTP_ENABLED "Secure RTP (SRTP) support" ${V})
if (SRTP_ENABLED)
set(RTP_SUPPORT_SRTP "#define RTP_SUPPORT_SRTP")
if (LIBSRTP_FOUND)
save_paths(JRTPLIB_EXTERNAL_INCLUDES "${LIBSRTP_INCLUDE_DIR}")
save_paths(JRTPLIB_LINK_LIBS "${LIBSRTP_LIBRARY_DIR}")
endif (LIBSRTP_FOUND)
else (SRTP_ENABLED)
set(RTP_SUPPORT_SRTP "// No SRTP support")
endif (SRTP_ENABLED)

find_package(LIBSRTP2)
if (LIBSRTP2_FOUND)
set(V "ON")
else (LIBSRTP2_FOUND)
set(V "OFF")
endif (LIBSRTP2_FOUND)

option(SRTP2_ENABLED "Secure RTP 2 (SRTP2) support" ${V})
if (SRTP2_ENABLED)
set(RTP_SUPPORT_SRTP2 "#define RTP_SUPPORT_SRTP2")
if (LIBSRTP2_FOUND)
save_paths(JRTPLIB_EXTERNAL_INCLUDES "${LIBSRTP2_INCLUDE_DIR}")
save_paths(JRTPLIB_LINK_LIBS "${LIBSRTP2_LIBRARY_DIR}")
endif (LIBSRTP2_FOUND)
else (SRTP2_ENABLED)
set(RTP_SUPPORT_SRTP2 "// No SRTP2 support")
endif (SRTP2_ENABLED)

if (SRTP2_ENABLED)
if (SRTP_ENABLED)
message(FATAL_ERROR "Can't enable both SRTP and SRTP2 at the same time")
endif()
endif ()

if (CMAKE_CROSSCOMPILING)
option (JRTPLIB_USE_BIGENDIAN "Target platform is big endian" ON)
if (JRTPLIB_USE_BIGENDIAN)
set(RTP_ENDIAN "#define RTP_BIG_ENDIAN")
else (JRTPLIB_USE_BIGENDIAN)
set(RTP_ENDIAN "// Little endian system")
endif (JRTPLIB_USE_BIGENDIAN)
else (CMAKE_CROSSCOMPILING)
test_big_endian(JRTPLIB_BIGENDIAN)
if (JRTPLIB_BIGENDIAN)
set(RTP_ENDIAN "#define RTP_BIG_ENDIAN")
else (JRTPLIB_BIGENDIAN)
set(RTP_ENDIAN "// Little endian system")
endif (JRTPLIB_BIGENDIAN)
endif (CMAKE_CROSSCOMPILING)

option(JRTPLIB_COMPILE_TESTS "Compile various tests in the 'tests' subdirectory" NO)
option(JRTPLIB_COMPILE_EXAMPLES "Compile various examples in the 'examples' subdirectory" YES)

# Check winsock first
set(TESTDEFS "")
set(EMPTYWSSTRING "// Not using winsock sockets")
jrtplib_test_feature(winsocktest RTP_SOCKETTYPE_WINSOCK FALSE "${EMPTYWSSTRING}" "${TESTDEFS}")
if ("${RTP_SOCKETTYPE_WINSOCK}" STREQUAL "${EMPTYWSSTRING}")
set(JRTPLIB_WINSOCK FALSE)
else ()
set(JRTPLIB_WINSOCK TRUE)
set(TESTDEFS "${TESTDEFS} -DRTP_SOCKETTYPE_WINSOCK")
endif()

jrtplib_test_feature(socklentest RTP_SOCKLENTYPE_UINT TRUE "// socklen_t is 'int'" "${TESTDEFS}")
jrtplib_test_feature(ipv4mcasttest RTP_SUPPORT_IPV4MULTICAST FALSE "// No IPv4 multicasting support" "${TESTDEFS}")
jrtplib_test_feature(salentest RTP_HAVE_SOCKADDR_LEN FALSE "// No sa_len member in struct sockaddr" "${TESTDEFS}")
jrtplib_test_feature(getloginrtest RTP_SUPPORT_GETLOGINR FALSE "// Not using getlogin_r" "${TESTDEFS}")
jrtplib_test_feature(ipv6test RTP_SUPPORT_IPV6 FALSE "// No IPv6 support" "${TESTDEFS}")
jrtplib_test_feature(ipv6mcasttest RTP_SUPPORT_IPV6MULTICAST FALSE "// No IPv6 multicasting support" "${TESTDEFS}")
jrtplib_test_feature(performancecounter RTP_HAVE_QUERYPERFORMANCECOUNTER FALSE "// No QueryPerformanceCounter support" "${TESTDEFS}")
jrtplib_test_feature(suffix RTP_HAVE_VSUINT64SUFFIX FALSE "// No ui64 suffix" "${TESTDEFS}")
jrtplib_test_feature(arrayalloc RTP_HAVE_ARRAYALLOC FALSE "// No custom new[]" "${TESTDEFS}")
jrtplib_test_feature(randstest RTP_HAVE_RAND_S FALSE "// No rand_s support" "${TESTDEFS}")
jrtplib_test_feature(strncpystest RTP_HAVE_STRNCPY_S FALSE "// No strncpy_s support" "${TESTDEFS}")
jrtplib_test_feature(clockgettimetest RTP_HAVE_CLOCK_GETTIME FALSE "// No clock_gettime support" "${TESTDEFS}")
jrtplib_test_feature(polltest RTP_HAVE_POLL FALSE "// No 'poll' support" "${TESTDEFS}")
jrtplib_test_feature(wsapolltest RTP_HAVE_WSAPOLL FALSE "// No 'WSAPoll' support" "${TESTDEFS}")
jrtplib_test_feature(msgnosignaltest RTP_HAVE_MSG_NOSIGNAL FALSE "// No MSG_NOSIGNAL option" "${TESTDEFS}")
jrtplib_test_feature(ifaddrstest RTP_SUPPORT_IFADDRS FALSE "// No ifaddrs support" "${TESTDEFS}")

check_cxx_source_compiles("#include <windows.h>\n#include <stdio.h>\nint main(void) { char s[1024]; _snprintf_s(s, 1024,\"%d\", 10);\n return 0; }" JRTPLIB_SNPRINTF_S)
if (JRTPLIB_SNPRINTF_S)
set(RTP_SNPRINTF_VERSION "#define RTP_HAVE_SNPRINTF_S")
else ()
check_cxx_source_compiles("#include <windows.h>\n#include <stdio.h>\nint main(void) { char s[1024]; _snprintf(s, 1024,\"%d\", 10);\n return 0; }" JRTPLIB_SNPRINTF)
if (JRTPLIB_SNPRINTF)
set(RTP_SNPRINTF_VERSION "#define RTP_HAVE_SNPRINTF")
else ()
set(RTP_SNPRINTF_VERSION "// Stdio snprintf version")
endif()
endif()

check_cxx_source_compiles("#include <stdint.h>\n#include <sys/types.h>\nint main(void) { size_t a = 0 ; size_t b = a; uint32_t x = 0; uint32_t y = x; return 0; }" JRTPLIB_STDINT)
if (JRTPLIB_STDINT)
set(RTP_INTTYPE_HEADERS "#include <stdint.h>\n#include <sys/types.h>")
else (JRTPLIB_STDINT)
check_cxx_source_compiles("#include <inttypes.h>\n#include <sys/types.h>\nint main(void) { uint32_t x = 0; uint32_t y = x; return 0; }" JRTPLIB_INTTYPES)
if (JRTPLIB_INTTYPES)
set(RTP_INTTYPE_HEADERS "#include <inttypes.h>\n#include <sys/types.h>\n")
else (JRTPLIB_INTTYPES)
if (MSVC)
set(RTP_INTTYPE_HEADERS "#include \"rtptypes_win.h\"")
else (MSVC)
set(RTP_INTTYPE_HEADERS "#error Could not find header files that define types like 'uint32_t'. Please edit the file ${PROJECT_BINARY_DIR}/src/rtptypes_unix.h and make sure that the following types are defined: int8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t")
message("\n\nError: Could not find header files that define types like 'uint32_t'.\nPlease edit the file ${PROJECT_BINARY_DIR}/src/rtptypes_unix.h\nand make sure that the following types are defined: \nint8_t, uint8_t, int16_t, uint16_t, int32_t, uint32_t, int64_t, uint64_t\n\n")
endif (MSVC)
endif (JRTPLIB_INTTYPES)
endif (JRTPLIB_STDINT)

if (JRTPLIB_WINSOCK)
set(RTP_WINSOCK_HEADERS "#ifdef RTP_SOCKETTYPE_WINSOCK\n #include <winsock2.h> \n #include <ws2tcpip.h>\n#ifndef _WIN32_WCE\n #include <sys/types.h>\n#endif // _WIN32_WCE\n#endif // RTP_SOCKETTYPE_WINSOCK\n")
list(APPEND JRTPLIB_LINK_LIBS "ws2_32")
endif ()

if (MSVC)
set(JRTPLIB_COMPILE_STATIC ON CACHE BOOL "Flag indicating if a static library should be built, or a dynamic one")
endif ()

if (NOT MSVC OR JRTPLIB_COMPILE_STATIC)
set(JRTPLIB_IMPORT "")
set(JRTPLIB_EXPORT "")
else ()
set(JRTPLIB_IMPORT "__declspec(dllimport)")
set(JRTPLIB_EXPORT "__declspec(dllexport)")
endif ()

configure_file("${PROJECT_SOURCE_DIR}/src/rtptypes.h.in" "${PROJECT_BINARY_DIR}/src/rtptypes.h")
configure_file("${PROJECT_SOURCE_DIR}/src/rtpconfig.h.in" "${PROJECT_BINARY_DIR}/src/rtpconfig.h")
configure_file("${PROJECT_SOURCE_DIR}/src/rtplibraryversioninternal.h.in" "${PROJECT_BINARY_DIR}/src/rtplibraryversioninternal.h")

save_paths(JRTPLIB_INTERNAL_INCLUDES "${PROJECT_SOURCE_DIR}/src" "${PROJECT_BINARY_DIR}/src")

add_subdirectory(src)

if (JRTPLIB_COMPILE_EXAMPLES)
add_subdirectory(examples)
endif()

if (JRTPLIB_COMPILE_TESTS)
add_subdirectory(tests)
endif()

if (NOT MSVC)
set(JRTPLIB_LIBS "-L${LIBRARY_INSTALL_DIR}" "-ljrtp")
else ()
set(JRTPLIB_LIBS optimized "${LIBRARY_INSTALL_DIR}/jrtplib.lib"
debug "${LIBRARY_INSTALL_DIR}/jrtplib_d.lib")
endif ()

set(JRTPLIB_INCDIRS ${JRTPLIB_EXTERNAL_INCLUDES} ${CMAKE_INSTALL_PREFIX}/include)
set(JRTPLIB_LIBS ${JRTPLIB_LIBS} ${JRTPLIB_LINK_LIBS})
remove_empty(JRTPLIB_INCDIRS)
list(REMOVE_DUPLICATES JRTPLIB_INCDIRS)
remove_empty(JRTPLIB_LIBS)

foreach(ARG ${JRTPLIB_LIBS})
set(JRTPLIB_LIBS_CMAKECONFIG "${JRTPLIB_LIBS_CMAKECONFIG} \"${ARG}\"")
endforeach()
foreach(ARG ${JRTPLIB_INCDIRS})
set(JRTPLIB_INCDIRS_CMAKECONFIG "${JRTPLIB_INCDIRS_CMAKECONFIG} \"${ARG}\"")
endforeach()

configure_file("${PROJECT_SOURCE_DIR}/cmake/JRTPLIBConfig.cmake.in" "${PROJECT_BINARY_DIR}/cmake/JRTPLIBConfig.cmake")
install(FILES "${PROJECT_BINARY_DIR}/cmake/JRTPLIBConfig.cmake" DESTINATION ${LIBRARY_INSTALL_DIR}/cmake/JRTPLIB)

if (NOT MSVC)
foreach(ARG ${JRTPLIB_LIBS})
set(JRTPLIB_LIBS_PKGCONFIG "${JRTPLIB_LIBS_PKGCONFIG} ${ARG}")
endforeach()
foreach(ARG ${JRTPLIB_INCDIRS})
set(JRTPLIB_INCDIRS_PKGCONFIG "${JRTPLIB_INCDIRS_PKGCONFIG} -I${ARG}")
endforeach()

configure_file(${PROJECT_SOURCE_DIR}/pkgconfig/jrtplib.pc.in ${PROJECT_BINARY_DIR}/pkgconfig/jrtplib.pc)
install(FILES ${PROJECT_BINARY_DIR}/pkgconfig/jrtplib.pc DESTINATION ${LIBRARY_INSTALL_DIR}/pkgconfig)
endif ()


Loading