diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/Makefile.am | 11 | ||||
-rw-r--r-- | examples/Makefile.in | 483 | ||||
-rw-r--r-- | examples/example1.cpp | 149 | ||||
-rw-r--r-- | examples/example2.cpp | 99 | ||||
-rw-r--r-- | examples/example3.cpp | 223 | ||||
-rw-r--r-- | examples/example4.cpp | 144 | ||||
-rw-r--r-- | examples/example5.cpp | 223 |
7 files changed, 1332 insertions, 0 deletions
diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..d62a796 --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,11 @@ +noinst_PROGRAMS = example1 example2 example3 example4 example5 + +example1_SOURCES = example1.cpp +example2_SOURCES = example2.cpp +example3_SOURCES = example3.cpp +example4_SOURCES = example4.cpp +example5_SOURCES = example5.cpp + +INCLUDES = @RTP_JTHREADINCLUDES@ -I ../src/ +LDADD = ../src/.libs/libjrtp.a @RTP_LINKLIBS@ + diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100644 index 0000000..799dcca --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,483 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = .. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +noinst_PROGRAMS = example1$(EXEEXT) example2$(EXEEXT) \ + example3$(EXEEXT) example4$(EXEEXT) example5$(EXEEXT) +subdir = examples +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_example1_OBJECTS = example1.$(OBJEXT) +example1_OBJECTS = $(am_example1_OBJECTS) +example1_LDADD = $(LDADD) +example1_DEPENDENCIES = ../src/.libs/libjrtp.a +am_example2_OBJECTS = example2.$(OBJEXT) +example2_OBJECTS = $(am_example2_OBJECTS) +example2_LDADD = $(LDADD) +example2_DEPENDENCIES = ../src/.libs/libjrtp.a +am_example3_OBJECTS = example3.$(OBJEXT) +example3_OBJECTS = $(am_example3_OBJECTS) +example3_LDADD = $(LDADD) +example3_DEPENDENCIES = ../src/.libs/libjrtp.a +am_example4_OBJECTS = example4.$(OBJEXT) +example4_OBJECTS = $(am_example4_OBJECTS) +example4_LDADD = $(LDADD) +example4_DEPENDENCIES = ../src/.libs/libjrtp.a +am_example5_OBJECTS = example5.$(OBJEXT) +example5_OBJECTS = $(am_example5_OBJECTS) +example5_LDADD = $(LDADD) +example5_DEPENDENCIES = ../src/.libs/libjrtp.a +DEFAULT_INCLUDES = -I. -I$(srcdir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ + $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ +SOURCES = $(example1_SOURCES) $(example2_SOURCES) $(example3_SOURCES) \ + $(example4_SOURCES) $(example5_SOURCES) +DIST_SOURCES = $(example1_SOURCES) $(example2_SOURCES) \ + $(example3_SOURCES) $(example4_SOURCES) $(example5_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RANLIB = @RANLIB@ +RTP_ENDIAN = @RTP_ENDIAN@ +RTP_FILIO = @RTP_FILIO@ +RTP_HAVE_SOCKADDR_LEN = @RTP_HAVE_SOCKADDR_LEN@ +RTP_JTHREADINCLUDES = @RTP_JTHREADINCLUDES@ +RTP_LINKLIBS = @RTP_LINKLIBS@ +RTP_SOCKIO = @RTP_SOCKIO@ +RTP_SOCKLENTYPE_UINT = @RTP_SOCKLENTYPE_UINT@ +RTP_SUPPORT_GETLOGINR = @RTP_SUPPORT_GETLOGINR@ +RTP_SUPPORT_GNUDRAND = @RTP_SUPPORT_GNUDRAND@ +RTP_SUPPORT_IFADDRS = @RTP_SUPPORT_IFADDRS@ +RTP_SUPPORT_INLINETEMPLATEPARAM = @RTP_SUPPORT_INLINETEMPLATEPARAM@ +RTP_SUPPORT_IPV4MULTICAST = @RTP_SUPPORT_IPV4MULTICAST@ +RTP_SUPPORT_IPV6 = @RTP_SUPPORT_IPV6@ +RTP_SUPPORT_IPV6MULTICAST = @RTP_SUPPORT_IPV6MULTICAST@ +RTP_SUPPORT_MEMORYMANAGEMENT = @RTP_SUPPORT_MEMORYMANAGEMENT@ +RTP_SUPPORT_PROBATION = @RTP_SUPPORT_PROBATION@ +RTP_SUPPORT_RANDR = @RTP_SUPPORT_RANDR@ +RTP_SUPPORT_SDESPRIV = @RTP_SUPPORT_SDESPRIV@ +RTP_SUPPORT_SENDAPP = @RTP_SUPPORT_SENDAPP@ +RTP_SUPPORT_THREAD = @RTP_SUPPORT_THREAD@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +example1_SOURCES = example1.cpp +example2_SOURCES = example2.cpp +example3_SOURCES = example3.cpp +example4_SOURCES = example4.cpp +example5_SOURCES = example5.cpp +INCLUDES = @RTP_JTHREADINCLUDES@ -I ../src/ +LDADD = ../src/.libs/libjrtp.a @RTP_LINKLIBS@ +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign examples/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +clean-noinstPROGRAMS: + @list='$(noinst_PROGRAMS)'; for p in $$list; do \ + f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f $$p $$f"; \ + rm -f $$p $$f ; \ + done +example1$(EXEEXT): $(example1_OBJECTS) $(example1_DEPENDENCIES) + @rm -f example1$(EXEEXT) + $(CXXLINK) $(example1_LDFLAGS) $(example1_OBJECTS) $(example1_LDADD) $(LIBS) +example2$(EXEEXT): $(example2_OBJECTS) $(example2_DEPENDENCIES) + @rm -f example2$(EXEEXT) + $(CXXLINK) $(example2_LDFLAGS) $(example2_OBJECTS) $(example2_LDADD) $(LIBS) +example3$(EXEEXT): $(example3_OBJECTS) $(example3_DEPENDENCIES) + @rm -f example3$(EXEEXT) + $(CXXLINK) $(example3_LDFLAGS) $(example3_OBJECTS) $(example3_LDADD) $(LIBS) +example4$(EXEEXT): $(example4_OBJECTS) $(example4_DEPENDENCIES) + @rm -f example4$(EXEEXT) + $(CXXLINK) $(example4_LDFLAGS) $(example4_OBJECTS) $(example4_LDADD) $(LIBS) +example5$(EXEEXT): $(example5_OBJECTS) $(example5_DEPENDENCIES) + @rm -f example5$(EXEEXT) + $(CXXLINK) $(example5_LDFLAGS) $(example5_OBJECTS) $(example5_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example1.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example2.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example3.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example4.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/example5.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ +@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(PROGRAMS) +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ + mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-libtool distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-am + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-info-am + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-noinstPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-exec \ + install-exec-am install-info install-info-am install-man \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/examples/example1.cpp b/examples/example1.cpp new file mode 100644 index 0000000..f90df9f --- /dev/null +++ b/examples/example1.cpp @@ -0,0 +1,149 @@ +/* + Here's a small IPv4 example: it asks for a portbase and a destination and + starts sending packets to that destination. +*/ + +#include "rtpsession.h" +#include "rtppacket.h" +#include "rtpudpv4transmitter.h" +#include "rtpipv4address.h" +#include "rtpsessionparams.h" +#include "rtperrors.h" +#ifndef WIN32 + #include <netinet/in.h> + #include <arpa/inet.h> +#else + #include <winsock2.h> +#endif // WIN32 +#include <stdlib.h> +#include <stdio.h> +#include <iostream> +#include <string> + +// +// This function checks if there was a RTP error. If so, it displays an error +// message and exists. +// + +void checkerror(int rtperr) +{ + if (rtperr < 0) + { + std::cout << "ERROR: " << RTPGetErrorString(rtperr) << std::endl; + exit(-1); + } +} + +// +// The main routine +// + +int main(void) +{ +#ifdef WIN32 + WSADATA dat; + WSAStartup(MAKEWORD(2,2),&dat); +#endif // WIN32 + + RTPSession sess; + uint16_t portbase,destport; + uint32_t destip; + std::string ipstr; + int status,i,num; + + // First, we'll ask for the necessary information + + std::cout << "Enter local portbase:" << std::endl; + std::cin >> portbase; + std::cout << std::endl; + + std::cout << "Enter the destination IP address" << std::endl; + std::cin >> ipstr; + destip = inet_addr(ipstr.c_str()); + if (destip == INADDR_NONE) + { + std::cerr << "Bad IP address specified" << std::endl; + return -1; + } + + // The inet_addr function returns a value in network byte order, but + // we need the IP address in host byte order, so we use a call to + // ntohl + destip = ntohl(destip); + + std::cout << "Enter the destination port" << std::endl; + std::cin >> destport; + + std::cout << std::endl; + std::cout << "Number of packets you wish to be sent:" << std::endl; + std::cin >> num; + + // Now, we'll create a RTP session, set the destination, send some + // packets and poll for incoming data. + + RTPUDPv4TransmissionParams transparams; + RTPSessionParams sessparams; + + // IMPORTANT: The local timestamp unit MUST be set, otherwise + // RTCP Sender Report info will be calculated wrong + // In this case, we'll be sending 10 samples each second, so we'll + // put the timestamp unit to (1.0/10.0) + sessparams.SetOwnTimestampUnit(1.0/10.0); + + sessparams.SetAcceptOwnPackets(true); + transparams.SetPortbase(portbase); + status = sess.Create(sessparams,&transparams); + checkerror(status); + + RTPIPv4Address addr(destip,destport); + + status = sess.AddDestination(addr); + checkerror(status); + + for (i = 1 ; i <= num ; i++) + { + printf("\nSending packet %d/%d\n",i,num); + + // send the packet + status = sess.SendPacket((void *)"1234567890",10,0,false,10); + checkerror(status); + + sess.BeginDataAccess(); + + // check incoming packets + if (sess.GotoFirstSourceWithData()) + { + do + { + RTPPacket *pack; + + while ((pack = sess.GetNextPacket()) != NULL) + { + // You can examine the data here + printf("Got packet !\n"); + + // we don't longer need the packet, so + // we'll delete it + sess.DeletePacket(pack); + } + } while (sess.GotoNextSourceWithData()); + } + + sess.EndDataAccess(); + +#ifndef RTP_SUPPORT_THREAD + status = sess.Poll(); + checkerror(status); +#endif // RTP_SUPPORT_THREAD + + RTPTime::Wait(RTPTime(1,0)); + } + + sess.BYEDestroy(RTPTime(10,0),0,0); + +#ifdef WIN32 + WSACleanup(); +#endif // WIN32 + return 0; +} + diff --git a/examples/example2.cpp b/examples/example2.cpp new file mode 100644 index 0000000..30b8471 --- /dev/null +++ b/examples/example2.cpp @@ -0,0 +1,99 @@ +#include "rtpsession.h" +#include "rtpsessionparams.h" +#include "rtpudpv4transmitter.h" +#include "rtpipv4address.h" +#include "rtptimeutilities.h" +#include "rtppacket.h" +#include <stdlib.h> +#include <iostream> + +int main(void) +{ +#ifdef WIN32 + WSADATA dat; + WSAStartup(MAKEWORD(2,2),&dat); +#endif // WIN32 + + RTPSession session; + + RTPSessionParams sessionparams; + sessionparams.SetOwnTimestampUnit(1.0/8000.0); + + RTPUDPv4TransmissionParams transparams; + transparams.SetPortbase(8000); + + int status = session.Create(sessionparams,&transparams); + if (status < 0) + { + std::cerr << RTPGetErrorString(status) << std::endl; + exit(-1); + } + + uint8_t localip[]={127,0,0,1}; + RTPIPv4Address addr(localip,9000); + + status = session.AddDestination(addr); + if (status < 0) + { + std::cerr << RTPGetErrorString(status) << std::endl; + exit(-1); + } + + session.SetDefaultPayloadType(96); + session.SetDefaultMark(false); + session.SetDefaultTimestampIncrement(160); + + uint8_t silencebuffer[160]; + for (int i = 0 ; i < 160 ; i++) + silencebuffer[i] = 128; + + RTPTime delay(0.020); + RTPTime starttime = RTPTime::CurrentTime(); + + bool done = false; + while (!done) + { + status = session.SendPacket(silencebuffer,160); + if (status < 0) + { + std::cerr << RTPGetErrorString(status) << std::endl; + exit(-1); + } + + session.BeginDataAccess(); + if (session.GotoFirstSource()) + { + do + { + RTPPacket *packet; + + while ((packet = session.GetNextPacket()) != 0) + { + std::cout << "Got packet with " + << "extended sequence number " + << packet->GetExtendedSequenceNumber() + << " from SSRC " << packet->GetSSRC() + << std::endl; + session.DeletePacket(packet); + } + } while (session.GotoNextSource()); + } + session.EndDataAccess(); + + RTPTime::Wait(delay); + + RTPTime t = RTPTime::CurrentTime(); + t -= starttime; + if (t > RTPTime(60.0)) + done = true; + } + + delay = RTPTime(10.0); + session.BYEDestroy(delay,"Time's up",9); + +#ifdef WIN32 + WSACleanup(); +#endif // WIN32 + return 0; +} + diff --git a/examples/example3.cpp b/examples/example3.cpp new file mode 100644 index 0000000..ee852bc --- /dev/null +++ b/examples/example3.cpp @@ -0,0 +1,223 @@ +/* + This IPv4 example listens for incoming packets and automatically adds destinations + for new sources. +*/ + +#include "rtpsession.h" +#include "rtppacket.h" +#include "rtpudpv4transmitter.h" +#include "rtpipv4address.h" +#include "rtpsessionparams.h" +#include "rtperrors.h" +#ifndef WIN32 + #include <netinet/in.h> + #include <arpa/inet.h> +#else + #include <winsock2.h> +#endif // WIN32 +#include "rtpsourcedata.h" +#include <stdlib.h> +#include <stdio.h> +#include <iostream> +#include <string> + +// +// This function checks if there was a RTP error. If so, it displays an error +// message and exists. +// + +void checkerror(int rtperr) +{ + if (rtperr < 0) + { + std::cout << "ERROR: " << RTPGetErrorString(rtperr) << std::endl; + exit(-1); + } +} + +// +// The new class routine +// + +class MyRTPSession : public RTPSession +{ +protected: + void OnNewSource(RTPSourceData *dat) + { + if (dat->IsOwnSSRC()) + return; + + uint32_t ip; + uint16_t port; + + if (dat->GetRTPDataAddress() != 0) + { + const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTPDataAddress()); + ip = addr->GetIP(); + port = addr->GetPort(); + } + else if (dat->GetRTCPDataAddress() != 0) + { + const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTCPDataAddress()); + ip = addr->GetIP(); + port = addr->GetPort()-1; + } + else + return; + + RTPIPv4Address dest(ip,port); + AddDestination(dest); + + struct in_addr inaddr; + inaddr.s_addr = htonl(ip); + std::cout << "Adding destination " << std::string(inet_ntoa(inaddr)) << ":" << port << std::endl; + } + + void OnBYEPacket(RTPSourceData *dat) + { + if (dat->IsOwnSSRC()) + return; + + uint32_t ip; + uint16_t port; + + if (dat->GetRTPDataAddress() != 0) + { + const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTPDataAddress()); + ip = addr->GetIP(); + port = addr->GetPort(); + } + else if (dat->GetRTCPDataAddress() != 0) + { + const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTCPDataAddress()); + ip = addr->GetIP(); + port = addr->GetPort()-1; + } + else + return; + + RTPIPv4Address dest(ip,port); + DeleteDestination(dest); + + struct in_addr inaddr; + inaddr.s_addr = htonl(ip); + std::cout << "Deleting destination " << std::string(inet_ntoa(inaddr)) << ":" << port << std::endl; + } + + void OnRemoveSource(RTPSourceData *dat) + { + if (dat->IsOwnSSRC()) + return; + if (dat->ReceivedBYE()) + return; + + uint32_t ip; + uint16_t port; + + if (dat->GetRTPDataAddress() != 0) + { + const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTPDataAddress()); + ip = addr->GetIP(); + port = addr->GetPort(); + } + else if (dat->GetRTCPDataAddress() != 0) + { + const RTPIPv4Address *addr = (const RTPIPv4Address *)(dat->GetRTCPDataAddress()); + ip = addr->GetIP(); + port = addr->GetPort()-1; + } + else + return; + + RTPIPv4Address dest(ip,port); + DeleteDestination(dest); + + struct in_addr inaddr; + inaddr.s_addr = htonl(ip); + std::cout << "Deleting destination " << std::string(inet_ntoa(inaddr)) << ":" << port << std::endl; + } +}; + +// +// The main routine +// + +int main(void) +{ +#ifdef WIN32 + WSADATA dat; + WSAStartup(MAKEWORD(2,2),&dat); +#endif // WIN32 + + MyRTPSession sess; + uint16_t portbase; + std::string ipstr; + int status,i,num; + + // First, we'll ask for the necessary information + + std::cout << "Enter local portbase:" << std::endl; + std::cin >> portbase; + std::cout << std::endl; + + std::cout << std::endl; + std::cout << "Number of seconds you wish to wait:" << std::endl; + std::cin >> num; + + // Now, we'll create a RTP session, set the destination + // and poll for incoming data. + + RTPUDPv4TransmissionParams transparams; + RTPSessionParams sessparams; + + // IMPORTANT: The local timestamp unit MUST be set, otherwise + // RTCP Sender Report info will be calculated wrong + // In this case, we'll be just use 8000 samples per second. + sessparams.SetOwnTimestampUnit(1.0/8000.0); + + sessparams.SetAcceptOwnPackets(true); + transparams.SetPortbase(portbase); + status = sess.Create(sessparams,&transparams); + checkerror(status); + + for (i = 1 ; i <= num ; i++) + { + sess.BeginDataAccess(); + + // check incoming packets + if (sess.GotoFirstSourceWithData()) + { + do + { + RTPPacket *pack; + + while ((pack = sess.GetNextPacket()) != NULL) + { + // You can examine the data here + printf("Got packet !\n"); + + // we don't longer need the packet, so + // we'll delete it + sess.DeletePacket(pack); + } + } while (sess.GotoNextSourceWithData()); + } + + sess.EndDataAccess(); + +#ifndef RTP_SUPPORT_THREAD + status = sess.Poll(); + checkerror(status); +#endif // RTP_SUPPORT_THREAD + + RTPTime::Wait(RTPTime(1,0)); + } + + sess.BYEDestroy(RTPTime(10,0),0,0); + +#ifdef WIN32 + WSACleanup(); +#endif // WIN32 + return 0; +} + diff --git a/examples/example4.cpp b/examples/example4.cpp new file mode 100644 index 0000000..56d03f5 --- /dev/null +++ b/examples/example4.cpp @@ -0,0 +1,144 @@ +/* + This IPv4 example uses the background thread itself to process all packets. + You can use example one to send data to the session that's created in this + example. +*/ + +#include "rtpsession.h" +#include "rtppacket.h" +#include "rtpudpv4transmitter.h" +#include "rtpipv4address.h" +#include "rtpsessionparams.h" +#include "rtperrors.h" +#ifndef WIN32 + #include <netinet/in.h> + #include <arpa/inet.h> +#else + #include <winsock2.h> +#endif // WIN32 +#include "rtpsourcedata.h" +#include <stdlib.h> +#include <stdio.h> +#include <iostream> +#include <string> + +#ifdef RTP_SUPPORT_THREAD + +// +// This function checks if there was a RTP error. If so, it displays an error +// message and exists. +// + +void checkerror(int rtperr) +{ + if (rtperr < 0) + { + std::cout << "ERROR: " << RTPGetErrorString(rtperr) << std::endl; + exit(-1); + } +} + +// +// The new class routine +// + +class MyRTPSession : public RTPSession +{ +protected: + void OnPollThreadStep(); + void ProcessRTPPacket(const RTPSourceData &srcdat,const RTPPacket &rtppack); +}; + +void MyRTPSession::OnPollThreadStep() +{ + BeginDataAccess(); + + // check incoming packets + if (GotoFirstSourceWithData()) + { + do + { + RTPPacket *pack; + RTPSourceData *srcdat; + + srcdat = GetCurrentSourceInfo(); + + while ((pack = GetNextPacket()) != NULL) + { + ProcessRTPPacket(*srcdat,*pack); + DeletePacket(pack); + } + } while (GotoNextSourceWithData()); + } + + EndDataAccess(); +} + +void MyRTPSession::ProcessRTPPacket(const RTPSourceData &srcdat,const RTPPacket &rtppack) +{ + // You can inspect the packet and the source's info here + std::cout << "Got packet " << rtppack.GetExtendedSequenceNumber() << " from SSRC " << srcdat.GetSSRC() << std::endl; +} + +// +// The main routine +// + +int main(void) +{ +#ifdef WIN32 + WSADATA dat; + WSAStartup(MAKEWORD(2,2),&dat); +#endif // WIN32 + + MyRTPSession sess; + uint16_t portbase; + std::string ipstr; + int status,num; + + // First, we'll ask for the necessary information + + std::cout << "Enter local portbase:" << std::endl; + std::cin >> portbase; + std::cout << std::endl; + + std::cout << std::endl; + std::cout << "Number of seconds you wish to wait:" << std::endl; + std::cin >> num; + + // Now, we'll create a RTP session, set the destination + // and poll for incoming data. + + RTPUDPv4TransmissionParams transparams; + RTPSessionParams sessparams; + + // IMPORTANT: The local timestamp unit MUST be set, otherwise + // RTCP Sender Report info will be calculated wrong + // In this case, we'll be just use 8000 samples per second. + sessparams.SetOwnTimestampUnit(1.0/8000.0); + + transparams.SetPortbase(portbase); + status = sess.Create(sessparams,&transparams); + checkerror(status); + + // Wait a number of seconds + RTPTime::Wait(RTPTime(num,0)); + + sess.BYEDestroy(RTPTime(10,0),0,0); + +#ifdef WIN32 + WSACleanup(); +#endif // WIN32 + return 0; +} + +#else + +int main(void) +{ + std::cerr << "Thread support is required for this example" << std::endl; + return 0; +} + +#endif // RTP_SUPPORT_THREAD + diff --git a/examples/example5.cpp b/examples/example5.cpp new file mode 100644 index 0000000..63ed042 --- /dev/null +++ b/examples/example5.cpp @@ -0,0 +1,223 @@ +/* + This is a modified version of example1.cpp to illustrate the use of a memory + manager. +*/ + +#include "rtpsession.h" +#include "rtppacket.h" +#include "rtpudpv4transmitter.h" +#include "rtpipv4address.h" +#include "rtpsessionparams.h" +#include "rtperrors.h" +#include "rtpmemorymanager.h" +#ifndef WIN32 + #include <netinet/in.h> + #include <arpa/inet.h> +#else + #include <winsock2.h> +#endif // WIN32 +#include <stdlib.h> +#include <stdio.h> +#include <iostream> +#include <string> + +// +// This function checks if there was a RTP error. If so, it displays an error +// message and exists. +// + +void checkerror(int rtperr) +{ + if (rtperr < 0) + { + std::cout << "ERROR: " << RTPGetErrorString(rtperr) << std::endl; + exit(-1); + } +} + +// +// The main routine +// + +#ifdef RTP_SUPPORT_THREAD + +class MyMemoryManager : public RTPMemoryManager +{ +public: + MyMemoryManager() + { + mutex.Init(); + alloccount = 0; + freecount = 0; + } + ~MyMemoryManager() + { + std::cout << "alloc: " << alloccount << " free: " << freecount << std::endl; + } + void *AllocateBuffer(size_t numbytes, int memtype) + { + mutex.Lock(); + void *buf = malloc(numbytes); + std::cout << "Allocated " << numbytes << " bytes at location " << buf << " (memtype = " << memtype << ")" << std::endl; + alloccount++; + mutex.Unlock(); + return buf; + } + + void FreeBuffer(void *p) + { + mutex.Lock(); + std::cout << "Freeing block " << p << std::endl; + freecount++; + free(p); + mutex.Unlock(); + } +private: + int alloccount,freecount; + JMutex mutex; +}; + +#else + +class MyMemoryManager : public RTPMemoryManager +{ +public: + MyMemoryManager() + { + alloccount = 0; + freecount = 0; + } + ~MyMemoryManager() + { + std::cout << "alloc: " << alloccount << " free: " << freecount << std::endl; + } + void *AllocateBuffer(size_t numbytes, int memtype) + { + void *buf = malloc(numbytes); + std::cout << "Allocated " << numbytes << " bytes at location " << buf << " (memtype = " << memtype << ")" << std::endl; + alloccount++; + return buf; + } + + void FreeBuffer(void *p) + { + std::cout << "Freeing block " << p << std::endl; + freecount++; + free(p); + } +private: + int alloccount,freecount; +}; + +#endif // RTP_SUPPORT_THREAD + +int main(void) +{ +#ifdef WIN32 + WSADATA dat; + WSAStartup(MAKEWORD(2,2),&dat); +#endif // WIN32 + + MyMemoryManager mgr; + RTPSession sess(&mgr); + uint16_t portbase,destport; + uint32_t destip; + std::string ipstr; + int status,i,num; + + // First, we'll ask for the necessary information + + std::cout << "Enter local portbase:" << std::endl; + std::cin >> portbase; + std::cout << std::endl; + + std::cout << "Enter the destination IP address" << std::endl; + std::cin >> ipstr; + destip = inet_addr(ipstr.c_str()); + if (destip == INADDR_NONE) + { + std::cerr << "Bad IP address specified" << std::endl; + return -1; + } + + // The inet_addr function returns a value in network byte order, but + // we need the IP address in host byte order, so we use a call to + // ntohl + destip = ntohl(destip); + + std::cout << "Enter the destination port" << std::endl; + std::cin >> destport; + + std::cout << std::endl; + std::cout << "Number of packets you wish to be sent:" << std::endl; + std::cin >> num; + + // Now, we'll create a RTP session, set the destination, send some + // packets and poll for incoming data. + + RTPUDPv4TransmissionParams transparams; + RTPSessionParams sessparams; + + // IMPORTANT: The local timestamp unit MUST be set, otherwise + // RTCP Sender Report info will be calculated wrong + // In this case, we'll be sending 10 samples each second, so we'll + // put the timestamp unit to (1.0/10.0) + sessparams.SetOwnTimestampUnit(1.0/10.0); + + sessparams.SetAcceptOwnPackets(true); + transparams.SetPortbase(portbase); + status = sess.Create(sessparams,&transparams); + checkerror(status); + + RTPIPv4Address addr(destip,destport); + + status = sess.AddDestination(addr); + checkerror(status); + + for (i = 1 ; i <= num ; i++) + { + printf("\nSending packet %d/%d\n",i,num); + + // send the packet + status = sess.SendPacket((void *)"1234567890",10,0,false,10); + checkerror(status); + + sess.BeginDataAccess(); + + // check incoming packets + if (sess.GotoFirstSourceWithData()) + { + do + { + RTPPacket *pack; + + while ((pack = sess.GetNextPacket()) != NULL) + { + // You can examine the data here + printf("Got packet !\n"); + + // we don't longer need the packet, so + // we'll delete it + sess.DeletePacket(pack); + } + } while (sess.GotoNextSourceWithData()); + } + + sess.EndDataAccess(); + +#ifndef RTP_SUPPORT_THREAD + status = sess.Poll(); + checkerror(status); +#endif // RTP_SUPPORT_THREAD + + RTPTime::Wait(RTPTime(1,0)); + } + + sess.BYEDestroy(RTPTime(10,0),0,0); + +#ifdef WIN32 + WSACleanup(); +#endif // WIN32 + return 0; +} + |