├── CMakeLists.txt ├── ChangeLog ├── DEFINES ├── Doxyfile ├── LICENSE.GPL ├── LICENSE.LGPL ├── README.md ├── TODO ├── builddist.sh ├── cmake ├── EMIPLIBConfig.cmake.in ├── FindAudioFile.cmake ├── FindESound.cmake ├── FindJACK.cmake ├── FindJRTPLIB.cmake ├── FindJThread.cmake ├── FindLibAVCodec.cmake ├── FindLibSndFile.cmake ├── FindOpus.cmake ├── FindPortAudio.cmake ├── FindPulseAudio.cmake ├── FindSpeex.cmake └── Macros.cmake ├── doc ├── bufferchain.png ├── bufferchain.svg ├── chainbuilding.png ├── chainbuilding.svg ├── mainpage.h ├── nobufferchain.png ├── nobufferchain.svg ├── sound3d.png ├── sound3d.svg ├── subchains1.png ├── subchains1.svg ├── subchains2.png ├── subchains2.svg ├── subchains3.png ├── subchains3.svg ├── subchains4.png └── subchains4.svg ├── examples ├── CMakeLists.txt ├── audiosession.cpp ├── avsession.cpp ├── feedbackexample.cpp ├── multiplesoundfileplayer.cpp ├── pushtotalk.cpp ├── pushtotalk2.cpp ├── simplechain.cpp ├── soundfileplayer.cpp ├── soundrecorder.cpp └── soundvolume.cpp ├── homepage ├── EDM-UH.png ├── Makefile ├── emiplib-3dsound-screenshot.png ├── emiplib-avsession-screenshot.png ├── emiplib-wcesipphone-screenshot.jpg ├── emiplib.md └── md.py ├── pkgconfig └── emiplib.pc.in ├── sphinxdoc ├── Makefile ├── README.md └── source │ ├── _static │ └── .dummy │ ├── _templates │ └── .dummy │ └── conf.py ├── src ├── CMakeLists.txt ├── components │ ├── codec │ │ ├── mipalawdecoder.cpp │ │ ├── mipalawdecoder.h │ │ ├── mipalawencoder.cpp │ │ ├── mipalawencoder.h │ │ ├── mipavcodecdecoder.cpp │ │ ├── mipavcodecdecoder.h │ │ ├── mipavcodecencoder.cpp │ │ ├── mipavcodecencoder.h │ │ ├── mipgsmdecoder.cpp │ │ ├── mipgsmdecoder.h │ │ ├── mipgsmencoder.cpp │ │ ├── mipgsmencoder.h │ │ ├── miplpcdecoder.cpp │ │ ├── miplpcdecoder.h │ │ ├── miplpcencoder.cpp │ │ ├── miplpcencoder.h │ │ ├── mipopusdecoder.cpp │ │ ├── mipopusdecoder.h │ │ ├── mipopusencoder.cpp │ │ ├── mipopusencoder.h │ │ ├── mipsilkdecoder.cpp │ │ ├── mipsilkdecoder.h │ │ ├── mipsilkencoder.cpp │ │ ├── mipsilkencoder.h │ │ ├── mipspeexdecoder.cpp │ │ ├── mipspeexdecoder.h │ │ ├── mipspeexencoder.cpp │ │ ├── mipspeexencoder.h │ │ ├── miptinyjpegdecoder.cpp │ │ ├── miptinyjpegdecoder.h │ │ ├── mipulawdecoder.cpp │ │ ├── mipulawdecoder.h │ │ ├── mipulawencoder.cpp │ │ └── mipulawencoder.h │ ├── input │ │ ├── mipalsainput.cpp │ │ ├── mipalsainput.h │ │ ├── mipaudiofileinput.cpp │ │ ├── mipaudiofileinput.h │ │ ├── mipaudiorecorderinput.cpp │ │ ├── mipaudiorecorderinput.h │ │ ├── mipdirectshowcapture.cpp │ │ ├── mipdirectshowcapture.h │ │ ├── mipfrequencygenerator.cpp │ │ ├── mipfrequencygenerator.h │ │ ├── mipjackinput.cpp │ │ ├── mipjackinput.h │ │ ├── mipopenslesandroidinput.cpp │ │ ├── mipopenslesandroidinput.h │ │ ├── mipsndfileinput.cpp │ │ ├── mipsndfileinput.h │ │ ├── mipv4l2input.cpp │ │ ├── mipv4l2input.h │ │ ├── mipwavinput.cpp │ │ ├── mipwavinput.h │ │ ├── mipwinmminput.cpp │ │ ├── mipwinmminput.h │ │ ├── mipyuv420fileinput.cpp │ │ └── mipyuv420fileinput.h │ ├── io │ │ ├── mipossinputoutput.cpp │ │ ├── mipossinputoutput.h │ │ ├── mippainputoutput.cpp │ │ └── mippainputoutput.h │ ├── mixer │ │ ├── mipaudiomixer.cpp │ │ ├── mipaudiomixer.h │ │ ├── mipmediabuffer.cpp │ │ ├── mipmediabuffer.h │ │ ├── mipvideomixer.cpp │ │ └── mipvideomixer.h │ ├── output │ │ ├── mipalsaoutput.cpp │ │ ├── mipalsaoutput.h │ │ ├── mipaudiotrackoutput.cpp │ │ ├── mipaudiotrackoutput.h │ │ ├── mipesdoutput.cpp │ │ ├── mipesdoutput.h │ │ ├── mipjackoutput.cpp │ │ ├── mipjackoutput.h │ │ ├── mipmessagedumper.cpp │ │ ├── mipmessagedumper.h │ │ ├── mipopenaloutput.cpp │ │ ├── mipopenaloutput.h │ │ ├── mipopenslesandroidoutput.cpp │ │ ├── mipopenslesandroidoutput.h │ │ ├── mippulseoutput.cpp │ │ ├── mippulseoutput.h │ │ ├── mipqt5audiooutput.cpp │ │ ├── mipqt5audiooutput.h │ │ ├── mipqt5output.cpp │ │ ├── mipqt5output.h │ │ ├── mipqt5outputtemplate.h │ │ ├── mipsdlaudiooutput.cpp │ │ ├── mipsdlaudiooutput.h │ │ ├── mipsndfileoutput.cpp │ │ ├── mipsndfileoutput.h │ │ ├── mipvideoframestorage.cpp │ │ ├── mipvideoframestorage.h │ │ ├── mipwavoutput.cpp │ │ ├── mipwavoutput.h │ │ ├── mipwinmmoutput.cpp │ │ └── mipwinmmoutput.h │ ├── timer │ │ ├── mipaveragetimer.cpp │ │ ├── mipaveragetimer.h │ │ ├── mipinterchaintimer.cpp │ │ ├── mipinterchaintimer.h │ │ ├── mippusheventtimer.cpp │ │ └── mippusheventtimer.h │ ├── transform │ │ ├── mipaudio3dbase.cpp │ │ ├── mipaudio3dbase.h │ │ ├── mipaudiodistancefade.cpp │ │ ├── mipaudiodistancefade.h │ │ ├── mipaudiofilter.cpp │ │ ├── mipaudiofilter.h │ │ ├── mipaudiosplitter.cpp │ │ ├── mipaudiosplitter.h │ │ ├── mipavcodecframeconverter.cpp │ │ ├── mipavcodecframeconverter.h │ │ ├── miphrirbase.h │ │ ├── miphrirlisten.cpp │ │ ├── miphrirlisten.h │ │ ├── mipsampleencoder.cpp │ │ ├── mipsampleencoder.h │ │ ├── mipsamplingrateconverter.cpp │ │ ├── mipsamplingrateconverter.h │ │ ├── mipspeexechocanceller.cpp │ │ ├── mipspeexechocanceller.h │ │ ├── mipyuv420framecutter.cpp │ │ └── mipyuv420framecutter.h │ ├── transmission │ │ ├── miprtpalawdecoder.cpp │ │ ├── miprtpalawdecoder.h │ │ ├── miprtpalawencoder.cpp │ │ ├── miprtpalawencoder.h │ │ ├── miprtpcomponent.cpp │ │ ├── miprtpcomponent.h │ │ ├── miprtpdecoder.cpp │ │ ├── miprtpdecoder.h │ │ ├── miprtpdummydecoder.h │ │ ├── miprtpencoder.h │ │ ├── miprtpgsmdecoder.cpp │ │ ├── miprtpgsmdecoder.h │ │ ├── miprtpgsmencoder.cpp │ │ ├── miprtpgsmencoder.h │ │ ├── miprtph263decoder.cpp │ │ ├── miprtph263decoder.h │ │ ├── miprtph263encoder.cpp │ │ ├── miprtph263encoder.h │ │ ├── miprtpjpegdecoder.cpp │ │ ├── miprtpjpegdecoder.h │ │ ├── miprtpl16decoder.cpp │ │ ├── miprtpl16decoder.h │ │ ├── miprtpl16encoder.cpp │ │ ├── miprtpl16encoder.h │ │ ├── miprtplpcdecoder.cpp │ │ ├── miprtplpcdecoder.h │ │ ├── miprtplpcencoder.cpp │ │ ├── miprtplpcencoder.h │ │ ├── miprtpopusdecoder.cpp │ │ ├── miprtpopusdecoder.h │ │ ├── miprtpopusencoder.cpp │ │ ├── miprtpopusencoder.h │ │ ├── miprtppacketdecoder.h │ │ ├── miprtpsilkdecoder.cpp │ │ ├── miprtpsilkdecoder.h │ │ ├── miprtpsilkencoder.cpp │ │ ├── miprtpsilkencoder.h │ │ ├── miprtpspeexdecoder.cpp │ │ ├── miprtpspeexdecoder.h │ │ ├── miprtpspeexencoder.cpp │ │ ├── miprtpspeexencoder.h │ │ ├── miprtpulawdecoder.cpp │ │ ├── miprtpulawdecoder.h │ │ ├── miprtpulawencoder.cpp │ │ ├── miprtpulawencoder.h │ │ ├── miprtpvideodecoder.cpp │ │ ├── miprtpvideodecoder.h │ │ ├── miprtpvideoencoder.cpp │ │ └── miprtpvideoencoder.h │ └── util │ │ ├── mipoutputmessagequeue.cpp │ │ ├── mipoutputmessagequeue.h │ │ ├── mipoutputmessagequeuesimple.cpp │ │ ├── mipoutputmessagequeuesimple.h │ │ ├── mipoutputmessagequeuewithstate.cpp │ │ ├── mipoutputmessagequeuewithstate.h │ │ ├── mipoutputmessagequeuewithstatesimple.cpp │ │ └── mipoutputmessagequeuewithstatesimple.h ├── core │ ├── mipaudiomessage.h │ ├── mipcompat.h │ ├── mipcomponent.cpp │ ├── mipcomponent.h │ ├── mipcomponentalias.h │ ├── mipcomponentchain.cpp │ ├── mipcomponentchain.h │ ├── mipconfig.h.in │ ├── mipdebug.cpp │ ├── mipdebug.h │ ├── mipencodedaudiomessage.h │ ├── mipencodedvideomessage.h │ ├── miperrorbase.h │ ├── mipfeedback.h │ ├── mipmediamessage.h │ ├── mipmessage.h │ ├── miprawaudiomessage.h │ ├── miprawvideomessage.h │ ├── miprtpmessage.h │ ├── mipsystemmessage.h │ ├── miptime.cpp │ ├── miptime.h │ ├── miptypes.h.in │ ├── miptypes_win.h │ ├── mipversion.cpp │ ├── mipversion.h │ ├── mipversioninternal.h.in │ └── mipvideomessage.h ├── sessions │ ├── mipaudiosession.cpp │ ├── mipaudiosession.h │ ├── mipvideosession.cpp │ └── mipvideosession.h ├── thirdparty │ ├── gsm │ │ ├── COPYRIGHT │ │ ├── README │ │ ├── doc │ │ │ ├── COPYRIGHT │ │ │ ├── ChangeLog │ │ │ ├── ChangeLog.orig │ │ │ ├── INSTALL │ │ │ ├── MACHINES │ │ │ ├── MANIFEST │ │ │ └── README │ │ ├── inc │ │ │ ├── config.h │ │ │ ├── gsm.h │ │ │ ├── private.h │ │ │ ├── proto.h │ │ │ └── unproto.h │ │ └── src │ │ │ ├── gsm_add.cpp │ │ │ ├── gsm_code.cpp │ │ │ ├── gsm_create.cpp │ │ │ ├── gsm_debug.cpp │ │ │ ├── gsm_decode.cpp │ │ │ ├── gsm_decode2.cpp │ │ │ ├── gsm_destroy.cpp │ │ │ ├── gsm_encode.cpp │ │ │ ├── gsm_explode.cpp │ │ │ ├── gsm_implode.cpp │ │ │ ├── gsm_long_term.cpp │ │ │ ├── gsm_lpc.cpp │ │ │ ├── gsm_option.cpp │ │ │ ├── gsm_preprocess.cpp │ │ │ ├── gsm_print.cpp │ │ │ ├── gsm_rpe.cpp │ │ │ ├── gsm_short_term.cpp │ │ │ └── gsm_table.cpp │ ├── lpc │ │ ├── README │ │ ├── lpccodec.cpp │ │ └── lpccodec.h │ └── tinyjpeg │ │ ├── README │ │ ├── jidctflt.c │ │ ├── tinyjpeg-internal.h │ │ ├── tinyjpeg.c │ │ └── tinyjpeg.h └── util │ ├── mipdirectorybrowser.cpp │ ├── mipdirectorybrowser.h │ ├── mipresample.h │ ├── miprtppacketgrouper.cpp │ ├── miprtppacketgrouper.h │ ├── miprtpsynchronizer.cpp │ ├── miprtpsynchronizer.h │ ├── mipsignalwaiter.cpp │ ├── mipsignalwaiter.h │ ├── mipspeexutil.cpp │ ├── mipspeexutil.h │ ├── mipstreambuffer.cpp │ ├── mipstreambuffer.h │ ├── mipwavreader.cpp │ ├── mipwavreader.h │ ├── mipwavwriter.cpp │ └── mipwavwriter.h ├── tests ├── CMakeLists.txt ├── alsaintest.cpp ├── alsaouttest.cpp ├── audiocodectest.cpp ├── delayedchainstarttest.cpp ├── portaudioouttest.cpp ├── pulseouttest.cpp ├── qtaudiooutput.cpp ├── qtouttest.cpp ├── replayaudio.cpp ├── streamopus.cpp ├── streamopus.sdp ├── streamopusrecv.cpp └── streamopusrecv2.cpp └── tools ├── jrtplibversion ├── CMakeLists.txt └── jrtplibversion.cpp ├── openslesandroid.cpp ├── osstest.cpp ├── v4ltest.cpp └── winmmtest.cpp /ChangeLog: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/ChangeLog -------------------------------------------------------------------------------- /DEFINES: -------------------------------------------------------------------------------- 1 | Defines currently in use: 2 | MIPDEBUG 3 | MIPCONFIG_GPL 4 | MIPCONFIG_BIGENDIAN 5 | MIPCONFIG_SUPPORT_SNDFILE 6 | MIPCONFIG_SUPPORT_AUDIOFILE 7 | MIPCONFIG_SUPPORT_QT5 8 | MIPCONFIG_SUPPORT_ALSA 9 | MIPCONFIG_SUPPORT_ESD 10 | MIPCONFIG_SUPPORT_SPEEX 11 | MIPCONFIG_SUPPORT_AVCODEC 12 | MIPCONFIG_SUPPORT_INTELIPP 13 | MIPCONFIG_SUPPORT_DIRECTSHOW 14 | MIPCONFIG_SUPPORT_ESD 15 | MIPCONFIG_SUPPORT_JACK 16 | MIPCONFIG_SUPPORT_VIDEO4LINUX 17 | MIPCONFIG_SUPPORT_OSS 18 | MIPCONFIG_SUPPORT_SDLAUDIO 19 | MIPCONFIG_SUPPORT_LPC 20 | MIPCONFIG_SUPPORT_GSM 21 | MIPCONFIG_SUPPORT_OPENAL 22 | MIPCONFIG_SUPPORT_PORTAUDIO 23 | MIPCONFIG_SUPPORT_AUDIOTRACK 24 | MIPCONFIG_SUPPORT_AUDIORECORDER 25 | MIPCONFIG_SUPPORT_WINMM 26 | MIPCONFIG_SUPPORT_SILK 27 | MIPCONFIG_SUPPORT_OPUS 28 | MIPCONFIG_SUPPORT_PULSEAUDIO 29 | -------------------------------------------------------------------------------- /TODO: -------------------------------------------------------------------------------- 1 | 2 | * If no messages are passed (e.g. when a source is no longer transmitting 3 | data, the push member function will not be called, and no timeouts will 4 | be performed 5 | -> add a virtual function to indicate when a new iteration starts? 6 | -> or just pass a nullptr message? (this would mean that _all_ existing 7 | components need to be modified to be able to handle this) 8 | 9 | * Add codecs for video. 10 | * Improve the ALSA output component. 11 | * Add 8-bit sample support to the ESD output component. 12 | * Rewrite the audio session to allow a choice between available input 13 | and output components. 14 | -------------------------------------------------------------------------------- /builddist.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | VERSION_MAJOR=`cat CMakeLists.txt|grep VERSION_MAJOR | head -n 1 | grep set | head -n 1 |cut -f 2 -d " "|cut -f 1 -d ")"` 4 | VERSION_MINOR=`cat CMakeLists.txt|grep VERSION_MINOR | head -n 1 | grep set | head -n 1 |cut -f 2 -d " "|cut -f 1 -d ")"` 5 | VERSION_DEBUG=`cat CMakeLists.txt|grep VERSION_DEBUG | head -n 1 | grep set | head -n 1 |cut -f 2 -d " "|cut -f 1 -d ")"` 6 | VERSION=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_DEBUG 7 | LIBNAME=emiplib 8 | 9 | TMPDIR=`tempfile` 10 | CURDIR=`pwd` 11 | rm -r $TMPDIR 12 | if ! mkdir $TMPDIR ; then 13 | echo "Couldn't create temporary directory" 14 | exit -1 15 | fi 16 | 17 | cd $TMPDIR 18 | TMPDIR=`pwd` # Get the full path 19 | cd $CURDIR 20 | 21 | if ! git archive --format tar --prefix=${LIBNAME}-${VERSION}/ HEAD | (cd $TMPDIR && tar xf -) ; then 22 | echo "Couldn't archive repository" 23 | exit -1 24 | fi 25 | 26 | cd $TMPDIR/${LIBNAME}-${VERSION} 27 | 28 | rm -f `find . -name ".git*"` 29 | rm -f builddist.sh 30 | rm -rf sphinxdoc 31 | rm -f TODO 32 | rm -rf homepage 33 | 34 | cd .. 35 | 36 | if ! tar cfz ${LIBNAME}-${VERSION}.tar.gz ${LIBNAME}-${VERSION}/ ; then 37 | echo "Couldn't create archive" 38 | exit -1 39 | fi 40 | 41 | if ! tar cfj ${LIBNAME}-${VERSION}.tar.bz2 ${LIBNAME}-${VERSION}/ ; then 42 | echo "Couldn't create archive" 43 | exit -1 44 | fi 45 | 46 | if ! zip ${LIBNAME}-${VERSION}.zip `find ${LIBNAME}-${VERSION}/` ; then 47 | echo "Couldn't create archive" 48 | exit -1 49 | fi 50 | 51 | mv $TMPDIR $CURDIR/ 52 | 53 | 54 | -------------------------------------------------------------------------------- /cmake/EMIPLIBConfig.cmake.in: -------------------------------------------------------------------------------- 1 | 2 | set(EMIPLIB_FOUND 1) 3 | 4 | ${EMIPLIB_REQUIRED_MODULES} 5 | 6 | set(EMIPLIB_INCLUDE_DIRS ${EMIPLIB_INCDIRS_CMAKECONFIG}) 7 | 8 | set(EMIPLIB_LIBRARIES ${EMIPLIB_LIBS_CMAKECONFIG}) 9 | 10 | -------------------------------------------------------------------------------- /cmake/FindAudioFile.cmake: -------------------------------------------------------------------------------- 1 | 2 | find_path(AUDIOFILE_INCLUDE_DIR audiofile.h) 3 | 4 | set(AUDIOFILE_INCLUDE_DIRS ${AUDIOFILE_INCLUDE_DIR}) 5 | 6 | find_library(AUDIOFILE_LIBRARY audiofile) 7 | if (AUDIOFILE_LIBRARY) 8 | set(AUDIOFILE_LIBRARIES ${AUDIOFILE_LIBRARY}) 9 | endif (AUDIOFILE_LIBRARY) 10 | 11 | include(FindPackageHandleStandardArgs) 12 | 13 | find_package_handle_standard_args(AudioFile DEFAULT_MSG AUDIOFILE_INCLUDE_DIRS AUDIOFILE_LIBRARIES) 14 | 15 | -------------------------------------------------------------------------------- /cmake/FindESound.cmake: -------------------------------------------------------------------------------- 1 | 2 | find_path(ESOUND_INCLUDE_DIR esd.h) 3 | 4 | set(ESOUND_INCLUDE_DIRS ${ESOUND_INCLUDE_DIR}) 5 | 6 | find_library(ESOUND_LIBRARY esd) 7 | if (ESOUND_LIBRARY) 8 | set(ESOUND_LIBRARIES ${ESOUND_LIBRARY}) 9 | endif (ESOUND_LIBRARY) 10 | 11 | include(FindPackageHandleStandardArgs) 12 | 13 | find_package_handle_standard_args(ESound DEFAULT_MSG ESOUND_INCLUDE_DIRS ESOUND_LIBRARIES) 14 | 15 | -------------------------------------------------------------------------------- /cmake/FindJACK.cmake: -------------------------------------------------------------------------------- 1 | 2 | find_path(JACK_INCLUDE_DIR jack/jack.h) 3 | 4 | set(JACK_INCLUDE_DIRS ${JACK_INCLUDE_DIR}) 5 | 6 | find_library(JACK_LIBRARY jack) 7 | if (JACK_LIBRARY) 8 | set(JACK_LIBRARIES ${JACK_LIBRARY}) 9 | endif (JACK_LIBRARY) 10 | 11 | include(FindPackageHandleStandardArgs) 12 | 13 | find_package_handle_standard_args(JACK DEFAULT_MSG JACK_INCLUDE_DIRS JACK_LIBRARIES) 14 | 15 | -------------------------------------------------------------------------------- /cmake/FindJRTPLIB.cmake: -------------------------------------------------------------------------------- 1 | 2 | find_package(JRTPLIB QUIET NO_MODULE) 3 | 4 | if (NOT JRTPLIB_FOUND) # Config file could not be found 5 | find_path(JRTPLIB_INCLUDE_DIR jrtplib3/rtpsession.h) 6 | 7 | set(JRTPLIB_INCLUDE_DIRS ${JRTPLIB_INCLUDE_DIR}) 8 | 9 | if (UNIX) 10 | find_library(JRTPLIB_LIBRARY jrtp) 11 | if (JRTPLIB_LIBRARY) 12 | set(JRTPLIB_LIBRARIES ${JRTPLIB_LIBRARY}) 13 | endif (JRTPLIB_LIBRARY) 14 | else (UNIX) 15 | find_library(JRTPLIB_LIB_RELEASE jrtplib) 16 | find_library(JRTPLIB_LIB_DEBUG jrtplib_d) 17 | 18 | if (JRTPLIB_LIB_RELEASE OR JRTPLIB_LIB_DEBUG) 19 | set(JRTPLIB_LIBRARIES "") 20 | if (JRTPLIB_LIB_RELEASE) 21 | set(JRTPLIB_LIBRARIES ${JRTPLIB_LIBRARIES} optimized ${JRTPLIB_LIB_RELEASE}) 22 | endif (JRTPLIB_LIB_RELEASE) 23 | if (JRTPLIB_LIB_DEBUG) 24 | set(JRTPLIB_LIBRARIES ${JRTPLIB_LIBRARIES} debug ${JRTPLIB_LIB_DEBUG}) 25 | endif (JRTPLIB_LIB_DEBUG) 26 | endif (JRTPLIB_LIB_RELEASE OR JRTPLIB_LIB_DEBUG) 27 | endif(UNIX) 28 | endif (NOT JRTPLIB_FOUND) 29 | 30 | include(FindPackageHandleStandardArgs) 31 | 32 | find_package_handle_standard_args(JRTPLIB DEFAULT_MSG JRTPLIB_INCLUDE_DIRS JRTPLIB_LIBRARIES) 33 | 34 | -------------------------------------------------------------------------------- /cmake/FindJThread.cmake: -------------------------------------------------------------------------------- 1 | 2 | find_package(JThread QUIET NO_MODULE) 3 | 4 | if (NOT JTHREAD_FOUND) # Config file could not be found 5 | find_path(JTHREAD_INCLUDE_DIR jthread/jthread.h) 6 | 7 | set(JTHREAD_INCLUDE_DIRS ${JTHREAD_INCLUDE_DIR}) 8 | 9 | if (UNIX) 10 | find_library(JTHREAD_LIBRARY jthread) 11 | if (JTHREAD_LIBRARY) 12 | set(JTHREAD_LIBRARIES ${JTHREAD_LIBRARY}) 13 | find_library(JTHREAD_PTHREAD_LIB pthread) 14 | if (JTHREAD_PTHREAD_LIB) 15 | set(JTHREAD_LIBRARIES ${JTHREAD_LIBRARY} ${JTHREAD_PTHREAD_LIB}) 16 | endif(JTHREAD_PTHREAD_LIB) 17 | endif (JTHREAD_LIBRARY) 18 | else (UNIX) 19 | find_library(JTHREAD_LIB_RELEASE jthread) 20 | find_library(JTHREAD_LIB_DEBUG jthread_d) 21 | 22 | if (JTHREAD_LIB_RELEASE OR JTHREAD_LIB_DEBUG) 23 | set(JTHREAD_LIBRARIES "") 24 | if (JTHREAD_LIB_RELEASE) 25 | set(JTHREAD_LIBRARIES ${JTHREAD_LIBRARIES} optimized ${JTHREAD_LIB_RELEASE}) 26 | endif (JTHREAD_LIB_RELEASE) 27 | if (JTHREAD_LIB_DEBUG) 28 | set(JTHREAD_LIBRARIES ${JTHREAD_LIBRARIES} debug ${JTHREAD_LIB_DEBUG}) 29 | endif (JTHREAD_LIB_DEBUG) 30 | endif (JTHREAD_LIB_RELEASE OR JTHREAD_LIB_DEBUG) 31 | endif(UNIX) 32 | endif (NOT JTHREAD_FOUND) 33 | 34 | include(FindPackageHandleStandardArgs) 35 | 36 | find_package_handle_standard_args(JThread DEFAULT_MSG JTHREAD_INCLUDE_DIRS JTHREAD_LIBRARIES) 37 | 38 | -------------------------------------------------------------------------------- /cmake/FindLibAVCodec.cmake: -------------------------------------------------------------------------------- 1 | 2 | set(LIBAVCODEC_OLD FALSE) 3 | set(LIBAVCODEC_NEW FALSE) 4 | 5 | find_path(LIBAVCODEC_INCLUDE_DIR_NEW libavcodec/avcodec.h) 6 | if (NOT LIBAVCODEC_INCLUDE_DIR_NEW) 7 | find_path(LIBAVCODEC_INCLUDE_DIR_OLD ffmpeg/avcodec.h) 8 | if (LIBAVCODEC_INCLUDE_DIR_OLD) 9 | set(LIBAVCODEC_INCLUDE_DIRS ${LIBAVCODEC_INCLUDE_DIR_OLD}) 10 | set(LIBAVCODEC_OLD TRUE) 11 | set(LIBAVCODEC_AVCODEC_INIT TRUE) 12 | endif (LIBAVCODEC_INCLUDE_DIR_OLD) 13 | else (NOT LIBAVCODEC_INCLUDE_DIR_NEW) 14 | set(LIBAVCODEC_INCLUDE_DIRS ${LIBAVCODEC_INCLUDE_DIR_NEW}) 15 | set(LIBAVCODEC_NEW TRUE) 16 | set(CMAKE_REQUIRED_INCLUDES ${LIBAVCODEC_INCLUDE_DIR_NEW}) 17 | check_cxx_source_compiles("#ifndef __STDC_CONSTANT_MACROS\n#define __STDC_CONSTANT_MACROS\n#endif\n#include \nextern \"C\"\n{\n#include \n#include \n}\n\nint main(void)\n{\navcodec_init();\nreturn 0;\n}\n" LIBAVCODEC_AVCODEC_INIT) 18 | if (LIBAVCODEC_AVCODEC_INIT) 19 | set(LIBAVCODEC_AVCODEC_INIT TRUE) 20 | else () 21 | set(LIBAVCODEC_AVCODEC_INIT FALSE) 22 | endif() 23 | endif (NOT LIBAVCODEC_INCLUDE_DIR_NEW) 24 | 25 | if (LIBAVCODEC_OLD OR LIBAVCODEC_NEW) 26 | find_library(LIBAVCODEC_LIB_AVCODEC avcodec) 27 | 28 | if (LIBAVCODEC_LIB_AVCODEC) 29 | set(LIBAVCODEC_LIBRARIES ${LIBAVCODEC_LIB_AVCODEC}) 30 | find_library(LIBAVCODEC_LIB_AVUTIL avutil) 31 | find_library(LIBAVCODEC_LIB_SWSCALE swscale) 32 | find_library(LIBAVCODEC_LIB_AVCORE avcore) 33 | find_library(LIBAVCODEC_LIB_AVFILTER avfilter) 34 | if (LIBAVCODEC_LIB_AVUTIL) 35 | set(LIBAVCODEC_LIBRARIES ${LIBAVCODEC_LIBRARIES} ${LIBAVCODEC_LIB_AVUTIL}) 36 | endif (LIBAVCODEC_LIB_AVUTIL) 37 | if (LIBAVCODEC_LIB_SWSCALE) 38 | set(LIBAVCODEC_LIBRARIES ${LIBAVCODEC_LIBRARIES} ${LIBAVCODEC_LIB_SWSCALE}) 39 | endif (LIBAVCODEC_LIB_SWSCALE) 40 | if (LIBAVCODEC_LIB_AVCORE) 41 | set(LIBAVCODEC_LIBRARIES ${LIBAVCODEC_LIBRARIES} ${LIBAVCODEC_LIB_AVCORE}) 42 | endif (LIBAVCODEC_LIB_AVCORE) 43 | endif (LIBAVCODEC_LIB_AVCODEC) 44 | endif (LIBAVCODEC_OLD OR LIBAVCODEC_NEW) 45 | 46 | include(FindPackageHandleStandardArgs) 47 | 48 | find_package_handle_standard_args(LibAVCodec DEFAULT_MSG LIBAVCODEC_INCLUDE_DIRS LIBAVCODEC_LIBRARIES) 49 | 50 | -------------------------------------------------------------------------------- /cmake/FindLibSndFile.cmake: -------------------------------------------------------------------------------- 1 | 2 | find_path(LIBSNDFILE_INCLUDE_DIR sndfile.h) 3 | 4 | set(LIBSNDFILE_INCLUDE_DIRS ${LIBSNDFILE_INCLUDE_DIR}) 5 | 6 | find_library(LIBSNDFILE_LIBRARY sndfile) 7 | if (LIBSNDFILE_LIBRARY) 8 | set(LIBSNDFILE_LIBRARIES ${LIBSNDFILE_LIBRARY}) 9 | endif (LIBSNDFILE_LIBRARY) 10 | 11 | include(FindPackageHandleStandardArgs) 12 | 13 | find_package_handle_standard_args(LibSndFile DEFAULT_MSG LIBSNDFILE_INCLUDE_DIRS LIBSNDFILE_LIBRARIES) 14 | 15 | -------------------------------------------------------------------------------- /cmake/FindPortAudio.cmake: -------------------------------------------------------------------------------- 1 | # - Try to find Portaudio 2 | # Once done this will define 3 | # 4 | # PORTAUDIO_FOUND - system has Portaudio 5 | # PORTAUDIO_INCLUDE_DIRS - the Portaudio include directory 6 | # PORTAUDIO_LIBRARIES - Link these to use Portaudio 7 | # PORTAUDIO_DEFINITIONS - Compiler switches required for using Portaudio 8 | # 9 | # Copyright (c) 2006 Andreas Schneider 10 | # 11 | # Redistribution and use is allowed according to the terms of the New BSD license. 12 | # For details see the accompanying COPYING-CMAKE-SCRIPTS file. 13 | # 14 | 15 | 16 | if (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS) 17 | # in cache already 18 | set(PORTAUDIO_FOUND TRUE) 19 | else (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS) 20 | find_path(PORTAUDIO_INCLUDE_DIR 21 | NAMES 22 | portaudio.h 23 | PATHS 24 | /usr/include 25 | /usr/local/include 26 | /opt/local/include 27 | /sw/include 28 | ) 29 | 30 | find_library(PORTAUDIO_LIBRARY 31 | NAMES 32 | portaudio 33 | PATHS 34 | /usr/lib 35 | /usr/local/lib 36 | /opt/local/lib 37 | /sw/lib 38 | ) 39 | 40 | set(PORTAUDIO_INCLUDE_DIRS 41 | ${PORTAUDIO_INCLUDE_DIR} 42 | ) 43 | set(PORTAUDIO_LIBRARIES 44 | ${PORTAUDIO_LIBRARY} 45 | ) 46 | 47 | if (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES) 48 | set(PORTAUDIO_FOUND TRUE) 49 | endif (PORTAUDIO_INCLUDE_DIRS AND PORTAUDIO_LIBRARIES) 50 | 51 | if (PORTAUDIO_FOUND) 52 | if (NOT Portaudio_FIND_QUIETLY) 53 | message(STATUS "Found Portaudio: ${PORTAUDIO_LIBRARIES}") 54 | endif (NOT Portaudio_FIND_QUIETLY) 55 | else (PORTAUDIO_FOUND) 56 | if (Portaudio_FIND_REQUIRED) 57 | message(FATAL_ERROR "Could not find Portaudio") 58 | endif (Portaudio_FIND_REQUIRED) 59 | endif (PORTAUDIO_FOUND) 60 | 61 | # show the PORTAUDIO_INCLUDE_DIRS and PORTAUDIO_LIBRARIES variables only in the advanced view 62 | mark_as_advanced(PORTAUDIO_INCLUDE_DIRS PORTAUDIO_LIBRARIES) 63 | 64 | endif (PORTAUDIO_LIBRARIES AND PORTAUDIO_INCLUDE_DIRS) -------------------------------------------------------------------------------- /cmake/FindPulseAudio.cmake: -------------------------------------------------------------------------------- 1 | 2 | find_path(PULSEAUDIO_INCLUDE_DIR pulse/simple.h) 3 | 4 | set(PULSEAUDIO_INCLUDE_DIRS ${PULSEAUDIO_INCLUDE_DIR}) 5 | 6 | find_library(PULSEAUDIO_LIBRARY pulse-simple) 7 | if (PULSEAUDIO_LIBRARY) 8 | set(PULSEAUDIO_LIBRARIES ${PULSEAUDIO_LIBRARY}) 9 | endif (PULSEAUDIO_LIBRARY) 10 | 11 | include(FindPackageHandleStandardArgs) 12 | 13 | find_package_handle_standard_args(PULSEAUDIO DEFAULT_MSG PULSEAUDIO_INCLUDE_DIRS PULSEAUDIO_LIBRARIES) 14 | 15 | -------------------------------------------------------------------------------- /cmake/FindSpeex.cmake: -------------------------------------------------------------------------------- 1 | 2 | find_path(SPEEX_INCLUDE_DIR speex/speex.h) 3 | 4 | set(SPEEX_INCLUDE_DIRS ${SPEEX_INCLUDE_DIR}) 5 | 6 | if (UNIX) 7 | find_library(SPEEX_LIBRARY speex) 8 | if (SPEEX_LIBRARY) 9 | find_library(SPEEXDSP_LIBRARY speexdsp) 10 | if (SPEEXDSP_LIBRARY) 11 | set(SPEEX_LIBRARIES ${SPEEX_LIBRARY} ${SPEEXDSP_LIBRARY}) 12 | else (SPEEXDSP_LIBRARY) 13 | set(SPEEX_LIBRARIES ${SPEEX_LIBRARY}) 14 | endif (SPEEXDSP_LIBRARY) 15 | endif (SPEEX_LIBRARY) 16 | else (UNIX) 17 | find_library(SPEEX_LIB_RELEASE speex) 18 | find_library(SPEEX_LIB_DEBUG speex_d) 19 | 20 | set(LOOKFORSPEEXDSP FALSE) 21 | if (SPEEX_LIB_RELEASE OR SPEEX_LIB_DEBUG) 22 | set(LOOKFORSPEEXDSP TRUE) 23 | set(SPEEX_LIBRARIES "") 24 | if (NOT SPEEX_LIB_RELEASE OR NOT SPEEX_LIB_DEBUG) 25 | if (SPEEX_LIB_RELEASE) 26 | set(SPEEX_LIBRARIES ${SPEEX_LIB_RELEASE}) 27 | else () 28 | set(SPEEX_LIBRARIES ${SPEEX_LIB_DEBUG}) 29 | endif() 30 | else () 31 | set(SPEEX_LIBRARIES optimized ${SPEEX_LIB_RELEASE} debug ${SPEEX_LIB_DEBUG}) 32 | endif() 33 | endif (SPEEX_LIB_RELEASE OR SPEEX_LIB_DEBUG) 34 | 35 | if (LOOKFORSPEEXDSP) 36 | find_library(SPEEXDSP_LIB_RELEASE speexdsp) 37 | find_library(SPEEXDSP_LIB_DEBUG speexdsp_d) 38 | if (SPEEXDSP_LIB_RELEASE OR SPEEXDSP_LIB_DEBUG) 39 | if (NOT SPEEXDSP_LIB_RELEASE OR NOT SPEEXDSP_LIB_DEBUG) 40 | if (SPEEXDSP_LIB_RELEASE) 41 | set(SPEEX_LIBRARIES ${SPEEX_LIBRARIES} ${SPEEX_LIB_RELEASE}) 42 | else () 43 | set(SPEEX_LIBRARIES ${SPEEX_LIBRARIES} ${SPEEX_LIB_DEBUG}) 44 | endif() 45 | else () 46 | set(SPEEX_LIBRARIES ${SPEEX_LIBRARIES} optimized ${SPEEXDSP_LIB_RELEASE} debug ${SPEEXDSP_LIB_DEBUG}) 47 | endif() 48 | endif (SPEEXDSP_LIB_RELEASE OR SPEEXDSP_LIB_DEBUG) 49 | 50 | endif() 51 | endif(UNIX) 52 | 53 | include(FindPackageHandleStandardArgs) 54 | 55 | find_package_handle_standard_args(SPEEX DEFAULT_MSG SPEEX_INCLUDE_DIRS SPEEX_LIBRARIES) 56 | 57 | -------------------------------------------------------------------------------- /doc/bufferchain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/doc/bufferchain.png -------------------------------------------------------------------------------- /doc/chainbuilding.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/doc/chainbuilding.png -------------------------------------------------------------------------------- /doc/nobufferchain.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/doc/nobufferchain.png -------------------------------------------------------------------------------- /doc/sound3d.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/doc/sound3d.png -------------------------------------------------------------------------------- /doc/subchains1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/doc/subchains1.png -------------------------------------------------------------------------------- /doc/subchains2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/doc/subchains2.png -------------------------------------------------------------------------------- /doc/subchains3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/doc/subchains3.png -------------------------------------------------------------------------------- /doc/subchains4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/doc/subchains4.png -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | apply_include_paths("${EMIPLIB_INTERNAL_INCLUDES}") 2 | apply_include_paths("${EMIPLIB_EXTERNAL_INCLUDES}") 3 | 4 | foreach(IDX avsession feedbackexample multiplesoundfileplayer simplechain soundfileplayer soundrecorder pushtotalk 5 | pushtotalk2 soundvolume audiosession) 6 | add_executable(${IDX} ${IDX}.cpp) 7 | if (NOT MSVC OR EMIPLIB_COMPILE_STATIC) 8 | target_link_libraries(${IDX} emiplib-static ${EMIPLIB_LINK_LIBS}) 9 | else () 10 | target_link_libraries(${IDX} emiplib-shared ${EMIPLIB_LINK_LIBS}) 11 | endif () 12 | endforeach(IDX) 13 | 14 | -------------------------------------------------------------------------------- /examples/simplechain.cpp: -------------------------------------------------------------------------------- 1 | /** 2 | * \file simplechain.cpp 3 | */ 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | void checkError(bool returnValue, const MIPComponent &component) 15 | { 16 | if (returnValue == true) 17 | return; 18 | 19 | std::cerr << "An error occured in component: " << component.getComponentName() << std::endl; 20 | std::cerr << "Error description: " << component.getErrorString() << std::endl; 21 | 22 | exit(-1); 23 | } 24 | 25 | void checkError(bool returnValue, const MIPComponentChain &chain) 26 | { 27 | if (returnValue == true) 28 | return; 29 | 30 | std::cerr << "An error occured in chain: " << chain.getName() << std::endl; 31 | std::cerr << "Error description: " << chain.getErrorString() << std::endl; 32 | 33 | exit(-1); 34 | } 35 | 36 | class MyChain : public MIPComponentChain 37 | { 38 | public: 39 | MyChain(const std::string &chainName) : MIPComponentChain(chainName) 40 | { 41 | } 42 | private: 43 | void onThreadExit(bool error, const std::string &errorComponent, const std::string &errorDescription) 44 | { 45 | if (!error) 46 | return; 47 | 48 | std::cerr << "An error occured in the background thread." << std::endl; 49 | std::cerr << " Component: " << errorComponent << std::endl; 50 | std::cerr << " Error description: " << errorDescription << std::endl; 51 | } 52 | }; 53 | 54 | int main(void) 55 | { 56 | // We'll initialize the timer to generate messages after 0.5 seconds. 57 | MIPAverageTimer timer(MIPTime(0.5)); 58 | MIPMessageDumper msgDump; 59 | MyChain chain("Simple chain"); 60 | bool returnValue; 61 | 62 | // The timing component and message dumper don't require further 63 | // initialization, so we'll just add them to the chain. 64 | 65 | returnValue = chain.setChainStart(&timer); 66 | checkError(returnValue, chain); 67 | 68 | returnValue = chain.addConnection(&timer, &msgDump); 69 | checkError(returnValue, chain); 70 | 71 | // Now, we can start the chain. 72 | 73 | returnValue = chain.start(); 74 | checkError(returnValue, chain); 75 | 76 | // We'll wait five seconds before stopping the chain. 77 | MIPTime::wait(MIPTime(5.0)); 78 | 79 | returnValue = chain.stop(); 80 | checkError(returnValue, chain); 81 | 82 | return 0; 83 | } 84 | 85 | -------------------------------------------------------------------------------- /homepage/EDM-UH.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/homepage/EDM-UH.png -------------------------------------------------------------------------------- /homepage/Makefile: -------------------------------------------------------------------------------- 1 | all: index.html emiplib.html 2 | 3 | emiplib.html: emiplib.md 4 | ./md.py emiplib.md > emiplib.html 5 | 6 | index.html: emiplib.html 7 | cp emiplib.html index.html 8 | 9 | clean: 10 | rm -f emiplib.html index.html 11 | -------------------------------------------------------------------------------- /homepage/emiplib-3dsound-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/homepage/emiplib-3dsound-screenshot.png -------------------------------------------------------------------------------- /homepage/emiplib-avsession-screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/homepage/emiplib-avsession-screenshot.png -------------------------------------------------------------------------------- /homepage/emiplib-wcesipphone-screenshot.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/homepage/emiplib-wcesipphone-screenshot.jpg -------------------------------------------------------------------------------- /pkgconfig/emiplib.pc.in: -------------------------------------------------------------------------------- 1 | Name: EMIPLIB 2 | Description: EDM Media over IP Library 3 | Requires: 4 | Version: ${VERSION} 5 | Libs: ${EMIPLIB_LIBS_PKGCONFIG} 6 | Cflags: ${EMIPLIB_INCDIRS_PKGCONFIG} 7 | 8 | -------------------------------------------------------------------------------- /sphinxdoc/README.md: -------------------------------------------------------------------------------- 1 | Not really using Sphinx documentation, just a small script so that the docs 2 | are automatically generated on readthedocs. 3 | -------------------------------------------------------------------------------- /sphinxdoc/source/_static/.dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/sphinxdoc/source/_static/.dummy -------------------------------------------------------------------------------- /sphinxdoc/source/_templates/.dummy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/j0r1/EMIPLIB/fb27e190ba035d271ff7acec25403b442b1e7478/sphinxdoc/source/_templates/.dummy -------------------------------------------------------------------------------- /src/components/codec/mipalawdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipalawdecoder.h 27 | */ 28 | 29 | #ifndef MIPALAWDECODER_H 30 | 31 | #define MIPALAWDECODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include "miptime.h" 36 | #include 37 | 38 | class MIPRaw16bitAudioMessage; 39 | 40 | /** An a-law decoder. 41 | * This component accepts a-law encoded audio messages and produces message 42 | * raw audio messages using 16 bit signed native endian encoding. 43 | */ 44 | class EMIPLIB_IMPORTEXPORT MIPALawDecoder : public MIPComponent 45 | { 46 | public: 47 | MIPALawDecoder(); 48 | ~MIPALawDecoder(); 49 | 50 | /** Initialize the component. */ 51 | bool init(); 52 | 53 | /** Clean up the component. */ 54 | bool destroy(); 55 | 56 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 57 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 58 | private: 59 | void clearMessages(); 60 | 61 | bool m_init; 62 | int64_t m_prevIteration; 63 | 64 | std::list m_messages; 65 | std::list::const_iterator m_msgIt; 66 | 67 | static int16_t m_decompressionTable[256]; 68 | }; 69 | 70 | #endif // MIPALAWDECODER_H 71 | 72 | -------------------------------------------------------------------------------- /src/components/codec/mipalawencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipalawencoder.h 27 | */ 28 | 29 | #ifndef MIPALAWENCODER_H 30 | 31 | #define MIPALAWENCODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include "miptime.h" 36 | #include 37 | 38 | class MIPEncodedAudioMessage; 39 | 40 | /** An a-law encoder. 41 | * This component accepts raw audio messages using 16 bit signed native endian 42 | * encoding. The samples are converted to a-law encoded samples and a message 43 | * with type MIPMESSAGE_TYPE_AUDIO_ENCODED and subtype MIPENCODEDAUDIOMESSAGE_TYPE_ALAW 44 | * is produced. 45 | */ 46 | class EMIPLIB_IMPORTEXPORT MIPALawEncoder : public MIPComponent 47 | { 48 | public: 49 | MIPALawEncoder(); 50 | ~MIPALawEncoder(); 51 | 52 | /** Initialize the component. */ 53 | bool init(); 54 | 55 | /** Clean up the component. */ 56 | bool destroy(); 57 | 58 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 59 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 60 | private: 61 | void clearMessages(); 62 | 63 | bool m_init; 64 | int64_t m_prevIteration; 65 | 66 | std::list m_messages; 67 | std::list::const_iterator m_msgIt; 68 | }; 69 | 70 | #endif // MIPALAWENCODER_H 71 | 72 | -------------------------------------------------------------------------------- /src/components/codec/mipgsmdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipgsmdecoder.h 27 | */ 28 | 29 | #ifndef MIPGSMDECODER_H 30 | 31 | #define MIPGSMDECODER_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_GSM 36 | 37 | #include "mipcomponent.h" 38 | #include "miptime.h" 39 | #include 40 | #include 41 | 42 | class MIPAudioMessage; 43 | struct gsm_state; 44 | 45 | /** Decodes messages which contain GSM 06.10 encoded data. 46 | * This component can be used to decompress data using the GSM codec. Input messages 47 | * should be MIPEncodedAudioMessage instances with subtype MIPENCODEDAUDIOMESSAGE_TYPE_GSM. 48 | * The component generates signed 16 bit native endian encoded raw audio messages. 49 | */ 50 | class EMIPLIB_IMPORTEXPORT MIPGSMDecoder : public MIPComponent 51 | { 52 | public: 53 | MIPGSMDecoder(); 54 | ~MIPGSMDecoder(); 55 | 56 | /** Initialize the GSM decoder. */ 57 | bool init(); 58 | 59 | /** Clean up the GSM decoder. */ 60 | bool destroy(); 61 | 62 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 63 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 64 | private: 65 | void clearMessages(); 66 | void expire(); 67 | 68 | class GSMStateInfo 69 | { 70 | public: 71 | GSMStateInfo(); 72 | ~GSMStateInfo(); 73 | 74 | gsm_state *getState() { return m_pState; } 75 | MIPTime getLastUpdateTime() const { return m_lastTime; } 76 | void setUpdateTime() { m_lastTime = MIPTime::getCurrentTime(); } 77 | private: 78 | MIPTime m_lastTime; 79 | gsm_state *m_pState; 80 | }; 81 | 82 | bool m_init; 83 | 84 | std::unordered_map m_gsmStates; 85 | 86 | std::list m_messages; 87 | std::list::const_iterator m_msgIt; 88 | int64_t m_lastIteration; 89 | MIPTime m_lastExpireTime; 90 | }; 91 | 92 | #endif // MIPCONFIG_SUPPORT_GSM 93 | 94 | #endif // MIPGSMDECODER_H 95 | 96 | -------------------------------------------------------------------------------- /src/components/codec/mipgsmencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipgsmencoder.h 27 | */ 28 | 29 | #ifndef MIPGSMENCODER_H 30 | 31 | #define MIPGSMENCODER_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_GSM 36 | 37 | #include "mipcomponent.h" 38 | #include "miptime.h" 39 | #include 40 | 41 | class MIPEncodedAudioMessage; 42 | struct gsm_state; 43 | 44 | /** Compress audio using the GSM 06.10 codec. 45 | * Using this component, 16 bit signed (native encoded) raw audio messages can 46 | * be compressed using the GSM 06.10 codec. Messages generated by this component 47 | * are encoded audio messages with subtype MIPENCODEDAUDIOMESSAGE_TYPE_GSM. 48 | */ 49 | class EMIPLIB_IMPORTEXPORT MIPGSMEncoder : public MIPComponent 50 | { 51 | public: 52 | MIPGSMEncoder(); 53 | ~MIPGSMEncoder(); 54 | 55 | /** Initialize the GSM encoding component. */ 56 | bool init(); 57 | 58 | /** Clean up the GSM encoder. */ 59 | bool destroy(); 60 | 61 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 62 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 63 | private: 64 | void clearMessages(); 65 | 66 | bool m_init; 67 | struct gsm_state *m_pState; 68 | int64_t m_prevIteration; 69 | 70 | std::list m_messages; 71 | std::list::const_iterator m_msgIt; 72 | }; 73 | 74 | #endif // MIPCONFIG_SUPPORT_GSM 75 | 76 | #endif // MIPGSMENCODER_H 77 | 78 | -------------------------------------------------------------------------------- /src/components/codec/miplpcdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miplpcdecoder.h 27 | */ 28 | 29 | #ifndef MIPLPCDECODER_H 30 | 31 | #define MIPLPCDECODER_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_LPC 36 | 37 | #include "mipcomponent.h" 38 | #include "miptime.h" 39 | #include 40 | #include 41 | 42 | class MIPAudioMessage; 43 | class LPCDecoder; 44 | 45 | /** Decodes messages which contain LPC encoded data. 46 | * This component can be used to decompress data using the LPC codec. Input messages 47 | * should be MIPEncodedAudioMessage instances with subtype MIPENCODEDAUDIOMESSAGE_TYPE_LPC. 48 | * The component generates signed 16 bit native endian encoded raw audio messages. 49 | */ 50 | class EMIPLIB_IMPORTEXPORT MIPLPCDecoder : public MIPComponent 51 | { 52 | public: 53 | MIPLPCDecoder(); 54 | ~MIPLPCDecoder(); 55 | 56 | /** Initialize the LPC decoder. */ 57 | bool init(); 58 | 59 | /** Clean up the LPC decoder. */ 60 | bool destroy(); 61 | 62 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 63 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 64 | private: 65 | void clearMessages(); 66 | void expire(); 67 | 68 | class LPCStateInfo 69 | { 70 | public: 71 | LPCStateInfo(); 72 | ~LPCStateInfo(); 73 | 74 | LPCDecoder *getDecoder() { return m_pDecoder; } 75 | MIPTime getLastUpdateTime() const { return m_lastTime; } 76 | void setUpdateTime() { m_lastTime = MIPTime::getCurrentTime(); } 77 | private: 78 | MIPTime m_lastTime; 79 | LPCDecoder *m_pDecoder; 80 | }; 81 | 82 | bool m_init; 83 | 84 | std::unordered_map m_lpcStates; 85 | 86 | int *m_pFrameBuffer; 87 | std::list m_messages; 88 | std::list::const_iterator m_msgIt; 89 | int64_t m_lastIteration; 90 | MIPTime m_lastExpireTime; 91 | }; 92 | 93 | #endif // MIPCONFIG_SUPPORT_LPC 94 | 95 | #endif // MIPLPCDECODER_H 96 | 97 | -------------------------------------------------------------------------------- /src/components/codec/miplpcencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miplpcencoder.h 27 | */ 28 | 29 | #ifndef MIPLPCENCODER_H 30 | 31 | #define MIPLPCENCODER_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_LPC 36 | 37 | #include "mipcomponent.h" 38 | #include "miptime.h" 39 | #include 40 | 41 | class MIPEncodedAudioMessage; 42 | class LPCEncoder; 43 | 44 | /** Compress audio using the LPC codec. 45 | * Using this component, signed raw 16 bit (native encoded) audio messages can be 46 | * compressed using the LPC codec. Messages generated by this component 47 | * are encoded audio messages with subtype MIPENCODEDAUDIOMESSAGE_TYPE_LPC. 48 | */ 49 | class EMIPLIB_IMPORTEXPORT MIPLPCEncoder : public MIPComponent 50 | { 51 | public: 52 | MIPLPCEncoder(); 53 | ~MIPLPCEncoder(); 54 | 55 | /** Initialize the LPC encoding component. */ 56 | bool init(); 57 | 58 | /** Clean up the LPC encoder. */ 59 | bool destroy(); 60 | 61 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 62 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 63 | private: 64 | void clearMessages(); 65 | 66 | bool m_init; 67 | LPCEncoder *m_pEncoder; 68 | int *m_pFrameBuffer; 69 | int64_t m_prevIteration; 70 | 71 | std::list m_messages; 72 | std::list::const_iterator m_msgIt; 73 | }; 74 | 75 | #endif // MIPCONFIG_SUPPORT_LPC 76 | 77 | #endif // MIPLPCENCODER_H 78 | 79 | -------------------------------------------------------------------------------- /src/components/codec/miptinyjpegdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miptinyjpegdecoder.h 27 | */ 28 | 29 | #ifndef MIPTINYJPEGDECODER_H 30 | 31 | #define MIPTINYJPEGDECODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include 36 | 37 | class MIPVideoMessage; 38 | 39 | /** A JPEG decoder based on the Tiny JPEG Decoder library. 40 | * A JPEG decoder based on the Tiny JPEG Decoder library. It accepts frames that 41 | * are JPEG compressed and outputs YUV420P frames. 42 | */ 43 | class EMIPLIB_IMPORTEXPORT MIPTinyJPEGDecoder : public MIPComponent 44 | { 45 | public: 46 | MIPTinyJPEGDecoder(); 47 | ~MIPTinyJPEGDecoder(); 48 | 49 | /** Initialize the component. */ 50 | bool init(); 51 | 52 | /** Clean up the component. */ 53 | bool destroy(); 54 | 55 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 56 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 57 | private: 58 | void clearMessages(); 59 | 60 | bool m_init; 61 | int64_t m_prevIteration; 62 | 63 | std::list m_messages; 64 | std::list::const_iterator m_msgIt; 65 | }; 66 | 67 | #endif // MIPTINYJPEGDECODER_H 68 | 69 | -------------------------------------------------------------------------------- /src/components/codec/mipulawdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipulawdecoder.h 27 | */ 28 | 29 | #ifndef MIPULAWDECODER_H 30 | 31 | #define MIPULAWDECODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include "miptime.h" 36 | #include 37 | 38 | class MIPRaw16bitAudioMessage; 39 | 40 | /** An u-law decoder. 41 | * This component accepts u-law encoded audio messages and produces message 42 | * raw audio messages using 16 bit signed native endian encoding. 43 | */ 44 | class EMIPLIB_IMPORTEXPORT MIPULawDecoder : public MIPComponent 45 | { 46 | public: 47 | MIPULawDecoder(); 48 | ~MIPULawDecoder(); 49 | 50 | /** Initialize the component. */ 51 | bool init(); 52 | 53 | /** Clean up the component. */ 54 | bool destroy(); 55 | 56 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 57 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 58 | private: 59 | void clearMessages(); 60 | 61 | bool m_init; 62 | int64_t m_prevIteration; 63 | 64 | std::list m_messages; 65 | std::list::const_iterator m_msgIt; 66 | 67 | static int16_t m_decompressionTable[256]; 68 | }; 69 | 70 | #endif // MIPULAWDECODER_H 71 | 72 | -------------------------------------------------------------------------------- /src/components/codec/mipulawencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipulawencoder.h 27 | */ 28 | 29 | #ifndef MIPULAWENCODER_H 30 | 31 | #define MIPULAWENCODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include "miptime.h" 36 | #include 37 | 38 | class MIPEncodedAudioMessage; 39 | 40 | /** An u-law encoder. 41 | * This component accepts raw audio messages using 16 bit signed native endian 42 | * encoding. The samples are converted to u-law encoded samples and a message 43 | * with type MIPMESSAGE_TYPE_AUDIO_ENCODED and subtype MIPENCODEDAUDIOMESSAGE_TYPE_ULAW 44 | * is produced. 45 | */ 46 | class EMIPLIB_IMPORTEXPORT MIPULawEncoder : public MIPComponent 47 | { 48 | public: 49 | MIPULawEncoder(); 50 | ~MIPULawEncoder(); 51 | 52 | /** Initialize the component. */ 53 | bool init(); 54 | 55 | /** Clean up the component. */ 56 | bool destroy(); 57 | 58 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 59 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 60 | private: 61 | void clearMessages(); 62 | 63 | bool m_init; 64 | int64_t m_prevIteration; 65 | 66 | std::list m_messages; 67 | std::list::const_iterator m_msgIt; 68 | 69 | static const uint8_t expEnc[256]; 70 | }; 71 | 72 | #endif // MIPULAWENCODER_H 73 | 74 | -------------------------------------------------------------------------------- /src/components/input/mipfrequencygenerator.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipfrequencygenerator.h 27 | */ 28 | 29 | #ifndef MIPFREQUENCYGENERATOR_H 30 | 31 | #define MIPFREQUENCYGENERATOR_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include "miptime.h" 36 | 37 | class MIPRawFloatAudioMessage; 38 | 39 | /** Generates sound with specific frequencies. 40 | * This component generates stereo sound, containing a signal with a specific 41 | * frequency in each channel. It takes system messages with subtype 42 | * MIPSYSTEMMESSAGE_TYPE_ISTIME as input and generates stereo floating point 43 | * raw audio messages. 44 | */ 45 | class EMIPLIB_IMPORTEXPORT MIPFrequencyGenerator : public MIPComponent 46 | { 47 | public: 48 | MIPFrequencyGenerator(); 49 | ~MIPFrequencyGenerator(); 50 | 51 | /** Initializes the frequency generator. 52 | * This function is used to initialize the frequency generator. 53 | * \param leftFreq The frequency of the left channel. 54 | * \param rightFreq The frequency of the right channel. 55 | * \param leftAmp Amplitude of signal in the left channel. 56 | * \param rightAmp Amplitude of signal in the right channel. 57 | * \param sampRate The sampling rate of the output messages. 58 | * \param interval The time inverval contained in the output messages. 59 | */ 60 | bool init(real_t leftFreq, real_t rightFreq, real_t leftAmp, real_t rightAmp, int sampRate, MIPTime interval); 61 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 62 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 63 | private: 64 | void cleanUp(); 65 | 66 | float *m_pFrames; 67 | int m_numFrames; 68 | MIPRawFloatAudioMessage *m_pAudioMsg; 69 | bool m_gotMessage; 70 | 71 | real_t m_leftFreq, m_rightFreq; 72 | real_t m_leftAmp, m_rightAmp; 73 | real_t m_curTime, m_timePerSample; 74 | }; 75 | 76 | #endif // MIPFREQUENCYGENERATOR_H 77 | 78 | -------------------------------------------------------------------------------- /src/components/input/mipyuv420fileinput.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipyuv420fileinput.h 27 | */ 28 | 29 | #ifndef MIPYUV420FILEINPUT_H 30 | 31 | #define MIPYUV420FILEINPUT_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include 36 | 37 | class MIPRawYUV420PVideoMessage; 38 | 39 | /** Read uncompressed YUV420P frames from a file. 40 | * This component allow you to read uncompressed, raw YUV420P frames 41 | * from a file. It only accepts MIPSYSTEMMESSAGE_TYPE_ISTIME system 42 | * messages as input, and produces a raw YUV420P video message as 43 | * output. 44 | */ 45 | class EMIPLIB_IMPORTEXPORT MIPYUV420FileInput : public MIPComponent 46 | { 47 | public: 48 | MIPYUV420FileInput(); 49 | ~MIPYUV420FileInput(); 50 | 51 | /** Opens a file. 52 | * This method opens a file and will assume that each frame has 53 | * a specific width and height. Each time the \c push method 54 | * is called, this will result in (width*height*3)/2 bytes 55 | * being read from the file, and being interpreted as the data 56 | * of a single YUV frame. 57 | */ 58 | bool open(const std::string &fileName, int width, int height); 59 | 60 | /** Closes the file again and deinitiazes the component. */ 61 | bool close(); 62 | 63 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 64 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 65 | private: 66 | int m_width, m_height; 67 | int m_frameSize; 68 | FILE *m_pFile; 69 | uint8_t *m_pData; 70 | MIPRawYUV420PVideoMessage *m_pVideoMessage; 71 | bool m_gotMessage; 72 | }; 73 | 74 | #endif // MIPYUV420FILEINPUT_H 75 | -------------------------------------------------------------------------------- /src/components/output/mipmessagedumper.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | #include "mipmessagedumper.h" 27 | #include "mipcomponentchain.h" 28 | #include "miptime.h" 29 | #include 30 | #include 31 | 32 | #include "mipdebug.h" 33 | 34 | MIPMessageDumper::MIPMessageDumper() : MIPComponent("MIPMessageDumper") 35 | { 36 | m_prevTime = 0; 37 | } 38 | 39 | MIPMessageDumper::~MIPMessageDumper() 40 | { 41 | } 42 | 43 | bool MIPMessageDumper::push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg) 44 | { 45 | MIPTime t = MIPTime::getCurrentTime(); 46 | 47 | std::cout << "Time: " << t.getString() << std::endl; 48 | if (m_prevTime > 0) 49 | std::cout << "DT: " << t.getValue()-m_prevTime << std::endl; 50 | m_prevTime = t.getValue(); 51 | 52 | std::cout << "Chain: " << chain.getName() << std::endl; 53 | std::cout << "Iteration: " << iteration << std::endl; 54 | std::cout << "MIPMessage type: " << pMsg->getMessageType() << std::endl; 55 | std::cout << "MIPMessage subtype: " << pMsg->getMessageSubtype() << std::endl; 56 | std::cout << std::endl; 57 | return true; 58 | } 59 | 60 | bool MIPMessageDumper::pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg) 61 | { 62 | setErrorString("Pull not implemented"); 63 | return false; 64 | } 65 | 66 | -------------------------------------------------------------------------------- /src/components/output/mipmessagedumper.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipmessagedumper.h 27 | */ 28 | 29 | #ifndef MIPMESSAGEDUMPER_H 30 | 31 | #define MIPMESSAGEDUMPER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | 36 | /** Outputs information about the incoming messages. 37 | * This component writes the message type and submessage type of incoming messages 38 | * to stdout. This can be useful for debugging. No messages are generated by the 39 | * component. 40 | */ 41 | class EMIPLIB_IMPORTEXPORT MIPMessageDumper : public MIPComponent 42 | { 43 | public: 44 | MIPMessageDumper(); 45 | ~MIPMessageDumper(); 46 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 47 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 48 | private: 49 | double m_prevTime; 50 | }; 51 | 52 | #endif // MIPMESSAGEDUMPER_H 53 | 54 | -------------------------------------------------------------------------------- /src/components/output/mippulseoutput.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mippulseoutput.h 27 | */ 28 | 29 | #ifndef MIPPULSEOUTPUT_H 30 | 31 | #define MIPPULSEOUTPUT_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_PULSEAUDIO 36 | 37 | #include "mipcomponent.h" 38 | #include "miptime.h" 39 | #include 40 | #include 41 | #include 42 | 43 | /** A PulseAudio output component. 44 | * This component uses PulseAudio to provide audio output. 45 | * It accepts raw floating point audio messages and does not produce 46 | * any messages itself. 47 | */ 48 | class EMIPLIB_IMPORTEXPORT MIPPulseOutput : public MIPComponent 49 | { 50 | public: 51 | MIPPulseOutput(); 52 | ~MIPPulseOutput(); 53 | 54 | /** Initializes the output component. 55 | * Initializes the output component. 56 | * \param sampleRate The sampling rate of the audio 57 | * \param channels The number of channels of the audio 58 | * \param interval Output is processed in blocks of this size. 59 | * \param serverName PulseAudio server name to which the client should connect. 60 | */ 61 | bool open(int sampleRate = 48000, int channels = 2, MIPTime interval = MIPTime(0.020), 62 | const std::string &serverName = std::string("")); 63 | 64 | /** Cleans up the component. */ 65 | bool close(); 66 | 67 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 68 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 69 | private: 70 | pa_simple *m_pStream; 71 | 72 | int m_sampRate; 73 | int m_channels; 74 | }; 75 | 76 | #endif // MIPCONFIG_SUPPORT_PULSEAUDIO 77 | 78 | #endif // MIPPULSEOUTPUT_H 79 | 80 | -------------------------------------------------------------------------------- /src/components/output/mipqt5audiooutput.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipqt5audiooutput.h 27 | */ 28 | 29 | #ifndef MIPQT5AUDIOOUTPUT_H 30 | 31 | #define MIPQT5AUDIOOUTPUT_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_QT5 36 | 37 | #include "mipcomponent.h" 38 | #include "miptime.h" 39 | #include 40 | #include 41 | 42 | class QAudioDeviceInfo; 43 | class QAudioOutput; 44 | class QIODevice; 45 | class MIPStreamBuffer; 46 | 47 | /** TODO 48 | * note: qt event loop must be running! 49 | */ 50 | class EMIPLIB_IMPORTEXPORT MIPQt5AudioOutput : public MIPComponent 51 | { 52 | public: 53 | MIPQt5AudioOutput(); 54 | ~MIPQt5AudioOutput(); 55 | 56 | /** TODO 57 | */ 58 | bool open(int sampleRate = 48000, int channels = 2, MIPTime interval = MIPTime(0.020), 59 | const QAudioDeviceInfo *pAudioDevice = nullptr, int maxQueuedBuffers = 3); 60 | 61 | /** Cleans up the component. */ 62 | bool close(); 63 | 64 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 65 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 66 | private: 67 | bool m_init; 68 | int m_sampRate, m_numChannels; 69 | int m_bytesPerFrame; 70 | int m_maxQueuedBuffers; 71 | MIPStreamBuffer *m_pBuffer; 72 | QIODevice *m_pIODev; 73 | QAudioOutput *m_pAudioOutput; 74 | }; 75 | 76 | #endif // MIPCONFIG_SUPPORT_QT5 77 | 78 | #endif // MIPQT5AUDIOOUTPUT_H 79 | 80 | -------------------------------------------------------------------------------- /src/components/output/mipwavoutput.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipwavoutput.h 27 | */ 28 | 29 | #ifndef MIPWAVOUTPUT_H 30 | 31 | #define MIPWAVOUTPUT_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | 36 | class MIPWAVWriter; 37 | 38 | /** A sound file output component. 39 | * This component writes incoming sound data to a file. It uses an internal simple 40 | * WAV file write to accomplish this. Incoming messages have to be unsigned 8 bit audio messages. 41 | * No messages are generated by this component. 42 | */ 43 | class EMIPLIB_IMPORTEXPORT MIPWAVOutput : public MIPComponent 44 | { 45 | public: 46 | MIPWAVOutput(); 47 | ~MIPWAVOutput(); 48 | 49 | /** Opens a sound file. 50 | * This function opens a sound file. 51 | * \param fname The name of the file. 52 | * \param sampRate The sampling rate. 53 | */ 54 | bool open(const std::string &fname, int sampRate); 55 | 56 | /** Closes the sound file. 57 | * Using this function, a previously opened sound file can be closed again. 58 | */ 59 | bool close(); 60 | 61 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 62 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 63 | private: 64 | MIPWAVWriter *m_pSndFile; 65 | int m_sampRate; 66 | }; 67 | 68 | #endif // MIPWAVOUTPUT_H 69 | 70 | -------------------------------------------------------------------------------- /src/components/timer/mipaveragetimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipaveragetimer.h 27 | */ 28 | 29 | #ifndef MIPAVERAGETIMER_H 30 | 31 | #define MIPAVERAGETIMER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include "miptime.h" 36 | #include "mipsystemmessage.h" 37 | 38 | class MIPComponentChain; 39 | 40 | /** A simple timing component. 41 | * This is a simple timing component which accepts MIPSYSTEMMESSAGE_WAITTIME system 42 | * messages. It generates a MIPSYSTEMMESSAGE_ISTIME system message each time the 43 | * specified interval has elapsed. Note that this is only on average after each interval: 44 | * fluctuation will be present. 45 | */ 46 | class EMIPLIB_IMPORTEXPORT MIPAverageTimer : public MIPComponent 47 | { 48 | public: 49 | /** Creates a timing object. 50 | * Using this constructor, a timing object will be created which will generate 51 | * messages eacht time \c interval has elapsed. 52 | */ 53 | MIPAverageTimer(MIPTime interval); 54 | ~MIPAverageTimer(); 55 | 56 | /** Re-initializes the component. */ 57 | void reset(); 58 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 59 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 60 | private: 61 | const MIPComponentChain *m_pChain; 62 | MIPTime m_startTime, m_interval; 63 | MIPSystemMessage m_timeMsg; 64 | bool m_gotMsg; 65 | }; 66 | 67 | #endif // MIPAVERAGETIMER_H 68 | 69 | -------------------------------------------------------------------------------- /src/components/timer/mippusheventtimer.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | #include "mippusheventtimer.h" 27 | 28 | #include "mipdebug.h" 29 | 30 | MIPPushEventTimer::MIPPushEventTimer() : MIPComponent("MIPPushEventTimer"), 31 | m_timeMsg(MIPSYSTEMMESSAGE_TYPE_ISTIME) 32 | { 33 | m_prevIteration = -1; 34 | } 35 | 36 | MIPPushEventTimer::~MIPPushEventTimer() 37 | { 38 | } 39 | 40 | bool MIPPushEventTimer::push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg) 41 | { 42 | m_prevIteration = iteration; 43 | m_gotMsg = false; 44 | return true; 45 | } 46 | 47 | bool MIPPushEventTimer::pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg) 48 | { 49 | if (m_prevIteration != iteration) // no event received 50 | { 51 | *pMsg = 0; 52 | return true; 53 | } 54 | 55 | if (!m_gotMsg) 56 | { 57 | *pMsg = &m_timeMsg; 58 | m_gotMsg = true; 59 | } 60 | else 61 | { 62 | *pMsg = 0; 63 | m_gotMsg = false; 64 | } 65 | return true; 66 | } 67 | 68 | -------------------------------------------------------------------------------- /src/components/timer/mippusheventtimer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mippusheventtimer.h 27 | */ 28 | 29 | #ifndef MIPPUSHEVENTTIMER_H 30 | 31 | #define MIPPUSHEVENTTIMER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include "mipsystemmessage.h" 36 | 37 | /** Component which generates a MIPSYSTEMMESSAGE_ISTIME system message when data has 38 | * been supplied to it during this iteration. 39 | * This component generates a MIPSYSTEMMESSAGE_ISTIME system message when another 40 | * component has delivered data to it during this iteration. It accepts any incoming 41 | * message. 42 | * 43 | * Suppose you have a soundcard input component at the start of the chain. 44 | * You can then add a link from the soundcard input component to this component 45 | * to make this component behave like it's a timing component. 46 | */ 47 | class EMIPLIB_IMPORTEXPORT MIPPushEventTimer : public MIPComponent 48 | { 49 | public: 50 | MIPPushEventTimer(); 51 | ~MIPPushEventTimer(); 52 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 53 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 54 | private: 55 | MIPSystemMessage m_timeMsg; 56 | bool m_gotMsg; 57 | int64_t m_prevIteration; 58 | }; 59 | 60 | #endif // MIPPUSHEVENTTIMER_H 61 | -------------------------------------------------------------------------------- /src/components/transform/mipaudiodistancefade.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipaudiodistancefade.h 27 | */ 28 | 29 | #ifndef MIPAUDIODISTANCEFADE_H 30 | 31 | #define MIPAUDIODISTANCEFADE_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipaudio3dbase.h" 35 | #include 36 | 37 | class MIPRawFloatAudioMessage; 38 | 39 | /** A simple 3D audio component which only takes the distance between participants into account. 40 | * A simple 3D audio component which only takes the distance between participants into account. 41 | * The compontent accepts and produces floating point raw audio messages. 42 | */ 43 | class EMIPLIB_IMPORTEXPORT MIPAudioDistanceFade : public MIPAudio3DBase 44 | { 45 | public: 46 | MIPAudioDistanceFade(); 47 | ~MIPAudioDistanceFade(); 48 | 49 | /** Initialize the component. 50 | * This function initializes the component. 51 | * \param cutOffDistance Specifies the distance (in meters) beyond which audio information 52 | * is ignored. 53 | */ 54 | bool init(real_t cutOffDistance = 50.0); 55 | 56 | /** Clean up the component. */ 57 | bool destroy(); 58 | 59 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 60 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 61 | private: 62 | bool m_init; 63 | real_t m_cutOffDistance; 64 | std::list m_messages; 65 | std::list::const_iterator m_msgIt; 66 | int64_t m_curIteration; 67 | }; 68 | 69 | #endif // MIPAUDIODISTANCEFADE_H 70 | 71 | -------------------------------------------------------------------------------- /src/components/transform/mipaudiosplitter.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipaudiosplitter.h 27 | */ 28 | 29 | #ifndef MIPAUDIOSPLITTER_H 30 | 31 | #define MIPAUDIOSPLITTER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include "miptime.h" 36 | #include 37 | 38 | class MIPAudioMessage; 39 | 40 | /** Split incoming raw audio messages into smaller messages. 41 | * This component takes raw audio messages as its input and produces similar 42 | * messages, containing at most a specified amount of data. 43 | */ 44 | class EMIPLIB_IMPORTEXPORT MIPAudioSplitter : public MIPComponent 45 | { 46 | public: 47 | MIPAudioSplitter(); 48 | ~MIPAudioSplitter(); 49 | 50 | /** Initializes the component. 51 | * This function (re)initializes the component. 52 | * \param interval The messages sent to the output will contain the amount of 53 | * data corresponding to this parameter. 54 | */ 55 | bool init(MIPTime interval); 56 | 57 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 58 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 59 | private: 60 | void cleanUp(); 61 | void clearMessages(); 62 | 63 | bool m_init; 64 | MIPTime m_interval; 65 | std::list m_messages; 66 | std::list::const_iterator m_msgIt; 67 | int64_t m_prevIteration; 68 | }; 69 | 70 | #endif // MIPAUDIOSPLITTER_H 71 | 72 | -------------------------------------------------------------------------------- /src/components/transform/mipsampleencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipsampleencoder.h 27 | */ 28 | 29 | #ifndef MIPSAMPLEENCODER_H 30 | 31 | #define MIPSAMPLEENCODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include "miprawaudiomessage.h" 36 | #include 37 | 38 | class MIPAudioMessage; 39 | 40 | /** Changes the sample encoding of raw audio messages. 41 | * This component can be used to change the sample encoding of raw audio messages. 42 | * It accepts all raw audio messages and produces similar raw audio messages, using 43 | * a predefined encoding type. 44 | */ 45 | class EMIPLIB_IMPORTEXPORT MIPSampleEncoder : public MIPComponent 46 | { 47 | public: 48 | MIPSampleEncoder(); 49 | ~MIPSampleEncoder(); 50 | 51 | /** Initializes the sample encoder. 52 | * Using this function, the sample encoder is initialized. Messages produced by 53 | * this component will be raw audio messages of subtype \c destType. See miprawaudiomessage.h 54 | * for an overview of the subtypes. 55 | */ 56 | bool init(int destType); 57 | 58 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 59 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 60 | private: 61 | void cleanUp(); 62 | void clearMessages(); 63 | 64 | bool m_init; 65 | int m_dstType; 66 | std::list m_messages; 67 | std::list::const_iterator m_msgIt; 68 | int64_t m_prevIteration; 69 | }; 70 | 71 | #endif // MIPSAMPLEENCODER_H 72 | 73 | -------------------------------------------------------------------------------- /src/components/transform/mipsamplingrateconverter.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipsamplingrateconverter.h 27 | */ 28 | 29 | #ifndef MIPSAMPLINGRATECONVERTER_H 30 | 31 | #define MIPSAMPLINGRATECONVERTER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include 36 | 37 | class MIPAudioMessage; 38 | 39 | /** Converts sampling rate and number of channels of raw audio messages. 40 | * This component accepts incoming floating point or 16 bit signed integer raw audio 41 | * messages and produces 42 | * similar messages with a specific sampling rate and number of channels set during 43 | * initialization. 44 | */ 45 | class EMIPLIB_IMPORTEXPORT MIPSamplingRateConverter : public MIPComponent 46 | { 47 | public: 48 | MIPSamplingRateConverter(); 49 | ~MIPSamplingRateConverter(); 50 | 51 | /** Initialize the sampling rate converter. 52 | * This function instructs the converter to generate raw audio 53 | * messages with sampling rate \c outRate and number of channels \c outChannels. 54 | * If the \c floatSamples flag is set, floating point samples will be used, 55 | * otherwise 16 bit signed native endian samples will be used. 56 | */ 57 | bool init(int outRate, int outChannels, bool floatSamples = true); 58 | 59 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 60 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 61 | private: 62 | void cleanUp(); 63 | void clearMessages(); 64 | 65 | bool m_init; 66 | std::list m_messages; 67 | std::list::const_iterator m_msgIt; 68 | int64_t m_prevIteration; 69 | int m_outRate, m_outChannels; 70 | bool m_floatSamples; 71 | }; 72 | 73 | #endif // MIPSAMPLINGRATECONVERTER_H 74 | 75 | -------------------------------------------------------------------------------- /src/components/transform/mipyuv420framecutter.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipyuv420framecutter.h 27 | */ 28 | 29 | #ifndef MIPYUV420FRAMECUTTER_H 30 | 31 | #define MIPYUV420FRAMECUTTER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipcomponent.h" 35 | #include "miptime.h" 36 | #include 37 | 38 | class MIPVideoMessage; 39 | 40 | /** Extracts a part of an YUV420P frame. 41 | * This component takes a raw video frame, YUV420P encoded, as input and 42 | * creates a video frame (same encoding) which containts a part of the 43 | * input frame as output. 44 | */ 45 | class EMIPLIB_IMPORTEXPORT MIPYUV420FrameCutter : public MIPComponent 46 | { 47 | public: 48 | MIPYUV420FrameCutter(); 49 | ~MIPYUV420FrameCutter(); 50 | 51 | /** Initializes the component. 52 | * Initializes the component. 53 | * \param inputWidth The width that each input frame must have. 54 | * \param inputHeight The height that each input frame must have. 55 | * \param x0 Start X coordinate of the subframe. 56 | * \param x1 End X coordinate (not included) of the subframe. 57 | * \param y0 Start Y coordinate of the subframe. 58 | * \param y1 End Y coordinate (not included) of the subframe. 59 | * The subframe will have (x1-x0) as its width and (y1-y0) as 60 | * its height. 61 | */ 62 | bool init(int inputWidth, int inputHeight, 63 | int x0, int x1, int y0, int y1); 64 | 65 | /** Deinitializes the component. */ 66 | bool destroy(); 67 | 68 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 69 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 70 | private: 71 | void clearMessages(); 72 | 73 | bool m_init; 74 | std::list m_messages; 75 | std::list::const_iterator m_msgIt; 76 | int64_t m_lastIteration; 77 | 78 | int m_x0, m_x1, m_y0, m_y1; 79 | int m_inputWidth, m_inputHeight; 80 | }; 81 | 82 | #endif // MIPYUV420FRAMECUTTER_H 83 | 84 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpalawdecoder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | #include "miprtpalawdecoder.h" 27 | #include "miprawaudiomessage.h" 28 | #include "mipencodedaudiomessage.h" 29 | #include "miprtpmessage.h" 30 | #include 31 | 32 | #include "mipdebug.h" 33 | 34 | using namespace jrtplib; 35 | 36 | MIPRTPALawDecoder::MIPRTPALawDecoder() 37 | { 38 | } 39 | 40 | MIPRTPALawDecoder::~MIPRTPALawDecoder() 41 | { 42 | } 43 | 44 | bool MIPRTPALawDecoder::validatePacket(const RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate) 45 | { 46 | size_t length; 47 | 48 | length = (size_t)pRTPPack->GetPayloadLength(); 49 | if (length < 1) 50 | return false; 51 | 52 | timestampUnit = 1.0/8000.0; 53 | return true; 54 | } 55 | 56 | void MIPRTPALawDecoder::createNewMessages(const RTPPacket *pRTPPack, std::list &messages, std::list ×tamps) 57 | { 58 | size_t length = pRTPPack->GetPayloadLength(); 59 | uint8_t *pData = new uint8_t [length]; 60 | 61 | memcpy(pData, pRTPPack->GetPayloadData(), length); 62 | MIPEncodedAudioMessage *pEncMsg = new MIPEncodedAudioMessage(MIPENCODEDAUDIOMESSAGE_TYPE_ALAW, 8000, 1, (int)length, pData, length, true); 63 | 64 | messages.push_back(pEncMsg); 65 | timestamps.push_back(pRTPPack->GetTimestamp()); 66 | } 67 | 68 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpalawdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpalawdecoder.h 27 | */ 28 | 29 | #ifndef MIPRTPALAWDECODER_H 30 | 31 | #define MIPRTPALAWDECODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miprtppacketdecoder.h" 35 | 36 | /** Decodes incoming RTP data into U-law encoded messages. 37 | * This class takes MIPRTPReceiveMessages as input and generates 38 | * U-law encoded audio messages. 39 | */ 40 | class EMIPLIB_IMPORTEXPORT MIPRTPALawDecoder : public MIPRTPPacketDecoder 41 | { 42 | public: 43 | MIPRTPALawDecoder(); 44 | ~MIPRTPALawDecoder(); 45 | private: 46 | bool validatePacket(const jrtplib::RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate); 47 | void createNewMessages(const jrtplib::RTPPacket *pRTPPack, std::list &messages, std::list ×tamps); 48 | }; 49 | 50 | #endif // MIPRTPALAWDECODER_H 51 | 52 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpalawencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpalawencoder.h 27 | */ 28 | 29 | #ifndef MIPRTPALAWENCODER_H 30 | 31 | #define MIPRTPALAWENCODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miprtpencoder.h" 35 | #include 36 | 37 | class MIPRTPSendMessage; 38 | 39 | /** Creates RTP packets for A-law encoded audio packets. 40 | * This component accepts incoming A-law encoded 8000Hz mono audio packets and generates 41 | * MIPRTPSendMessage objects which can then be transferred to a MIPRTPComponent instance. 42 | */ 43 | class EMIPLIB_IMPORTEXPORT MIPRTPALawEncoder : public MIPRTPEncoder 44 | { 45 | public: 46 | MIPRTPALawEncoder(); 47 | ~MIPRTPALawEncoder(); 48 | 49 | /** Initializes the encoder. */ 50 | bool init(); 51 | 52 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 53 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 54 | private: 55 | void cleanUp(); 56 | void clearMessages(); 57 | 58 | bool m_init; 59 | std::list m_messages; 60 | std::list::const_iterator m_msgIt; 61 | int64_t m_prevIteration; 62 | }; 63 | 64 | #endif // MIPRTPALAWENCODER_H 65 | 66 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpdummydecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpdummydecoder.h 27 | */ 28 | 29 | #ifndef MIPRTPDUMMYDECODER_H 30 | 31 | #define MIPRTPDUMMYDECODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miprtppacketdecoder.h" 35 | 36 | /** Dummy RTP packet decoder. 37 | * Dummy RTP packet decoder. If an RTP packet is received with an unsupported 38 | * payload type, the MIPRTPDecoder::push function will return an error and the 39 | * background thread of the component chain will stop. To avoid this from 40 | * happening, a dummy RTP packet decoder can be installed as default packet 41 | * decoder. 42 | */ 43 | class EMIPLIB_IMPORTEXPORT MIPRTPDummyDecoder : public MIPRTPPacketDecoder 44 | { 45 | public: 46 | MIPRTPDummyDecoder() { } 47 | ~MIPRTPDummyDecoder() { } 48 | private: 49 | bool validatePacket(const jrtplib::RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate) { return false; } 50 | void createNewMessages(const jrtplib::RTPPacket *pRTPPack, std::list &messages, 51 | std::list ×tamps) { } 52 | }; 53 | 54 | #endif // MIPRTPDUMMYDECODER_H 55 | 56 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpencoder.h 27 | */ 28 | 29 | #ifndef MIPRTPENCODER_H 30 | 31 | #define MIPRTPENCODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipoutputmessagequeue.h" 35 | 36 | /** Base class for RTP encoders. 37 | * Base class for RTP encoders. Contains a member function to set the payload type. 38 | */ 39 | class EMIPLIB_IMPORTEXPORT MIPRTPEncoder : public MIPOutputMessageQueue 40 | { 41 | public: 42 | MIPRTPEncoder(const std::string &compName) : MIPOutputMessageQueue(compName) { m_payloadType = 0; } 43 | ~MIPRTPEncoder() { } 44 | 45 | /** Sets the payload type. */ 46 | void setPayloadType(uint8_t payloadType) { m_payloadType = payloadType; } 47 | 48 | /** Returns the payload type. */ 49 | uint8_t getPayloadType() const { return m_payloadType; } 50 | private: 51 | uint8_t m_payloadType; 52 | }; 53 | 54 | #endif // MIPRTPENCODER_H 55 | 56 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpgsmdecoder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | #include "miprtpgsmdecoder.h" 27 | #include "miprawaudiomessage.h" 28 | #include "mipencodedaudiomessage.h" 29 | #include "miprtpmessage.h" 30 | #include 31 | 32 | #include "mipdebug.h" 33 | 34 | using namespace jrtplib; 35 | 36 | #define MIPRTPGSMDECODER_SIZE 33 37 | #define MIPRTPGSMDECODER_NUMFRAMES 160 38 | 39 | MIPRTPGSMDecoder::MIPRTPGSMDecoder() 40 | { 41 | } 42 | 43 | MIPRTPGSMDecoder::~MIPRTPGSMDecoder() 44 | { 45 | } 46 | 47 | bool MIPRTPGSMDecoder::validatePacket(const RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate) 48 | { 49 | size_t length; 50 | 51 | length = (size_t)pRTPPack->GetPayloadLength(); 52 | if (length != MIPRTPGSMDECODER_SIZE) // TODO: for now we only support one GSM frame per packet 53 | return false; 54 | 55 | timestampUnit = 1.0/8000.0; 56 | return true; 57 | } 58 | 59 | void MIPRTPGSMDecoder::createNewMessages(const RTPPacket *pRTPPack, std::list &messages, std::list ×tamps) 60 | { 61 | size_t length = pRTPPack->GetPayloadLength(); 62 | uint8_t *pData = new uint8_t [length]; 63 | 64 | memcpy(pData, pRTPPack->GetPayloadData(), length); 65 | MIPEncodedAudioMessage *pEncMsg = new MIPEncodedAudioMessage(MIPENCODEDAUDIOMESSAGE_TYPE_GSM, 8000, 1, MIPRTPGSMDECODER_NUMFRAMES, pData, length, true); 66 | 67 | messages.push_back(pEncMsg); 68 | timestamps.push_back(pRTPPack->GetTimestamp()); 69 | } 70 | 71 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpgsmdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpgsmdecoder.h 27 | */ 28 | 29 | #ifndef MIPRTPGSMDECODER_H 30 | 31 | #define MIPRTPGSMDECODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miprtppacketdecoder.h" 35 | 36 | /** Decodes incoming RTP data into GSM encoded messages. 37 | * This class takes MIPRTPReceiveMessages as input and generates 38 | * GSM encoded audio messages. 39 | */ 40 | class EMIPLIB_IMPORTEXPORT MIPRTPGSMDecoder : public MIPRTPPacketDecoder 41 | { 42 | public: 43 | MIPRTPGSMDecoder(); 44 | ~MIPRTPGSMDecoder(); 45 | private: 46 | bool validatePacket(const jrtplib::RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate); 47 | void createNewMessages(const jrtplib::RTPPacket *pRTPPack, std::list &messages, std::list ×tamps); 48 | }; 49 | 50 | #endif // MIPRTPGSMDECODER_H 51 | 52 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpgsmencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpgsmencoder.h 27 | */ 28 | 29 | #ifndef MIPRTPGSMENCODER_H 30 | 31 | #define MIPRTPGSMENCODER_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_GSM 36 | 37 | #include "miprtpencoder.h" 38 | #include 39 | 40 | class MIPRTPSendMessage; 41 | 42 | /** Creates RTP packets for GSM compressed audio packets. 43 | * This component accepts incoming GSM compressed audio packets and generates 44 | * MIPRTPSendMessage objects which can then be transferred to a MIPRTPComponent instance. 45 | */ 46 | class EMIPLIB_IMPORTEXPORT MIPRTPGSMEncoder : public MIPRTPEncoder 47 | { 48 | public: 49 | MIPRTPGSMEncoder(); 50 | ~MIPRTPGSMEncoder(); 51 | 52 | /** Initializes the encoder. */ 53 | bool init(); 54 | 55 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 56 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 57 | private: 58 | void cleanUp(); 59 | void clearMessages(); 60 | 61 | bool m_init; 62 | std::list m_messages; 63 | std::list::const_iterator m_msgIt; 64 | int64_t m_prevIteration; 65 | }; 66 | 67 | #endif // MIPCONFIG_SUPPORT_GSM 68 | 69 | #endif // MIPRTPGSMENCODER_H 70 | 71 | -------------------------------------------------------------------------------- /src/components/transmission/miprtph263decoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtph263decoder.h 27 | */ 28 | 29 | #ifndef MIPRTPH263DECODER_H 30 | 31 | #define MIPRTPH263DECODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miprtppacketdecoder.h" 35 | #include "miprtppacketgrouper.h" 36 | #include "miptime.h" 37 | #include 38 | 39 | /** This class decodes incoming RTP data into H.263 video messages. 40 | * This class takes MIPRTPReceiveMessages as input and generates 41 | * H.263 video messages. 42 | */ 43 | class EMIPLIB_IMPORTEXPORT MIPRTPH263Decoder : public MIPRTPPacketDecoder 44 | { 45 | public: 46 | MIPRTPH263Decoder(); 47 | ~MIPRTPH263Decoder(); 48 | private: 49 | bool validatePacket(const jrtplib::RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate); 50 | void createNewMessages(const jrtplib::RTPPacket *pRTPPack, std::list &messages, std::list ×tamps); 51 | 52 | void expireGroupers(); 53 | 54 | class PacketGrouper 55 | { 56 | public: 57 | PacketGrouper(MIPRTPPacketGrouper *pPacketGrouper) 58 | { 59 | m_pGrouper = pPacketGrouper; 60 | m_lastAccesstime = MIPTime::getCurrentTime(); 61 | } 62 | 63 | ~PacketGrouper() 64 | { 65 | delete m_pGrouper; 66 | } 67 | 68 | MIPRTPPacketGrouper *getGrouper() 69 | { 70 | m_lastAccesstime = MIPTime::getCurrentTime(); 71 | return m_pGrouper; 72 | } 73 | 74 | MIPTime getLastAccessTime() const 75 | { 76 | return m_lastAccesstime; 77 | } 78 | private: 79 | MIPTime m_lastAccesstime; 80 | MIPRTPPacketGrouper *m_pGrouper; 81 | }; 82 | 83 | std::unordered_map m_packetGroupers; 84 | MIPTime m_lastCheckTime; 85 | }; 86 | 87 | #endif // MIPRTPH263DECODER_H 88 | 89 | -------------------------------------------------------------------------------- /src/components/transmission/miprtph263encoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtph263encoder.h 27 | */ 28 | 29 | #ifndef MIPRTPH263ENCODER_H 30 | 31 | #define MIPRTPH263ENCODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miprtpencoder.h" 35 | #include 36 | 37 | class MIPRTPSendMessage; 38 | 39 | /** Creates RTP packets for incoming video packets in H.263 encoded format. 40 | * This component accepts incoming video packets using H.263 compression 41 | * and generates MIPRTPSendMessage objects which can then be transferred 42 | * to a MIPRTPComponent instance. 43 | */ 44 | class EMIPLIB_IMPORTEXPORT MIPRTPH263Encoder : public MIPRTPEncoder 45 | { 46 | public: 47 | MIPRTPH263Encoder(); 48 | ~MIPRTPH263Encoder(); 49 | 50 | /** Initializes the encoder. 51 | * Initializes the encoder. 52 | * \param frameRate Frame rate of incoming video frames. 53 | * \param maxPayloadSize Maximum length the payload of an RTP packet can have 54 | */ 55 | bool init(real_t frameRate, size_t maxPayloadSize); 56 | 57 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 58 | bool pull (const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 59 | private: 60 | void cleanUp(); 61 | void clearMessages(); 62 | 63 | bool m_init; 64 | real_t m_frameRate; 65 | std::list m_messages; 66 | std::list::const_iterator m_msgIt; 67 | int64_t m_prevIteration; 68 | size_t m_maxPayloadSize; 69 | }; 70 | 71 | #endif // MIPRTPH263ENCODER_H 72 | 73 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpl16decoder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | #include "miprtpl16decoder.h" 27 | #include "miprawaudiomessage.h" 28 | #include "miprtpmessage.h" 29 | #include 30 | 31 | #include "mipdebug.h" 32 | 33 | using namespace jrtplib; 34 | 35 | MIPRTPL16Decoder::MIPRTPL16Decoder(bool stereo, int sampRate) 36 | { 37 | if (stereo) 38 | m_channels = 2; 39 | else 40 | m_channels = 1; 41 | m_sampRate = sampRate; 42 | } 43 | 44 | MIPRTPL16Decoder::~MIPRTPL16Decoder() 45 | { 46 | } 47 | 48 | bool MIPRTPL16Decoder::validatePacket(const RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate) 49 | { 50 | size_t length; 51 | 52 | length = (size_t)pRTPPack->GetPayloadLength(); 53 | if (length < 1) 54 | return false; 55 | 56 | if (m_channels == 1) 57 | { 58 | if ((length % 2) != 0) 59 | return false; 60 | } 61 | else // stereo 62 | { 63 | if ((length % 4) != 0) 64 | return false; 65 | } 66 | 67 | timestampUnit = 1.0/(double)m_sampRate; 68 | return true; 69 | } 70 | 71 | void MIPRTPL16Decoder::createNewMessages(const RTPPacket *pRTPPack, std::list &messages, std::list ×tamps) 72 | { 73 | size_t length = pRTPPack->GetPayloadLength(); 74 | size_t numSamples = length/2; // 2 bytes per sample 75 | 76 | uint16_t *pFrames = new uint16_t [numSamples]; 77 | 78 | memcpy(pFrames, pRTPPack->GetPayloadData(), length); 79 | 80 | MIPRaw16bitAudioMessage *pRawMsg = new MIPRaw16bitAudioMessage(m_sampRate, m_channels, numSamples/m_channels, true, MIPRaw16bitAudioMessage::BigEndian, pFrames, true); 81 | 82 | messages.push_back(pRawMsg); 83 | timestamps.push_back(pRTPPack->GetTimestamp()); 84 | } 85 | 86 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpl16decoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpl16decoder.h 27 | */ 28 | 29 | #ifndef MIPRTPL16DECODER_H 30 | 31 | #define MIPRTPL16DECODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miprtppacketdecoder.h" 35 | 36 | /** Decodes incoming RTP data into 16 bit signed big endian messages of a 37 | * specific sampling rate. 38 | * This class takes MIPRTPReceiveMessages as input and generates 39 | * raw audio messages containing signed 16 bit big endian samples of a 40 | * specific sampling rate. 41 | */ 42 | class EMIPLIB_IMPORTEXPORT MIPRTPL16Decoder : public MIPRTPPacketDecoder 43 | { 44 | public: 45 | MIPRTPL16Decoder(bool stereo, int sampRate = 44100); 46 | ~MIPRTPL16Decoder(); 47 | private: 48 | bool validatePacket(const jrtplib::RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate); 49 | void createNewMessages(const jrtplib::RTPPacket *pRTPPack, std::list &messages, std::list ×tamps); 50 | 51 | int m_channels, m_sampRate; 52 | }; 53 | 54 | #endif // MIPRTPL16DECODER_H 55 | 56 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpl16encoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpl16encoder.h 27 | */ 28 | 29 | #ifndef MIPRTPL16ENCODER_H 30 | 31 | #define MIPRTPL16ENCODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miprtpencoder.h" 35 | #include 36 | 37 | class MIPRTPSendMessage; 38 | 39 | /** Creates RTP packets for 16 bit signed big endian encoded audio packets. 40 | * This component accepts incoming mono or stereo audio packets (16 bit signed 41 | * big endian) of a specific sampling rate and generates MIPRTPSendMessage objects 42 | * which can then be transferred to a MIPRTPComponent instance. The default sampling 43 | * rate is 44100 Hz, which corresponds to a predefined payload type in RFC 3551. 44 | */ 45 | class EMIPLIB_IMPORTEXPORT MIPRTPL16Encoder : public MIPRTPEncoder 46 | { 47 | public: 48 | MIPRTPL16Encoder(); 49 | ~MIPRTPL16Encoder(); 50 | 51 | /** Initializes the encoder for mono or stereo audio messages. */ 52 | bool init(bool stereo, int sampRate = 44100); 53 | 54 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 55 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 56 | private: 57 | void cleanUp(); 58 | void clearMessages(); 59 | 60 | bool m_init; 61 | int m_channels, m_sampRate; 62 | std::list m_messages; 63 | std::list::const_iterator m_msgIt; 64 | int64_t m_prevIteration; 65 | }; 66 | 67 | #endif // MIPRTPL16ENCODER_H 68 | 69 | -------------------------------------------------------------------------------- /src/components/transmission/miprtplpcdecoder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | #include "miprtplpcdecoder.h" 27 | #include "miprawaudiomessage.h" 28 | #include "mipencodedaudiomessage.h" 29 | #include "miprtpmessage.h" 30 | #include 31 | 32 | #include "mipdebug.h" 33 | 34 | using namespace jrtplib; 35 | 36 | #define MIPRTPLPCDECODER_SIZE 14 37 | #define MIPRTPLPCDECODER_NUMFRAMES 160 38 | 39 | MIPRTPLPCDecoder::MIPRTPLPCDecoder() 40 | { 41 | } 42 | 43 | MIPRTPLPCDecoder::~MIPRTPLPCDecoder() 44 | { 45 | } 46 | 47 | bool MIPRTPLPCDecoder::validatePacket(const RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate) 48 | { 49 | size_t length; 50 | 51 | length = (size_t)pRTPPack->GetPayloadLength(); 52 | if (length != MIPRTPLPCDECODER_SIZE) // TODO: for now we only support one LPC frame per packet 53 | return false; 54 | 55 | timestampUnit = 1.0/8000.0; 56 | return true; 57 | } 58 | 59 | void MIPRTPLPCDecoder::createNewMessages(const RTPPacket *pRTPPack, std::list &messages, std::list ×tamps) 60 | { 61 | size_t length = pRTPPack->GetPayloadLength(); 62 | uint8_t *pData = new uint8_t [length]; 63 | 64 | memcpy(pData, pRTPPack->GetPayloadData(), length); 65 | MIPEncodedAudioMessage *pEncMsg = new MIPEncodedAudioMessage(MIPENCODEDAUDIOMESSAGE_TYPE_LPC, 8000, 1, MIPRTPLPCDECODER_NUMFRAMES, pData, length, true); 66 | 67 | messages.push_back(pEncMsg); 68 | timestamps.push_back(pRTPPack->GetTimestamp()); 69 | } 70 | 71 | -------------------------------------------------------------------------------- /src/components/transmission/miprtplpcdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtplpcdecoder.h 27 | */ 28 | 29 | #ifndef MIPRTPLPCDECODER_H 30 | 31 | #define MIPRTPLPCDECODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miprtppacketdecoder.h" 35 | 36 | /** Decodes incoming RTP data into LPC encoded messages. 37 | * This class takes MIPRTPReceiveMessages as input and generates 38 | * LPC encoded audio messages. 39 | */ 40 | class EMIPLIB_IMPORTEXPORT MIPRTPLPCDecoder : public MIPRTPPacketDecoder 41 | { 42 | public: 43 | MIPRTPLPCDecoder(); 44 | ~MIPRTPLPCDecoder(); 45 | private: 46 | bool validatePacket(const jrtplib::RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate); 47 | void createNewMessages(const jrtplib::RTPPacket *pRTPPack, std::list &messages, std::list ×tamps); 48 | }; 49 | 50 | #endif // MIPRTPLPCDECODER_H 51 | 52 | -------------------------------------------------------------------------------- /src/components/transmission/miprtplpcencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtplpcencoder.h 27 | */ 28 | 29 | #ifndef MIPRTPLPCENCODER_H 30 | 31 | #define MIPRTPLPCENCODER_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_LPC 36 | 37 | #include "miprtpencoder.h" 38 | #include 39 | 40 | class MIPRTPSendMessage; 41 | 42 | /** Creates RTP packets for LPC compressed audio packets. 43 | * This component accepts incoming LPC compressed audio packets and generates 44 | * MIPRTPSendMessage objects which can then be transferred to a MIPRTPComponent instance. 45 | */ 46 | class EMIPLIB_IMPORTEXPORT MIPRTPLPCEncoder : public MIPRTPEncoder 47 | { 48 | public: 49 | MIPRTPLPCEncoder(); 50 | ~MIPRTPLPCEncoder(); 51 | 52 | /** Initializes the encoder. */ 53 | bool init(); 54 | 55 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 56 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 57 | private: 58 | void cleanUp(); 59 | void clearMessages(); 60 | 61 | bool m_init; 62 | std::list m_messages; 63 | std::list::const_iterator m_msgIt; 64 | int64_t m_prevIteration; 65 | }; 66 | 67 | #endif // MIPCONFIG_SUPPORT_LPC 68 | 69 | #endif // MIPRTPLPCENCODER_H 70 | 71 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpopusdecoder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | 27 | #ifdef MIPCONFIG_SUPPORT_OPUS 28 | 29 | #include "miprtpopusdecoder.h" 30 | #include "miprawaudiomessage.h" 31 | #include "mipencodedaudiomessage.h" 32 | #include "miprtpmessage.h" 33 | #include 34 | 35 | #include "mipdebug.h" 36 | 37 | using namespace jrtplib; 38 | 39 | MIPRTPOpusDecoder::MIPRTPOpusDecoder() 40 | { 41 | } 42 | 43 | MIPRTPOpusDecoder::~MIPRTPOpusDecoder() 44 | { 45 | } 46 | 47 | bool MIPRTPOpusDecoder::validatePacket(const RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate) 48 | { 49 | size_t length; 50 | 51 | length = (size_t)pRTPPack->GetPayloadLength(); 52 | if (length < 1) 53 | return false; 54 | 55 | timestampUnit = 1.0/48000.0; 56 | 57 | return true; 58 | } 59 | 60 | void MIPRTPOpusDecoder::createNewMessages(const RTPPacket *pRTPPack, std::list &messages, std::list ×tamps) 61 | { 62 | size_t length = pRTPPack->GetPayloadLength(); 63 | uint8_t *pData = new uint8_t [length]; 64 | 65 | memcpy(pData, pRTPPack->GetPayloadData(), length); 66 | MIPEncodedAudioMessage *pEncMsg = new MIPEncodedAudioMessage(MIPENCODEDAUDIOMESSAGE_TYPE_OPUS, -1, 1, -1, pData, length, true); 67 | 68 | messages.push_back(pEncMsg); 69 | timestamps.push_back(pRTPPack->GetTimestamp()); 70 | } 71 | 72 | #endif // MIPCONFIG_SUPPORT_OPUS 73 | 74 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpopusdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpopusdecoder.h 27 | */ 28 | 29 | #ifndef MIPRTPOPUSDECODER_H 30 | 31 | #define MIPRTPOPUSDECODER_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_OPUS 36 | 37 | #include "miprtppacketdecoder.h" 38 | 39 | /** This class decodes incoming RTP data into Opus encoded audio messages. 40 | * This class takes MIPRTPReceiveMessages as input and generates 41 | * Opus encoded audio messages. 42 | */ 43 | class EMIPLIB_IMPORTEXPORT MIPRTPOpusDecoder : public MIPRTPPacketDecoder 44 | { 45 | public: 46 | MIPRTPOpusDecoder(); 47 | ~MIPRTPOpusDecoder(); 48 | private: 49 | bool validatePacket(const jrtplib::RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate); 50 | void createNewMessages(const jrtplib::RTPPacket *pRTPPack, std::list &messages, std::list ×tamps); 51 | }; 52 | 53 | #endif // MIPCONFIG_SUPPORT_OPUS 54 | 55 | #endif // MIPRTPOPUSDECODER_H 56 | 57 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpopusencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpopusencoder.h 27 | */ 28 | 29 | #ifndef MIPRTPOPUSENCODER_H 30 | 31 | #define MIPRTPOPUSENCODER_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_OPUS 36 | 37 | #include "miprtpencoder.h" 38 | #include 39 | 40 | class MIPRTPSendMessage; 41 | 42 | /** Creates RTP packets for Opus compressed audio packets. 43 | * This component accepts incoming Opus compressed audio packets and generates 44 | * MIPRTPSendMessage objects which can then be transferred to a MIPRTPComponent instance. 45 | */ 46 | class EMIPLIB_IMPORTEXPORT MIPRTPOpusEncoder : public MIPRTPEncoder 47 | { 48 | public: 49 | MIPRTPOpusEncoder(); 50 | ~MIPRTPOpusEncoder(); 51 | 52 | /** Initializes the encoder. */ 53 | bool init(); 54 | 55 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 56 | private: 57 | void cleanUp(); 58 | 59 | bool m_init; 60 | }; 61 | 62 | #endif // MIPCONFIG_SUPPORT_OPUS 63 | 64 | #endif // MIPRTPOPUSENCODER_H 65 | 66 | -------------------------------------------------------------------------------- /src/components/transmission/miprtppacketdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtppacketdecoder.h 27 | */ 28 | 29 | #ifndef MIPRTPPACKETDECODER_H 30 | 31 | #define MIPRTPPACKETDECODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miptypes.h" 35 | #include 36 | 37 | namespace jrtplib 38 | { 39 | class RTPPacket; 40 | } 41 | 42 | class MIPMediaMessage; 43 | 44 | /** Abstract base class for RTP packet decoders for a specific kind of payload. */ 45 | class EMIPLIB_IMPORTEXPORT MIPRTPPacketDecoder 46 | { 47 | public: 48 | MIPRTPPacketDecoder() { } 49 | virtual ~MIPRTPPacketDecoder() { } 50 | 51 | /** Validates an RTP packet and gives information about the timestamp unit of the packet data. 52 | * This function validates an RTP packet and provides information about the timestamp unit 53 | * of the packet data. It has to be implemented in a derived class. The function should return 54 | * true if the packet is valid and false otherwise and if possible, the timestamp unit should 55 | * be filled in. 56 | */ 57 | virtual bool validatePacket(const jrtplib::RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate) = 0; 58 | 59 | /** Creates a new message from an RTP packet. 60 | * This function has to be implemented by a derived class. Based on the validated 61 | * RTP packet \c pRTPPack, one or more appropriate messages should be generated. 62 | * \param pRTPPack The RTP packet which should be processed. 63 | * \param messages A list in which the resulting messages should be stored. 64 | * \param timestamps A list containing the RTP timestamp for each message in the 65 | * 'messages' list. 66 | */ 67 | virtual void createNewMessages(const jrtplib::RTPPacket *pRTPPack, std::list &messages, 68 | std::list ×tamps) = 0; 69 | }; 70 | 71 | #endif // MIPRTPPACKETDECODER_H 72 | 73 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpsilkdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpsilkdecoder.h 27 | */ 28 | 29 | #ifndef MIPRTPSILKDECODER_H 30 | 31 | #define MIPRTPSILKDECODER_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_SILK 36 | 37 | #include "miprtppacketdecoder.h" 38 | 39 | /** This class decodes incoming RTP data into SILK messages. 40 | * This class takes MIPRTPReceiveMessages as input and generates 41 | * SILK audio messages. For the best result, the user should set the timestamp 42 | * unit of each RTPSourceData instance from which SILK messages are being 43 | * received. If not, the component can derive this timestamp unit when two 44 | * consecutive RTCP sender reports from that source have been received, but 45 | * this can take a number of seconds. 46 | */ 47 | class EMIPLIB_IMPORTEXPORT MIPRTPSILKDecoder : public MIPRTPPacketDecoder 48 | { 49 | public: 50 | MIPRTPSILKDecoder(); 51 | ~MIPRTPSILKDecoder(); 52 | private: 53 | bool validatePacket(const jrtplib::RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate); 54 | void createNewMessages(const jrtplib::RTPPacket *pRTPPack, std::list &messages, std::list ×tamps); 55 | static bool isCloseTo(real_t estimate, real_t value); 56 | 57 | int m_sampRate; 58 | }; 59 | 60 | #endif // MIPCONFIG_SUPPORT_SILK 61 | 62 | #endif // MIPRTPSILKDECODER_H 63 | 64 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpsilkencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpsilkencoder.h 27 | */ 28 | 29 | #ifndef MIPRTPSILKENCODER_H 30 | 31 | #define MIPRTPSILKENCODER_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_SILK 36 | 37 | #include "miprtpencoder.h" 38 | #include 39 | 40 | class MIPRTPSendMessage; 41 | 42 | /** Creates RTP packets for SILK compressed audio packets. 43 | * This component accepts incoming SILK compressed audio packets and generates 44 | * MIPRTPSendMessage objects which can then be transferred to a MIPRTPComponent instance. 45 | */ 46 | class EMIPLIB_IMPORTEXPORT MIPRTPSILKEncoder : public MIPRTPEncoder 47 | { 48 | public: 49 | MIPRTPSILKEncoder(); 50 | ~MIPRTPSILKEncoder(); 51 | 52 | /** Initializes the encoder. 53 | * Initializes the component. 54 | * \param timestampsPerSecond Tells the component how much the RTP timestamp should be increased 55 | * each second. This can be either 8000, 12000, 16000 or 24000. 56 | */ 57 | bool init(int timestampsPerSecond); 58 | 59 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 60 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 61 | private: 62 | void cleanUp(); 63 | void clearMessages(); 64 | 65 | bool m_init; 66 | int m_timestampsPerSecond; 67 | std::list m_messages; 68 | std::list::const_iterator m_msgIt; 69 | int64_t m_prevIteration; 70 | }; 71 | 72 | #endif // MIPCONFIG_SUPPORT_SILK 73 | 74 | #endif // MIPRTPSILKENCODER_H 75 | 76 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpspeexdecoder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | 27 | #ifdef MIPCONFIG_SUPPORT_SPEEX 28 | 29 | #include "miprtpspeexdecoder.h" 30 | #include "miprawaudiomessage.h" 31 | #include "mipencodedaudiomessage.h" 32 | #include "miprtpmessage.h" 33 | #include 34 | 35 | #include "mipdebug.h" 36 | 37 | using namespace jrtplib; 38 | 39 | MIPRTPSpeexDecoder::MIPRTPSpeexDecoder() 40 | { 41 | } 42 | 43 | MIPRTPSpeexDecoder::~MIPRTPSpeexDecoder() 44 | { 45 | } 46 | 47 | bool MIPRTPSpeexDecoder::validatePacket(const RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate) 48 | { 49 | size_t length; 50 | 51 | length = (size_t)pRTPPack->GetPayloadLength(); 52 | if (length < 1) 53 | return false; 54 | 55 | if (timestampUnit < 0) 56 | { 57 | if (m_speexUtil.processBytes(pRTPPack->GetPayloadData(),pRTPPack->GetPayloadLength())) 58 | { 59 | m_sampRate = m_speexUtil.getSamplingRate(); 60 | timestampUnit = 1.0/((real_t)m_sampRate); 61 | } 62 | else 63 | return false; 64 | } 65 | else 66 | m_sampRate = (int)((1.0/timestampUnit)+0.5); 67 | 68 | return true; 69 | } 70 | 71 | void MIPRTPSpeexDecoder::createNewMessages(const RTPPacket *pRTPPack, std::list &messages, std::list ×tamps) 72 | { 73 | size_t length = pRTPPack->GetPayloadLength(); 74 | uint8_t *pData = new uint8_t [length]; 75 | 76 | memcpy(pData, pRTPPack->GetPayloadData(), length); 77 | MIPEncodedAudioMessage *pEncMsg = new MIPEncodedAudioMessage(MIPENCODEDAUDIOMESSAGE_TYPE_SPEEX, m_sampRate, 1, -1, pData, length, true); 78 | 79 | messages.push_back(pEncMsg); 80 | timestamps.push_back(pRTPPack->GetTimestamp()); 81 | } 82 | 83 | #endif // MIPCONFIG_SUPPORT_SPEEX 84 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpspeexdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpspeexdecoder.h 27 | */ 28 | 29 | #ifndef MIPRTPSPEEXDECODER_H 30 | 31 | #define MIPRTPSPEEXDECODER_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_SPEEX 36 | 37 | #include "miprtppacketdecoder.h" 38 | #include "mipspeexutil.h" 39 | 40 | /** This class decodes incoming RTP data into Speex messages. 41 | * This class takes MIPRTPReceiveMessages as input and generates 42 | * Speex audio messages. 43 | */ 44 | class EMIPLIB_IMPORTEXPORT MIPRTPSpeexDecoder : public MIPRTPPacketDecoder 45 | { 46 | public: 47 | MIPRTPSpeexDecoder(); 48 | ~MIPRTPSpeexDecoder(); 49 | private: 50 | bool validatePacket(const jrtplib::RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate); 51 | void createNewMessages(const jrtplib::RTPPacket *pRTPPack, std::list &messages, std::list ×tamps); 52 | 53 | MIPSpeexUtil m_speexUtil; 54 | int m_sampRate; 55 | }; 56 | 57 | #endif // MIPCONFIG_SUPPORT_SPEEX 58 | 59 | #endif // MIPRTPSPEEXDECODER_H 60 | 61 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpspeexencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpspeexencoder.h 27 | */ 28 | 29 | #ifndef MIPRTPSPEEXENCODER_H 30 | 31 | #define MIPRTPSPEEXENCODER_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_SPEEX 36 | 37 | #include "miprtpencoder.h" 38 | #include 39 | 40 | class MIPRTPSendMessage; 41 | 42 | /** Creates RTP packets for Speex compressed audio packets. 43 | * This component accepts incoming Speex compressed audio packets and generates 44 | * MIPRTPSendMessage objects which can then be transferred to a MIPRTPComponent instance. 45 | */ 46 | class EMIPLIB_IMPORTEXPORT MIPRTPSpeexEncoder : public MIPRTPEncoder 47 | { 48 | public: 49 | MIPRTPSpeexEncoder(); 50 | ~MIPRTPSpeexEncoder(); 51 | 52 | /** Initializes the encoder. */ 53 | bool init(); 54 | 55 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 56 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 57 | private: 58 | void cleanUp(); 59 | void clearMessages(); 60 | 61 | bool m_init; 62 | std::list m_messages; 63 | std::list::const_iterator m_msgIt; 64 | int64_t m_prevIteration; 65 | }; 66 | 67 | #endif // MIPCONFIG_SUPPORT_SPEEX 68 | 69 | #endif // MIPRTPSPEEXENCODER_H 70 | 71 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpulawdecoder.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | #include "miprtpulawdecoder.h" 27 | #include "miprawaudiomessage.h" 28 | #include "mipencodedaudiomessage.h" 29 | #include "miprtpmessage.h" 30 | #include 31 | 32 | #include "mipdebug.h" 33 | 34 | using namespace jrtplib; 35 | 36 | MIPRTPULawDecoder::MIPRTPULawDecoder() 37 | { 38 | } 39 | 40 | MIPRTPULawDecoder::~MIPRTPULawDecoder() 41 | { 42 | } 43 | 44 | bool MIPRTPULawDecoder::validatePacket(const RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate) 45 | { 46 | size_t length; 47 | 48 | length = (size_t)pRTPPack->GetPayloadLength(); 49 | if (length < 1) 50 | return false; 51 | 52 | timestampUnit = 1.0/8000.0; 53 | return true; 54 | } 55 | 56 | void MIPRTPULawDecoder::createNewMessages(const RTPPacket *pRTPPack, std::list &messages, std::list ×tamps) 57 | { 58 | size_t length = pRTPPack->GetPayloadLength(); 59 | uint8_t *pData = new uint8_t [length]; 60 | 61 | memcpy(pData, pRTPPack->GetPayloadData(), length); 62 | MIPEncodedAudioMessage *pEncMsg = new MIPEncodedAudioMessage(MIPENCODEDAUDIOMESSAGE_TYPE_ULAW, 8000, 1, (int)length, pData, length, true); 63 | 64 | messages.push_back(pEncMsg); 65 | timestamps.push_back(pRTPPack->GetTimestamp()); 66 | } 67 | 68 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpulawdecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpulawdecoder.h 27 | */ 28 | 29 | #ifndef MIPRTPULAWDECODER_H 30 | 31 | #define MIPRTPULAWDECODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miprtppacketdecoder.h" 35 | 36 | /** Decodes incoming RTP data into U-law encoded messages. 37 | * This class takes MIPRTPReceiveMessages as input and generates 38 | * U-law encoded audio messages. 39 | */ 40 | class EMIPLIB_IMPORTEXPORT MIPRTPULawDecoder : public MIPRTPPacketDecoder 41 | { 42 | public: 43 | MIPRTPULawDecoder(); 44 | ~MIPRTPULawDecoder(); 45 | private: 46 | bool validatePacket(const jrtplib::RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate); 47 | void createNewMessages(const jrtplib::RTPPacket *pRTPPack, std::list &messages, std::list ×tamps); 48 | }; 49 | 50 | #endif // MIPRTPULAWDECODER_H 51 | 52 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpulawencoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpulawencoder.h 27 | */ 28 | 29 | #ifndef MIPRTPULAWENCODER_H 30 | 31 | #define MIPRTPULAWENCODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miprtpencoder.h" 35 | #include 36 | 37 | class MIPRTPSendMessage; 38 | 39 | /** Creates RTP packets for U-law encoded audio packets. 40 | * This component accepts incoming U-law encoded 8000Hz mono audio packets and generates 41 | * MIPRTPSendMessage objects which can then be transferred to a MIPRTPComponent instance. 42 | */ 43 | class EMIPLIB_IMPORTEXPORT MIPRTPULawEncoder : public MIPRTPEncoder 44 | { 45 | public: 46 | MIPRTPULawEncoder(); 47 | ~MIPRTPULawEncoder(); 48 | 49 | /** Initializes the encoder. */ 50 | bool init(); 51 | 52 | bool push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg); 53 | bool pull(const MIPComponentChain &chain, int64_t iteration, MIPMessage **pMsg); 54 | private: 55 | void cleanUp(); 56 | void clearMessages(); 57 | 58 | bool m_init; 59 | std::list m_messages; 60 | std::list::const_iterator m_msgIt; 61 | int64_t m_prevIteration; 62 | }; 63 | 64 | #endif // MIPRTPULAWENCODER_H 65 | 66 | -------------------------------------------------------------------------------- /src/components/transmission/miprtpvideodecoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miprtpvideodecoder.h 27 | */ 28 | 29 | #ifndef MIPRTPVIDEODECODER_H 30 | 31 | #define MIPRTPVIDEODECODER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miprtppacketdecoder.h" 35 | #include "miprtppacketgrouper.h" 36 | #include "miptime.h" 37 | #include 38 | 39 | /** This class decodes incoming RTP data into video messages. 40 | * This class takes MIPRTPReceiveMessages as input and generates 41 | * video messages. The RTP messages themselves should use the 42 | * internal format provided by MIPRTPVideoEncoder. 43 | */ 44 | class EMIPLIB_IMPORTEXPORT MIPRTPVideoDecoder : public MIPRTPPacketDecoder 45 | { 46 | public: 47 | MIPRTPVideoDecoder(); 48 | ~MIPRTPVideoDecoder(); 49 | private: 50 | bool validatePacket(const jrtplib::RTPPacket *pRTPPack, real_t ×tampUnit, real_t timestampUnitEstimate); 51 | void createNewMessages(const jrtplib::RTPPacket *pRTPPack, std::list &messages, std::list ×tamps); 52 | 53 | void expireGroupers(); 54 | 55 | class PacketGrouper 56 | { 57 | public: 58 | PacketGrouper(MIPRTPPacketGrouper *pPacketGrouper) 59 | { 60 | m_pGrouper = pPacketGrouper; 61 | m_lastAccesstime = MIPTime::getCurrentTime(); 62 | } 63 | 64 | ~PacketGrouper() 65 | { 66 | delete m_pGrouper; 67 | } 68 | 69 | MIPRTPPacketGrouper *getGrouper() 70 | { 71 | m_lastAccesstime = MIPTime::getCurrentTime(); 72 | return m_pGrouper; 73 | } 74 | 75 | MIPTime getLastAccessTime() const 76 | { 77 | return m_lastAccesstime; 78 | } 79 | private: 80 | MIPTime m_lastAccesstime; 81 | MIPRTPPacketGrouper *m_pGrouper; 82 | }; 83 | 84 | std::unordered_map m_packetGroupers; 85 | MIPTime m_lastCheckTime; 86 | }; 87 | 88 | #endif // MIPRTPVIDEODECODER_H 89 | 90 | -------------------------------------------------------------------------------- /src/components/util/mipoutputmessagequeuesimple.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | #include "mipoutputmessagequeuesimple.h" 27 | #include "mipmessage.h" 28 | 29 | #include "mipdebug.h" 30 | 31 | MIPOutputMessageQueueSimple::MIPOutputMessageQueueSimple(const std::string &componentName) : MIPOutputMessageQueue(componentName) 32 | { 33 | } 34 | 35 | MIPOutputMessageQueueSimple::~MIPOutputMessageQueueSimple() 36 | { 37 | } 38 | 39 | bool MIPOutputMessageQueueSimple::push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg) 40 | { 41 | checkIteration(iteration); 42 | 43 | bool deleteMessage = true; 44 | bool gotError = false; 45 | 46 | MIPMessage *pNewMsg = pushSub(chain, iteration, pMsg, deleteMessage, gotError); 47 | if (gotError) 48 | { 49 | if (pNewMsg != 0 && deleteMessage) // clean up if necessary 50 | delete pNewMsg; 51 | 52 | return false; 53 | } 54 | 55 | if (pNewMsg != 0) // can be zero 56 | addToOutputQueue(pNewMsg, deleteMessage); 57 | 58 | return true; 59 | } 60 | 61 | 62 | -------------------------------------------------------------------------------- /src/components/util/mipoutputmessagequeuewithstatesimple.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | #include "mipoutputmessagequeuewithstatesimple.h" 27 | #include "mipmessage.h" 28 | 29 | #include "mipdebug.h" 30 | 31 | MIPOutputMessageQueueWithStateSimple::MIPOutputMessageQueueWithStateSimple(const std::string &componentName) : MIPOutputMessageQueueWithState(componentName) 32 | { 33 | } 34 | 35 | MIPOutputMessageQueueWithStateSimple::~MIPOutputMessageQueueWithStateSimple() 36 | { 37 | } 38 | 39 | bool MIPOutputMessageQueueWithStateSimple::push(const MIPComponentChain &chain, int64_t iteration, MIPMessage *pMsg) 40 | { 41 | checkIteration(iteration); 42 | 43 | bool deleteMessage = true; 44 | bool gotError = false; 45 | 46 | MIPMessage *pNewMsg = subPush(chain, iteration, pMsg, deleteMessage, gotError); 47 | if (gotError) 48 | return false; 49 | 50 | if (pNewMsg != 0) // can be zero 51 | addToOutputQueue(pNewMsg, deleteMessage); 52 | 53 | return true; 54 | } 55 | 56 | 57 | -------------------------------------------------------------------------------- /src/core/mipcompat.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #ifndef MIPCOMPAT_H 26 | 27 | #define MIPCOMPAT_H 28 | 29 | #include "mipconfig.h" 30 | 31 | #if (defined(WIN32) || defined(_WIN32_WCE)) 32 | #if (!defined(_WIN32_WCE)) && (defined(_MSC_VER) && _MSC_VER >= 1400 ) 33 | #define MIP_SNPRINTF _snprintf_s 34 | #define MIP_SSCANF sscanf_s 35 | #else 36 | #define MIP_SNPRINTF _snprintf 37 | #define MIP_SSCANF sscanf 38 | #endif 39 | #else 40 | #define MIP_SNPRINTF snprintf 41 | #define MIP_SSCANF sscanf 42 | #endif // WIN32 || _WIN32_WCE 43 | 44 | #endif // MIPCOMPAT_H 45 | 46 | -------------------------------------------------------------------------------- /src/core/mipcomponent.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | #include "mipcomponent.h" 27 | #include "miptime.h" 28 | #include 29 | #include 30 | 31 | #include "mipdebug.h" 32 | 33 | MIPComponent::MIPComponent(const std::string &name) 34 | { 35 | 36 | // We're forwarding this getCurrentTime call to something that needs initialization, 37 | // so we'll just call it as soon as possible here, so that the initialization is 38 | // already performed by the time we're using threads 39 | m_dummy = (uint32_t)MIPTime::getCurrentTime().getSeconds(); 40 | 41 | int status; 42 | 43 | if ((status = m_componentMutex.Init()) < 0) 44 | { 45 | std::cerr << "Error: can't initialize component mutex (JMutex error code " << status << ")" << std::endl; 46 | exit(-1); 47 | } 48 | m_componentName = name; 49 | } 50 | 51 | MIPComponent::~MIPComponent() 52 | { 53 | } 54 | 55 | -------------------------------------------------------------------------------- /src/core/mipconfig.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #ifndef MIPCONFIG_H 26 | 27 | #define MIPCONFIG_H 28 | 29 | #define EMIPLIB_IMPORT ${EMIPLIB_IMPORT} 30 | #define EMIPLIB_EXPORT ${EMIPLIB_EXPORT} 31 | #ifdef EMIPLIB_COMPILING 32 | #define EMIPLIB_IMPORTEXPORT EMIPLIB_EXPORT 33 | #else 34 | #define EMIPLIB_IMPORTEXPORT EMIPLIB_IMPORT 35 | #endif // EMIPLIB_COMPILING 36 | 37 | ${MIPCONFIG_GPL} 38 | 39 | ${MIPCONFIG_BIGENDIAN} 40 | 41 | ${MIPCONFIG_SUPPORT_SNDFILE} 42 | 43 | ${MIPCONFIG_SUPPORT_AUDIOFILE} 44 | 45 | ${MIPCONFIG_SUPPORT_QT5} 46 | 47 | ${MIPCONFIG_SUPPORT_ALSA} 48 | 49 | ${MIPCONFIG_SUPPORT_SPEEX} 50 | 51 | ${MIPCONFIG_SUPPORT_GSM} 52 | 53 | ${MIPCONFIG_SUPPORT_LPC} 54 | 55 | ${MIPCONFIG_SUPPORT_AVCODEC} 56 | 57 | ${MIPCONFIG_SUPPORT_INTELIPP} 58 | 59 | ${MIPCONFIG_SUPPORT_ESD} 60 | 61 | ${MIPCONFIG_SUPPORT_JACK} 62 | 63 | ${MIPCONFIG_SUPPORT_VIDEO4LINUX} 64 | 65 | ${MIPCONFIG_SUPPORT_OSS} 66 | 67 | ${MIPCONFIG_SUPPORT_SDLAUDIO} 68 | 69 | ${MIPCONFIG_SUPPORT_OPENAL} 70 | 71 | ${MIPCONFIG_SUPPORT_PORTAUDIO} 72 | 73 | ${MIPCONFIG_SUPPORT_AUDIOTRACK} 74 | 75 | ${MIPCONFIG_SUPPORT_AUDIORECORDER} 76 | 77 | ${MIPCONFIG_SUPPORT_WINMM} 78 | 79 | ${MIPCONFIG_SUPPORT_DIRECTSHOW} 80 | 81 | ${MIPCONFIG_SUPPORT_SILK} 82 | 83 | ${MIPCONFIG_SUPPORT_OPUS} 84 | 85 | ${MIPCONFIG_SUPPORT_PULSEAUDIO} 86 | 87 | ${MIPCONFIG_SUPPORT_OPENSLESANDROID} 88 | 89 | #ifdef MIPCONFIG_SUPPORT_AVCODEC 90 | #ifndef __STDC_CONSTANT_MACROS 91 | #define __STDC_CONSTANT_MACROS 92 | #endif // __STDC_CONSTANT_MACROS 93 | #endif // MIPCONFIG_SUPPORT_AVCODEC 94 | 95 | #endif // MIPCONFIG_H 96 | 97 | -------------------------------------------------------------------------------- /src/core/mipdebug.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #ifndef MIPDEBUG_H 26 | 27 | #define MIPDEBUG_H 28 | 29 | #include "mipconfig.h" 30 | 31 | #ifdef MIPDEBUG 32 | 33 | #include "miptypes.h" 34 | 35 | void *operator new(size_t s,char filename[],int line); 36 | void *operator new[](size_t s,char filename[],int line); 37 | 38 | #define new new (__FILE__,__LINE__) 39 | 40 | #endif // MIPDEBUG 41 | 42 | #endif // MIPDEBUG_H 43 | 44 | -------------------------------------------------------------------------------- /src/core/miperrorbase.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file miperrorbase.h 27 | */ 28 | 29 | #ifndef MIPERRORBASE_H 30 | 31 | #define MIPERRORBASE_H 32 | 33 | #include "mipconfig.h" 34 | #include 35 | 36 | /** This class provides the error description functions for other classes. 37 | */ 38 | class EMIPLIB_IMPORTEXPORT MIPErrorBase 39 | { 40 | public: 41 | MIPErrorBase() { } 42 | virtual ~MIPErrorBase() { } 43 | 44 | /** Returns the last known error description. 45 | * Typically, when some boolean function returned false, an error occured. A 46 | * string describing this error can then be retrieved by this function if the 47 | * derived class used the MIPErrorBase::setErrorString member function to set 48 | * a description. 49 | */ 50 | std::string getErrorString() const { return m_errStr; } 51 | protected: 52 | /** Stores an error description. 53 | * If something goes wrong in a derived class it should store a description of what went 54 | * wrong. This which can be done using this function. 55 | */ 56 | void setErrorString(const std::string &str) const { m_errStr = str; } 57 | private: 58 | mutable std::string m_errStr; 59 | }; 60 | 61 | #endif // MIPERRORBASE_H 62 | -------------------------------------------------------------------------------- /src/core/mipsystemmessage.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipsystemmessage.h 27 | */ 28 | 29 | #ifndef MIPSYSTEMMESSAGE_H 30 | 31 | #define MIPSYSTEMMESSAGE_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipmessage.h" 35 | 36 | /** 37 | * \def MIPSYSTEMMESSAGE_TYPE_WAITTIME 38 | * \brief A system message with this subtype is sent by the component chain to the first 39 | * component to instuct it to wait until it is time to process the rest of the 40 | * chain. 41 | * \def MIPSYSTEMMESSAGE_TYPE_ISTIME 42 | * \brief This message can be sent by a timing component to the next component to let 43 | * it know that an interval has elapsed. 44 | */ 45 | 46 | #define MIPSYSTEMMESSAGE_TYPE_WAITTIME 0x00000001 47 | #define MIPSYSTEMMESSAGE_TYPE_ISTIME 0x00000002 48 | 49 | /** A system message. 50 | * This kind of message is used to instruct a component to wait until messages can be 51 | * distributed in the chain or to inform a component that an interval has elapsed. 52 | */ 53 | class EMIPLIB_IMPORTEXPORT MIPSystemMessage : public MIPMessage 54 | { 55 | public: 56 | /** Constructs a system message with a specific subtype. 57 | * This constructor creates a system message with a specific subtype. These subtypes 58 | * can be found in mipsystemmessage.h 59 | */ 60 | MIPSystemMessage(uint32_t subtype) : MIPMessage(MIPMESSAGE_TYPE_SYSTEM, subtype) { } 61 | }; 62 | 63 | #endif // MIPSYSTEMMESSAGE_H 64 | 65 | -------------------------------------------------------------------------------- /src/core/miptime.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | #define __STDC_FORMAT_MACROS 25 | #include "mipconfig.h" 26 | #include "miptime.h" 27 | #include "mipcompat.h" 28 | #include 29 | #include 30 | 31 | std::string MIPTime::getString() const 32 | { 33 | char str[256]; 34 | 35 | MIP_SNPRINTF(str, 255, "%" PRId64 ".%06d", getSeconds(), (int)getMicroSeconds()); 36 | 37 | return std::string(str); 38 | } 39 | 40 | 41 | -------------------------------------------------------------------------------- /src/core/miptypes.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #ifndef MIPTYPES_H 26 | 27 | #define MIPTYPES_H 28 | 29 | ${EMIPLIB_INTTYPE_HEADERS} 30 | 31 | typedef long double real_t; 32 | 33 | #endif // MIPTYPES_H 34 | -------------------------------------------------------------------------------- /src/core/miptypes_win.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #ifndef MIPTYPES_WIN_H 26 | 27 | #define MIPTYPES_WIN_H 28 | 29 | #ifndef INTTYPES_DEFINED 30 | 31 | #define INTTYPES_DEFINED 32 | 33 | typedef char int8_t; 34 | typedef unsigned char uint8_t; 35 | typedef short int16_t; 36 | typedef unsigned short uint16_t; 37 | typedef int int32_t; 38 | typedef unsigned int uint32_t; 39 | typedef __int64 int64_t; 40 | typedef unsigned __int64 uint64_t; 41 | 42 | #endif // INTTYPES_DEFINED 43 | 44 | #endif // MIPTYPES_WIN_H 45 | -------------------------------------------------------------------------------- /src/core/mipversion.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #include "mipconfig.h" 26 | #include "mipversion.h" 27 | #include "mipcompat.h" 28 | #include "mipversioninternal.h" 29 | #include 30 | 31 | #include "mipdebug.h" 32 | 33 | MIPVersion::MIPVersion() 34 | { 35 | m_major = MIPVERSION_MAJOR; 36 | m_minor = MIPVERSION_MINOR; 37 | m_debug = MIPVERSION_DEBUG; 38 | #ifdef MIPCONFIG_GPL 39 | m_license = std::string("GPL"); 40 | #else 41 | m_license = std::string("LGPL"); 42 | #endif // MIPCONFIG_GPL 43 | } 44 | 45 | MIPVersion::~MIPVersion() 46 | { 47 | } 48 | 49 | std::string MIPVersion::getVersionString() const 50 | { 51 | char str[16]; 52 | 53 | MIP_SNPRINTF(str, 16, "%d.%d.%d", m_major, m_minor, m_debug); 54 | 55 | return std::string(str); 56 | } 57 | 58 | -------------------------------------------------------------------------------- /src/core/mipversion.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipversion.h 27 | */ 28 | 29 | #ifndef MIPVERSION_H 30 | 31 | #define MIPVERSION_H 32 | 33 | #include "mipconfig.h" 34 | #include 35 | 36 | /** Version information about the library. */ 37 | class EMIPLIB_IMPORTEXPORT MIPVersion 38 | { 39 | public: 40 | MIPVersion(); 41 | ~MIPVersion(); 42 | 43 | /** Returns the major version number. */ 44 | int getMajorVersion() const { return m_major; } 45 | 46 | /** Returns the minor version number. */ 47 | int getMinorVersion() const { return m_minor; } 48 | 49 | /** Returns the debug version number. */ 50 | int getDebugVersion() const { return m_debug; } 51 | 52 | /** Returns the version string. */ 53 | std::string getVersionString() const; 54 | 55 | /** Returns the license which applies to this library. */ 56 | std::string getLicense() const { return m_license; } 57 | private: 58 | std::string m_license; 59 | int m_major, m_minor, m_debug; 60 | }; 61 | 62 | #endif // MIPVERSION_H 63 | 64 | -------------------------------------------------------------------------------- /src/core/mipversioninternal.h.in: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | #ifndef MIPVERSIONINTERNAL_H 26 | 27 | #define MIPVERSIONINTERNAL_H 28 | 29 | #define MIPVERSION_MAJOR ${VERSION_MAJOR} 30 | #define MIPVERSION_MINOR ${VERSION_MINOR} 31 | #define MIPVERSION_DEBUG ${VERSION_DEBUG} 32 | 33 | #endif // MIPVERSIONINTERNAL_H 34 | -------------------------------------------------------------------------------- /src/core/mipvideomessage.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipvideomessage.h 27 | */ 28 | 29 | #ifndef MIPVIDEOMESSAGE_H 30 | 31 | #define MIPVIDEOMESSAGE_H 32 | 33 | #include "mipconfig.h" 34 | #include "mipmediamessage.h" 35 | #include "miptypes.h" 36 | #include "miptime.h" 37 | 38 | /** Base class for encoded and raw video messages. 39 | * This class is the base class of both raw video messages and encoded video messages. 40 | */ 41 | class EMIPLIB_IMPORTEXPORT MIPVideoMessage : public MIPMediaMessage 42 | { 43 | protected: 44 | /** Constructor of the class. 45 | * Constructor of the class, meant to be used by subclasses. 46 | * \param isRaw Flag indicating is the message is intended for raw video frames or 47 | * encoded video. 48 | * \param msgSubtype Subtype of the message. 49 | * \param width Width of the video frame. 50 | * \param height Height of the video frame. 51 | */ 52 | MIPVideoMessage(bool isRaw, uint32_t msgSubtype, int width, int height) : MIPMediaMessage(MIPMediaMessage::Video, isRaw, msgSubtype) 53 | { m_height = height; m_width = width; } 54 | public: 55 | ~MIPVideoMessage() { } 56 | 57 | /** Returns the width of the video frame. */ 58 | int getWidth() const { return m_width; } 59 | 60 | /** Returns the height of the video frame. */ 61 | int getHeight() const { return m_height; } 62 | 63 | /** Copies the information stored in \c msg, including the MIPMediaMessage info. */ 64 | void copyVideoInfoFrom(const MIPVideoMessage &msg) { m_width = msg.m_width; m_height = msg.m_height; } 65 | private: 66 | int m_width, m_height; 67 | }; 68 | 69 | #endif // MIPVIDEOMESSAGE_H 70 | 71 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, 2 | Technische Universitaet Berlin 3 | 4 | Any use of this software is permitted provided that this notice is not 5 | removed and that neither the authors nor the Technische Universitaet Berlin 6 | are deemed to have made any representations as to the suitability of this 7 | software for any purpose nor are held responsible for any defects of 8 | this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | 10 | As a matter of courtesy, the authors request to be informed about uses 11 | this software has found, about bugs in this software, and about any 12 | improvements that may be of general interest. 13 | 14 | Berlin, 28.11.1994 15 | Jutta Degener 16 | Carsten Bormann 17 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/README: -------------------------------------------------------------------------------- 1 | These source files were obtained from JVOIPLIB 1.4.1. The original 2 | README is the following: 3 | 4 | ------------------------------------------------------------------------- 5 | 6 | These sources are derived from the work done by Jutta Degener and Carsten 7 | Bormann at the Technical University of Berlin. These sources are modified 8 | and files were left out of the original package. 9 | 10 | You can find the original implementation at the following URL: 11 | http://kbs.cs.tu-berlin.de/~jutta/toast.html 12 | 13 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/doc/COPYRIGHT: -------------------------------------------------------------------------------- 1 | Copyright 1992, 1993, 1994 by Jutta Degener and Carsten Bormann, 2 | Technische Universitaet Berlin 3 | 4 | Any use of this software is permitted provided that this notice is not 5 | removed and that neither the authors nor the Technische Universitaet Berlin 6 | are deemed to have made any representations as to the suitability of this 7 | software for any purpose nor are held responsible for any defects of 8 | this software. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | 10 | As a matter of courtesy, the authors request to be informed about uses 11 | this software has found, about bugs in this software, and about any 12 | improvements that may be of general interest. 13 | 14 | Berlin, 28.11.1994 15 | Jutta Degener 16 | Carsten Bormann 17 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/doc/MACHINES: -------------------------------------------------------------------------------- 1 | The gsm library has been tested successfully on the following platforms: 2 | 3 | - Various Sun4's running SunOS 4.1.2 4 | - SPARC1 (SunOS 4.1.1) 5 | - Integrated Solutions 68k Optimum running 4.3BSD UNIX with a Green Hills cc 6 | - NeXTstation running NeXT-OS/Mach 3.0 7 | - No-name AT/386 with Xenix 2.3.2 (using -DSTUPID_COMPILER) 8 | - RS/6000-350 running AIX 3.2.0 9 | - RS/6000-320 running AIX 3.1.5 10 | - Alliant FX80 (Concentrix 5.7) 11 | - SGI Indigo XS4000 (IRIX 4.0.5F) 12 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/doc/MANIFEST: -------------------------------------------------------------------------------- 1 | gsm-1.0/COPYRIGHT 2 | gsm-1.0/ChangeLog 3 | gsm-1.0/INSTALL 4 | gsm-1.0/MACHINES 5 | gsm-1.0/MANIFEST 6 | gsm-1.0/Makefile 7 | gsm-1.0/README 8 | gsm-1.0/add-test/add_test.c 9 | gsm-1.0/add-test/add_test.dta 10 | gsm-1.0/inc/gsm.h 11 | gsm-1.0/inc/proto.h 12 | gsm-1.0/inc/unproto.h 13 | gsm-1.0/inc/config.h 14 | gsm-1.0/inc/private.h 15 | gsm-1.0/inc/toast.h 16 | gsm-1.0/man/bitter.1 17 | gsm-1.0/man/gsm.3 18 | gsm-1.0/man/gsm_explode.3 19 | gsm-1.0/man/gsm_print.3 20 | gsm-1.0/man/gsm_option.3 21 | gsm-1.0/man/toast.1 22 | gsm-1.0/src/add.c 23 | gsm-1.0/src/code.c 24 | gsm-1.0/src/debug.c 25 | gsm-1.0/src/decode.c 26 | gsm-1.0/src/gsm_destroy.c 27 | gsm-1.0/src/gsm_decode.c 28 | gsm-1.0/src/gsm_encode.c 29 | gsm-1.0/src/gsm_explode.c 30 | gsm-1.0/src/gsm_implode.c 31 | gsm-1.0/src/gsm_create.c 32 | gsm-1.0/src/gsm_print.c 33 | gsm-1.0/src/gsm_option.c 34 | gsm-1.0/src/long_term.c 35 | gsm-1.0/src/lpc.c 36 | gsm-1.0/src/preprocess.c 37 | gsm-1.0/src/rpe.c 38 | gsm-1.0/src/short_term.c 39 | gsm-1.0/src/table.c 40 | gsm-1.0/src/toast.c 41 | gsm-1.0/src/toast_alaw.c 42 | gsm-1.0/src/toast_audio.c 43 | gsm-1.0/src/toast_lin.c 44 | gsm-1.0/src/toast_ulaw.c 45 | gsm-1.0/tls/bitter.c 46 | gsm-1.0/tls/bitter.dta 47 | gsm-1.0/tls/taste.c 48 | gsm-1.0/tls/taste.h 49 | gsm-1.0/tls/sweet.c 50 | gsm-1.0/tls/sour.c 51 | gsm-1.0/tls/sour1.dta 52 | gsm-1.0/tls/sour2.dta 53 | gsm-1.0/tls/ginger.c 54 | gsm-1.0/tst/cod2lin.c 55 | gsm-1.0/tst/cod2txt.c 56 | gsm-1.0/tst/gsm2cod.c 57 | gsm-1.0/tst/lin2cod.c 58 | gsm-1.0/tst/lin2txt.c 59 | gsm-1.0/tst/run 60 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/doc/README: -------------------------------------------------------------------------------- 1 | 2 | GSM 06.10 13 kbit/s RPE/LTP speech compression available 3 | -------------------------------------------------------- 4 | 5 | The Communications and Operating Systems Research Group (KBS) at the 6 | Technische Universitaet Berlin is currently working on a set of 7 | UNIX-based tools for computer-mediated telecooperation that will be 8 | made freely available. 9 | 10 | As part of this effort we are publishing an implementation of the 11 | European GSM 06.10 provisional standard for full-rate speech 12 | transcoding, prI-ETS 300 036, which uses RPE/LTP (residual pulse 13 | excitation/long term prediction) coding at 13 kbit/s. 14 | 15 | GSM 06.10 compresses frames of 160 13-bit samples (8 kHz sampling 16 | rate, i.e. a frame rate of 50 Hz) into 260 bits; for compatibility 17 | with typical UNIX applications, our implementation turns frames of 160 18 | 16-bit linear samples into 33-byte frames (1650 Bytes/s). 19 | The quality of the algorithm is good enough for reliable speaker 20 | recognition; even music often survives transcoding in recognizable 21 | form (given the bandwidth limitations of 8 kHz sampling rate). 22 | 23 | The interfaces offered are a front end modelled after compress(1), and 24 | a library API. Compression and decompression run faster than realtime 25 | on most SPARCstations. The implementation has been verified against the 26 | ETSI standard test patterns. 27 | 28 | Jutta Degener (jutta@cs.tu-berlin.de) 29 | Carsten Bormann (cabo@cs.tu-berlin.de) 30 | 31 | Communications and Operating Systems Research Group, TU Berlin 32 | Fax: +49.30.31425156, Phone: +49.30.31424315 33 | 34 | -- 35 | Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 36 | Universitaet Berlin. See the accompanying file "COPYRIGHT" for 37 | details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 38 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/inc/config.h: -------------------------------------------------------------------------------- 1 | #include "mipconfig.h" 2 | 3 | #ifdef MIPCONFIG_SUPPORT_GSM 4 | 5 | /* 6 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 7 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 8 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | */ 10 | 11 | #ifndef CONFIG_H 12 | #define CONFIG_H 13 | 14 | //efine SIGHANDLER_T int /* signal handlers are void */ 15 | //efine HAS_SYSV_SIGNAL 1 /* sigs not blocked/reset? */ 16 | 17 | #define HAS_STDLIB_H 1 /* /usr/include/stdlib.h */ 18 | //efine HAS_LIMITS_H 1 /* /usr/include/limits.h */ 19 | #define HAS_FCNTL_H 1 /* /usr/include/fcntl.h */ 20 | //efine HAS_ERRNO_DECL 1 /* errno.h declares errno */ 21 | 22 | #define HAS_FSTAT 1 /* fstat syscall */ 23 | #define HAS_FCHMOD 1 /* fchmod syscall */ 24 | #define HAS_CHMOD 1 /* chmod syscall */ 25 | #define HAS_FCHOWN 1 /* fchown syscall */ 26 | #define HAS_CHOWN 1 /* chown syscall */ 27 | //efine HAS__FSETMODE 1 /* _fsetmode -- set file mode */ 28 | 29 | #define HAS_STRING_H 1 /* /usr/include/string.h */ 30 | //efine HAS_STRINGS_H 1 /* /usr/include/strings.h */ 31 | 32 | #define HAS_UNISTD_H 1 /* /usr/include/unistd.h */ 33 | #define HAS_UTIME 1 /* POSIX utime(path, times) */ 34 | //efine HAS_UTIMES 1 /* use utimes() syscall instead */ 35 | #define HAS_UTIME_H 1 /* UTIME header file */ 36 | //efine HAS_UTIMBUF 1 /* struct utimbuf */ 37 | //efine HAS_UTIMEUSEC 1 /* microseconds in utimbuf? */ 38 | 39 | #endif /* CONFIG_H */ 40 | 41 | 42 | #endif // MIPCONFIG_SUPPORT_GSM 43 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/inc/gsm.h: -------------------------------------------------------------------------------- 1 | #include "mipconfig.h" 2 | 3 | #ifdef MIPCONFIG_SUPPORT_GSM 4 | 5 | /* 6 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 7 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 8 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | */ 10 | 11 | #ifndef GSM_H 12 | #define GSM_H 13 | 14 | #ifdef __cplusplus 15 | # define NeedFunctionPrototypes 1 16 | #endif 17 | 18 | #if __STDC__ 19 | # define NeedFunctionPrototypes 1 20 | #endif 21 | 22 | #ifdef _NO_PROTO 23 | # undef NeedFunctionPrototypes 24 | #endif 25 | 26 | #ifdef NeedFunctionPrototypes 27 | # include /* for FILE * */ 28 | #endif 29 | 30 | #undef GSM_P 31 | #if NeedFunctionPrototypes 32 | # define GSM_P( protos ) protos 33 | #else 34 | # define GSM_P( protos ) ( /* protos */ ) 35 | #endif 36 | 37 | /* 38 | * Interface 39 | */ 40 | 41 | typedef struct gsm_state * gsm; 42 | typedef short gsm_signal; /* signed 16 bit */ 43 | typedef unsigned char gsm_byte; 44 | typedef gsm_byte gsm_frame[33]; /* 33 * 8 bits */ 45 | 46 | #define GSM_MAGIC 0xD /* 13 kbit/s RPE-LTP */ 47 | 48 | #define GSM_PATCHLEVEL 10 49 | #define GSM_MINOR 0 50 | #define GSM_MAJOR 1 51 | 52 | #define GSM_OPT_VERBOSE 1 53 | #define GSM_OPT_FAST 2 54 | #define GSM_OPT_LTP_CUT 3 55 | #define GSM_OPT_WAV49 4 56 | #define GSM_OPT_FRAME_INDEX 5 57 | #define GSM_OPT_FRAME_CHAIN 6 58 | 59 | extern gsm gsm_create GSM_P((void)); 60 | extern void gsm_destroy GSM_P((gsm)); 61 | 62 | extern int gsm_print GSM_P((FILE *, gsm, gsm_byte *)); 63 | extern int gsm_option GSM_P((gsm, int, int *)); 64 | 65 | extern void gsm_encode GSM_P((gsm, gsm_signal *, gsm_byte *)); 66 | extern int gsm_decode GSM_P((gsm, gsm_byte *, gsm_signal *)); 67 | 68 | extern int gsm_explode GSM_P((gsm, gsm_byte *, gsm_signal *)); 69 | extern void gsm_implode GSM_P((gsm, gsm_signal *, gsm_byte *)); 70 | 71 | #undef GSM_P 72 | 73 | #endif /* GSM_H */ 74 | 75 | 76 | #endif // MIPCONFIG_SUPPORT_GSM 77 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/inc/proto.h: -------------------------------------------------------------------------------- 1 | #include "mipconfig.h" 2 | 3 | #ifdef MIPCONFIG_SUPPORT_GSM 4 | 5 | /* 6 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 7 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 8 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | */ 10 | 11 | #ifndef PROTO_H 12 | #define PROTO_H 13 | 14 | #if __cplusplus 15 | # define NeedFunctionPrototypes 1 16 | #endif 17 | 18 | #if __STDC__ 19 | # define NeedFunctionPrototypes 1 20 | #endif 21 | 22 | #ifdef _NO_PROTO 23 | # undef NeedFunctionPrototypes 24 | #endif 25 | 26 | #undef P /* gnu stdio.h actually defines this... */ 27 | #undef P0 28 | #undef P1 29 | #undef P2 30 | #undef P3 31 | #undef P4 32 | #undef P5 33 | #undef P6 34 | #undef P7 35 | #undef P8 36 | 37 | #if NeedFunctionPrototypes 38 | 39 | # define P( protos ) protos 40 | 41 | # define P0() (void) 42 | # define P1(x, a) (a) 43 | # define P2(x, a, b) (a, b) 44 | # define P3(x, a, b, c) (a, b, c) 45 | # define P4(x, a, b, c, d) (a, b, c, d) 46 | # define P5(x, a, b, c, d, e) (a, b, c, d, e) 47 | # define P6(x, a, b, c, d, e, f) (a, b, c, d, e, f) 48 | # define P7(x, a, b, c, d, e, f, g) (a, b, c, d, e, f, g) 49 | # define P8(x, a, b, c, d, e, f, g, h) (a, b, c, d, e, f, g, h) 50 | 51 | #else /* !NeedFunctionPrototypes */ 52 | 53 | # define P( protos ) ( /* protos */ ) 54 | 55 | # define P0() () 56 | # define P1(x, a) x a; 57 | # define P2(x, a, b) x a; b; 58 | # define P3(x, a, b, c) x a; b; c; 59 | # define P4(x, a, b, c, d) x a; b; c; d; 60 | # define P5(x, a, b, c, d, e) x a; b; c; d; e; 61 | # define P6(x, a, b, c, d, e, f) x a; b; c; d; e; f; 62 | # define P7(x, a, b, c, d, e, f, g) x a; b; c; d; e; f; g; 63 | # define P8(x, a, b, c, d, e, f, g, h) x a; b; c; d; e; f; g; h; 64 | 65 | #endif /* !NeedFunctionPrototypes */ 66 | 67 | #endif /* PROTO_H */ 68 | 69 | 70 | #endif // MIPCONFIG_SUPPORT_GSM 71 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/inc/unproto.h: -------------------------------------------------------------------------------- 1 | #include "mipconfig.h" 2 | 3 | #ifdef MIPCONFIG_SUPPORT_GSM 4 | 5 | /* 6 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 7 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 8 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | */ 10 | 11 | #ifdef PROTO_H /* sic */ 12 | #undef PROTO_H 13 | 14 | #undef P 15 | #undef P0 16 | #undef P1 17 | #undef P2 18 | #undef P3 19 | #undef P4 20 | #undef P5 21 | #undef P6 22 | #undef P7 23 | #undef P8 24 | 25 | #endif /* PROTO_H */ 26 | 27 | 28 | #endif // MIPCONFIG_SUPPORT_GSM 29 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/src/gsm_create.cpp: -------------------------------------------------------------------------------- 1 | #include "mipconfig.h" 2 | 3 | #ifdef MIPCONFIG_SUPPORT_GSM 4 | 5 | /* 6 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 7 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 8 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | */ 10 | 11 | static char const ident[] = "$Header: /home/jori/CVSROOT/jvoiplib/src/thirdparty/gsm/src/gsm_create.cpp,v 1.2 2004/09/02 14:47:35 jori Exp $"; 12 | 13 | #include "config.h" 14 | 15 | #ifdef HAS_STRING_H 16 | #include 17 | #else 18 | # include "proto.h" 19 | extern char * memset P((char *, int, int)); 20 | #endif 21 | 22 | #ifdef HAS_STDLIB_H 23 | # include 24 | #else 25 | # ifdef HAS_MALLOC_H 26 | # include 27 | # else 28 | extern char * malloc(); 29 | # endif 30 | #endif 31 | 32 | #include 33 | 34 | #include "gsm.h" 35 | #include "private.h" 36 | #include "proto.h" 37 | 38 | gsm gsm_create P0() 39 | { 40 | gsm r; 41 | 42 | r = (gsm)malloc(sizeof(struct gsm_state)); 43 | if (!r) return r; 44 | 45 | memset((char *)r, 0, sizeof(*r)); 46 | r->nrp = 40; 47 | 48 | return r; 49 | } 50 | 51 | 52 | 53 | #endif // MIPCONFIG_SUPPORT_GSM 54 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/src/gsm_debug.cpp: -------------------------------------------------------------------------------- 1 | #include "mipconfig.h" 2 | 3 | #ifdef MIPCONFIG_SUPPORT_GSM 4 | 5 | /* 6 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 7 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 8 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | */ 10 | 11 | /* $Header: /home/jori/CVSROOT/jvoiplib/src/thirdparty/gsm/src/gsm_debug.cpp,v 1.2 2004/09/02 14:47:35 jori Exp $ */ 12 | 13 | #include "private.h" 14 | 15 | #ifndef NDEBUG 16 | 17 | /* If NDEBUG _is_ defined and no debugging should be performed, 18 | * calls to functions in this module are #defined to nothing 19 | * in private.h. 20 | */ 21 | 22 | #include 23 | #include "proto.h" 24 | 25 | void gsm_debug_words P4( (name, from, to, ptr), 26 | char * name, 27 | int from, 28 | int to, 29 | word * ptr) 30 | { 31 | int nprinted = 0; 32 | 33 | fprintf( stderr, "%s [%d .. %d]: ", name, from, to ); 34 | while (from <= to) { 35 | fprintf(stderr, "%d ", ptr[ from ] ); 36 | from++; 37 | if (nprinted++ >= 7) { 38 | nprinted = 0; 39 | if (from < to) putc('\n', stderr); 40 | } 41 | } 42 | putc('\n', stderr); 43 | } 44 | 45 | void gsm_debug_longwords P4( (name, from, to, ptr), 46 | char * name, 47 | int from, 48 | int to, 49 | longword * ptr) 50 | { 51 | int nprinted = 0; 52 | 53 | fprintf( stderr, "%s [%d .. %d]: ", name, from, to ); 54 | while (from <= to) { 55 | 56 | fprintf(stderr, "%d ", (int)ptr[ from ] ); 57 | from++; 58 | if (nprinted++ >= 7) { 59 | nprinted = 0; 60 | if (from < to) putc('\n', stderr); 61 | } 62 | } 63 | putc('\n', stderr); 64 | } 65 | 66 | void gsm_debug_longword P2( (name, value), 67 | char * name, 68 | longword value ) 69 | { 70 | fprintf(stderr, "%s: %d\n", name, (int)value ); 71 | } 72 | 73 | void gsm_debug_word P2( (name, value), 74 | char * name, 75 | word value ) 76 | { 77 | fprintf(stderr, "%s: %d\n", name, (int)value); 78 | } 79 | 80 | #endif 81 | 82 | #endif // MIPCONFIG_SUPPORT_GSM 83 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/src/gsm_decode2.cpp: -------------------------------------------------------------------------------- 1 | #include "mipconfig.h" 2 | 3 | #ifdef MIPCONFIG_SUPPORT_GSM 4 | 5 | /* 6 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 7 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 8 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | */ 10 | 11 | /* $Header: /home/jori/CVSROOT/jvoiplib/src/thirdparty/gsm/src/gsm_decode2.cpp,v 1.2 2004/09/02 14:47:35 jori Exp $ */ 12 | 13 | #include 14 | 15 | #include "private.h" 16 | #include "gsm.h" 17 | #include "proto.h" 18 | 19 | /* 20 | * 4.3 FIXED POINT IMPLEMENTATION OF THE RPE-LTP DECODER 21 | */ 22 | 23 | static void Postprocessing P2((S,s), 24 | struct gsm_state * S, 25 | register word * s) 26 | { 27 | register int k; 28 | register word msr = S->msr; 29 | register longword ltmp; /* for GSM_ADD */ 30 | register word tmp; 31 | 32 | for (k = 160; k--; s++) { 33 | tmp = GSM_MULT_R( msr, 28180 ); 34 | msr = GSM_ADD(*s, tmp); /* Deemphasis */ 35 | *s = GSM_ADD(msr, msr) & 0xFFF8; /* Truncation & Upscaling */ 36 | } 37 | S->msr = msr; 38 | } 39 | 40 | void Gsm_Decoder P8((S,LARcr, Ncr,bcr,Mcr,xmaxcr,xMcr,s), 41 | struct gsm_state * S, 42 | 43 | word * LARcr, /* [0..7] IN */ 44 | 45 | word * Ncr, /* [0..3] IN */ 46 | word * bcr, /* [0..3] IN */ 47 | word * Mcr, /* [0..3] IN */ 48 | word * xmaxcr, /* [0..3] IN */ 49 | word * xMcr, /* [0..13*4] IN */ 50 | 51 | word * s) /* [0..159] OUT */ 52 | { 53 | int j, k; 54 | word erp[40], wt[160]; 55 | word * drp = S->dp0 + 120; 56 | 57 | for (j=0; j <= 3; j++, xmaxcr++, bcr++, Ncr++, Mcr++, xMcr += 13) { 58 | 59 | Gsm_RPE_Decoding( S, *xmaxcr, *Mcr, xMcr, erp ); 60 | Gsm_Long_Term_Synthesis_Filtering( S, *Ncr, *bcr, erp, drp ); 61 | 62 | for (k = 0; k <= 39; k++) wt[ j * 40 + k ] = drp[ k ]; 63 | } 64 | 65 | Gsm_Short_Term_Synthesis_Filter( S, LARcr, wt, s ); 66 | Postprocessing(S, s); 67 | } 68 | 69 | 70 | 71 | #endif // MIPCONFIG_SUPPORT_GSM 72 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/src/gsm_destroy.cpp: -------------------------------------------------------------------------------- 1 | #include "mipconfig.h" 2 | 3 | #ifdef MIPCONFIG_SUPPORT_GSM 4 | 5 | /* 6 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 7 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 8 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | */ 10 | 11 | /* $Header: /home/jori/CVSROOT/jvoiplib/src/thirdparty/gsm/src/gsm_destroy.cpp,v 1.2 2004/09/02 14:47:35 jori Exp $ */ 12 | 13 | #include "gsm.h" 14 | #include "config.h" 15 | #include "proto.h" 16 | 17 | #ifdef HAS_STDLIB_H 18 | # include 19 | #else 20 | # ifdef HAS_MALLOC_H 21 | # include 22 | # else 23 | extern void free(); 24 | # endif 25 | #endif 26 | 27 | void gsm_destroy P1((S), gsm S) 28 | { 29 | if (S) free((char *)S); 30 | } 31 | 32 | 33 | 34 | #endif // MIPCONFIG_SUPPORT_GSM 35 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/src/gsm_option.cpp: -------------------------------------------------------------------------------- 1 | #include "mipconfig.h" 2 | 3 | #ifdef MIPCONFIG_SUPPORT_GSM 4 | 5 | /* 6 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 7 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 8 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | */ 10 | 11 | /* $Header: /home/jori/CVSROOT/jvoiplib/src/thirdparty/gsm/src/gsm_option.cpp,v 1.2 2004/09/02 14:47:35 jori Exp $ */ 12 | 13 | #include "private.h" 14 | 15 | #include "gsm.h" 16 | #include "proto.h" 17 | 18 | int gsm_option P3((r, opt, val), gsm r, int opt, int * val) 19 | { 20 | int result = -1; 21 | 22 | switch (opt) { 23 | case GSM_OPT_LTP_CUT: 24 | #ifdef LTP_CUT 25 | result = r->ltp_cut; 26 | if (val) r->ltp_cut = *val; 27 | #endif 28 | break; 29 | 30 | case GSM_OPT_VERBOSE: 31 | #ifndef NDEBUG 32 | result = r->verbose; 33 | if (val) r->verbose = *val; 34 | #endif 35 | break; 36 | 37 | case GSM_OPT_FAST: 38 | 39 | #if defined(FAST) && defined(USE_FLOAT_MUL) 40 | result = r->fast; 41 | if (val) r->fast = !!*val; 42 | #endif 43 | break; 44 | 45 | case GSM_OPT_FRAME_CHAIN: 46 | 47 | #ifdef WAV49 48 | result = r->frame_chain; 49 | if (val) r->frame_chain = *val; 50 | #endif 51 | break; 52 | 53 | case GSM_OPT_FRAME_INDEX: 54 | 55 | #ifdef WAV49 56 | result = r->frame_index; 57 | if (val) r->frame_index = *val; 58 | #endif 59 | break; 60 | 61 | case GSM_OPT_WAV49: 62 | 63 | #ifdef WAV49 64 | result = r->wav_fmt; 65 | if (val) r->wav_fmt = !!*val; 66 | #endif 67 | break; 68 | 69 | default: 70 | break; 71 | } 72 | return result; 73 | } 74 | 75 | 76 | #endif // MIPCONFIG_SUPPORT_GSM 77 | -------------------------------------------------------------------------------- /src/thirdparty/gsm/src/gsm_table.cpp: -------------------------------------------------------------------------------- 1 | #include "mipconfig.h" 2 | 3 | #ifdef MIPCONFIG_SUPPORT_GSM 4 | 5 | /* 6 | * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische 7 | * Universitaet Berlin. See the accompanying file "COPYRIGHT" for 8 | * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. 9 | */ 10 | 11 | /* $Header: /home/jori/CVSROOT/jvoiplib/src/thirdparty/gsm/src/gsm_table.cpp,v 1.2 2004/09/02 14:47:35 jori Exp $ */ 12 | 13 | /* Most of these tables are inlined at their point of use. 14 | */ 15 | 16 | /* 4.4 TABLES USED IN THE FIXED POINT IMPLEMENTATION OF THE RPE-LTP 17 | * CODER AND DECODER 18 | * 19 | * (Most of them inlined, so watch out.) 20 | */ 21 | 22 | #define GSM_TABLE_C 23 | #include "private.h" 24 | #include "gsm.h" 25 | 26 | /* Table 4.1 Quantization of the Log.-Area Ratios 27 | */ 28 | /* i 1 2 3 4 5 6 7 8 */ 29 | word gsm_A[8] = {20480, 20480, 20480, 20480, 13964, 15360, 8534, 9036}; 30 | word gsm_B[8] = { 0, 0, 2048, -2560, 94, -1792, -341, -1144}; 31 | word gsm_MIC[8] = { -32, -32, -16, -16, -8, -8, -4, -4 }; 32 | word gsm_MAC[8] = { 31, 31, 15, 15, 7, 7, 3, 3 }; 33 | 34 | 35 | /* Table 4.2 Tabulation of 1/A[1..8] 36 | */ 37 | word gsm_INVA[8]={ 13107, 13107, 13107, 13107, 19223, 17476, 31454, 29708 }; 38 | 39 | 40 | /* Table 4.3a Decision level of the LTP gain quantizer 41 | */ 42 | /* bc 0 1 2 3 */ 43 | word gsm_DLB[4] = { 6554, 16384, 26214, 32767 }; 44 | 45 | 46 | /* Table 4.3b Quantization levels of the LTP gain quantizer 47 | */ 48 | /* bc 0 1 2 3 */ 49 | word gsm_QLB[4] = { 3277, 11469, 21299, 32767 }; 50 | 51 | 52 | /* Table 4.4 Coefficients of the weighting filter 53 | */ 54 | /* i 0 1 2 3 4 5 6 7 8 9 10 */ 55 | word gsm_H[11] = {-134, -374, 0, 2054, 5741, 8192, 5741, 2054, 0, -374, -134 }; 56 | 57 | 58 | /* Table 4.5 Normalized inverse mantissa used to compute xM/xmax 59 | */ 60 | /* i 0 1 2 3 4 5 6 7 */ 61 | word gsm_NRFAC[8] = { 29128, 26215, 23832, 21846, 20165, 18725, 17476, 16384 }; 62 | 63 | 64 | /* Table 4.6 Normalized direct mantissa used to compute xM/xmax 65 | */ 66 | /* i 0 1 2 3 4 5 6 7 */ 67 | word gsm_FAC[8] = { 18431, 20479, 22527, 24575, 26623, 28671, 30719, 32767 }; 68 | 69 | 70 | 71 | #endif // MIPCONFIG_SUPPORT_GSM 72 | -------------------------------------------------------------------------------- /src/thirdparty/lpc/README: -------------------------------------------------------------------------------- 1 | These files were taken from JVOIPLIB 1.4.1. The original README is the 2 | following: 3 | 4 | ------------------------------------------------------------------------ 5 | 6 | This LPC implementation is based upon the one done by Ron Frederick. 7 | You can find the original sources at 8 | ftp://parcftp.xerox.com/pub/net-research/lpc.tar.Z 9 | 10 | Some modifications were made based upon the changes in the Speak Freely 11 | LPC codec. 12 | 13 | -------------------------------------------------------------------------------- /src/thirdparty/lpc/lpccodec.h: -------------------------------------------------------------------------------- 1 | #include "mipconfig.h" 2 | 3 | #ifdef MIPCONFIG_SUPPORT_LPC 4 | 5 | #ifndef LPCCODEC_H 6 | 7 | #define LPCCODEC_H 8 | 9 | #define LPCCODEC_INPUTLEN 160 10 | #define LPCCODEC_OUTPUTLEN 14 11 | #define LPCCODEC_BUFLEN ((LPCCODEC_INPUTLEN*3)/2) 12 | #define LPCCODEC_FILTORDER 10 13 | #define LPCCODEC_MAXWINDOW 1000 /* Max analysis window length */ 14 | 15 | struct lpcparams_t 16 | { 17 | unsigned short period; 18 | unsigned char gain; 19 | char k[LPCCODEC_FILTORDER]; 20 | }; 21 | 22 | class LPCEncoder 23 | { 24 | public: 25 | LPCEncoder(); 26 | ~LPCEncoder(); 27 | void Reset(); 28 | void Encode(int samples[LPCCODEC_INPUTLEN],unsigned char frame[LPCCODEC_OUTPUTLEN]); 29 | private: 30 | void lpc_analyze(int *buf, lpcparams_t *params); 31 | void calc_pitch(float w[], float *per); 32 | void auto_correl(float w[], int n, int p, float r[]); 33 | void durbin(float r[], int p, float k[], float *g); 34 | void inverse_filter(float w[], float k[]); 35 | void lpc_init(); 36 | 37 | float s[LPCCODEC_MAXWINDOW],y[LPCCODEC_MAXWINDOW],h[LPCCODEC_MAXWINDOW]; 38 | float fa[6],u,u1,yp1,yp2; 39 | int vuv; 40 | }; 41 | 42 | class LPCDecoder 43 | { 44 | public: 45 | LPCDecoder(); 46 | ~LPCDecoder(); 47 | void Reset(); 48 | void Decode(unsigned char frame[LPCCODEC_OUTPUTLEN],int samples[LPCCODEC_INPUTLEN]); 49 | private: 50 | void lpc_synthesize(lpcparams_t *params, int *buf); 51 | void lpc_init(); 52 | 53 | float Oldper, OldG, Oldk[LPCCODEC_FILTORDER+1]; 54 | float b[LPCCODEC_FILTORDER+1],bp[LPCCODEC_FILTORDER+1],f[LPCCODEC_FILTORDER+1]; 55 | int pitchctr; 56 | }; 57 | 58 | #endif // LPCCODEC_H 59 | 60 | 61 | #endif // MIPCONFIG_SUPPORT_LPC 62 | -------------------------------------------------------------------------------- /src/thirdparty/tinyjpeg/README: -------------------------------------------------------------------------------- 1 | 2 | Files from tinyjpegdecoder-20070609. 3 | Some minor modifications were made to make compilation on Win32 4 | platform possible. 5 | 6 | -------------------------------------------------------------------------------- /src/thirdparty/tinyjpeg/tinyjpeg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Small jpeg decoder library (header file) 3 | * 4 | * Copyright (c) 2006, Luc Saillard 5 | * All rights reserved. 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright notice, 10 | * this list of conditions and the following disclaimer. 11 | * 12 | * - Redistributions in binary form must reproduce the above copyright notice, 13 | * this list of conditions and the following disclaimer in the documentation 14 | * and/or other materials provided with the distribution. 15 | * 16 | * - Neither the name of the author nor the names of its contributors may be 17 | * used to endorse or promote products derived from this software without 18 | * specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 24 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 25 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 26 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 27 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 28 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 29 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 | * POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | */ 33 | 34 | 35 | #ifndef __JPEGDEC_H__ 36 | #define __JPEGDEC_H__ 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | struct jdec_private; 43 | 44 | /* Flags that can be set by any applications */ 45 | #define TINYJPEG_FLAGS_MJPEG_TABLE (1<<1) 46 | 47 | /* Format accepted in outout */ 48 | enum tinyjpeg_fmt { 49 | TINYJPEG_FMT_GREY = 1, 50 | TINYJPEG_FMT_BGR24, 51 | TINYJPEG_FMT_RGB24, 52 | TINYJPEG_FMT_YUV420P, 53 | }; 54 | 55 | struct jdec_private *tinyjpeg_init(void); 56 | void tinyjpeg_free(struct jdec_private *priv); 57 | 58 | int tinyjpeg_parse_header(struct jdec_private *priv, const unsigned char *buf, unsigned int size); 59 | int tinyjpeg_decode(struct jdec_private *priv, int pixel_format); 60 | const char *tinyjpeg_get_errorstring(struct jdec_private *priv); 61 | void tinyjpeg_get_size(struct jdec_private *priv, unsigned int *width, unsigned int *height); 62 | int tinyjpeg_get_components(struct jdec_private *priv, unsigned char **components); 63 | int tinyjpeg_set_components(struct jdec_private *priv, unsigned char **components, unsigned int ncomponents); 64 | int tinyjpeg_set_flags(struct jdec_private *priv, int flags); 65 | 66 | #ifdef __cplusplus 67 | } 68 | #endif 69 | 70 | #endif 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /src/util/mipdirectorybrowser.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipdirectorybrowser.h 27 | */ 28 | 29 | #ifndef MIPDIRECTORYBROWSER_H 30 | 31 | #define MIPDIRECTORYBROWSER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miperrorbase.h" 35 | #if (defined(WIN32) || defined (_WIN32_WCE)) 36 | #include 37 | #else 38 | #include 39 | #include 40 | #endif // WIN32 || _WIN32_WCE 41 | #include 42 | 43 | /** An object of this type can be used to get the file names in a 44 | * specific directory. 45 | */ 46 | class EMIPLIB_IMPORTEXPORT MIPDirectoryBrowser : public MIPErrorBase 47 | { 48 | public: 49 | MIPDirectoryBrowser(); 50 | ~MIPDirectoryBrowser(); 51 | 52 | /** Opens a directory. */ 53 | bool open(const std::string &dirName); 54 | 55 | /** Retrieves the next entry in the directory. */ 56 | bool getNextEntry(std::string &fileName, bool *isDirectory); 57 | 58 | /** Closes the directory. */ 59 | bool close(); 60 | private: 61 | #if (defined(WIN32) || defined (_WIN32_WCE)) 62 | HANDLE m_findHandle; 63 | std::string m_nextFileName; 64 | bool m_gotNextFileName; 65 | bool m_isNextFileDirectory; 66 | #else 67 | DIR *m_dir; 68 | std::string m_dirName; 69 | #endif // WIN32 || _WIN32_WCE 70 | }; 71 | 72 | #endif // MIPDIRECTORYBROWSER_H 73 | 74 | -------------------------------------------------------------------------------- /src/util/mipsignalwaiter.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipsignalwaiter.h 27 | */ 28 | 29 | #ifndef MIPSIGNALWAITER_H 30 | 31 | #define MIPSIGNALWAITER_H 32 | 33 | #include "mipconfig.h" 34 | #include 35 | #if !defined(WIN32) && !defined(_WIN32_WCE) 36 | #include 37 | #endif // !WIN32 && !_WIN32_WCE 38 | 39 | /** Objects of this type can be used to send signals between threads. 40 | * This kind of object can be used to send signals between threads. For 41 | * example, soundcard input plugins use such an object to indicate when 42 | * a new block of sound data is available. 43 | */ 44 | class EMIPLIB_IMPORTEXPORT MIPSignalWaiter 45 | { 46 | public: 47 | MIPSignalWaiter(); 48 | ~MIPSignalWaiter(); 49 | 50 | /** Initialized the object. */ 51 | bool init(); 52 | 53 | /** Destroys a previously initialized signalling object. */ 54 | void destroy(); 55 | 56 | /** Waits until somewhere else a signal is generated. */ 57 | bool waitForSignal(); 58 | 59 | /** Generates a signal. */ 60 | bool signal(); 61 | 62 | /** Clears the signalling buffers; this returns the object to its state right after initialization. */ 63 | bool clearSignalBuffers(); 64 | 65 | /** Returns \c true if the object is already initialized, \c false otherwise. */ 66 | bool isInit() { return m_init; } 67 | private: 68 | #ifndef WIN32 69 | pthread_cond_t m_cond; 70 | pthread_mutex_t m_mutex; 71 | #else 72 | HANDLE m_eventObject; 73 | #endif // WIN32 74 | bool m_init; 75 | jthread::JMutex m_countMutex,m_waitMutex; 76 | int m_count; 77 | bool m_isWaiting; 78 | }; 79 | 80 | #endif // MIPSIGNALWAITER_H 81 | 82 | -------------------------------------------------------------------------------- /src/util/mipspeexutil.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipspeexutil.h 27 | */ 28 | 29 | #ifndef MIPSPEEXUTIL_H 30 | 31 | #define MIPSPEEXUTIL_H 32 | 33 | #include "mipconfig.h" 34 | 35 | #ifdef MIPCONFIG_SUPPORT_SPEEX 36 | 37 | #include "miperrorbase.h" 38 | #include 39 | 40 | /** An instance of this class can be used to analyse Speex data. */ 41 | class EMIPLIB_IMPORTEXPORT MIPSpeexUtil : public MIPErrorBase 42 | { 43 | public: 44 | /** Identifies the Speex bandwidth used. */ 45 | enum SpeexBandWidth 46 | { 47 | NarrowBand, /**< Narrow band mode. */ 48 | WideBand, /**< Wide band mode. */ 49 | UltraWideBand, /**< Ultra wide band mode. */ 50 | Invalid /**< Didn't recognize the mode which was used. */ 51 | }; 52 | 53 | MIPSpeexUtil() { m_bandWidth = Invalid; m_sampRate = 0; speex_bits_init(&m_bits); } 54 | ~MIPSpeexUtil() { speex_bits_destroy(&m_bits); } 55 | 56 | /** Analyze the data given by \c speexData, of length \c length. */ 57 | bool processBytes(const void *speexData, size_t length); 58 | 59 | /** Returns the bandwidth used by the previously processed speex data. */ 60 | SpeexBandWidth getBandWidth() const { return m_bandWidth; } 61 | 62 | /** Returns the sampling rate used by the previously processed speex data. */ 63 | int getSamplingRate() const { return m_sampRate; } 64 | private: 65 | SpeexBits m_bits; 66 | SpeexBandWidth m_bandWidth; 67 | int m_sampRate; 68 | }; 69 | 70 | #endif // MIPCONFIG_SUPPORT_SPEEX 71 | 72 | #endif // MIPSPEEXUTIL_H 73 | 74 | -------------------------------------------------------------------------------- /src/util/mipwavwriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | This file is a part of EMIPLIB, the EDM Media over IP Library. 4 | 5 | Copyright (C) 2006-2016 Hasselt University - Expertise Centre for 6 | Digital Media (EDM) (http://www.edm.uhasselt.be) 7 | 8 | This library is free software; you can redistribute it and/or 9 | modify it under the terms of the GNU Lesser General Public 10 | License as published by the Free Software Foundation; either 11 | version 2.1 of the License, or (at your option) any later version. 12 | 13 | This library is distributed in the hope that it will be useful, 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 | Lesser General Public License for more details. 17 | 18 | You should have received a copy of the GNU Lesser General Public 19 | License along with this library; if not, write to the Free Software 20 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 21 | USA 22 | 23 | */ 24 | 25 | /** 26 | * \file mipwavwriter.h 27 | */ 28 | 29 | #ifndef MIPWAVWRITER_H 30 | 31 | #define MIPWAVWRITER_H 32 | 33 | #include "mipconfig.h" 34 | #include "miperrorbase.h" 35 | #include "miptypes.h" 36 | #include 37 | 38 | /** This is a simple WAV file writer (8 bit, mono) */ 39 | class EMIPLIB_IMPORTEXPORT MIPWAVWriter : public MIPErrorBase 40 | { 41 | public: 42 | MIPWAVWriter(); 43 | ~MIPWAVWriter(); 44 | 45 | /** Opens the WAV file specified in \c fileName at sampling rate \c sampRate */ 46 | bool open(const std::string &fileName, int sampRate); 47 | 48 | /** Closes the WAV file */ 49 | bool close(); 50 | 51 | /** Writes a number of frames. 52 | * This function allows you to write sound data to the file. Note that 53 | * currently only mono sound is supported. 54 | * \param pBuffer Sound data 55 | * \param numFrames Number of frames in the buffer. Is currently equal to the number of bytes. 56 | */ 57 | bool writeFrames(uint8_t *pBuffer, int numFrames); 58 | private: 59 | FILE *m_pFile; 60 | int64_t m_frameCount; 61 | }; 62 | 63 | #endif // MIPWAVWRITER_H 64 | 65 | -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | apply_include_paths("${EMIPLIB_INTERNAL_INCLUDES}") 2 | apply_include_paths("${EMIPLIB_EXTERNAL_INCLUDES}") 3 | 4 | macro(linkit TARGET) 5 | if (NOT MSVC OR EMIPLIB_COMPILE_STATIC) 6 | target_link_libraries(${TARGET} emiplib-static ${EMIPLIB_LINK_LIBS} ${ARGN}) 7 | else () 8 | target_link_libraries(${TARGET} emiplib-shared ${EMIPLIB_LINK_LIBS} ${ARGN}) 9 | endif () 10 | endmacro() 11 | 12 | foreach(IDX pulseouttest portaudioouttest replayaudio qtouttest audiocodectest delayedchainstarttest streamopus streamopusrecv 13 | streamopusrecv2 alsaouttest alsaintest) 14 | add_executable(${IDX} ${IDX}.cpp) 15 | linkit(${IDX}) 16 | endforeach(IDX) 17 | 18 | if (EMIPLIB_SUPPORT_QT5) 19 | find_package(Qt5Multimedia) 20 | if (Qt5Multimedia_FOUND) 21 | include_directories(${Qt5Multimedia_INCLUDE_DIRS}) 22 | 23 | add_executable(qtaudiooutput qtaudiooutput.cpp) 24 | linkit(qtaudiooutput ${Qt5Multimedia_LIBRARIES}) 25 | endif() 26 | endif() 27 | 28 | 29 | -------------------------------------------------------------------------------- /tests/streamopus.sdp: -------------------------------------------------------------------------------- 1 | v=0 2 | o=- 0 0 IN IP4 127.0.0.1 3 | s=No Name 4 | c=IN IP4 224.2.36.42/2 5 | t=0 0 6 | m=audio 8002 RTP/AVP 96 7 | a=rtpmap:96 opus/48000 8 | -------------------------------------------------------------------------------- /tests/streamopusrecv.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | using namespace jrtplib; 8 | 9 | void checkRet(bool ret,const MIPErrorBase &obj) 10 | { 11 | if (!ret) 12 | { 13 | std::cerr << obj.getErrorString() << std::endl; 14 | exit(-1); 15 | } 16 | } 17 | 18 | class MyAudioSession : public MIPAudioSession 19 | { 20 | protected: 21 | void onInputThreadExit(bool err, const std::string &compName, const std::string &errStr) 22 | { 23 | if (err) 24 | { 25 | std::cerr << "Input chain thread exited due to an error" << std::endl; 26 | std::cerr << "Component: " << compName << std::endl; 27 | std::cerr << "Error: " << errStr << std::endl; 28 | } 29 | } 30 | void onOutputThreadExit(bool err, const std::string &compName, const std::string &errStr) 31 | { 32 | if (err) 33 | { 34 | std::cerr << "Output chain thread exited due to an error" << std::endl; 35 | std::cerr << "Component: " << compName << std::endl; 36 | std::cerr << "Error: " << errStr << std::endl; 37 | } 38 | } 39 | }; 40 | 41 | int main(void) 42 | { 43 | #ifdef WIN32 44 | WSADATA dat; 45 | WSAStartup(MAKEWORD(2,2),&dat); 46 | #endif // WIN32 47 | #ifdef MIPCONFIG_SUPPORT_PORTAUDIO 48 | std::string errStr; 49 | 50 | if (!MIPPAInputOutput::initializePortAudio(errStr)) 51 | { 52 | std::cerr << "Can't initialize PortAudio: " << errStr << std::endl; 53 | return -1; 54 | } 55 | #endif // MIPCONFIG_SUPPORT_PORTAUDIO 56 | 57 | MIPAudioSessionParams Aparams; 58 | MyAudioSession audioSess; 59 | bool ret; 60 | 61 | int audioPort = 8002; 62 | 63 | Aparams.setPortbase(audioPort); 64 | Aparams.setCompressionType(MIPAudioSessionParams::Opus); 65 | Aparams.setOpusIncomingPayloadType(96); 66 | Aparams.setSpeexIncomingPayloadType(97); 67 | 68 | std::cout << "Starting audio session at portbase " << audioPort << std::endl; 69 | 70 | ret = audioSess.init(&Aparams); 71 | checkRet(ret, audioSess); 72 | 73 | uint8_t ip[4] = {224, 2, 36, 42 }; 74 | //ret = audioSess.addDestination(RTPIPv4Address(ip, audioPort)); 75 | audioSess.joinMulticastGroup(RTPIPv4Address(ip)); 76 | 77 | std::string dummy; 78 | std::cout << "Type something to exit" << std::endl; 79 | std::cin >> dummy; 80 | 81 | std::cout << "Exiting..." << std::endl; 82 | 83 | audioSess.destroy(); 84 | 85 | #ifdef MIPCONFIG_SUPPORT_PORTAUDIO 86 | MIPPAInputOutput::terminatePortAudio(); 87 | #endif // MIPCONFIG_SUPPORT_PORTAUDIO 88 | #ifdef WIN32 89 | WSACleanup(); 90 | #endif // WIN32 91 | 92 | return 0; 93 | } 94 | 95 | -------------------------------------------------------------------------------- /tools/jrtplibversion/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(jrtplibversion) 4 | 5 | find_package(JThread REQUIRED) 6 | find_package(JRTPLIB REQUIRED) 7 | 8 | include_directories(${JTHREAD_INCLUDE_DIRS}) 9 | include_directories(${JRTPLIB_INCLUDE_DIRS}) 10 | 11 | add_executable(jrtplibversiontest jrtplibversion.cpp) 12 | target_link_libraries(jrtplibversiontest ${JTHREAD_LIBRARIES} ${JRTPLIB_LIBRARIES}) 13 | 14 | -------------------------------------------------------------------------------- /tools/jrtplibversion/jrtplibversion.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | // We can't use RTPSecureSession as an object since SRTP support 7 | // may not have been compiled in. The header should still exist 8 | // though 9 | jrtplib::RTPSession sess; 10 | return 0; 11 | } 12 | -------------------------------------------------------------------------------- /tools/openslesandroid.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main(void) 4 | { 5 | return 0; 6 | } 7 | -------------------------------------------------------------------------------- /tools/osstest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | int dev = 0; 7 | int val = 0; 8 | 9 | ioctl(dev, SNDCTL_DSP_SETFRAGMENT, &val); 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /tools/v4ltest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main(void) 5 | { 6 | int dev = 0; 7 | struct v4l2_capability capabilities; 8 | 9 | ioctl(dev, VIDIOC_QUERYCAP, &capabilities); 10 | 11 | return 0; 12 | } 13 | -------------------------------------------------------------------------------- /tools/winmmtest.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #ifndef _WIN32_WCE 3 | #include 4 | #endif // _WIN32_WCE 5 | 6 | int main(void) 7 | { 8 | WAVEFORMATEX format; 9 | 10 | format.wFormatTag = WAVE_FORMAT_PCM; 11 | 12 | return 0; 13 | } 14 | 15 | --------------------------------------------------------------------------------