├── projects ├── grapher │ ├── build │ │ └── cmake │ │ │ ├── run_release.sh │ │ │ ├── run_debug.sh │ │ │ ├── cleanup_build_dir.sh │ │ │ ├── build_debug.sh │ │ │ ├── build_release.sh │ │ │ ├── create_xcode_project.sh │ │ │ ├── debug.sh │ │ │ └── functions.sh │ ├── src │ │ └── grapher │ │ │ ├── Config.cpp │ │ │ ├── Vertices.cpp │ │ │ ├── Shader.cpp │ │ │ ├── GraphConfigReader.cpp │ │ │ └── opengl │ │ │ └── OpenGLProfiler.cpp │ └── include │ │ └── grapher │ │ ├── Shader.h │ │ ├── Types.h │ │ ├── Vertices.h │ │ ├── Daemon.h │ │ └── GraphConfigReader.h ├── hwscale │ ├── build │ │ └── cmake │ │ │ ├── run_release.sh │ │ │ ├── run_debug.sh │ │ │ ├── cleanup_build_dir.sh │ │ │ ├── build_debug.sh │ │ │ ├── build_release.sh │ │ │ ├── create_xcode_project.sh │ │ │ ├── build_release_vs2010.bat │ │ │ ├── debug.sh │ │ │ └── CMakeLists.txt │ ├── tests │ │ ├── CMakeLists.txt │ │ └── opengl_yuv420p │ │ │ └── Animation.h │ └── include │ │ └── hwscale │ │ └── opengl │ │ └── ResizerFBO.h ├── decklink │ ├── build │ │ └── cmake │ │ │ ├── run_debug.bat │ │ │ ├── run_release.bat │ │ │ ├── build_debug_vs2010.bat │ │ │ ├── build_release_vs2010.bat │ │ │ └── CMakeLists.txt │ ├── README.md │ ├── src │ │ └── decklink │ │ │ └── DeckLinkCaptureCallback.cpp │ └── include │ │ └── decklink │ │ ├── DeckLinkTypes.h │ │ ├── DeckLinkCaptureCallback.h │ │ ├── DeckLinkCard.h │ │ └── DeckLink.h ├── streamer │ ├── build │ │ └── cmake │ │ │ ├── run_debug.sh │ │ │ ├── run_release.sh │ │ │ ├── run_release.bat │ │ │ ├── run_debug_vs2010.bat │ │ │ ├── cleanup_build_dir.sh │ │ │ ├── build_debug.sh │ │ │ ├── build_release.sh │ │ │ ├── create_xcode_project.sh │ │ │ ├── cleanup_build_dir.bat │ │ │ ├── build_debug_vs2010.bat │ │ │ ├── build_release.bat │ │ │ ├── debug.sh │ │ │ └── videostreamer_config_example.xml │ ├── src │ │ └── streamer │ │ │ ├── core │ │ │ ├── AudioEncoder.cpp │ │ │ ├── MemoryPool.cpp │ │ │ ├── BitStream.cpp │ │ │ └── H264Parser.cpp │ │ │ ├── amf │ │ │ ├── types │ │ │ │ ├── AMFType.cpp │ │ │ │ ├── AMF0Property.cpp │ │ │ │ ├── AMF0Boolean.cpp │ │ │ │ ├── AMF0Number.cpp │ │ │ │ ├── AMF0String.cpp │ │ │ │ ├── AMF0EcmaArray.cpp │ │ │ │ └── AMF0Object.cpp │ │ │ └── AMF0.cpp │ │ │ ├── daemon │ │ │ └── Daemon.cpp │ │ │ └── flv │ │ │ ├── FLVFileWriter.cpp │ │ │ └── FLVTypes.cpp │ └── include │ │ └── streamer │ │ ├── amf │ │ └── types │ │ │ ├── AMF0Number.h │ │ │ ├── AMF0Property.h │ │ │ ├── AMF0Boolean.h │ │ │ ├── AMFTypes.h │ │ │ ├── AMF0String.h │ │ │ ├── AMF0EcmaArray.h │ │ │ ├── AMF0Object.h │ │ │ └── AMFType.h │ │ ├── daemon │ │ ├── Types.h │ │ ├── Daemon.h │ │ ├── Runner.h │ │ ├── Channel.h │ │ └── DaemonConfig.h │ │ ├── flv │ │ ├── FLVFileWriter.h │ │ ├── FLVReader.h │ │ └── FLVListener.h │ │ └── core │ │ ├── AudioEncoder.h │ │ ├── Debug.h │ │ ├── EncoderThread.h │ │ ├── RTMPThread.h │ │ ├── AudioEncoderMP3.h │ │ └── H264Parser.h ├── tinylib │ └── build │ │ └── cmake │ │ ├── build_debug_vs2010.bat │ │ ├── build_release_vs2010.bat │ │ └── CMakeLists.txt ├── xmlconfig │ ├── build │ │ └── cmake │ │ │ └── CMakeLists.txt │ └── src │ │ └── xmlconfig │ │ └── Config.cpp └── portaudio │ ├── build │ └── cmake │ │ └── CMakeLists.txt │ └── include │ └── portaudio │ └── PAudio.h ├── tools ├── html │ ├── swf │ │ ├── flowplayer-3.2.16.swf │ │ ├── flowplayer.rtmp-3.2.12.swf │ │ └── flowplayer.controls-3.2.15.swf │ ├── images │ │ └── background_pattern.png │ ├── index.html │ └── css │ │ └── rtmpd.css ├── run_rtmpd.sh ├── setup_rtmpd.sh └── cmake │ └── Triplet.cmake ├── applications ├── test_faac │ ├── build │ │ └── cmake │ │ │ ├── cleanup_build_dir.sh │ │ │ ├── run_debug.sh │ │ │ ├── run_release.bat │ │ │ ├── run_debug.bat │ │ │ ├── run_release.sh │ │ │ ├── build_debug.sh │ │ │ ├── build_release.sh │ │ │ ├── build_debug_vs2010.bat │ │ │ ├── build_release_vs2010.bat │ │ │ ├── connection_test.xml │ │ │ ├── CMakeLists.txt │ │ │ └── functions.sh │ └── src │ │ └── main.cpp ├── test_audio_in │ ├── build │ │ └── cmake │ │ │ ├── cleanup_build_dir.sh │ │ │ ├── run_release.bat │ │ │ ├── run_debug.bat │ │ │ ├── run_debug.sh │ │ │ ├── run_release.sh │ │ │ ├── build_debug.sh │ │ │ ├── build_release.sh │ │ │ ├── build_debug_vs2010.bat │ │ │ ├── build_release_vs2010.bat │ │ │ ├── connection_test.xml │ │ │ ├── CMakeLists.txt │ │ │ └── functions.sh │ └── src │ │ └── main.cpp ├── test_connection │ └── build │ │ └── cmake │ │ ├── cleanup_build_dir.sh │ │ ├── run_release.bat │ │ ├── run_debug.bat │ │ ├── run_debug.sh │ │ ├── run_release.sh │ │ ├── build_debug.sh │ │ ├── build_release.sh │ │ ├── build_debug_vs2010.bat │ │ ├── build_release_vs2010.bat │ │ ├── connection_test.xml │ │ ├── CMakeLists.txt │ │ └── functions.sh ├── yuv420p_grabber │ ├── build │ │ └── cmake │ │ │ ├── cleanup_build_dir.sh │ │ │ ├── run_release.bat │ │ │ ├── debug.sh │ │ │ ├── run_debug.bat │ │ │ ├── run_debug.sh │ │ │ ├── run_release.sh │ │ │ ├── build_debug.sh │ │ │ ├── build_release.sh │ │ │ ├── create_xcode_project.sh │ │ │ ├── build_debug_vs2010.bat │ │ │ ├── build_release_vs2010.bat │ │ │ ├── yuv420p_grabber.xml │ │ │ ├── CMakeLists.txt │ │ │ └── functions.sh │ └── src │ │ └── Animation.h ├── test_multi_streamer │ ├── build │ │ └── cmake │ │ │ ├── cleanup_build_dir.sh │ │ │ ├── run_release.bat │ │ │ ├── run_debug.bat │ │ │ ├── run_debug.sh │ │ │ ├── run_release.sh │ │ │ ├── .DS_Store │ │ │ ├── build_debug.sh │ │ │ ├── build_release.sh │ │ │ ├── build_debug_vs2010.bat │ │ │ ├── build_release_vs2010.bat │ │ │ ├── CMakeLists.txt │ │ │ └── functions.sh │ └── src │ │ └── Animation.h ├── decklink_streamer │ ├── build │ │ └── cmake │ │ │ ├── run_release.bat │ │ │ ├── run_debug.bat │ │ │ ├── build_debug_vs2010.bat │ │ │ ├── build_release_vs2010.bat │ │ │ ├── decklink_streamer.xml │ │ │ └── CMakeLists.txt │ └── include │ │ └── decklink_streamer │ │ └── FastI420Upload.h └── test_shutdown_flvwriter │ └── build │ └── cmake │ ├── cleanup_build_dir.sh │ ├── run_release.bat │ ├── run_debug.bat │ ├── run_debug.sh │ ├── run_release.sh │ ├── build_debug.sh │ ├── build_release.sh │ ├── build_debug_vs2010.bat │ ├── build_release_vs2010.bat │ ├── connection_test.xml │ └── CMakeLists.txt ├── thirdparty └── openFrameworks │ └── ofxVideoStreamer │ ├── build │ └── cmake │ │ ├── package.sh │ │ └── CMakeLists.txt │ ├── include │ └── ofxVideoStreamer │ │ └── ofxMultiVideoStreamer.h │ └── src │ └── ofxVideoStreamer │ └── ofxVideoStreamer.cpp ├── .gitignore └── README.md /projects/grapher/build/cmake/run_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_run_release 5 | -------------------------------------------------------------------------------- /projects/hwscale/build/cmake/run_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_run_release 5 | -------------------------------------------------------------------------------- /projects/decklink/build/cmake/run_debug.bat: -------------------------------------------------------------------------------- 1 | call build_debug.bat 2 | .\..\..\install\bin\decklink_debug.exe -------------------------------------------------------------------------------- /projects/decklink/build/cmake/run_release.bat: -------------------------------------------------------------------------------- 1 | call build_release.bat 2 | .\..\..\install\bin\decklink.exe -------------------------------------------------------------------------------- /projects/grapher/build/cmake/run_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_run_debug 6 | -------------------------------------------------------------------------------- /projects/hwscale/build/cmake/run_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_run_debug 6 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/run_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_run_debug 6 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/run_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_run_release 5 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/run_release.bat: -------------------------------------------------------------------------------- 1 | call build_release.bat 2 | .\..\..\..\..\install\bin\video_streamer.exe 3 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/run_debug_vs2010.bat: -------------------------------------------------------------------------------- 1 | call build_debug_vs2010.bat 2 | .\..\..\..\..\install\bin\video_streamer_debug.exe -------------------------------------------------------------------------------- /tools/html/swf/flowplayer-3.2.16.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diederickh/video_streamer/HEAD/tools/html/swf/flowplayer-3.2.16.swf -------------------------------------------------------------------------------- /projects/grapher/build/cmake/cleanup_build_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_remove_build_dirs 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /projects/hwscale/build/cmake/cleanup_build_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_remove_build_dirs 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/cleanup_build_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_remove_build_dirs 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /applications/test_faac/build/cmake/cleanup_build_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_remove_build_dirs 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /tools/html/images/background_pattern.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diederickh/video_streamer/HEAD/tools/html/images/background_pattern.png -------------------------------------------------------------------------------- /tools/html/swf/flowplayer.rtmp-3.2.12.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diederickh/video_streamer/HEAD/tools/html/swf/flowplayer.rtmp-3.2.12.swf -------------------------------------------------------------------------------- /applications/test_audio_in/build/cmake/cleanup_build_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_remove_build_dirs 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /applications/test_connection/build/cmake/cleanup_build_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_remove_build_dirs 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /applications/test_faac/build/cmake/run_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_debug.sh 3 | ./../../../../install/mac-clang-x86_64d/bin/test_faac_debug 4 | -------------------------------------------------------------------------------- /applications/test_faac/build/cmake/run_release.bat: -------------------------------------------------------------------------------- 1 | call build_release_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386\bin\decklink_streamer.exe -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/cleanup_build_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_remove_build_dirs 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /applications/test_audio_in/build/cmake/run_release.bat: -------------------------------------------------------------------------------- 1 | call build_release_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386\bin\decklink_streamer.exe -------------------------------------------------------------------------------- /applications/test_connection/build/cmake/run_release.bat: -------------------------------------------------------------------------------- 1 | call build_release_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386\bin\decklink_streamer.exe -------------------------------------------------------------------------------- /applications/test_faac/build/cmake/run_debug.bat: -------------------------------------------------------------------------------- 1 | call build_debug_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386d\bin\decklink_streamer_debug.exe -------------------------------------------------------------------------------- /applications/test_multi_streamer/build/cmake/cleanup_build_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_remove_build_dirs 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/run_release.bat: -------------------------------------------------------------------------------- 1 | call build_release_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386\bin\decklink_streamer.exe -------------------------------------------------------------------------------- /tools/html/swf/flowplayer.controls-3.2.15.swf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diederickh/video_streamer/HEAD/tools/html/swf/flowplayer.controls-3.2.15.swf -------------------------------------------------------------------------------- /applications/decklink_streamer/build/cmake/run_release.bat: -------------------------------------------------------------------------------- 1 | call build_release_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386\bin\decklink_streamer.exe -------------------------------------------------------------------------------- /applications/test_audio_in/build/cmake/run_debug.bat: -------------------------------------------------------------------------------- 1 | call build_debug_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386d\bin\decklink_streamer_debug.exe -------------------------------------------------------------------------------- /applications/test_audio_in/build/cmake/run_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_debug.sh 3 | ./../../../../install/mac-clang-x86_64d/bin/connection_test_debug 4 | -------------------------------------------------------------------------------- /applications/test_audio_in/build/cmake/run_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_release.sh 3 | ./../../../../install/mac-clang-x86_64/bin/connection_test 4 | 5 | -------------------------------------------------------------------------------- /applications/test_connection/build/cmake/run_debug.bat: -------------------------------------------------------------------------------- 1 | call build_debug_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386d\bin\decklink_streamer_debug.exe -------------------------------------------------------------------------------- /applications/test_connection/build/cmake/run_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_debug.sh 3 | ./../../../../install/mac-clang-x86_64d/bin/test_connection_debug 4 | -------------------------------------------------------------------------------- /applications/test_faac/build/cmake/run_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_release.sh 3 | ./../../../../install/mac-clang-x86_64/bin/connection_test 4 | 5 | -------------------------------------------------------------------------------- /applications/test_multi_streamer/build/cmake/run_release.bat: -------------------------------------------------------------------------------- 1 | call build_release_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386\bin\decklink_streamer.exe -------------------------------------------------------------------------------- /applications/test_shutdown_flvwriter/build/cmake/cleanup_build_dir.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_remove_build_dirs 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_debug.sh 3 | lldb ../../../../install/mac-clang-x86_64d/bin/yuv420p_grabber_debug 4 | -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/run_debug.bat: -------------------------------------------------------------------------------- 1 | call build_debug_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386d\bin\decklink_streamer_debug.exe -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/run_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_debug.sh 3 | ./../../../../install/mac-clang-x86_64d/bin/yuv420p_grabber_debug 4 | -------------------------------------------------------------------------------- /applications/decklink_streamer/build/cmake/run_debug.bat: -------------------------------------------------------------------------------- 1 | call build_debug_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386d\bin\decklink_streamer_debug.exe -------------------------------------------------------------------------------- /applications/test_connection/build/cmake/run_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_release.sh 3 | ./../../../../install/mac-clang-x86_64/bin/test_connection 4 | 5 | -------------------------------------------------------------------------------- /applications/test_multi_streamer/build/cmake/run_debug.bat: -------------------------------------------------------------------------------- 1 | call build_debug_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386d\bin\decklink_streamer_debug.exe -------------------------------------------------------------------------------- /applications/test_shutdown_flvwriter/build/cmake/run_release.bat: -------------------------------------------------------------------------------- 1 | call build_release_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386\bin\decklink_streamer.exe -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/run_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_release.sh 3 | ./../../../../install/mac-clang-x86_64/bin/yuv420p_grabber 4 | 5 | -------------------------------------------------------------------------------- /projects/grapher/build/cmake/build_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_debug 7 | 8 | -------------------------------------------------------------------------------- /projects/grapher/build/cmake/build_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_release 7 | -------------------------------------------------------------------------------- /projects/hwscale/build/cmake/build_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_debug 7 | 8 | -------------------------------------------------------------------------------- /projects/hwscale/build/cmake/build_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_release 7 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/build_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_debug 7 | 8 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/build_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_release 7 | -------------------------------------------------------------------------------- /applications/test_faac/build/cmake/build_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_debug 7 | 8 | -------------------------------------------------------------------------------- /applications/test_faac/build/cmake/build_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_release 7 | -------------------------------------------------------------------------------- /applications/test_multi_streamer/build/cmake/run_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_debug.sh 3 | ./../../../../install/mac-clang-x86_64d/bin/test_multi_streamer_debug 4 | -------------------------------------------------------------------------------- /applications/test_multi_streamer/build/cmake/run_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_release.sh 3 | ./../../../../install/mac-clang-x86_64/bin/test_multi_streamer 4 | 5 | -------------------------------------------------------------------------------- /applications/test_shutdown_flvwriter/build/cmake/run_debug.bat: -------------------------------------------------------------------------------- 1 | call build_debug_vs2010.bat 2 | .\..\..\..\..\install\win-vs2010-i386d\bin\decklink_streamer_debug.exe -------------------------------------------------------------------------------- /applications/test_shutdown_flvwriter/build/cmake/run_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_debug.sh 3 | ./../../../../install/mac-clang-x86_64d/bin/connection_test_debug 4 | -------------------------------------------------------------------------------- /applications/test_shutdown_flvwriter/build/cmake/run_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ./build_release.sh 3 | ./../../../../install/mac-clang-x86_64/bin/connection_test 4 | 5 | -------------------------------------------------------------------------------- /applications/test_audio_in/build/cmake/build_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_debug 7 | 8 | -------------------------------------------------------------------------------- /applications/test_audio_in/build/cmake/build_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_release 7 | -------------------------------------------------------------------------------- /applications/test_connection/build/cmake/build_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_debug 7 | 8 | -------------------------------------------------------------------------------- /applications/test_connection/build/cmake/build_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_release 7 | -------------------------------------------------------------------------------- /applications/test_multi_streamer/build/cmake/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/diederickh/video_streamer/HEAD/applications/test_multi_streamer/build/cmake/.DS_Store -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/build_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_debug 7 | 8 | -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/build_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_release 7 | -------------------------------------------------------------------------------- /applications/test_multi_streamer/build/cmake/build_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_debug 7 | 8 | -------------------------------------------------------------------------------- /applications/test_multi_streamer/build/cmake/build_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_release 7 | -------------------------------------------------------------------------------- /applications/test_shutdown_flvwriter/build/cmake/build_debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_debug 7 | 8 | -------------------------------------------------------------------------------- /applications/test_shutdown_flvwriter/build/cmake/build_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . functions.sh 3 | 4 | roxlu_check_build_dirs 5 | roxlu_check_compiler 6 | roxlu_build_release 7 | -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/create_xcode_project.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . functions.sh 4 | 5 | roxlu_check_build_dirs 6 | roxlu_check_compiler 7 | roxlu_create_xcodeproject 8 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/core/AudioEncoder.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | AudioEncoder::AudioEncoder() { 4 | } 5 | 6 | AudioEncoder::~AudioEncoder() { 7 | } 8 | 9 | -------------------------------------------------------------------------------- /projects/grapher/build/cmake/create_xcode_project.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . ./../../../../../lib/build/functions.sh 4 | 5 | roxlu_check_build_dirs 6 | roxlu_check_compiler 7 | roxlu_create_xcodeproject 8 | -------------------------------------------------------------------------------- /projects/hwscale/build/cmake/create_xcode_project.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . ./../../../../../lib/build/functions.sh 4 | 5 | roxlu_check_build_dirs 6 | roxlu_check_compiler 7 | roxlu_create_xcodeproject 8 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/create_xcode_project.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | . ./../../../../../lib/build/functions.sh 4 | 5 | roxlu_check_build_dirs 6 | roxlu_check_compiler 7 | roxlu_create_xcodeproject 8 | -------------------------------------------------------------------------------- /tools/run_rtmpd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | d=${PWD} 4 | if [ ! -d ${d}/rtmpd ] ; then 5 | ./setup.sh 6 | fi 7 | 8 | cd ${d}/rtmpd/builders/cmake 9 | ./crtmpserver/crtmpserver crtmpserver/crtmpserver.lua 10 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/cleanup_build_dir.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | if exist build.debug ( 4 | rd /s/q build.debug 5 | ) 6 | 7 | if exist build.release ( 8 | rd /s/q build.release 9 | ) 10 | 11 | mkdir build.release 12 | mkdir build.debug -------------------------------------------------------------------------------- /thirdparty/openFrameworks/ofxVideoStreamer/build/cmake/package.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | d=${PWD} 4 | if [ ! -d ${d}/packaged ] ; then 5 | mkdir ${d}/packaged 6 | fi 7 | 8 | cd ${d}/packaged 9 | cmake ../ 10 | cmake --build . --target install 11 | -------------------------------------------------------------------------------- /applications/test_faac/build/cmake/build_debug_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.debug" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Debug 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/amf/types/AMFType.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | AMFType::AMFType(uint8_t type, BitStream& bs) 5 | :type(type) 6 | ,bs(bs) 7 | { 8 | } 9 | 10 | AMFType::~AMFType() { 11 | } 12 | 13 | -------------------------------------------------------------------------------- /applications/test_audio_in/build/cmake/build_debug_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.debug" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Debug 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /applications/test_connection/build/cmake/build_debug_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.debug" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Debug 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/build_debug_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.debug" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Debug 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /projects/decklink/build/cmake/build_debug_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.debug" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Debug 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/build_debug_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.debug" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Debug 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /projects/tinylib/build/cmake/build_debug_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.debug" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Debug 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /applications/test_audio_in/build/cmake/build_release_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.release" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Release 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /applications/test_faac/build/cmake/build_release_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.release" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Release 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /applications/test_multi_streamer/build/cmake/build_debug_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.debug" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Debug 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /projects/hwscale/build/cmake/build_release_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.release" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Release 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /projects/tinylib/build/cmake/build_release_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.release" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Release 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /applications/test_connection/build/cmake/build_release_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.release" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Release 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /applications/test_shutdown_flvwriter/build/cmake/build_debug_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.debug" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Debug 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/build_release_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.release" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Release 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /projects/decklink/build/cmake/build_release_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.release" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Release 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /applications/decklink_streamer/build/cmake/build_debug_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.debug" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Debug 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /applications/test_multi_streamer/build/cmake/build_release_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.release" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Release 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /applications/test_shutdown_flvwriter/build/cmake/build_release_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.release" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Release 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/build_release.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set d=%CD% 4 | 5 | if not exist "%d%\build.release" ( 6 | mkdir %d%\build.release 7 | ) 8 | 9 | cd %d%\build.release 10 | cmake -DCMAKE_BUILD_TYPE=Release .. 11 | cmake --build . --target install --config Release 12 | 13 | cd %d% -------------------------------------------------------------------------------- /applications/decklink_streamer/build/cmake/build_release_vs2010.bat: -------------------------------------------------------------------------------- 1 | set d="%CD%\build.release" 2 | if not exist %d% ( 3 | mkdir %d% 4 | ) 5 | 6 | cd %d% 7 | cmake -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 10" .. 8 | cmake --build . --target install --config Release 9 | cd %d%\..\ 10 | 11 | -------------------------------------------------------------------------------- /projects/hwscale/build/cmake/debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | d=${PWD} 4 | bd=${d}/../../../install/bin 5 | appdir=${bd}/../../ 6 | 7 | # get app name 8 | cd ${appdir} 9 | app=${PWD##*/} 10 | 11 | if [ ! -d ${bd} ] ; then 12 | mkdir ${bd} 13 | mkdir ${bd}/data 14 | fi 15 | 16 | cd ${d} 17 | ./build_debug.sh 18 | 19 | cd ${bd} 20 | 21 | lldb ./yuv420 22 | 23 | 24 | -------------------------------------------------------------------------------- /projects/grapher/build/cmake/debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | d=${PWD} 4 | bd=${d}/../../../install/bin 5 | appdir=${bd}/../../ 6 | 7 | # get app name 8 | cd ${appdir} 9 | app=${PWD##*/} 10 | 11 | if [ ! -d ${bd} ] ; then 12 | mkdir ${bd} 13 | mkdir ${bd}/data 14 | fi 15 | 16 | cd ${d} 17 | ./build_debug.sh 18 | 19 | cd ${bd} 20 | 21 | lldb ./grapher_debug 22 | 23 | 24 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/debug.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -x 3 | d=${PWD} 4 | bd=${d}/../../install/bin 5 | appdir=${bd}/../../ 6 | 7 | # get app name 8 | cd ${appdir} 9 | app=${PWD##*/} 10 | 11 | if [ ! -d ${bd} ] ; then 12 | mkdir ${bd} 13 | mkdir ${bd}/data 14 | fi 15 | 16 | cd ${d} 17 | ./build_debug.sh 18 | 19 | cd ${bd} 20 | 21 | lldb ./${app}_debug 22 | 23 | 24 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/amf/types/AMF0Property.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | AMF0Property::AMF0Property() 5 | :value(NULL) 6 | ,name(NULL) 7 | { 8 | } 9 | 10 | AMF0Property::~AMF0Property() { 11 | if(value) { 12 | delete value; 13 | value = NULL; 14 | } 15 | if(name) { 16 | delete name; 17 | name = NULL; 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /projects/tinylib/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | # ${tinylib_include_dirs} - Include directories for tinylib, add these to your include dirs 4 | # ${tinylib_libraries} - The libraries to link with. 5 | 6 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../tools/cmake/Triplet.cmake) # include triplet 7 | 8 | set(tinylib_include_dirs ${CMAKE_CURRENT_LIST_DIR}/../../include/) 9 | 10 | set(tinylib_libraries 11 | ${extern_dir}/lib/libpng.a 12 | ) 13 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/amf/types/AMF0Boolean.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | AMF0Boolean::AMF0Boolean(BitStream& bs) 5 | :AMFType(AMF0_TYPE_BOOLEAN, bs) 6 | ,value(false) 7 | { 8 | } 9 | 10 | void AMF0Boolean::print() { 11 | printf("amf0_boolean: %c\n", (value) ? 'y' : 'n'); 12 | } 13 | 14 | void AMF0Boolean::read() { 15 | value = bs.getU8(); 16 | } 17 | 18 | void AMF0Boolean::write() { 19 | bs.putU8(value ? 1 : 0); 20 | } 21 | -------------------------------------------------------------------------------- /tools/setup_rtmpd.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | d=${PWD} 3 | 4 | if [ ! -d ${d}/rtmpd ] ; then 5 | mkdir ${d}/rtmpd 6 | 7 | cd ${d}/rtmpd 8 | svn co --username anonymous --password "" https://svn.rtmpd.com/crtmpserver/trunk/ . 9 | 10 | if [ "${OSTYPE}" = "darwin10.0" ] ; then 11 | svn up -r 760 12 | elif [ "${OSTYPE}" = "darwin12" ] ; then 13 | # svn up -r 799 // worked with darwin 12.?? not with x86_64-apple-darwin12.5.0, 14 | # latest test with r 811 worked on mac 10.8.5 15 | fi 16 | 17 | cd ${d}/rtmpd/builders/cmake 18 | ./run 19 | fi 20 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/amf/types/AMF0Number.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | AMF0Number::AMF0Number(BitStream& bs) 6 | :AMFType(AMF0_TYPE_NUMBER, bs) 7 | ,value(0.0) 8 | { 9 | } 10 | 11 | void AMF0Number::print() { 12 | printf("amf0_number: %f\n", value); 13 | } 14 | 15 | void AMF0Number::read() { 16 | uint64_t num = FromBE64(bs.getU64()); 17 | memcpy((char*)&value, (char*)&num, 8); 18 | } 19 | 20 | void AMF0Number::write() { 21 | uint64_t v = 0; 22 | memcpy((char*)&v, (char*)&value, 8); 23 | bs.putU64(ToBE64(v)); 24 | } 25 | 26 | -------------------------------------------------------------------------------- /projects/decklink/README.md: -------------------------------------------------------------------------------- 1 | 2 | # DeckLink SDK wrapper 3 | 4 | Download the BlackMagic DeckLink SDK and install it. The SDK only 5 | ships with header files and on windows you get a set of .idl files 6 | which are used to generate a .h and .c file. 7 | 8 | ## Install on windows 9 | 10 | - Extract the SDK 11 | - Copy the *.idl files from _BlackMagic DeckLink SDK #.#.#\Win\include\_ 12 | to _projects\decklink\sdk\idl_ 13 | - I also copied the _DeckLinkAPI.dll_ and _DeckLinkAPI64.dll_ from the 14 | _BlackMagic Media Express_ application which is found in one of the 15 | other downloads from the blackmagic site. Put these dlls in the 16 | _projects\decklink\sdk\bin_ -------------------------------------------------------------------------------- /applications/test_faac/build/cmake/connection_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0 6 | 7 | rtmp://127.0.0.1/flvplayback/livestream 8 | 9 | 14 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /applications/test_audio_in/build/cmake/connection_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0 6 | 7 | rtmp://127.0.0.1/flvplayback/livestream 8 | 9 | 14 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/amf/types/AMF0String.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | AMF0String::AMF0String(BitStream& bs) 6 | :AMFType(AMF0_TYPE_STRING, bs) 7 | { 8 | } 9 | 10 | AMF0String::AMF0String(BitStream& bs, std::string value) 11 | :AMFType(AMF0_TYPE_STRING, bs) 12 | ,value(value) 13 | { 14 | 15 | } 16 | 17 | void AMF0String::print() { 18 | printf("amf0_string: %s\n", value.c_str()); 19 | } 20 | 21 | void AMF0String::read() { 22 | uint16_t len = FromBE16(bs.getU16()); 23 | value = bs.getString(len); 24 | } 25 | 26 | void AMF0String::write() { 27 | uint16_t len = value.size(); 28 | bs.putU16(ToBE16(len)); 29 | bs.putString(value); 30 | } 31 | -------------------------------------------------------------------------------- /applications/decklink_streamer/build/cmake/decklink_streamer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0 6 | 7 | rtmp://127.0.0.1/flvplayback/livestream 8 | 9 | 14 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /applications/test_shutdown_flvwriter/build/cmake/connection_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 0 6 | 7 | rtmp://127.0.0.1/flvplayback/livestream 8 | 9 | 14 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /projects/hwscale/tests/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | include(${CMAKE_CURRENT_LIST_DIR}/../../grapher/build/cmake/CMakeLists.txt) # grapher 4 | include(${CMAKE_CURRENT_LIST_DIR}/../../tinylib/build/cmake/CMakeLists.txt) # tinylib 5 | 6 | set(hws_test_name "yuv420") 7 | 8 | set(hws_base_dir ${hws_tests_dir}/opengl_yuv420p) 9 | 10 | set(hws_test_source_files 11 | ${hws_source_files} 12 | ${hws_base_dir}/main.cpp 13 | ${hws_base_dir}/Animation.cpp 14 | ) 15 | 16 | add_executable(${hws_test_name} ${hws_test_source_files}) 17 | 18 | target_link_libraries(${hws_test_name} ${hws_libs} ${gr_lib_name}) 19 | 20 | install(TARGETS ${hws_test_name} RUNTIME DESTINATION bin) 21 | 22 | add_dependencies(${hws_test_name} ${gr_lib_name}) # gr_lib_name is defined in the cmake of grapher 23 | -------------------------------------------------------------------------------- /projects/xmlconfig/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | # ${xmlconfig_source_dir} - path to source dir 4 | # ${xmlconfig_source_dirs} - all the source dirs that contains source files for xmlconfig (use this when you want to package something, see the openFrameworks addon) 5 | # ${xmlconfig_souce_files} - compile these source files 6 | # ${xmlconfig_include_dirs} - add these to your include directories 7 | 8 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../tools/cmake/Triplet.cmake) 9 | 10 | set(xmlconfig_source_dir ${CMAKE_CURRENT_LIST_DIR}/../../src/xmlconfig) 11 | 12 | set(xmlconfig_source_dirs ${xmlconfig_source_dir}/) 13 | 14 | set(xmlconfig_include_dirs ${CMAKE_CURRENT_LIST_DIR}/../../include/) 15 | 16 | set(xmlconfig_source_files ${xmlconfig_source_dir}/Config.cpp) 17 | 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #OS junk files 2 | [Tt]humbs.db 3 | *.DS_Store 4 | 5 | #Visual Studio files 6 | *.[Oo]bj 7 | *.user 8 | *.aps 9 | *.pch 10 | *.vspscc 11 | *.vssscc 12 | *_i.c 13 | *_p.c 14 | *.ncb 15 | *.suo 16 | *.tlb 17 | *.tlh 18 | *.bak 19 | *.[Cc]ache 20 | *.ilk 21 | *.log 22 | *.lib 23 | *.sbr 24 | *.sdf 25 | *.opensdf 26 | *.unsuccessfulbuild 27 | ipch/ 28 | obj/ 29 | [Bb]in 30 | [Dd]ebug*/ 31 | [Rr]elease*/ 32 | Ankh.NoLoad 33 | 34 | #MonoDevelop 35 | *.pidb 36 | *.userprefs 37 | 38 | #Tooling 39 | _ReSharper*/ 40 | *.resharper 41 | [Tt]est[Rr]esult* 42 | *.sass-cache 43 | 44 | #Project files 45 | [Bb]uild/ 46 | 47 | #Subversion files 48 | .svn 49 | 50 | # Office Temp Files 51 | ~$* 52 | 53 | #NuGet 54 | packages/ 55 | 56 | #ncrunch 57 | *ncrunch* 58 | *crunch*.local.xml 59 | 60 | # visual studio database projects 61 | *.dbmdl 62 | 63 | #Test files 64 | *.testsettings -------------------------------------------------------------------------------- /applications/decklink_streamer/include/decklink_streamer/FastI420Upload.h: -------------------------------------------------------------------------------- 1 | #ifndef ROXLU_FAST_I420_UPLOAD_H 2 | #define ROXLU_FAST_I420_UPLOAD_H 3 | 4 | #include 5 | #include 6 | 7 | #define FI_NUM_BUFFERS 3 8 | 9 | class FastI420Upload { 10 | public: 11 | FastI420Upload(); 12 | ~FastI420Upload(); 13 | bool setup(int width, int height); 14 | void update(uint8_t* y, uint8_t* u, uint8_t* v); 15 | private: 16 | GLuint createTexture(int width, int height); 17 | public: 18 | int w; /* W-plae width */ 19 | int h; /* Y-plane height */ 20 | int uv_w; 21 | int uv_h; 22 | int read_dx; 23 | int write_dx; 24 | GLuint tex_y; 25 | GLuint tex_u; 26 | GLuint tex_v; 27 | GLuint pbo_y[FI_NUM_BUFFERS]; 28 | GLuint pbo_u[FI_NUM_BUFFERS]; 29 | GLuint pbo_v[FI_NUM_BUFFERS]; 30 | bool must_unmap; 31 | }; 32 | 33 | #endif 34 | -------------------------------------------------------------------------------- /projects/xmlconfig/src/xmlconfig/Config.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | Config::Config() { 8 | } 9 | 10 | Config::~Config() { 11 | } 12 | 13 | bool Config::load(std::string filepath) { 14 | 15 | std::ifstream ifs(filepath.c_str(), std::ios::in); 16 | if(!ifs.is_open()) { 17 | printf("error: cannot open the xml from: `%s`\n", filepath.c_str()); 18 | return false; 19 | } 20 | 21 | xml_str.assign ( (std::istreambuf_iterator(ifs)) , std::istreambuf_iterator()); 22 | if(!xml_str.size()) { 23 | printf("error: empty xml.\n"); 24 | return false; 25 | } 26 | 27 | try { 28 | doc.parse<0>((char*)xml_str.c_str()); 29 | } 30 | catch(...) { 31 | printf("error: error while parsing xml.\n"); 32 | return false; 33 | } 34 | return true; 35 | } 36 | -------------------------------------------------------------------------------- /projects/grapher/src/grapher/Config.cpp: -------------------------------------------------------------------------------- 1 | // @todo - Use the config project class 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | Config::Config() { 8 | } 9 | 10 | Config::~Config() { 11 | } 12 | 13 | bool Config::load(std::string filepath) { 14 | 15 | std::ifstream ifs(filepath.c_str(), std::ios::in); 16 | if(!ifs.is_open()) { 17 | printf("error: cannot open the xml from: `%s`\n", filepath.c_str()); 18 | return false; 19 | } 20 | 21 | std::string str( (std::istreambuf_iterator(ifs)) , std::istreambuf_iterator()); 22 | if(!str.size()) { 23 | printf("error: empty xml.\n"); 24 | return false; 25 | } 26 | 27 | try { 28 | doc.parse((char*)str.c_str()); 29 | } 30 | catch(...) { 31 | printf("error: error while parsin xml.\n"); 32 | return false; 33 | } 34 | return true; 35 | } 36 | -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/yuv420p_grabber.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0 5 | 6 | 7 | 8 | 0 9 | 10 | rtmp://127.0.0.1/flvplayback/livestream 11 | 12 | 19 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/amf/types/AMF0EcmaArray.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | AMF0EcmaArray::AMF0EcmaArray(BitStream& bs) 8 | :AMFType(AMF0_TYPE_ECMA_ARRAY, bs) 9 | ,obj(bs) 10 | { 11 | } 12 | 13 | AMF0EcmaArray::~AMF0EcmaArray() { 14 | obj.removeElements(); 15 | } 16 | 17 | void AMF0EcmaArray::add(std::string name, AMFType* v) { 18 | obj.add(name, v); 19 | } 20 | 21 | void AMF0EcmaArray::add(AMF0String* name, AMFType* v) { 22 | obj.add(name, v); 23 | } 24 | 25 | void AMF0EcmaArray::print() { 26 | obj.print(); 27 | } 28 | 29 | void AMF0EcmaArray::read() { 30 | uint32_t num = FromBE32(bs.getU32()); 31 | obj.readElements(); 32 | } 33 | 34 | void AMF0EcmaArray::write() { 35 | bs.putU8(AMF0_TYPE_ECMA_ARRAY); 36 | 37 | uint32_t len = (uint32_t)obj.values.size(); 38 | bs.putU32(ToBE32(len)); 39 | 40 | obj.writeElements(); 41 | } 42 | -------------------------------------------------------------------------------- /applications/test_connection/build/cmake/connection_test.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0 5 | 6 | 7 | 8 | 0 9 | 10 | rtmp://127.0.0.1/flvplayback/live 11 | 12 | 19 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /projects/decklink/src/decklink/DeckLinkCaptureCallback.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | DeckLinkCaptureCallback::DeckLinkCaptureCallback() 5 | :cb_user(NULL) 6 | ,cb_frame(NULL) 7 | { 8 | } 9 | 10 | DeckLinkCaptureCallback::~DeckLinkCaptureCallback() { 11 | cb_user = NULL; 12 | cb_frame = NULL; 13 | } 14 | 15 | HRESULT DeckLinkCaptureCallback::VideoInputFormatChanged(BMDVideoInputFormatChangedEvents ev, 16 | IDeckLinkDisplayMode* mode, 17 | BMDDetectedVideoInputFormatFlags flags) 18 | { 19 | printf("-- video input format changed.\n"); 20 | return S_OK; 21 | } 22 | 23 | HRESULT DeckLinkCaptureCallback::VideoInputFrameArrived(IDeckLinkVideoInputFrame* vframe, 24 | IDeckLinkAudioInputPacket* aframe) 25 | { 26 | if(cb_frame) { 27 | cb_frame(vframe, aframe, cb_user); 28 | } 29 | 30 | return S_OK; 31 | } 32 | 33 | 34 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/daemon/Daemon.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | Daemon::Daemon() { 4 | } 5 | 6 | Daemon::~Daemon() { 7 | 8 | for(runner_iterator it = runners.begin(); it != runners.end(); ++it) { 9 | delete it->second; 10 | } 11 | runners.clear(); 12 | 13 | } 14 | 15 | bool Daemon::setup(std::string configpath) { 16 | 17 | if(!config.load(configpath)) { 18 | return false; 19 | } 20 | 21 | for(DaemonConfig::iterator it = config.begin(); it != config.end(); ++it) { 22 | Runner* r = new Runner(it->second); 23 | if(!r->setup()) { 24 | return false; 25 | } 26 | runners.insert(std::pair(it->first, r)); 27 | } 28 | 29 | return true; 30 | } 31 | 32 | bool Daemon::initialize() { 33 | 34 | if(!runners.size()) { 35 | printf("error: no runners found; did you add some entries to your config?.\n"); 36 | return false; 37 | } 38 | 39 | for(runner_iterator it = runners.begin(); it != runners.end(); ++it) { 40 | if(!it->second->initialize()) { 41 | return false; 42 | } 43 | } 44 | 45 | return true; 46 | } 47 | -------------------------------------------------------------------------------- /projects/portaudio/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | # ${portaudio_include_dirs} - include directories, add these to you include dirs 4 | # ${portaudio_source_files} - source files of hwscale, compile these 5 | # ${portaudio_libraries} - link with these libraries 6 | # ${portaudio_source_dirs} - use this with install hen you want to package hwscaler, see the openframeworks addon 7 | 8 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../tools/cmake/Triplet.cmake) # include triplet 9 | 10 | set(portaudio_include_dirs ${CMAKE_CURRENT_LIST_DIR}/../../include/) 11 | 12 | set(portaudio_source_dir ${CMAKE_CURRENT_LIST_DIR}/../../src) 13 | 14 | set(portaudio_source_dirs ${portaudio_source_dir}/portaudio/) 15 | 16 | set(portaudio_source_files 17 | ${portaudio_source_dir}/portaudio/PAudio.cpp 18 | ) 19 | 20 | if(APPLE) 21 | find_library(fr_audio CoreAudio) 22 | find_library(fr_audio_unit AudioUnit) 23 | find_library(fr_audio_toolbox AudioToolbox) 24 | find_library(fr_core_services CoreServices) 25 | 26 | set(portaudio_libraries 27 | ${fr_audio} 28 | ${fr_audio_unit} 29 | ${fr_audio_toolbox} 30 | ${fr_core_services} 31 | ${extern_dir}/lib/libportaudio.a 32 | ) 33 | 34 | endif() 35 | 36 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/core/MemoryPool.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | MemoryPool::MemoryPool() { 5 | uv_mutex_init(&video_mutex); 6 | uv_mutex_init(&audio_mutex); 7 | } 8 | 9 | MemoryPool::~MemoryPool() { 10 | uv_mutex_destroy(&video_mutex); 11 | uv_mutex_destroy(&audio_mutex); 12 | } 13 | 14 | bool MemoryPool::allocateVideoFrames(size_t nframes, uint32_t nbytes) { 15 | 16 | lockVideo(); 17 | { 18 | for(size_t i = 0; i < nframes; ++i) { 19 | AVPacket* pkt = new AVPacket(this); 20 | pkt->allocate(nbytes); 21 | pkt->makeVideoPacket(); 22 | pkt->refcount = 0; // make sure refcount starts at zero, so it's free 23 | video_packets.push_back(pkt); 24 | } 25 | } 26 | unlockVideo(); 27 | 28 | return true; 29 | } 30 | 31 | bool MemoryPool::allocateAudioFrames(size_t nframes, uint32_t nbytes) { 32 | 33 | lockAudio(); 34 | { 35 | for(size_t i = 0; i < nframes; ++i) { 36 | AVPacket* pkt = new AVPacket(this); 37 | pkt->allocate(nbytes); 38 | pkt->makeAudioPacket(); 39 | pkt->refcount = 0; // make sure refcount starts at zero, so it's free 40 | audio_packets.push_back(pkt); 41 | } 42 | } 43 | unlockAudio(); 44 | 45 | return true; 46 | } 47 | 48 | -------------------------------------------------------------------------------- /projects/streamer/build/cmake/videostreamer_config_example.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 0 5 | 6 | 7 | 8 | 0 9 | 10 | rtmp://192.168.0.188/flvplayback/livestream 11 | 12 | 19 | 28 | 29 | 30 | 31 | 43 | 44 | -------------------------------------------------------------------------------- /applications/test_multi_streamer/src/Animation.h: -------------------------------------------------------------------------------- 1 | #ifndef ROXLU_ANIMATION_H 2 | #define ROXLU_ANIMATION_H 3 | 4 | #include /* using this for the correct GL includes */ 5 | 6 | #if YUV420P_GRABBER_GLSL_VERSION == 120 7 | # error "The animation class does not yet have support for GLSL 120" 8 | #elif YUV420P_GRABBER_GLSL_VERSION == 150 9 | static const char* ANIM_VS = "" 10 | "#version 150\n" 11 | "uniform mat4 u_pm;" 12 | "uniform mat4 u_mm;" 13 | "in vec4 a_pos;" 14 | "in vec3 a_norm;" 15 | "out vec3 v_norm;" 16 | "void main() { " 17 | " gl_Position = u_pm * u_mm * a_pos;" 18 | " v_norm = a_norm; " 19 | "}" 20 | ; 21 | 22 | static const char* ANIM_FS = "" 23 | "#version 150\n" 24 | "out vec4 fragcolor; " 25 | "in vec3 v_norm;" 26 | "void main() {" 27 | " fragcolor.rgba = vec4(1.0, 0.0, 1.0, 1.0);" 28 | " fragcolor.rgb = 0.5 + 0.5 * v_norm;" 29 | "}" 30 | ; 31 | #endif 32 | 33 | 34 | class Animation { 35 | public: 36 | Animation(); 37 | ~Animation(); 38 | 39 | bool setup(int w, int h); 40 | void draw(); 41 | 42 | public: 43 | GLuint prog; 44 | GLuint vert; 45 | GLuint frag; 46 | GLuint vao; 47 | GLuint vbo; 48 | float pm[16]; 49 | float mm[16]; 50 | GLint u_mm; 51 | int nvertices; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /applications/yuv420p_grabber/src/Animation.h: -------------------------------------------------------------------------------- 1 | #ifndef ROXLU_ANIMATION_H 2 | #define ROXLU_ANIMATION_H 3 | 4 | #include /* using this for the correct GL includes */ 5 | 6 | #if YUV420P_GRABBER_GLSL_VERSION == 120 7 | # error "The animation class does not yet have support for GLSL 120" 8 | #elif YUV420P_GRABBER_GLSL_VERSION == 150 9 | static const char* ANIM_VS = "" 10 | "#version 150\n" 11 | "uniform mat4 u_pm;" 12 | "uniform mat4 u_mm;" 13 | "in vec4 a_pos;" 14 | "in vec3 a_norm;" 15 | "out vec3 v_norm;" 16 | "void main() { " 17 | " gl_Position = u_pm * u_mm * a_pos;" 18 | " v_norm = a_norm; " 19 | "}" 20 | ; 21 | 22 | static const char* ANIM_FS = "" 23 | "#version 150\n" 24 | "out vec4 fragcolor; " 25 | "in vec3 v_norm;" 26 | "void main() {" 27 | " fragcolor.rgba = vec4(1.0, 0.0, 1.0, 1.0);" 28 | " fragcolor.rgb = 0.5 + 0.5 * v_norm;" 29 | "}" 30 | ; 31 | #endif 32 | 33 | 34 | class Animation { 35 | public: 36 | Animation(); 37 | ~Animation(); 38 | 39 | bool setup(int w, int h); 40 | void draw(); 41 | 42 | public: 43 | GLuint prog; 44 | GLuint vert; 45 | GLuint frag; 46 | GLuint vao; 47 | GLuint vbo; 48 | float pm[16]; 49 | float mm[16]; 50 | GLint u_mm; 51 | int nvertices; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /projects/hwscale/tests/opengl_yuv420p/Animation.h: -------------------------------------------------------------------------------- 1 | #ifndef ROXLU_ANIMATION_H 2 | #define ROXLU_ANIMATION_H 3 | 4 | #include /* using this for the correct GL includes */ 5 | 6 | #if YUV420P_GRABBER_GLSL_VERSION == 120 7 | # error "The animation class does not yet have support for GLSL 120" 8 | #elif YUV420P_GRABBER_GLSL_VERSION == 150 9 | static const char* ANIM_VS = "" 10 | "#version 150\n" 11 | "uniform mat4 u_pm;" 12 | "uniform mat4 u_mm;" 13 | "in vec4 a_pos;" 14 | "in vec3 a_norm;" 15 | "out vec3 v_norm;" 16 | "void main() { " 17 | " gl_Position = u_pm * u_mm * a_pos;" 18 | " v_norm = a_norm; " 19 | "}" 20 | ; 21 | 22 | static const char* ANIM_FS = "" 23 | "#version 150\n" 24 | "out vec4 fragcolor; " 25 | "in vec3 v_norm;" 26 | "void main() {" 27 | " fragcolor.rgba = vec4(1.0, 0.0, 1.0, 1.0);" 28 | " fragcolor.rgb = 0.5 + 0.5 * v_norm;" 29 | "}" 30 | ; 31 | #endif 32 | 33 | 34 | class Animation { 35 | public: 36 | Animation(); 37 | ~Animation(); 38 | 39 | bool setup(int w, int h); 40 | void draw(); 41 | 42 | public: 43 | GLuint prog; 44 | GLuint vert; 45 | GLuint frag; 46 | GLuint vao; 47 | GLuint vbo; 48 | float pm[16]; 49 | float mm[16]; 50 | GLint u_mm; 51 | int nvertices; 52 | }; 53 | 54 | #endif 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # VideoStreamer 2 | 3 | _Documentation will be added when we have a working version of this lib_ 4 | 5 | 6 | ## Prepare 7 | 8 | - Download the DeckLink SDK and for mac, copy the include directory to _projects/decklink/sdk/include_ 9 | 10 | This library makes use of the following libraries: 11 | 12 | - x264 13 | - rapidxml 14 | - glxw (only for opengl apps) 15 | - glfw3 (only for opengl apps) 16 | - mp3lame 17 | - libfaac 18 | - libyuv 19 | - openssl 20 | - zlib 21 | - nanomsg (only for daemon, which is under development) 22 | - librtmp 23 | - libuv 24 | 25 | _Build system command_ 26 | ````sh 27 | python rbs.py -t build -c clang -b debug -a 64 -s rapidxml,glxw,glfw,uv,lamemp3,rtmp,x264,openssl,zlib,nanomsg,libyuv 28 | ```` 29 | 30 | ## Things to be aware of 31 | 32 | _Windows .idl files_ 33 | 34 | The DeckLink SDK uses .idl file that are used to genereate code (header/c files). 35 | When you want to use this code, make sure that you have not defined WIN32_LEAN_AND_MEAN 36 | as this seems to give problems with the _interface_ keyword, which is a MSVC++ 37 | thing. Also, make sure to first include the DeckLink header () 38 | and then the windows.h if you need it. Also, make sure to include the 39 | (generate .h file) as soon as possible -------------------------------------------------------------------------------- /projects/streamer/include/streamer/amf/types/AMF0Number.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_AMF0_NUMBER_H 21 | #define ROXLU_AMF0_NUMBER_H 22 | 23 | #include 24 | 25 | class BitStream; 26 | 27 | struct AMF0Number : public AMFType { 28 | AMF0Number(BitStream& bs); 29 | void print(); 30 | void read(); 31 | void write(); 32 | double value; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/amf/types/AMF0Property.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | 21 | #ifndef ROXLU_AMF0_PROPERTY_H 22 | #define ROXLU_AMF0_PROPERTY_H 23 | 24 | #include 25 | #include 26 | 27 | struct AMF0String; 28 | 29 | struct AMF0Property { 30 | AMF0Property(); 31 | ~AMF0Property(); 32 | AMFType* value; 33 | AMF0String* name; 34 | }; 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/amf/types/AMF0Boolean.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_AMF0_BOOLEAN_H 21 | #define ROXLU_AMF0_BOOLEAN_H 22 | 23 | #include 24 | 25 | class BitStream; 26 | 27 | struct AMF0Boolean : public AMFType { 28 | AMF0Boolean(BitStream& bs); 29 | void print(); 30 | void read(); 31 | void write(); 32 | bool value; 33 | }; 34 | 35 | #endif 36 | -------------------------------------------------------------------------------- /tools/cmake/Triplet.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | # Creates: 4 | # ${install_dir} - the install prefix 5 | # ${extern_dir} - path to the extern libraries (root) 6 | # ${extern_include_dirs} - include directories in for the extern libraries 7 | 8 | if(USE_64BIT) 9 | set(tri_arch "x86_64") 10 | else() 11 | set(tri_arch "i386") 12 | endif() 13 | 14 | if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") 15 | set(tri_compiler "clang") 16 | elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") 17 | set(tri_compiler "gcc") 18 | elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") 19 | if(MSVC10) 20 | set(tri_compiler "vs2010") 21 | else() 22 | set(tri_compiler "vs2012") 23 | endif() 24 | endif() 25 | 26 | if(APPLE) 27 | set(tri_platform "mac") 28 | elseif(WIN32) 29 | set(tri_platform "win") 30 | else() 31 | set(tri_platform "unix") 32 | endif() 33 | 34 | set(tri_triplet "${tri_platform}-${tri_compiler}-${tri_arch}") 35 | 36 | if(CMAKE_BUILD_TYPE STREQUAL "Debug") 37 | set(tri_triplet "${tri_triplet}d") 38 | endif() 39 | 40 | set(install_dir ${CMAKE_CURRENT_LIST_DIR}/../../install/${tri_triplet}) 41 | 42 | set(extern_dir ${CMAKE_CURRENT_LIST_DIR}/../../extern/${tri_triplet}) 43 | 44 | set(extern_include_dirs ${extern_dir}/include/) 45 | 46 | set(CMAKE_INSTALL_PREFIX ${install_dir}) -------------------------------------------------------------------------------- /projects/streamer/include/streamer/daemon/Types.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | 21 | #ifndef ROXLU_DAEMON_H 22 | #define ROXLU_DAEMON_H 23 | 24 | /* Channel commands - are sent by client to the daemon */ 25 | 26 | #define CP_TYPE_NONE 0 /* default, unset */ 27 | #define CP_TYPE_AVPACKET 1 /* channel data contains a AVPacket, we will delete the packet when used */ 28 | #define CP_TYPE_STOP 2 /* stop command; */ 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/amf/types/AMFTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_AMF_TYPES_H 21 | #define ROXLU_AMF_TYPES_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | 30 | #endif 31 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/amf/types/AMF0String.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | 21 | #ifndef ROXLU_AMF0_STRING_H 22 | #define ROXLU_AMF0_STRING_H 23 | 24 | #include 25 | 26 | class BitStream; 27 | 28 | struct AMF0String : public AMFType { 29 | AMF0String(BitStream& bs); 30 | AMF0String(BitStream& bs, std::string value); 31 | void print(); 32 | void read(); 33 | void write(); 34 | std::string value; 35 | }; 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/core/BitStream.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | BitStream::BitStream() 5 | :bit_offset(0) 6 | ,byte_to_write(0) 7 | { 8 | } 9 | 10 | BitStream::~BitStream() { 11 | } 12 | 13 | bool BitStream::loadFile(std::string filepath) { 14 | 15 | if(!filepath.size()) { 16 | printf("error: not valid file given.\n"); 17 | return false; 18 | } 19 | 20 | std::ifstream ifs(filepath.c_str(), std::ios::binary | std::ios::in); 21 | if(!ifs.is_open()) { 22 | printf("error: cannot open: %s\n", filepath.c_str()); 23 | return false; 24 | } 25 | 26 | buffer.assign(std::istreambuf_iterator(ifs), std::istreambuf_iterator()); 27 | 28 | ifs.close(); 29 | 30 | return true; 31 | } 32 | 33 | bool BitStream::saveFile(std::string filepath) { 34 | 35 | std::ofstream ofs(filepath.c_str(), std::ios::binary | std::ios::out); 36 | if(!ofs.is_open()) { 37 | printf("error: cannot open: %s\n", filepath.c_str()); 38 | return false; 39 | } 40 | 41 | ofs.write((char*)&buffer.front(), buffer.size()); 42 | 43 | ofs.close(); 44 | 45 | return true; 46 | } 47 | 48 | void BitStream::print(size_t nbytes) { 49 | size_t col = 0; 50 | for(size_t i = 0; i < nbytes && i < size(); ++i) { 51 | printf("%02X ", buffer[i]); 52 | ++col; 53 | if(col == 40) { 54 | printf("\n"); 55 | col = 0; 56 | } 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /projects/grapher/src/grapher/Vertices.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | Vertices::Vertices() 5 | :vao(0) 6 | ,vbo(0) 7 | ,changed(false) 8 | ,bytes_allocated(0) 9 | { 10 | } 11 | 12 | Vertices::~Vertices() { 13 | } 14 | 15 | 16 | bool Vertices::setup() { 17 | #if USE_APPLE 18 | glGenVertexArraysAPPLE(1, &vao); 19 | glBindVertexArrayAPPLE(vao); 20 | #else 21 | glGenVertexArrays(1, &vao); 22 | glBindVertexArray(vao); 23 | #endif 24 | glGenBuffers(1, &vbo); 25 | glBindBuffer(GL_ARRAY_BUFFER, vbo); 26 | 27 | glEnableVertexAttribArray(0); // pos 28 | glEnableVertexAttribArray(1); // col; 29 | 30 | glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*)0); 31 | glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, sizeof(Vertex), (GLvoid*)8); 32 | 33 | return true; 34 | } 35 | 36 | void Vertices::update() { 37 | 38 | if(!changed) { 39 | return; 40 | } 41 | 42 | changed = false; 43 | 44 | size_t bytes_needed = numBytes(); 45 | if(!bytes_needed) { 46 | return; 47 | } 48 | 49 | glBindBuffer(GL_ARRAY_BUFFER, vbo); 50 | 51 | if(bytes_needed) { 52 | while(bytes_allocated < bytes_needed) { 53 | bytes_allocated = std::max(bytes_allocated * 2, 1024); 54 | } 55 | glBufferData(GL_ARRAY_BUFFER, bytes_allocated, NULL, GL_DYNAMIC_DRAW); 56 | } 57 | 58 | glBufferSubData(GL_ARRAY_BUFFER, 0, bytes_needed, getPtr()); 59 | } 60 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/flv/FLVFileWriter.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_FLV_FILE_WRITER_H 21 | #define ROXLU_FILE_FILE_WRITER_H 22 | 23 | #include 24 | #include 25 | 26 | class FLVFileWriter : public FLVListener { 27 | public: 28 | FLVFileWriter(); 29 | ~FLVFileWriter(); 30 | bool open(std::string filepath); 31 | bool close(); 32 | void onSignature(BitStream& bs); 33 | void onTag(BitStream& bs, FLVTag& tag); 34 | private: 35 | std::ofstream ofs; 36 | }; 37 | 38 | #endif 39 | -------------------------------------------------------------------------------- /applications/test_audio_in/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(ConnectionTest) 4 | 5 | if(APPLE) 6 | set(USE_64BIT ON) 7 | endif() 8 | 9 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../tools/cmake/Triplet.cmake) # include triplet 10 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/portaudio/build/cmake/CMakeLists.txt) # portaudio 11 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/tinylib/build/cmake/CMakeLists.txt) # tinylib 12 | 13 | set(app_source_dir ${CMAKE_CURRENT_LIST_DIR}/../../src/) 14 | set(app_name "test_audio_in") 15 | 16 | if(CMAKE_BUILD_TYPE STREQUAL Debug) 17 | set(app_name "${app_name}_debug") 18 | endif() 19 | 20 | set(app_source_files 21 | ${portaudio_source_files} 22 | ${app_source_dir}/main.cpp 23 | ) 24 | 25 | set(app_libraries 26 | ${portaudio_libraries} 27 | ) 28 | 29 | include_directories( 30 | ${CMAKE_CURRENT_LIST_DIR}/../../include/ 31 | ${portaudio_include_dirs} 32 | ${tinylib_include_dirs} 33 | ${extern_include_dirs} 34 | ) 35 | 36 | set(CMAKE_INSTALL_PREFIX ${install_dir}) 37 | 38 | add_executable(${app_name} ${app_source_files}) 39 | 40 | target_link_libraries(${app_name} ${app_libraries}) 41 | 42 | install(TARGETS ${app_name} DESTINATION bin) 43 | 44 | install(FILES ${app_install_files} DESTINATION bin) 45 | 46 | #add_custom_command(TARGET test POST_BUILD COMMAND ${CMAKE_INSTALL_PREFIX}/bin/${app_name}) 47 | 48 | # start the app after building 49 | add_custom_command(TARGET ${app_name} POST_BUILD COMMAND ${app_name}) -------------------------------------------------------------------------------- /projects/streamer/include/streamer/core/AudioEncoder.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | # AudioEncoder 20 | 21 | Base class for the AudioEncoderFAAC, AudioEncoderMP3 22 | 23 | */ 24 | #ifndef ROXLU_AUDIO_ENCODER_H 25 | #define ROXLU_AUDIO_ENCODER_H 26 | 27 | #include 28 | #include 29 | 30 | class AudioEncoder { 31 | public: 32 | AudioEncoder(); 33 | virtual ~AudioEncoder(); 34 | virtual bool setup(AudioSettings settings) = 0; 35 | virtual bool initialize() = 0; 36 | virtual bool encodePacket(AVPacket* p, FLVTag& result) = 0; 37 | virtual bool shutdown() = 0; 38 | }; 39 | 40 | #endif 41 | -------------------------------------------------------------------------------- /projects/hwscale/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | # ${hwscale_definitions} - add these to your preprocessor definitions 4 | # ${hwscale_include_dirs} - include directories, add these to you include dirs 5 | # ${hwscale_source_files} - source files of hwscale, compile these 6 | # ${hwscale_libraries} - link with these libraries 7 | # ${hwscale_source_dirs} - use this with install hen you want to package hwscaler, see the openframeworks addon 8 | 9 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../tools/cmake/Triplet.cmake) # include triplet 10 | 11 | set(hwscale_include_dirs ${CMAKE_CURRENT_LIST_DIR}/../../include/) 12 | 13 | set(hwscale_source_dir ${CMAKE_CURRENT_LIST_DIR}/../../src) 14 | 15 | set(hwscale_source_dirs ${hwscale_source_dir}/hwscale/) 16 | 17 | set(hwscale_source_files 18 | ${hwscale_source_dir}/hwscale/opengl/ResizerFBO.cpp 19 | ${hwscale_source_dir}/hwscale/opengl/YUV420PGrabber.cpp 20 | ) 21 | 22 | set(hwscale_definitions 23 | # -DGLFW_INCLUDE_GLCOREARB # tmp disabled for the decklink streamer on mac @todo can we leave it out? 24 | -DYUV420P_GRABBER_GLSL_VERSION=150 25 | ) 26 | 27 | if(APPLE) 28 | find_library(fr_opengl OpenGL) 29 | find_library(fr_iokit IOKit) 30 | find_library(fr_cf CoreFoundation) 31 | find_library(fr_cocoa Cocoa) 32 | 33 | set(hwscale_libraries 34 | ${extern_dir}/lib/libglfw3.a 35 | ${extern_dir}/lib/libuv.a 36 | ${extern_dir}/lib/libnanomsg.a 37 | ${fr_opengl} 38 | ${fr_iokit} 39 | ${fr_cf} 40 | ${fr_cocoa} 41 | # ${fr_opengl}/Headers/ 42 | ) 43 | endif() 44 | 45 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/flv/FLVFileWriter.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | FLVFileWriter::FLVFileWriter() { 4 | } 5 | 6 | FLVFileWriter::~FLVFileWriter() { 7 | 8 | if(ofs.is_open()) { 9 | ofs.close(); 10 | } 11 | 12 | } 13 | 14 | bool FLVFileWriter::open(std::string filepath) { 15 | 16 | if(ofs.is_open()) { 17 | printf("error: flvfilewriter already opened the output.\n"); 18 | return false; 19 | } 20 | 21 | ofs.open(filepath.c_str(), std::ios::out | std::ios::binary); 22 | if(!ofs.is_open()) { 23 | printf("error: cannot open the file for the FLFFileWriter: %s\n", filepath.c_str()); 24 | ::exit(EXIT_FAILURE); 25 | } 26 | 27 | return true; 28 | } 29 | 30 | bool FLVFileWriter::close() { 31 | 32 | if(!ofs.is_open()) { 33 | printf("error: cannot close the flvfilewriter because we're not open.\n"); 34 | return false; 35 | } 36 | 37 | ofs.close(); 38 | 39 | return true; 40 | } 41 | 42 | void FLVFileWriter::onSignature(BitStream& bs) { 43 | 44 | #if !defined(NDEBUG) 45 | if(!ofs.is_open()) { 46 | printf("error: cannot write the signature to the flvfilewriter because you didn't opened the file.\n"); 47 | return; 48 | } 49 | #endif 50 | 51 | ofs.write((char*)bs.getPtr(), bs.size()); 52 | } 53 | 54 | void FLVFileWriter::onTag(BitStream& bs, FLVTag& tag) { 55 | 56 | #if !defined(NDEBUG) 57 | if(!ofs.is_open()) { 58 | printf("error: cannot write the flvtag to the flvfilewriter because you didn't opened the file.\n"); 59 | return; 60 | } 61 | #endif 62 | 63 | ofs.write((char*)bs.getPtr(), bs.size()); 64 | ofs.flush(); 65 | } 66 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/amf/types/AMF0EcmaArray.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_AMF0_ECMA_ARRAY_H 21 | #define ROXLU_AMF0_ECMA_ARRAY_H 22 | 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | struct AMF0String; 30 | class BitStream; 31 | 32 | // ------------------------------------------------- 33 | 34 | struct AMF0EcmaArray : public AMFType { 35 | AMF0EcmaArray(BitStream& bs); 36 | ~AMF0EcmaArray(); 37 | 38 | void print(); 39 | void read(); 40 | void write(); 41 | void add(std::string name, AMFType* v); 42 | void add(AMF0String* name, AMFType* v); 43 | 44 | AMF0Object obj; 45 | }; 46 | 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/amf/types/AMF0Object.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | 21 | #ifndef ROXLU_AMF0_OBJECT_H 22 | #define ROXLU_AMF0_OBJECT_H 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | struct AMF0String; 30 | class BitStream; 31 | 32 | struct AMF0Object : public AMFType { 33 | AMF0Object(BitStream& bs); 34 | ~AMF0Object(); 35 | 36 | void print(); 37 | void read(); 38 | void readElements(); 39 | void write(); 40 | void writeElements(); 41 | void removeElements(); /* deletes all the values */ 42 | 43 | void add(std::string name, AMFType* v); 44 | void add(AMF0String* name, AMFType* v); 45 | std::vector values; 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /applications/test_audio_in/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | # Test Audio input 4 | 5 | When using the settings from below you can use avconv to convert the test capture 6 | to an mp3 file. 7 | 8 | for: 2 channels, sampleformat: paInt16, samplerate: 44100 9 | ./avconv -v debug -f s16le -ac 2 -ar 44100 -i raw.pcm out.mp3 10 | 11 | */ 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | std::ofstream ofs; 18 | 19 | void on_audio(const void* input, unsigned long nframes, void* user) { 20 | 21 | size_t nbytes = nframes * sizeof(short int) * 2; 22 | printf("nbytes: %ld\n", nbytes); 23 | if(ofs.is_open()) { 24 | ofs.write((char*)input, nbytes); 25 | } 26 | 27 | } 28 | 29 | bool must_run = true; 30 | 31 | void sighandler(int sig); 32 | 33 | int main() { 34 | 35 | std::string of = rx_get_exe_path()+"raw.pcm"; 36 | ofs.open(of.c_str(), std::ios::binary | std::ios::out); 37 | if(!ofs.is_open()) { 38 | printf("error: cannot open output file.\n"); 39 | ::exit(EXIT_FAILURE); 40 | } 41 | 42 | PAudio pa; 43 | 44 | pa.listDevices(); 45 | 46 | pa.setCallback(on_audio, NULL); 47 | 48 | if(!pa.openInputStream(0, 2, paInt16, 44100, 512)) { 49 | printf("error: cannot open input stream.\n"); 50 | ::exit(EXIT_FAILURE); 51 | } 52 | 53 | if(!pa.start()) { 54 | printf("error: cannot start the input stream.\n"); 55 | ::exit(EXIT_FAILURE); 56 | } 57 | 58 | printf("default input device: %d\n", pa.getDefaultInputDevice()); 59 | 60 | signal(SIGINT, sighandler); 61 | 62 | printf("audio in test"); 63 | while(must_run) { 64 | printf("..\n"); 65 | sleep(1); 66 | } 67 | 68 | if(ofs.is_open()) { 69 | ofs.close(); 70 | } 71 | 72 | return 0; 73 | } 74 | 75 | void sighandler(int sig) { 76 | must_run = false; 77 | } 78 | -------------------------------------------------------------------------------- /projects/decklink/include/decklink/DeckLinkTypes.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_DECKLINK_TYPES_H 21 | #define ROXLU_DECKLINK_TYPES_H 22 | 23 | #include 24 | //#include 25 | 26 | /* 27 | The capture callback you set if you want to handle the frames. 28 | This function will be called whenever the DeckLink SDK triggers our 29 | own internally used callback handler. 30 | 31 | By default a frame is only valid for the duration of the callback 32 | unless you call `vframe->AddRef()` in which case you can hold on to 33 | the frame untill you call `vframe->Release()`. 34 | 35 | */ 36 | //extern "C" { 37 | 38 | typedef void(*decklink_capture_callback)(IDeckLinkVideoInputFrame* vframe, 39 | IDeckLinkAudioInputPacket* aframe, 40 | void* user); 41 | //} 42 | 43 | #endif 44 | 45 | -------------------------------------------------------------------------------- /applications/test_faac/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(ConnectionTest) 4 | 5 | if(APPLE) 6 | set(USE_64BIT ON) 7 | endif() 8 | 9 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../tools/cmake/Triplet.cmake) # include triplet 10 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/portaudio/build/cmake/CMakeLists.txt) # portaudio 11 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/streamer/build/cmake/CMakeLists.txt) # streamer 12 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/xmlconfig/build/cmake/CMakeLists.txt) # xmlconfig 13 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/tinylib/build/cmake/CMakeLists.txt) # tinylib 14 | 15 | set(app_source_dir ${CMAKE_CURRENT_LIST_DIR}/../../src/) 16 | set(app_name "test_faac") 17 | 18 | if(CMAKE_BUILD_TYPE STREQUAL Debug) 19 | set(app_name "${app_name}_debug") 20 | endif() 21 | 22 | set(app_source_files 23 | ${portaudio_source_files} 24 | ${streamer_source_files} 25 | ${xmlconfig_source_files} 26 | ${app_source_dir}/AudioEncoderFAAC.cpp 27 | ${app_source_dir}/main.cpp 28 | ) 29 | 30 | set(app_libraries 31 | ${streamer_libraries} 32 | ${portaudio_libraries} 33 | ${extern_dir}/lib/libfaac.a 34 | ) 35 | 36 | include_directories( 37 | ${CMAKE_CURRENT_LIST_DIR}/../../include/ 38 | ${portaudio_include_dirs} 39 | ${streamer_include_dirs} 40 | ${xmlconfig_include_dirs} 41 | ${tinylib_include_dirs} 42 | ${extern_include_dirs} 43 | ) 44 | 45 | add_definitions(${streamer_definitions}) 46 | 47 | set(CMAKE_INSTALL_PREFIX ${install_dir}) 48 | 49 | add_executable(${app_name} ${app_source_files}) 50 | 51 | target_link_libraries(${app_name} ${app_libraries}) 52 | 53 | install(TARGETS ${app_name} DESTINATION bin) 54 | 55 | install(FILES ${app_install_files} DESTINATION bin) 56 | 57 | # start the app after building 58 | add_custom_command(TARGET ${app_name} POST_BUILD COMMAND ${app_name}) -------------------------------------------------------------------------------- /projects/streamer/include/streamer/daemon/Daemon.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | # Daemon 20 | 21 | The daemon class is used to accept video/audio streams from a 22 | client which are then encoded and streamed to an RTMP server. 23 | This is like a "hidden" Flash Media Live Encoder. 24 | 25 | */ 26 | #ifndef ROXLU_VIDEOSTREAMER_DAEMON_H 27 | #define ROXLU_VIDEOSTREAMER_DAEMIN_H 28 | 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | typedef std::map::iterator runner_iterator; 37 | 38 | class Daemon { 39 | public: 40 | Daemon(); 41 | ~Daemon(); 42 | bool setup(std::string configpath); /* sets the state of all `runners` and ourself */ 43 | bool initialize(); /* kicks off the runners which can start to receive data */ 44 | private: 45 | DaemonConfig config; 46 | std::map runners; /* the runners which ingest video/audio streams, encode it and send it to a server */ 47 | }; 48 | 49 | #endif 50 | -------------------------------------------------------------------------------- /projects/grapher/include/grapher/Shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | 21 | #ifndef ROXLU_GRAPHER_SHADER_H 22 | #define ROXLU_GRAPHER_SHADER_H 23 | 24 | #include 25 | 26 | static const char* GR_VS = "" 27 | "#version 150\n" 28 | "uniform mat4 u_pm;" 29 | "in vec4 a_pos;" 30 | "in vec3 a_col;" 31 | "out vec3 v_col;" 32 | 33 | "void main() {" 34 | " gl_Position = u_pm * a_pos;" 35 | " v_col = a_col;" 36 | "}" 37 | ; 38 | 39 | static const char* GR_FS = "" 40 | "#version 150\n" 41 | "in vec3 v_col;" 42 | "out vec4 fragcol; " 43 | "void main() {" 44 | " fragcol = vec4(1.0, 0.0, 1.0, 1.0);" 45 | " fragcol.rgb = v_col;" 46 | "}" 47 | ; 48 | 49 | class Shader { 50 | public: 51 | Shader(); 52 | ~Shader(); 53 | bool setup(); 54 | void use(); 55 | void setPM(const float* pm); 56 | private: 57 | void printShaderCompileInfo(GLuint shader); 58 | void printShaderLinkInfo(GLuint shader); 59 | public: 60 | GLuint prog; 61 | GLuint vert; 62 | GLuint frag; 63 | GLint u_pm; 64 | 65 | }; 66 | 67 | #endif 68 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/amf/types/AMFType.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_AMF_TYPE_H 21 | #define ROXLU_AMF_TYPE_H 22 | 23 | #include 24 | 25 | #define AMF0_TYPE_NUMBER 0x00 26 | #define AMF0_TYPE_BOOLEAN 0x01 27 | #define AMF0_TYPE_STRING 0x02 28 | #define AMF0_TYPE_OBJECT 0x03 29 | #define AMF0_TYPE_MOVIECLIP 0x04 30 | #define AMF0_TYPE_NULL 0x05 31 | #define AMF0_TYPE_UNDEFINED 0x06 32 | #define AMF0_TYPE_REFERENCE 0x07 33 | #define AMF0_TYPE_ECMA_ARRAY 0x08 34 | #define AMF0_TYPE_OBJECT_END 0x09 35 | #define AMF0_TYPE_STRICT_ARRAY 0x0A 36 | #define AMF0_TYPE_DATE 0x0B 37 | #define AMF0_TYPE_LONG_STRING 0x0C 38 | #define AMF0_TYPE_UNSUPPORTED 0x0D 39 | #define AMF0_TYPE_RECORDSET 0x0E 40 | #define AMF0_TYPE_XML 0x0F 41 | #define AMF0_TYPE_TYPED_OBJECT 0x10 42 | 43 | class BitStream; 44 | 45 | struct AMFType { 46 | AMFType(uint8_t type, BitStream& bs); 47 | 48 | virtual ~AMFType(); 49 | virtual void read() = 0; 50 | virtual void write() = 0; 51 | virtual void print() = 0; 52 | 53 | uint8_t type; 54 | BitStream& bs; 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/flv/FLVTypes.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // --------------------------------------------------------- 5 | 6 | double flv_samplerate_to_double(uint8_t r) { 7 | switch(r) { 8 | case FLV_SOUNDRATE_5_5KHZ: return 5500.0; 9 | case FLV_SOUNDRATE_11KHZ: return 11025.0; 10 | case FLV_SOUNDRATE_22KHZ: return 22050.0; 11 | case FLV_SOUNDRATE_44KHZ: return 44100.0; 12 | default: return 0.0; 13 | } 14 | } 15 | 16 | // --------------------------------------------------------- 17 | 18 | AVCDecoderConfigurationRecord::AVCDecoderConfigurationRecord() 19 | :configuration_version(1) 20 | ,avc_profile_indication(0) 21 | ,profile_compatibility(0) 22 | ,avc_level_indication(0) 23 | ,nal_size_length_minus_one(0) 24 | ,number_of_sps(0) 25 | ,number_of_pps(0) 26 | { 27 | } 28 | 29 | // --------------------------------------------------------- 30 | 31 | FLVHeader::FLVHeader() 32 | :version(0) 33 | ,type_flags_audio(0) 34 | ,type_flags_video(0) 35 | ,data_offset(0) 36 | { 37 | tag[0] = tag[1] = tag[2] = 0x00; 38 | } 39 | 40 | void FLVHeader::print() { 41 | printf("flv_header.tag: %c%c%c\n", tag[0], tag[1], tag[2]); 42 | printf("flv_header.version: %d\n", version); 43 | printf("flv_header.type_flags_audio: %d\n", type_flags_audio); 44 | printf("flv_header.type_flags_video: %d\n", type_flags_video); 45 | printf("flv_header.data_offset: %d\n", data_offset); 46 | } 47 | 48 | // --------------------------------------------------------- 49 | 50 | FLVTag::FLVTag() 51 | :reserved(0) 52 | ,filter(0) 53 | ,tag_type(0) 54 | ,data_size(0) 55 | ,timestamp(0) 56 | ,timestamp_extended(0) 57 | ,stream_id(0) 58 | ,sound_format(FLV_SOUNDFORMAT_UNKNOWN) 59 | ,sound_rate(FLV_SOUNDRATE_UNKNOWN) 60 | ,sound_type(FLV_SOUNDTYPE_UNKNOWN) 61 | ,sound_size(FLV_SOUNDSIZE_UNKNOWN) 62 | ,aac_packet_type(FLV_AAC_UNKNOWN) 63 | ,frame_type(FLV_VIDEOFRAME_UNKNOWN) 64 | ,codec_id(FLV_VIDEOCODEC_UNKNOWN) 65 | ,avc_packet_type(FLV_AVC_UNKNOWN) 66 | ,composition_time(0) 67 | ,data(NULL) 68 | ,size(0) 69 | { 70 | } 71 | 72 | -------------------------------------------------------------------------------- /projects/decklink/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | # ${decklink_dependencies} - VERY IMPORTANT TO ADD! - add this to: add_dependencies(YOUR_APP ${decklink_dependencies}) 4 | # ${decklink_source_files} - compile these sources 5 | # ${decklink_libraries} - link with these libraries 6 | # ${decklink_include_dirs} - add this to your include dirs 7 | 8 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../tools/cmake/Triplet.cmake) 9 | 10 | set(decklink_source_dir ${CMAKE_CURRENT_LIST_DIR}/../../src/) 11 | 12 | set(decklink_source_files 13 | ${decklink_source_dir}/decklink/DeckLink.cpp 14 | ${decklink_source_dir}/decklink/DeckLinkCard.cpp 15 | ${decklink_source_dir}/decklink/DeckLinkCaptureCallback.cpp 16 | ) 17 | 18 | if(WIN32) 19 | 20 | # midl.exe only works when the output directory (-out) actually exists 21 | #set(vd_sdk_dir ${CMAKE_CURRENT_BINARY_DIR}/) 22 | add_custom_target(DeckLinkAPI 23 | COMMAND midl.exe -nologo -W1 -char signed -env win32 -out "${CMAKE_CURRENT_BINARY_DIR}" -h DeckLinkAPI.h /iid DeckLinkAPI_i.c ${CMAKE_CURRENT_LIST_DIR}/../../sdk/idl/DeckLinkAPI.idl 24 | ) 25 | 26 | set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/DeckLinkAPI_i.c PROPERTIES GENERATED TRUE) 27 | 28 | list(APPEND decklink_source_files ${CMAKE_CURRENT_BINARY_DIR}/DeckLinkAPI_i.c) # note that we have set that this is a generated file (see above) 29 | 30 | # for which is used for BSTR > char* conversion (_bstr_t) 31 | set(decklink_libraries 32 | comsuppw.lib 33 | ) 34 | endif() 35 | 36 | if(APPLE) 37 | 38 | list(APPEND decklink_source_files ${CMAKE_CURRENT_LIST_DIR}/../../sdk/include/DeckLinkAPIDispatch.cpp) 39 | 40 | endif() 41 | 42 | 43 | set(decklink_include_dirs 44 | ${CMAKE_CURRENT_LIST_DIR}/../../include 45 | ${CMAKE_CURRENT_BINARY_DIR} 46 | ${CMAKE_CURRENT_LIST_DIR}/../../sdk/include/ # unices put the sdk here 47 | ) 48 | 49 | set(decklink_dependencies DeckLinkAPI) 50 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/amf/AMF0.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | AMF0::AMF0(BitStream& bs) 6 | :bs(bs) 7 | { 8 | } 9 | 10 | // returns an array with all found amf elements, the reader must free all! 11 | bool AMF0::parse(std::vector& result, size_t nbytes) { 12 | 13 | size_t nstart = bs.size(); 14 | while(bs.size()) { 15 | switch(bs[0]) { 16 | case AMF0_TYPE_ECMA_ARRAY: { 17 | bs.flush(1); 18 | result.push_back(readEcmaArray()); 19 | break; 20 | } 21 | case AMF0_TYPE_OBJECT: { 22 | bs.flush(1); 23 | result.push_back(readObject()); 24 | break; 25 | } 26 | case AMF0_TYPE_STRING: { 27 | bs.flush(1); 28 | result.push_back(readString()); 29 | break; 30 | } 31 | case AMF0_TYPE_BOOLEAN: { 32 | bs.flush(1); 33 | result.push_back(readBoolean()); 34 | break; 35 | } 36 | case AMF0_TYPE_NUMBER: { 37 | bs.flush(1); 38 | result.push_back(readNumber()); 39 | break; 40 | } 41 | default: { 42 | printf("warning: unhandled amf type: %02X\n", bs[0]); 43 | return true; 44 | } 45 | } 46 | 47 | // make sure we don't read more then nbytes 48 | size_t nend = bs.size(); 49 | size_t ndelta = nstart - nend; 50 | if(ndelta >= nbytes) { 51 | return true; 52 | } 53 | } 54 | return result.size(); 55 | } 56 | 57 | AMF0String* AMF0::readString() { 58 | AMF0String* v = new AMF0String(bs); 59 | v->read(); 60 | return v; 61 | } 62 | 63 | AMF0Number* AMF0::readNumber() { 64 | AMF0Number* n = new AMF0Number(bs); 65 | n->read(); 66 | return n; 67 | } 68 | 69 | AMF0Boolean* AMF0::readBoolean() { 70 | AMF0Boolean* v = new AMF0Boolean(bs); 71 | v->read(); 72 | return v; 73 | } 74 | 75 | AMF0EcmaArray* AMF0::readEcmaArray() { 76 | AMF0EcmaArray* a = new AMF0EcmaArray(bs); 77 | a->read(); 78 | return a; 79 | } 80 | 81 | AMF0Object* AMF0::readObject() { 82 | AMF0Object* o = new AMF0Object(bs); 83 | o->read(); 84 | return o; 85 | } 86 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/flv/FLVReader.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_FLV_READER_H 21 | #define ROXLU_FLV_READER_H 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | #define FLV_READER_STATE_NONE 0 28 | #define FLV_READER_STATE_TAG 1 29 | #define FLV_READER_STATE_TAG_BODY 2 30 | #define FLV_READER_STATE_PREV_TAG_SIZE 3 31 | 32 | class BitStream; 33 | 34 | class FLVReader { 35 | public: 36 | FLVReader(BitStream& bs); 37 | void parse(); 38 | void addListener(FLVListener* l); 39 | private: 40 | bool parseHeader(); /* parses the first bytes; validates the FLV */ 41 | bool parseFLVTag(FLVTag& result); 42 | bool parseFLVTagMeta(FLVTag& result); 43 | bool parseFLVTagAudio(FLVTag& result); 44 | bool parseFLVTagVideo(FLVTag& result); 45 | bool parseDecoderConfigurationRecord(BitStream& bitstream, AVCDecoderConfigurationRecord& rec); 46 | private: 47 | BitStream& bs; 48 | int state; 49 | uint32_t tag_size; /* the number of bytes in the current tag */ 50 | FLVHeader header; 51 | FLVListeners listeners; 52 | }; 53 | 54 | inline void FLVReader::addListener(FLVListener* l) { 55 | listeners.addListener(l); 56 | } 57 | 58 | #endif 59 | -------------------------------------------------------------------------------- /tools/html/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | Streaming Video Player 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 |
15 | 16 |
17 |

flvplayback/quality0

18 |
19 |
20 | 21 |
22 |

flvplayback/quality1

23 |
24 |
25 | 26 | 27 | 49 | 50 |
51 |

WOWZA - livestream

52 |
53 |
54 | 55 |
56 |

WOWZA - live

57 |
58 |
59 | 60 | 61 | 62 |
63 |

Live stream

64 |
65 |
66 | 77 | 78 |
79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /projects/hwscale/include/hwscale/opengl/ResizerFBO.h: -------------------------------------------------------------------------------- 1 | /* 2 | -------------------------------------------------------------------------------- 3 | 4 | oooo 5 | `888 6 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 7 | `888""8P d88' `88b `88b..8P' 888 `888 `888 8 | 888 888 888 Y888' 888 888 888 9 | 888 888 888 .o8"'88b 888 888 888 10 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 11 | 12 | www.roxlu.com 13 | www.apollomedia.nl 14 | 15 | -------------------------------------------------------------------------------- 16 | 17 | # Resizer FBO 18 | 19 | This classes uses a FBO to resize Y, U and V planes that are stored 20 | in the textures that are given to this class, different scales. Each 21 | FBO can resize to a maximum of 2 different scales. 22 | 23 | */ 24 | #ifndef ROXLU_HWSCALE_RESIZER_FBO_H 25 | #define ROXLU_HWSCALE_RESIZER_FBO_H 26 | 27 | #if defined(__APPLE__) 28 | # include 29 | # include 30 | #else 31 | # include 32 | #endif 33 | 34 | #include 35 | 36 | class ResizerFBO { 37 | public: 38 | ResizerFBO(GLuint ytex, GLuint utex, GLuint vtex); 39 | ~ResizerFBO(); 40 | bool setup(int inWidth, int inHeight, int w0, int h0, int w1 = 0, int h1 = 0); /* inWidth/inHeight is the size of the y_tex. set the width and heights of the two resized outputs */ 41 | void resize(YUV420PGrabber& grabber); /* does the actual resizing */ 42 | GLuint createTexture(int w, int h); 43 | 44 | public: 45 | int in_width; 46 | int in_height; 47 | GLuint y_tex; 48 | GLuint u_tex; 49 | GLuint v_tex; 50 | int width[2]; 51 | int height[2]; 52 | 53 | GLuint fbo; 54 | GLuint depth; 55 | GLuint resized_y_tex[2]; 56 | GLuint resized_u_tex[2]; 57 | GLuint resized_v_tex[2]; 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/core/Debug.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | 20 | # Debug 21 | 22 | Contains kinds of debug relates functions for AMF, FLV, X264 etc.. 23 | 24 | */ 25 | 26 | #ifndef ROXLU_DEBUG_H 27 | #define ROXLU_DEBUG_H 28 | 29 | #include 30 | 31 | extern "C" { 32 | # include 33 | } 34 | 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | 41 | std::string flv_tagtype_to_string(uint8_t t); 42 | std::string flv_soundformat_to_string(uint8_t t); 43 | std::string flv_frametype_to_string(uint8_t t); 44 | std::string flv_videocodec_to_string(uint8_t t); 45 | std::string flv_soundrate_to_string(uint8_t t); 46 | std::string flv_soundsize_to_string(uint8_t t); 47 | std::string flv_soundtype_to_string(uint8_t t); 48 | void flv_print_tag(FLVTag& tag); 49 | 50 | void print_x264_params(x264_param_t* p); 51 | void print_nal_unit(NalUnit* nu); 52 | void print_nal_sps(nal_sps& n); 53 | void print_decoder_configuration_record(AVCDecoderConfigurationRecord* r); 54 | 55 | /* debug for EncoderTypes.h defines */ 56 | std::string av_audio_samplerate_to_string(uint32_t t); 57 | std::string av_audio_mode_to_string(uint32_t t); 58 | std::string av_audio_bitsize_to_string(uint32_t t); 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /thirdparty/openFrameworks/ofxVideoStreamer/include/ofxVideoStreamer/ofxMultiVideoStreamer.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | # ofxMultiVideoStreamer 20 | 21 | */ 22 | 23 | #ifndef ROXLU_OFX_MULTI_VIDEO_STREAMER_H 24 | #define ROXLU_OFX_MULTI_VIDEO_STREAMER_H 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | class ofxMultiVideoStreamer { 32 | public: 33 | ofxMultiVideoStreamer(); 34 | ~ofxMultiVideoStreamer(); 35 | bool setup(std::string filename, int winW, int winH, int fps); 36 | bool start(); 37 | bool wantsNewFrame(); 38 | void beginGrab(); 39 | void endGrab(); 40 | void addAudio(float* input, int nsize, int nchannels); 41 | void update(); /* call this often; this makes sure that we reconnect to the remote server when we get disconnected */ 42 | private: 43 | MultiVideoStreamer mvs; 44 | YUV420PGrabber grabber; 45 | MemoryPool memory_pool; 46 | bool has_allocated_audio_pool; /* we allocate the audio pool when we receive the first audio frame, @todo move this to setup() */ 47 | }; 48 | 49 | inline bool ofxMultiVideoStreamer::wantsNewFrame() { 50 | return grabber.hasNewFrame(); 51 | } 52 | 53 | inline void ofxMultiVideoStreamer::update() { 54 | mvs.update(); 55 | } 56 | #endif 57 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/daemon/Runner.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | # Runner 20 | 21 | A runner is a sperate process which ingests video/audio streams 22 | for the given StreamConfig. It will create a new VideoStreamer instance 23 | based on these configurations. It has it's own 'socket', which can be 24 | any of the nanomsg defined addresses (inproc, ipc, tcp) and this is 25 | with what the client communicates. 26 | 27 | This class is used/instatiated by the main Daemon class. 28 | 29 | */ 30 | #ifndef ROXLU_VIDEOSTREAMER_RUNNER_H 31 | #define ROXLU_VIDEOSTREAMER_RUNNER_H 32 | 33 | #include 34 | #include 35 | 36 | extern "C" { 37 | # include 38 | # include 39 | # include 40 | # include 41 | } 42 | 43 | void runner_thread(void* user); 44 | 45 | class Runner { 46 | public: 47 | Runner(StreamConfig* sc); 48 | ~Runner(); 49 | bool setup(); 50 | bool initialize(); 51 | 52 | void handleCommand(uint8_t type, uint32_t nbytes, std::vector& buffer); 53 | 54 | public: 55 | VideoStreamer streamer; /* the instance which does the encoding and streaming */ 56 | StreamConfig* sc; /* stream configuration (we are not the owner) */ 57 | int sock; 58 | uv_thread_t thread; 59 | volatile bool must_run; 60 | }; 61 | #endif 62 | -------------------------------------------------------------------------------- /projects/grapher/src/grapher/Shader.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | Shader::Shader() 6 | :prog(0) 7 | ,vert(0) 8 | ,frag(0) 9 | ,u_pm(-1) 10 | { 11 | 12 | } 13 | 14 | Shader::~Shader() { 15 | printf("error: free Gl.\n"); 16 | } 17 | 18 | bool Shader::setup() { 19 | 20 | vert = glCreateShader(GL_VERTEX_SHADER); 21 | glShaderSource(vert, 1, &GR_VS, NULL); 22 | glCompileShader(vert); 23 | printShaderCompileInfo(vert); 24 | 25 | frag = glCreateShader(GL_FRAGMENT_SHADER); 26 | glShaderSource(frag, 1, &GR_FS, NULL); 27 | glCompileShader(frag); 28 | printShaderCompileInfo(frag); 29 | 30 | prog = glCreateProgram(); 31 | glAttachShader(prog, vert); 32 | glAttachShader(prog, frag); 33 | glBindAttribLocation(prog, 0, "a_pos"); 34 | glBindAttribLocation(prog, 1, "a_col"); 35 | glLinkProgram(prog); 36 | printShaderLinkInfo(prog); 37 | 38 | u_pm = glGetUniformLocation(prog, "u_pm"); 39 | if(u_pm < 0) { 40 | printf("error: u_pm not found.\n"); 41 | return false; 42 | } 43 | 44 | return true; 45 | } 46 | 47 | void Shader::use() { 48 | glUseProgram(prog); 49 | } 50 | 51 | void Shader::setPM(const float* pm) { 52 | glUniformMatrix4fv(u_pm, 1, GL_FALSE, pm); 53 | } 54 | 55 | void Shader::printShaderCompileInfo(GLuint shader) { 56 | GLint status = 0; 57 | GLint count = 0; 58 | GLchar* error = NULL; 59 | glGetShaderiv(shader, GL_COMPILE_STATUS, &status); 60 | if(!status) { 61 | glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &count); 62 | if(count > 0) { 63 | error = new GLchar[count]; 64 | glGetShaderInfoLog(shader, count, NULL, error); 65 | printf("%s\n", error); 66 | delete[] error; 67 | error = NULL; 68 | assert(0); 69 | } 70 | } 71 | } 72 | 73 | void Shader::printShaderLinkInfo(GLuint shader) { 74 | GLint status = 0; 75 | GLint count = 0; 76 | GLchar* error = NULL; 77 | GLsizei nchars = 0; 78 | glGetProgramiv(shader, GL_LINK_STATUS, &status); 79 | if(!status) { 80 | glGetProgramiv(shader, GL_INFO_LOG_LENGTH, &count); 81 | if(count > 0) { 82 | error = new GLchar[count]; 83 | glGetProgramInfoLog(shader, 2048, &nchars, error); 84 | printf("%s\n", error); 85 | delete[] error; 86 | error = NULL; 87 | assert(0); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /projects/grapher/src/grapher/GraphConfigReader.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | // loads server settings 5 | bool GraphConfigReader::loadServerConfig(std::string filepath, ServerSettings& result) { 6 | 7 | if(!filepath.size()) { 8 | printf("error: invalid filepath for server config: %s\n", filepath.c_str()); 9 | return false; 10 | } 11 | 12 | Config c; 13 | if(!c.load(filepath)) { 14 | return false; 15 | } 16 | 17 | try { 18 | xml_node<>* n = c.firstNode("settings"); 19 | if(!n) { 20 | printf("error: no settings found for server.\n"); 21 | ::exit(EXIT_FAILURE); 22 | } 23 | 24 | xml_node<>* d = c.getNode(n, "server"); 25 | result.width = c.readU16(d, "width"); 26 | result.height = c.readU16(d, "height"); 27 | result.address = c.readString(d, "address"); 28 | } 29 | catch(ConfigException ex) { 30 | printf("error: %s\n", ex.what()); 31 | ::exit(EXIT_FAILURE); 32 | } 33 | 34 | return true; 35 | } 36 | 37 | // loads the graphs + server address. 38 | bool GraphConfigReader::loadClientConfig(std::string filepath, ClientSettings& result) { 39 | 40 | if(!filepath.size()) { 41 | printf("error: invalid filepath for client config: %s\n", filepath.c_str()); 42 | return false; 43 | } 44 | 45 | Config c; 46 | if(!c.load(filepath)) { 47 | return false; 48 | } 49 | 50 | try { 51 | xml_node<>* n = c.firstNode("settings"); 52 | xml_node<>* graphs = c.getNode(n, "graphs"); 53 | for(xml_node<>* graph = graphs->first_node(); graph; graph = graph->next_sibling()) { 54 | GraphConfig gc; 55 | gc.width = c.readU16(graph, "width"); 56 | gc.height = c.readU16(graph, "height"); 57 | gc.x = c.readU16(graph, "x"); 58 | gc.y = c.readU16(graph, "y"); 59 | gc.xtics = c.readU8(graph, "xtics"); 60 | gc.ytics = c.readU8(graph, "ytics"); 61 | gc.yrange[0] = c.readS32(graph, "min"); 62 | gc.yrange[1] = c.readS32(graph, "max"); 63 | gc.id = c.readU8(graph, "id"); 64 | result.graphs.push_back(gc); 65 | } 66 | 67 | xml_node<>* s = c.getNode(n, "server"); 68 | result.address = c.readString(s, "address"); 69 | 70 | } 71 | catch(ConfigException ex) { 72 | printf("error: %s\n", ex.what()); 73 | ::exit(EXIT_FAILURE); 74 | } 75 | return true; 76 | } 77 | -------------------------------------------------------------------------------- /thirdparty/openFrameworks/ofxVideoStreamer/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../../tools/cmake/Triplet.cmake) 4 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../../projects/hwscale/build/cmake/CMakeLists.txt) # hwscale 5 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../../projects/streamer/build/cmake/CMakeLists.txt) # streamer 6 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../../projects/xmlconfig/build/cmake/CMakeLists.txt) # xmlconfig 7 | 8 | set(ofx_source_dir ${CMAKE_CURRENT_LIST_DIR}/../../src/ofxVideoStreamer/) 9 | 10 | set(ofx_source_files 11 | ${ofx_source_dir}/ofxVideoStreamer.cpp 12 | ${ofx_source_dir}/ofxMultiVideoStreamer.cpp 13 | ) 14 | 15 | set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_LIST_DIR}/../../../../../install/${tri_triplet}/thirdparty/openframeworks/ofxVideoStreamer/) 16 | 17 | install(FILES ${ofx_source_files} DESTINATION src) 18 | 19 | install(DIRECTORY ${xmlconfig_source_dirs} DESTINATION src/xmlconfig) 20 | 21 | install(DIRECTORY ${streamer_source_dirs} DESTINATION src/streamer) 22 | 23 | install(DIRECTORY ${hwscale_source_dirs} DESTINATION src/hwscale) 24 | 25 | install(DIRECTORY ${streamer_include_dirs} DESTINATION include/) 26 | 27 | install(DIRECTORY ${xmlconfig_include_dirs} DESTINATION include/) 28 | 29 | install(DIRECTORY ${hwscale_include_dirs} DESTINATION include/) 30 | 31 | install(DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/../../include/ DESTINATION include) 32 | 33 | # extern files 34 | set(extern_dirs 35 | ${extern_dir}/include/lame 36 | ${extern_dir}/include/librtmp 37 | ${extern_dir}/include/nanomsg 38 | ${extern_dir}/include/openssl 39 | ) 40 | 41 | file(GLOB extern_header_files ${extern_dir}/include/*.h ) 42 | 43 | file(GLOB extern_hpp_files ${extern_dir}/include/*.hpp) 44 | 45 | install(DIRECTORY ${extern_dirs} DESTINATION include) 46 | 47 | install(FILES ${extern_hpp_files} DESTINATION include) 48 | 49 | install(FILES ${extern_header_files} DESTINATION include) 50 | 51 | # install streamer libraries 52 | foreach(lib ${streamer_libraries}) 53 | if(NOT IS_DIRECTORY ${lib}) 54 | install(FILES ${lib} DESTINATION lib) 55 | endif() 56 | endforeach() 57 | 58 | # install hwscale libraries 59 | foreach(lib ${hwscale_libraries}) 60 | if(NOT IS_DIRECTORY ${lib}) 61 | install(FILES ${lib} DESTINATION lib) 62 | endif() 63 | endforeach() 64 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/core/H264Parser.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // ------------------------------------------------ 6 | nal_sps::nal_sps() 7 | :profile_idc(0) 8 | ,constraint_set0_flag(0) 9 | ,constraint_set1_flag(0) 10 | ,constraint_set2_flag(0) 11 | ,constraint_set3_flag(0) 12 | ,constraint_set4_flag(0) 13 | ,constraint_set5_flag(0) 14 | ,reserved_zero_2bits(0) 15 | ,level_idc(0) 16 | { 17 | 18 | } 19 | 20 | // ------------------------------------------------ 21 | 22 | NalUnit::NalUnit() 23 | :forbidden_zero_bit(0) 24 | ,nal_ref_idc(0) 25 | ,nal_unit_type(0) 26 | { 27 | } 28 | 29 | // ------------------------------------------------ 30 | 31 | H264Parser::H264Parser(uint8_t* nal) 32 | :nal(nal) 33 | ,bit_offset(0) 34 | ,byte_offset(0) 35 | { 36 | } 37 | 38 | bool H264Parser::parse() { 39 | if(!nal) { 40 | STREAMER_ERROR("error: cannot parse h264, no nal unit set. %p\n", nal); 41 | return false; 42 | } 43 | 44 | NalUnit nu; 45 | nu.forbidden_zero_bit = f(1); 46 | nu.nal_ref_idc = u(2); 47 | nu.nal_unit_type = u(5); 48 | 49 | int num_header_bytes = 1; 50 | if(nu.nal_unit_type == 14 || nu.nal_unit_type == 20 || nu.nal_unit_type == 21) { 51 | STREAMER_ERROR("warning: not handling unit type 14, 20 or 21 yet.\n"); 52 | // num_header_bytes = ... 53 | return false; 54 | } 55 | 56 | for(int i = 0; i < num_header_bytes; ++i) { 57 | STREAMER_VERBOSE("h264 parser, warning: need to read the header bytes! %d\n", num_header_bytes); 58 | } 59 | 60 | switch(nu.nal_unit_type) { 61 | case NAL_SPS: { 62 | parseSPS(nu); 63 | break; 64 | } 65 | default: { 66 | STREAMER_ERROR("error: unhandled nal type.\n"); 67 | break; 68 | } 69 | } 70 | print_nal_unit(&nu); 71 | 72 | return true; 73 | } 74 | 75 | bool H264Parser::parseSPS(NalUnit& n) { 76 | n.sps.profile_idc = u8(); 77 | n.sps.constraint_set0_flag = f(1); 78 | n.sps.constraint_set1_flag = f(1); 79 | n.sps.constraint_set2_flag = f(1); 80 | n.sps.constraint_set3_flag = f(1); 81 | n.sps.constraint_set4_flag = f(1); 82 | n.sps.constraint_set5_flag = f(1); 83 | n.sps.reserved_zero_2bits = f(2); 84 | n.sps.level_idc = u8(); 85 | return true; 86 | } 87 | 88 | bool H264Parser::parsePPS(NalUnit& n) { 89 | 90 | return true; 91 | } 92 | 93 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/core/EncoderThread.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | 20 | # EncoderThread 21 | 22 | Accepts raw YUV420 and raw audio buffers as input which is will encode 23 | into FLVTags. A listener will be called from this thread when 24 | a new FLVTag has been generated; this thread creates a FLV bitstream. 25 | 26 | */ 27 | 28 | #ifndef ROXLU_ENCODER_THREAD_H 29 | #define ROXLU_ENCODER_THREAD_H 30 | 31 | extern "C" { 32 | # include 33 | } 34 | 35 | #include 36 | #include 37 | 38 | class FLVWriter; 39 | class VideoEncoder; 40 | class AudioEncoder; 41 | 42 | void encoder_congestion_thread_func(void* user); 43 | void encoder_thread_func(void* user); 44 | 45 | // ------------------------------------------------------------------ 46 | 47 | #define ENCT_STATE_NONE 0 48 | #define ENCT_STATE_STARTED 1 49 | 50 | class EncoderThread { 51 | public: 52 | EncoderThread(FLVWriter& flv, VideoEncoder& ve, AudioEncoder& ae); 53 | ~EncoderThread(); 54 | bool start(); 55 | bool stop(); /* stops the thread and joins it - this blocks */ 56 | void addPacket(AVPacket* pkt); /* add a packet that needs to be encoded */ 57 | public: 58 | FLVWriter& flv; 59 | AudioEncoder& audio_encoder; 60 | VideoEncoder& video_encoder; 61 | volatile bool must_stop; 62 | uv_thread_t thread; 63 | uv_cond_t cv; 64 | uv_mutex_t mutex; 65 | std::vector work; 66 | int state; 67 | }; 68 | 69 | 70 | #endif 71 | -------------------------------------------------------------------------------- /projects/decklink/include/decklink/DeckLinkCaptureCallback.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_DECKLINK_CAPTURE_CALLBACK_H 21 | #define ROXLU_DECKLINK_CAPTURE_CALLBACK_H 22 | 23 | #include 24 | //#include 25 | #include 26 | 27 | class DeckLinkCaptureCallback : public IDeckLinkInputCallback { 28 | public: 29 | DeckLinkCaptureCallback(); 30 | ~DeckLinkCaptureCallback(); 31 | virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID iid, LPVOID *ppv) { return E_NOINTERFACE; } 32 | virtual ULONG STDMETHODCALLTYPE AddRef(void) { return 1; } 33 | virtual ULONG STDMETHODCALLTYPE Release(void) { return 1; } 34 | virtual HRESULT STDMETHODCALLTYPE VideoInputFormatChanged(BMDVideoInputFormatChangedEvents, IDeckLinkDisplayMode*, BMDDetectedVideoInputFormatFlags); 35 | virtual HRESULT STDMETHODCALLTYPE VideoInputFrameArrived(IDeckLinkVideoInputFrame*, IDeckLinkAudioInputPacket*); 36 | void setCallback(decklink_capture_callback cbFrames, void* user); /* set the callback function which will receive the video and audio frames */ 37 | private: 38 | void* cb_user; /* the user that is passed into the frame callback */ 39 | decklink_capture_callback cb_frame; /* the frame callback */ 40 | }; 41 | 42 | inline void DeckLinkCaptureCallback::setCallback(decklink_capture_callback cbFrames, void* user) { 43 | cb_frame = cbFrames; 44 | cb_user = user; 45 | } 46 | 47 | #endif 48 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/core/RTMPThread.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | 20 | # RTMP Thread 21 | 22 | The RTMP Thread is responsible for sending FLVTags to the RTMP server 23 | as configured in the RTMPWriter object you pass into the constructor. 24 | 25 | */ 26 | #ifndef ROXLU_RTMP_THREAD_H 27 | #define ROXLU_RTMP_THREAD_H 28 | 29 | extern "C" { 30 | # include 31 | } 32 | 33 | #include 34 | #include 35 | 36 | // @todo - remove graph 37 | #if defined(USE_GRAPH) 38 | # include 39 | #endif 40 | 41 | // --------------------------------------------------- 42 | 43 | void rtmp_thread_func(void* user); 44 | 45 | struct RTMPData; 46 | class RTMPWriter; 47 | class FLVWriter; 48 | 49 | // --------------------------------------------------- 50 | 51 | #define RTMP_STATE_NONE 0 52 | #define RTMP_STATE_STARTED 1 53 | 54 | class RTMPThread : public FLVListener { 55 | public: 56 | RTMPThread(FLVWriter& flv, RTMPWriter& rtmpWriter); 57 | ~RTMPThread(); 58 | bool start(); 59 | bool stop(); /* will shutdown the thread and reset state. we join the thread */ 60 | void addPacket(RTMPData* pkt); 61 | 62 | /* FLVListener */ 63 | void onTag(BitStream& bs, FLVTag& tag); 64 | void onSignature(BitStream& bs); 65 | 66 | public: 67 | FLVWriter& flv; 68 | RTMPWriter& rtmp_writer; 69 | uv_thread_t thread; 70 | uv_cond_t cv; 71 | uv_mutex_t mutex; 72 | std::vector work; 73 | int state; 74 | }; 75 | 76 | // --------------------------------------------------- 77 | 78 | #endif 79 | -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(YUV420PGrabber) 4 | 5 | if(APPLE) 6 | set(USE_64BIT ON) 7 | endif() 8 | 9 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../tools/cmake/Triplet.cmake) # include triplet 10 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/streamer/build/cmake/CMakeLists.txt) # streamer 11 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/xmlconfig/build/cmake/CMakeLists.txt) # xmlconfig 12 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/decklink/build/cmake/CMakeLists.txt) # decklink 13 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/tinylib/build/cmake/CMakeLists.txt) # tinylib 14 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/hwscale/build/cmake/CMakeLists.txt) # hwscale 15 | 16 | set(app_source_dir ${CMAKE_CURRENT_LIST_DIR}/../../src/) 17 | set(app_name "yuv420p_grabber") 18 | 19 | if(CMAKE_BUILD_TYPE STREQUAL Debug) 20 | set(app_name "${app_name}_debug") 21 | endif() 22 | 23 | set(app_source_files 24 | ${streamer_source_files} 25 | ${xmlconfig_source_files} 26 | ${decklink_source_files} 27 | ${hwscale_source_files} 28 | ${app_source_dir}/main.cpp 29 | ${app_source_dir}/Animation.cpp 30 | ${extern_dir}/src/GLXW/glxw.c 31 | ) 32 | 33 | find_package(OpenGL REQUIRED) 34 | 35 | set(app_libraries 36 | ${streamer_libraries} 37 | ${decklink_libraries} 38 | ${hwscale_libraries} 39 | ${OPENGL_gl_LIBRARY} 40 | ) 41 | 42 | if(WIN32) 43 | list(APPEND app_libraries 44 | ${extern_dir}/lib/glfw3.lib 45 | ${extern_dir}/lib/libyuv.lib 46 | ) 47 | endif() 48 | 49 | if(APPLE) 50 | list(APPEND app_libraries 51 | ${extern_dir}/lib/libglfw3.a 52 | ${extern_dir}/lib/libyuv.a 53 | ) 54 | endif() 55 | 56 | set(app_install_files 57 | ${streamer_install_files} 58 | ${CMAKE_CURRENT_LIST_DIR}/yuv420p_grabber.xml 59 | ) 60 | 61 | add_definitions( 62 | ${hwscale_definitions} 63 | ${streamer_definitions} 64 | ) 65 | 66 | include_directories( 67 | ${CMAKE_CURRENT_LIST_DIR}/../../include/ 68 | ${streamer_include_dirs} 69 | ${xmlconfig_include_dirs} 70 | ${decklink_include_dirs} 71 | ${tinylib_include_dirs} 72 | ${hwscale_include_dirs} 73 | ${extern_include_dirs} 74 | ) 75 | 76 | add_executable(${app_name} ${app_source_files}) 77 | 78 | add_dependencies(${app_name} ${decklink_dependencies}) 79 | 80 | target_link_libraries(${app_name} ${app_libraries}) 81 | 82 | install(TARGETS ${app_name} DESTINATION bin) 83 | 84 | install(FILES ${app_install_files} DESTINATION bin) 85 | -------------------------------------------------------------------------------- /projects/portaudio/include/portaudio/PAudio.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | # PAuido 20 | 21 | Very thin and basic wrapper around PortAudio to get cross 22 | platform audio in. 23 | 24 | */ 25 | 26 | #ifndef ROXLU_PORTAUDIO_H 27 | #define ROXLU_PORTAUDIO_H 28 | 29 | #include 30 | 31 | // ----------------------------------------------------------- 32 | int paudio_in(const void* input, void* output, unsigned long nframes, 33 | const PaStreamCallbackTimeInfo* time, 34 | PaStreamCallbackFlags status, void* userData); 35 | // ----------------------------------------------------------- 36 | 37 | typedef void(*paudio_in_callback)(const void* input, unsigned long nframes, void* user); 38 | 39 | // ----------------------------------------------------------- 40 | 41 | class PAudio { 42 | public: 43 | PAudio(); 44 | ~PAudio(); 45 | void setCallback(paudio_in_callback cb, void* user); 46 | bool start(); 47 | bool stop(); 48 | bool openInputStream(int device, int nchannels, PaSampleFormat format, double samplerate, unsigned long framesPerBuffer); 49 | int listDevices(); 50 | int getDefaultInputDevice(); /* returns the ID of the default input device or < 0 on error */ 51 | bool isInputFormatSupported(int device, int nchannels, PaSampleFormat format, double samplerate); 52 | 53 | public: 54 | paudio_in_callback cb_audio; 55 | void* cb_user; 56 | 57 | private: 58 | PaStream* input_stream; 59 | }; 60 | 61 | inline void PAudio::setCallback(paudio_in_callback cb, void* user) { 62 | cb_audio = cb; 63 | cb_user = user; 64 | } 65 | 66 | #endif 67 | -------------------------------------------------------------------------------- /tools/html/css/rtmpd.css: -------------------------------------------------------------------------------- 1 | /* http://meyerweb.com/eric/tools/css/reset/ 2 | v2.0 | 20110126 3 | License: none (public domain) 4 | */ 5 | 6 | html, body, div, span, applet, object, iframe, 7 | h1, h2, h3, h4, h5, h6, p, blockquote, pre, 8 | a, abbr, acronym, address, big, cite, code, 9 | del, dfn, em, img, ins, kbd, q, s, samp, 10 | small, strike, strong, sub, sup, tt, var, 11 | b, u, i, center, 12 | dl, dt, dd, ol, ul, li, 13 | fieldset, form, label, legend, 14 | table, caption, tbody, tfoot, thead, tr, th, td, 15 | article, aside, canvas, details, embed, 16 | figure, figcaption, footer, header, hgroup, 17 | menu, nav, output, ruby, section, summary, 18 | time, mark, audio, video { 19 | margin: 0; 20 | padding: 0; 21 | border: 0; 22 | font-size: 100%; 23 | font: inherit; 24 | vertical-align: baseline; 25 | } 26 | 27 | /* HTML5 display-role reset for older browsers */ 28 | article, aside, details, figcaption, figure, 29 | footer, header, hgroup, menu, nav, section { 30 | display: block; 31 | } 32 | body { 33 | line-height: 1; 34 | } 35 | ol, ul { 36 | list-style: none; 37 | } 38 | blockquote, q { 39 | quotes: none; 40 | } 41 | blockquote:before, blockquote:after, 42 | q:before, q:after { 43 | content: ''; 44 | content: none; 45 | } 46 | table { 47 | border-collapse: collapse; 48 | border-spacing: 0; 49 | } 50 | 51 | /* Typography */ 52 | /* ------------------------------------------------------------------------ */ 53 | body { 54 | font-family: Helvetica, sans-serif; 55 | font-size:20px; 56 | color:black; 57 | } 58 | 59 | a { 60 | text-decoration:none; 61 | color:black; 62 | } 63 | 64 | input.input_submit, 65 | input.input_text { 66 | font-size:20px; 67 | } 68 | 69 | #youtube_login a { 70 | text-decoration:underline; 71 | color:red; 72 | } 73 | body { 74 | background:url(../images/background_pattern.png) top left repeat; 75 | } 76 | h2 { 77 | margin-bottom:20px; 78 | } 79 | 80 | /* Structure */ 81 | /* ------------------------------------------------------------------------ */ 82 | #page { 83 | width:900px; 84 | position:absolute; 85 | left:50%; 86 | top:50px; 87 | margin-left:-450px; 88 | } 89 | 90 | #playback_container { 91 | width:360px; 92 | height:288px; 93 | } 94 | 95 | .player h2 { 96 | margin-top:20px; 97 | } 98 | .player { 99 | margin-bottom:20px; 100 | } 101 | 102 | .player div { 103 | width:640px; 104 | height:360px; 105 | } 106 | -------------------------------------------------------------------------------- /applications/test_connection/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(ConnectionTest) 4 | 5 | if(APPLE) 6 | set(USE_64BIT ON) 7 | endif() 8 | 9 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../tools/cmake/Triplet.cmake) # include triplet 10 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/streamer/build/cmake/CMakeLists.txt) # streamer 11 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/xmlconfig/build/cmake/CMakeLists.txt) # xmlconfig 12 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/decklink/build/cmake/CMakeLists.txt) # decklink 13 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/tinylib/build/cmake/CMakeLists.txt) # tinylib 14 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/hwscale/build/cmake/CMakeLists.txt) # hwscale 15 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/portaudio/build/cmake/CMakeLists.txt) # portaudio 16 | 17 | set(app_source_dir ${CMAKE_CURRENT_LIST_DIR}/../../src/) 18 | set(app_name "test_connection") 19 | 20 | if(CMAKE_BUILD_TYPE STREQUAL Debug) 21 | set(app_name "${app_name}_debug") 22 | endif() 23 | 24 | set(app_source_files 25 | ${streamer_source_files} 26 | ${xmlconfig_source_files} 27 | ${decklink_source_files} 28 | ${hwscale_source_files} 29 | ${portaudio_source_files} 30 | ${app_source_dir}/main.cpp 31 | ${extern_dir}/src/GLXW/glxw.c 32 | ) 33 | 34 | find_package(OpenGL REQUIRED) 35 | 36 | set(app_libraries 37 | ${streamer_libraries} 38 | ${decklink_libraries} 39 | ${hwscale_libraries} 40 | ${portaudio_libraries} 41 | ${OPENGL_gl_LIBRARY} 42 | ) 43 | 44 | if(WIN32) 45 | list(APPEND app_libraries 46 | ${extern_dir}/lib/glfw3.lib 47 | ${extern_dir}/lib/libyuv.lib 48 | ) 49 | endif() 50 | 51 | if(APPLE) 52 | list(APPEND app_libraries 53 | ${extern_dir}/lib/libglfw3.a 54 | ${extern_dir}/lib/libyuv.a 55 | ) 56 | endif() 57 | 58 | 59 | set(app_install_files 60 | ${streamer_install_files} 61 | ${CMAKE_CURRENT_LIST_DIR}/connection_test.xml 62 | ) 63 | 64 | add_definitions( 65 | ${hwscale_definitions} 66 | ${streamer_definitions} 67 | ) 68 | 69 | include_directories( 70 | ${CMAKE_CURRENT_LIST_DIR}/../../include/ 71 | ${streamer_include_dirs} 72 | ${xmlconfig_include_dirs} 73 | ${decklink_include_dirs} 74 | ${tinylib_include_dirs} 75 | ${hwscale_include_dirs} 76 | ${extern_include_dirs} 77 | ${portaudio_include_dirs} 78 | ) 79 | 80 | add_executable(${app_name} ${app_source_files}) 81 | 82 | add_dependencies(${app_name} ${decklink_dependencies}) 83 | 84 | target_link_libraries(${app_name} ${app_libraries}) 85 | 86 | install(TARGETS ${app_name} DESTINATION bin) 87 | 88 | install(FILES ${app_install_files} DESTINATION bin) 89 | -------------------------------------------------------------------------------- /applications/decklink_streamer/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(DeckLinkStreamer) 4 | 5 | set(USE_64BIT ON) 6 | 7 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../tools/cmake/Triplet.cmake) # include triplet 8 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/streamer/build/cmake/CMakeLists.txt) # streamer 9 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/xmlconfig/build/cmake/CMakeLists.txt) # xmlconfig 10 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/decklink/build/cmake/CMakeLists.txt) # decklink 11 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/tinylib/build/cmake/CMakeLists.txt) # tinylib 12 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/hwscale/build/cmake/CMakeLists.txt) # hwscale 13 | 14 | set(dls_source_dir ${CMAKE_CURRENT_LIST_DIR}/../../src/) 15 | set(dls_name "decklink_streamer") 16 | 17 | if(CMAKE_BUILD_TYPE STREQUAL Debug) 18 | set(dls_name "${dls_name}_debug") 19 | endif() 20 | 21 | set(dls_source_files 22 | ${streamer_source_files} 23 | ${xmlconfig_source_files} 24 | ${decklink_source_files} 25 | ${hwscale_source_files} 26 | ${dls_source_dir}/main.cpp 27 | ${dls_source_dir}/FastI420Upload.cpp 28 | ${extern_dir}/src/GLXW/glxw.c 29 | ) 30 | 31 | find_package(OpenGL REQUIRED) 32 | 33 | set(dls_libraries 34 | ${streamer_libraries} 35 | ${decklink_libraries} 36 | ${hwscale_libraries} 37 | 38 | ${OPENGL_gl_LIBRARY} 39 | ) 40 | 41 | if(WIN32) 42 | list(APPEND dls_libraries 43 | ${extern_dir}/lib/glfw3.lib 44 | ${extern_dir}/lib/libyuv.lib 45 | ) 46 | elseif(APPLE) 47 | list(APPEND dls_libraries 48 | ${extern_dir}/lib/libyuv.a 49 | ${extern_dir}/lib/libglfw3.a 50 | ) 51 | endif() 52 | 53 | set(dls_install_files 54 | ${streamer_install_files} 55 | ) 56 | 57 | add_definitions( 58 | ${hwscale_definitions} 59 | ${streamer_definitions} 60 | ) 61 | 62 | include_directories( 63 | ${CMAKE_CURRENT_LIST_DIR}/../../include/ 64 | ${streamer_include_dirs} 65 | ${xmlconfig_include_dirs} 66 | ${decklink_include_dirs} 67 | ${tinylib_include_dirs} 68 | ${hwscale_include_dirs} 69 | ${extern_include_dirs} 70 | ) 71 | 72 | add_executable(${dls_name} ${dls_source_files}) 73 | 74 | add_dependencies(${dls_name} ${decklink_dependencies}) 75 | 76 | target_link_libraries(${dls_name} ${dls_libraries}) 77 | 78 | install(TARGETS ${dls_name} DESTINATION bin) 79 | 80 | if(NOT EXISTS ${CMAKE_INSTALL_PREFIX}/bin/decklink_streamer.xml) 81 | # install(FILES ${CMAKE_CURRENT_LIST_DIR}/decklink_streamer.xml DESTINATION bin) 82 | endif() 83 | 84 | install(FILES ${dls_install_files} DESTINATION bin) 85 | -------------------------------------------------------------------------------- /applications/test_shutdown_flvwriter/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(ConnectionTest) 4 | 5 | if(APPLE) 6 | set(USE_64BIT ON) 7 | endif() 8 | 9 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../tools/cmake/Triplet.cmake) # include triplet 10 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/streamer/build/cmake/CMakeLists.txt) # streamer 11 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/xmlconfig/build/cmake/CMakeLists.txt) # xmlconfig 12 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/decklink/build/cmake/CMakeLists.txt) # decklink 13 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/tinylib/build/cmake/CMakeLists.txt) # tinylib 14 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/hwscale/build/cmake/CMakeLists.txt) # hwscale 15 | 16 | set(app_source_dir ${CMAKE_CURRENT_LIST_DIR}/../../src/) 17 | set(app_name "test_shutdown_flvwriter") 18 | 19 | if(CMAKE_BUILD_TYPE STREQUAL Debug) 20 | set(app_name "${app_name}_debug") 21 | endif() 22 | 23 | set(app_source_files 24 | ${streamer_source_files} 25 | ${xmlconfig_source_files} 26 | ${decklink_source_files} 27 | ${hwscale_source_files} 28 | ${app_source_dir}/main.cpp 29 | ${extern_dir}/src/GLXW/glxw.c 30 | ) 31 | 32 | find_package(OpenGL REQUIRED) 33 | 34 | set(app_libraries 35 | ${streamer_libraries} 36 | ${decklink_libraries} 37 | ${hwscale_libraries} 38 | ${OPENGL_gl_LIBRARY} 39 | ) 40 | 41 | if(WIN32) 42 | list(APPEND app_libraries 43 | ${extern_dir}/lib/glfw3.lib 44 | ${extern_dir}/lib/libyuv.lib 45 | ) 46 | endif() 47 | 48 | if(APPLE) 49 | list(APPEND app_libraries 50 | ${extern_dir}/lib/libglfw3.a 51 | ${extern_dir}/lib/libyuv.a 52 | ) 53 | endif() 54 | 55 | 56 | set(app_install_files 57 | ${streamer_install_files} 58 | ) 59 | 60 | add_definitions( 61 | ${hwscale_definitions} 62 | ${streamer_definitions} 63 | ) 64 | 65 | include_directories( 66 | ${CMAKE_CURRENT_LIST_DIR}/../../include/ 67 | ${streamer_include_dirs} 68 | ${xmlconfig_include_dirs} 69 | ${decklink_include_dirs} 70 | ${tinylib_include_dirs} 71 | ${hwscale_include_dirs} 72 | ${extern_include_dirs} 73 | ) 74 | 75 | set(CMAKE_INSTALL_PREFIX ${install_dir}) 76 | 77 | add_executable(${app_name} ${app_source_files}) 78 | 79 | add_dependencies(${app_name} ${decklink_dependencies}) 80 | 81 | target_link_libraries(${app_name} ${app_libraries}) 82 | 83 | install(TARGETS ${app_name} DESTINATION bin) 84 | 85 | install(FILES ${app_install_files} DESTINATION bin) 86 | 87 | #add_custom_command(TARGET test POST_BUILD COMMAND ${CMAKE_INSTALL_PREFIX}/bin/${app_name}) 88 | 89 | # start the app after building 90 | add_custom_command(TARGET ${app_name} POST_BUILD COMMAND ${app_name}) -------------------------------------------------------------------------------- /projects/decklink/include/decklink/DeckLinkCard.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_DECKLINK_CARD_H 21 | #define ROXLU_DECKLINK_CARD_H 22 | 23 | #include 24 | //#include 25 | #include 26 | #include 27 | 28 | #if defined(_WIN32) 29 | # include 30 | #endif 31 | 32 | class DeckLinkCard { 33 | public: 34 | DeckLinkCard(IDeckLink* dl); 35 | ~DeckLinkCard(); 36 | bool setVideoMode(BMDDisplayMode mode, BMDPixelFormat format); /* sets the given display mode, if supported */ 37 | bool isVideoModeSupported(BMDDisplayMode mode, BMDPixelFormat format); /* checks whether the given display mode and pixel format are supported */ 38 | void setCallback(decklink_capture_callback cbFrames, void* user); /* set the callback function which will receive the video and audio frames */ 39 | bool initialize(); /* initializes the card for grabbing - call this after setting up this object */ 40 | bool start(); /* start captureing, make sure that you've set the video mode */ 41 | bool stop(); /* stop captureing */ 42 | private: 43 | bool is_started; 44 | IDeckLink* dl; /* represents a decklink card (input, output) */ 45 | IDeckLinkInput* input; /* input interface, allows capturing */ 46 | BMDDisplayMode display_mode; 47 | BMDPixelFormat pixel_format; 48 | DeckLinkCaptureCallback* capture_callback; 49 | public: 50 | void* cb_user; /* the user that is passed into the frame callback */ 51 | decklink_capture_callback cb_frame; /* the frame callback */ 52 | }; 53 | 54 | inline void DeckLinkCard::setCallback(decklink_capture_callback cbFrames, void* user) { 55 | cb_user = user; 56 | cb_frame = cbFrames; 57 | } 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /projects/grapher/include/grapher/Types.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_GRAPHER_TYPES_H 21 | #define ROXLU_GRAPHER_TYPES_H 22 | 23 | #define PKT_TYPE_NONE 0 24 | #define PKT_TYPE_STOP 1 /* stop the thread */ 25 | #define PKT_TYPE_CONFIG 2 /* graph config */ 26 | #define PKT_TYPE_DATA 3 /* graph data */ 27 | 28 | #include 29 | #include 30 | 31 | struct GraphConfig { 32 | 33 | GraphConfig() 34 | :width(0) 35 | ,height(0) 36 | ,xtics(0) 37 | ,ytics(0) 38 | ,id(0) 39 | ,x(0) 40 | ,y(0) 41 | { 42 | yrange[0] = yrange[1] = 0; 43 | } 44 | 45 | void print(); 46 | 47 | uint16_t width; 48 | uint16_t height; 49 | uint16_t x; 50 | uint16_t y; 51 | uint8_t xtics; 52 | uint8_t ytics; 53 | int32_t yrange[2]; 54 | uint8_t id; /* id of the graph; you can create multiple graphs, this identifies one such graph */ 55 | }; 56 | 57 | 58 | /* settings for the graph application which embeds the server */ 59 | struct ServerSettings { 60 | std::string address; /* tcp, inproc or ipc address, see nanomsg for valid addresses, but e.g.: tcp://127.0.0.1:7878 (only numerical) */ 61 | int width; /* width of the window */ 62 | int height; /* height of the window */ 63 | }; 64 | 65 | 66 | /* client config */ 67 | struct ClientSettings { 68 | std::string address; 69 | std::vector graphs; 70 | }; 71 | 72 | 73 | // ----------------------------------------------- 74 | inline void GraphConfig::print() { 75 | printf("width: %d.\n", width); 76 | printf("height: %d.\n", height); 77 | printf("x: %d.\n", x); 78 | printf("y: %d.\n", y); 79 | printf("xtics: %d\n", xtics); 80 | printf("ytics: %d\n", ytics); 81 | printf("yrange: %d\n", yrange[0]); 82 | printf("yrange: %d\n", yrange[1]); 83 | printf("id: %d\n", id); 84 | } 85 | #endif 86 | -------------------------------------------------------------------------------- /applications/test_multi_streamer/build/cmake/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | project(ConnectionTest) 4 | 5 | if(APPLE) 6 | set(USE_64BIT ON) 7 | endif() 8 | 9 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../tools/cmake/Triplet.cmake) # include triplet 10 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/streamer/build/cmake/CMakeLists.txt) # streamer 11 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/xmlconfig/build/cmake/CMakeLists.txt) # xmlconfig 12 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/decklink/build/cmake/CMakeLists.txt) # decklink 13 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/tinylib/build/cmake/CMakeLists.txt) # tinylib 14 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/hwscale/build/cmake/CMakeLists.txt) # hwscale 15 | include(${CMAKE_CURRENT_LIST_DIR}/../../../../projects/portaudio/build/cmake/CMakeLists.txt) # portaudio 16 | 17 | set(app_source_dir ${CMAKE_CURRENT_LIST_DIR}/../../src/) 18 | set(app_name "test_multi_streamer") 19 | 20 | if(CMAKE_BUILD_TYPE STREQUAL Debug) 21 | set(app_name "${app_name}_debug") 22 | endif() 23 | 24 | set(app_source_files 25 | ${streamer_source_files} 26 | ${xmlconfig_source_files} 27 | ${decklink_source_files} 28 | ${hwscale_source_files} 29 | ${portaudio_source_files} 30 | ${app_source_dir}/main.cpp 31 | ${app_source_dir}/Animation.cpp 32 | ${extern_dir}/src/GLXW/glxw.c 33 | ) 34 | 35 | find_package(OpenGL REQUIRED) 36 | 37 | set(app_libraries 38 | ${streamer_libraries} 39 | ${decklink_libraries} 40 | ${hwscale_libraries} 41 | ${portaudio_libraries} 42 | ${tinylib_libraries} 43 | ${OPENGL_gl_LIBRARY} 44 | ) 45 | 46 | if(WIN32) 47 | list(APPEND app_libraries 48 | ${extern_dir}/lib/glfw3.lib 49 | ${extern_dir}/lib/libyuv.lib 50 | ) 51 | endif() 52 | 53 | if(APPLE) 54 | list(APPEND app_libraries 55 | ${extern_dir}/lib/libglfw3.a 56 | ${extern_dir}/lib/libyuv.a 57 | ) 58 | endif() 59 | 60 | 61 | set(app_install_files 62 | ${streamer_install_files} 63 | ${CMAKE_CURRENT_LIST_DIR}/test_multi_streamer.xml 64 | ) 65 | 66 | add_definitions( 67 | ${hwscale_definitions} 68 | ${streamer_definitions} 69 | ) 70 | 71 | include_directories( 72 | ${CMAKE_CURRENT_LIST_DIR}/../../include/ 73 | ${streamer_include_dirs} 74 | ${xmlconfig_include_dirs} 75 | ${decklink_include_dirs} 76 | ${tinylib_include_dirs} 77 | ${hwscale_include_dirs} 78 | ${extern_include_dirs} 79 | ${portaudio_include_dirs} 80 | ) 81 | 82 | add_executable(${app_name} ${app_source_files}) 83 | 84 | add_dependencies(${app_name} ${decklink_dependencies}) 85 | 86 | target_link_libraries(${app_name} ${app_libraries}) 87 | 88 | install(TARGETS ${app_name} DESTINATION bin) 89 | 90 | install(FILES ${app_install_files} DESTINATION bin) 91 | -------------------------------------------------------------------------------- /projects/grapher/include/grapher/Vertices.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | 20 | */ 21 | #ifndef ROXLU_GRAPHER_VERTICES_H 22 | #define ROXLU_GRAPHER_VERTICES_H 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | // ---------------------------------------------------------- 29 | 30 | struct Vertex { 31 | Vertex(float x, float y, float r, float g, float b); 32 | float pos[2]; 33 | float color[3]; 34 | }; 35 | 36 | // ---------------------------------------------------------- 37 | 38 | struct Vertices { 39 | public: 40 | Vertices(); 41 | ~Vertices(); 42 | bool setup(); 43 | void push_back(const Vertex& v); 44 | size_t size(); 45 | void clear(); 46 | void update(); 47 | size_t numBytes(); 48 | const float* getPtr(); 49 | void bind(); 50 | public: 51 | GLuint vbo; 52 | GLuint vao; 53 | std::vector vertices; 54 | bool changed; 55 | size_t bytes_allocated; 56 | }; 57 | 58 | inline Vertex::Vertex(float x, float y, float r, float g, float b) { 59 | pos[0] = x; 60 | pos[1] = y; 61 | float rcp = 1.0f/255.0; 62 | color[0] = r * rcp; 63 | color[1] = g * rcp; 64 | color[2] = b * rcp; 65 | } 66 | 67 | inline void Vertices::push_back(const Vertex& v) { 68 | vertices.push_back(v); 69 | changed = true; 70 | } 71 | 72 | inline size_t Vertices::size() { 73 | return vertices.size(); 74 | } 75 | 76 | inline void Vertices::clear() { 77 | vertices.clear(); 78 | changed = true; 79 | } 80 | 81 | inline size_t Vertices::numBytes() { 82 | return size() * sizeof(Vertex); 83 | } 84 | 85 | inline const float* Vertices::getPtr() { 86 | if(!vertices.size()) { 87 | return NULL; 88 | } 89 | return &vertices[0].pos[0]; 90 | } 91 | 92 | inline void Vertices::bind() { 93 | #if USE_APPLE 94 | glBindVertexArrayAPPLE(vao); 95 | #else 96 | glBindVertexArray(vao); 97 | #endif 98 | } 99 | 100 | #endif 101 | 102 | -------------------------------------------------------------------------------- /projects/decklink/include/decklink/DeckLink.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_DECKLINK_BASE_H 21 | #define ROXLU_DECKLINK_BASE_H 22 | 23 | #include 24 | //#include 25 | #include 26 | #include 27 | #include 28 | 29 | #if defined(_WIN32) 30 | # include 31 | #endif 32 | 33 | class DeckLink { 34 | public: 35 | DeckLink(); 36 | ~DeckLink(); 37 | bool setup(int device); /* select the given device */ 38 | bool setVideoMode(BMDDisplayMode mode, BMDPixelFormat format); /* set the display-mode and pixel-format for the selected device; make sure that you've called setup() first. */ 39 | bool setCallback(decklink_capture_callback cbFrames, void* user); /* sets the callback on the selected device; this will receive video and audio frames. see DeckLinkTypes.h for more info on the callback */ 40 | bool start(); /* start captureing on the selected device */ 41 | bool stop(); /* stop captureing */ 42 | bool printDevices(); /* shows info about the devices */ 43 | private: 44 | bool getCapabilities(IDeckLink* dl); 45 | DeckLinkCard* card; 46 | }; 47 | 48 | inline bool DeckLink::setVideoMode(BMDDisplayMode mode, BMDPixelFormat format) { 49 | if(!card) { 50 | printf("error: no active card found. did you setup() ?\n"); 51 | return false; 52 | } 53 | return card->setVideoMode(mode, format); 54 | } 55 | 56 | inline bool DeckLink::start() { 57 | if(!card) { 58 | printf("error: no active card found. did you setup() ?\n"); 59 | return false; 60 | } 61 | return card->start(); 62 | } 63 | 64 | inline bool DeckLink::stop() { 65 | if(!card) { 66 | printf("error: no active card found. did you setup() ?\n"); 67 | return false; 68 | } 69 | return card->stop(); 70 | } 71 | 72 | inline bool DeckLink::setCallback(decklink_capture_callback cbFrames, void* user) { 73 | if(!card) { 74 | printf("error: no active card found. did you setup() ?\n"); 75 | return false; 76 | } 77 | card->setCallback(cbFrames, user); 78 | return true; 79 | } 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/core/AudioEncoderMP3.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | # AudioEncoderMP3 20 | 21 | Encodes raw audio data using liblamemp3. We can either ingest 22 | interleaved float or interleaved signed shorts. 23 | 24 | ````c++ 25 | AudioEncoderMP3 ae; 26 | 27 | my_settings.samplerate = AV_AUDIO_SAMPLERATE_44100; 28 | my_settings.mode = AV_AUDIO_MODE_STEREO; 29 | my_settings.bitsize = AV_AUDIO_BITSIZE_S16; 30 | my_settings.bitrate = 96; // 96 kbps 31 | my_settings.quality = 6; 32 | my_settings.in_bitsize = AV_AUDIO_BITSIZE_F32; 33 | my_settings.in_interleaved = true. 34 | 35 | ae.setup(my_settings); 36 | ae.initialize(); 37 | 38 | for(int i = 0; i < 50; ++i) { 39 | ... 40 | ae.encodePacket(some_packet, tag); 41 | ... 42 | } 43 | ```` 44 | 45 | */ 46 | 47 | #ifndef ROXLU_AUDIO_ENCODER_MP3_H 48 | #define ROXLU_AUDIO_ENCODER_MP3_H 49 | 50 | #include 51 | 52 | extern "C" { 53 | # include 54 | # include 55 | } 56 | 57 | #include 58 | #include 59 | #include 60 | #include 61 | 62 | #define AUDIO_ENCODER_BUFFER_SIZE 168384 63 | 64 | class AudioEncoderMP3 : public AudioEncoder { 65 | public: 66 | AudioEncoderMP3(); 67 | ~AudioEncoderMP3(); 68 | bool setup(AudioSettings settings); 69 | bool initialize(); 70 | bool encodePacket(AVPacket* p, FLVTag& result); 71 | bool shutdown(); 72 | private: 73 | int nchannels; 74 | AudioSettings settings; 75 | int samplerate; 76 | MPEG_mode mode; 77 | lame_global_flags* lame_flags; 78 | uint8_t mp3_buffer[AUDIO_ENCODER_BUFFER_SIZE]; 79 | 80 | /* used to monitor bitrate */ 81 | uint64_t bitrate_time_started; /* when we started with encoding, in nanosec. we've put this in setup() because we don't want to add a check in encodePacket(), this result in a bit less accurate value for the first run. */ 82 | uint64_t bitrate_timeout; /* when we should calculate the current bitrate again */ 83 | uint64_t bitrate_delay; /* the time between bitrate measurements, in nanosec */ 84 | double bitrate_in_kbps; /* the current bitrate we measured last delay */ 85 | double bitrate_nbytes; /* the total amount of transferred bytes */ 86 | 87 | }; 88 | 89 | #endif 90 | -------------------------------------------------------------------------------- /thirdparty/openFrameworks/ofxVideoStreamer/src/ofxVideoStreamer/ofxVideoStreamer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | ofxVideoStreamer::ofxVideoStreamer() 5 | :has_new_frame(false) 6 | ,has_allocated_audio_pool(false) 7 | ,streamer(aac) 8 | { 9 | printf("screen grabber\n"); 10 | } 11 | 12 | ofxVideoStreamer::~ofxVideoStreamer() { 13 | 14 | } 15 | 16 | bool ofxVideoStreamer::setup(std::string filename, 17 | int winW, int winH, 18 | int vidW, int vidH) 19 | { 20 | 21 | if(!streamer.loadSettings(ofToDataPath(filename))) { 22 | printf("error: cannot load the streamer settings.\n"); 23 | return false; 24 | } 25 | 26 | grabber.addSize(0, vidW, vidH); 27 | 28 | if(!grabber.setup(winW, winH, 25)) { 29 | printf("error: cannot setup the grabber.\n"); 30 | return false; 31 | } 32 | 33 | YUV420PSize size = grabber.getSize(0); 34 | streamer.setVideoWidth(size.yw); 35 | streamer.setVideoHeight(size.yh); 36 | 37 | if(!streamer.setup()) { 38 | printf("error: cannot setup the streamer.\n"); 39 | return false; 40 | } 41 | 42 | if(!memory_pool.allocateVideoFrames(10, grabber.getNumBytes())) { 43 | printf("error: cannot setup the memory pool. maybe out of memory?\n"); 44 | return false; 45 | } 46 | 47 | 48 | return true; 49 | } 50 | 51 | bool ofxVideoStreamer::start() { 52 | 53 | if(!streamer.start()) { 54 | printf("error: cannot start the streamer, did you call setup()?.\n"); 55 | return false; 56 | } 57 | 58 | grabber.start(); 59 | 60 | return true; 61 | } 62 | 63 | void ofxVideoStreamer::beginGrab() { 64 | grabber.beginGrab(); 65 | } 66 | 67 | void ofxVideoStreamer::endGrab() { 68 | grabber.endGrab(); 69 | grabber.downloadTextures(); 70 | 71 | AVPacket* vid = memory_pool.getFreeVideoPacket(); 72 | if(!vid) { 73 | printf("error: cannot get a free video packet, try to increase the pool size\n"); 74 | } 75 | else { 76 | vid->makeVideoPacket(); 77 | vid->setTimeStamp(grabber.getTimeStamp()); 78 | grabber.assignFrame(0, vid->data, vid->planes, vid->strides); 79 | streamer.addVideo(vid); 80 | } 81 | } 82 | 83 | void ofxVideoStreamer::draw() { 84 | grabber.draw(); 85 | } 86 | 87 | void ofxVideoStreamer::addAudio(float* input, int nsize, int nchannels) { 88 | 89 | size_t nbytes = nsize * sizeof(float) * nchannels; 90 | 91 | // @todo - we're delaying allocation here .. we should do this in setup() but then VideoStreamer must be updated. 92 | if(!has_allocated_audio_pool) { 93 | if(!memory_pool.allocateAudioFrames(128, nbytes)) { 94 | printf("error: cannot allocate audio!\n"); 95 | ::exit(EXIT_FAILURE); 96 | } 97 | 98 | has_allocated_audio_pool = true; 99 | } 100 | 101 | AVPacket* pkt = memory_pool.getFreeAudioPacket(); 102 | if(!pkt) { 103 | printf("error: cannot find a free audio packet, make sure that we've allocated enough.\n"); 104 | return ; 105 | } 106 | 107 | uint8_t* ptr = (uint8_t*)input; 108 | pkt->data.assign(ptr, ptr + nbytes); 109 | pkt->setTimeStamp(grabber.getTimeStamp()); 110 | streamer.addAudio(pkt); 111 | } 112 | -------------------------------------------------------------------------------- /projects/grapher/include/grapher/Daemon.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | 21 | #ifndef ROXLU_GRAPHER_DAEMON_H 22 | #define ROXLU_GRAPHER_DAEMON_H 23 | 24 | extern "C" { 25 | # include 26 | # include 27 | # include 28 | } 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | // ------------------------------------------------ 36 | 37 | void daemon_thread(void* user); 38 | 39 | // ------------------------------------------------ 40 | 41 | // data for a graph (id) and a specific line (name) 42 | struct GraphDataPacket { 43 | std::string name; /* name of the graph line */ 44 | uint8_t id; /* the GraphDrawer instance */ 45 | float value; /* the value for the graph */ 46 | }; 47 | 48 | // ------------------------------------------------ 49 | 50 | class Daemon { 51 | public: 52 | Daemon(); 53 | ~Daemon(); 54 | bool setup(std::string address, int winW, int winH); 55 | bool start(); 56 | void stop(); 57 | void lock(); 58 | void unlock(); 59 | void update(); 60 | void draw(); 61 | void onResize(int winW, int winH); 62 | 63 | void prev(); /* switch to previous graph */ 64 | void next(); /* switch to next graph */ 65 | public: 66 | std::vector configs; /* when we receive a new graph config it's added to this vector so the GraphDrawer* is created in the main thread */ 67 | std::map graphs; 68 | std::vector data_packets; /* the data that the client send to us */ 69 | bool must_run; 70 | std::string address; 71 | uv_mutex_t mutex; 72 | uv_thread_t thread; 73 | int32_t active_graph; 74 | int win_w; 75 | int win_h; 76 | }; 77 | 78 | inline void Daemon::lock() { 79 | uv_mutex_lock(&mutex); 80 | } 81 | 82 | inline void Daemon::unlock() { 83 | uv_mutex_unlock(&mutex); 84 | } 85 | 86 | inline void Daemon::next() { 87 | if(!graphs.size()) { 88 | return; 89 | } 90 | 91 | ++active_graph %= graphs.size(); 92 | } 93 | 94 | inline void Daemon::prev() { 95 | if(!graphs.size()) { 96 | return; 97 | } 98 | if(active_graph == 0) { 99 | active_graph = graphs.size() - 1; 100 | } 101 | else { 102 | active_graph--; 103 | } 104 | } 105 | 106 | #endif 107 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/flv/FLVListener.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | # FLVListener 20 | 21 | Interface for FLV events. e.g. the FLVReader fires an event 22 | when it reads a FLVTag, the listener can handle this in any way it 23 | prefers. 24 | 25 | The FLVListeners (with 's') is just a wrapper to handle multiple listeners 26 | 27 | */ 28 | 29 | #ifndef ROXLU_FLV_LISTENER_H 30 | #define ROXLU_FLV_LISTENER_H 31 | 32 | #include 33 | #include 34 | 35 | // ------------------------------------ 36 | 37 | class FLVListener { 38 | public: 39 | virtual void onSignature(BitStream& bs) = 0; /* gets called when the flv signature has been created and added to the bitstream, the bitstream is cleared after all listeners have been called so if you need to hold on to the data, copy it */ 40 | virtual void onTag(BitStream& bs, FLVTag& tag) = 0; /* gets called when the given tag has been created and added to the bitstream, the bitstream is cleared after all listeners have been called so if you need to hold on to the data, copy it */ 41 | }; 42 | 43 | // ------------------------------------ 44 | 45 | class FLVListeners { /* Container for multiple listeners, the caller is responsible for freeing the listeners */ 46 | public: 47 | void addListener(FLVListener* listener); 48 | void onSignature(BitStream& bs); /* gets called when the FLV signature is created; this is basically the file header */ 49 | void onTag(BitStream& bs, FLVTag& tag); /* gets called when a new FLV tag is created by the FLVWriter. The bitstream is cleared after all listeners have been called, so if you need to hold on to the data, copy it */ 50 | 51 | std::vector listeners; 52 | }; 53 | 54 | inline void FLVListeners::addListener(FLVListener* l) { 55 | listeners.push_back(l); 56 | } 57 | 58 | 59 | inline void FLVListeners::onSignature(BitStream& bs) { 60 | 61 | for(std::vector::iterator it = listeners.begin(); it != listeners.end(); ++it) { 62 | (*it)->onSignature(bs); 63 | } 64 | 65 | if(listeners.size()) { 66 | bs.clear(); 67 | } 68 | } 69 | 70 | inline void FLVListeners::onTag(BitStream& bs, FLVTag& tag) { 71 | 72 | for(std::vector::iterator it = listeners.begin(); it != listeners.end(); ++it) { 73 | (*it)->onTag(bs, tag); 74 | } 75 | 76 | if(listeners.size()) { 77 | bs.clear(); 78 | } 79 | } 80 | 81 | #endif 82 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/daemon/Channel.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | 21 | #ifndef ROXLU_VIDEOSTREAMER_CHANNEL_H 22 | #define ROXLU_VIDEOSTREAMER_CHANNEL_H 23 | 24 | extern "C" { 25 | # include 26 | # include 27 | # include 28 | # include 29 | } 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | // ---------------------------------------------- 39 | 40 | void channel_thread(void* user); /* the thread in which the channel work is done */ 41 | 42 | // ---------------------------------------------- 43 | 44 | struct ChannelPacket { 45 | ChannelPacket(); 46 | BitStream bs; 47 | }; 48 | 49 | // ---------------------------------------------- 50 | 51 | class Channel { 52 | public: 53 | Channel(); 54 | ~Channel(); 55 | bool setup(uint32_t id, std::string address); /* pass the stream id to which we're sending data (video/audio) and the address of the stream (ipc://, tcp://, inproc:// ) */ 56 | bool initialize(); /* start the channel */ 57 | bool shutdown(); /* stop the channel */ 58 | int send(uint8_t* data, size_t nbytes); 59 | void addVideoPacket(std::vector& pixels, uint32_t timestamp); 60 | // @todo - cleanup Channel.h 61 | //void addVideoPacket(AVPacket* p); /* add a video packet - we take ownership */ 62 | //void addAudioPacket(AVPacket* p); /* add an audiopacket - we take ownership */ 63 | private: 64 | //void addAVPacket(AVPacket* p); /* adds a generic av packet */ 65 | void addPacket(ChannelPacket* p); 66 | 67 | public: 68 | std::string stream_address; 69 | uint32_t stream_id; /* the video & audio, are sent to the server using unique streams */ 70 | uv_thread_t thread; 71 | uv_cond_t cv; 72 | uv_mutex_t mutex; 73 | std::vector work; /* packets that need to be delivered to the server */ 74 | int sock; 75 | }; 76 | 77 | // ---------------------------------------------- 78 | inline void Channel::addVideoPacket(std::vector& pixels, uint32_t timestamp) { 79 | ChannelPacket* cp = new ChannelPacket(); 80 | cp->bs.putU32(ToBE32(stream_id)); 81 | cp->bs.putU8(CP_TYPE_AVPACKET); 82 | cp->bs.putU32(ToBE32(timestamp)); 83 | cp->bs.putBytes(&pixels.front(), pixels.size()); 84 | addPacket(cp); 85 | } 86 | 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /applications/test_faac/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | # Test Audio input 4 | 5 | When using the settings from below you can use avconv to convert the test capture 6 | to an mp3 file. 7 | 8 | for: 2 channels, sampleformat: paInt16, samplerate: 44100 9 | ./avconv -v debug -f s16le -ac 2 -ar 44100 -i raw.pcm out.mp3 10 | 11 | */ 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include "AudioEncoderFAAC.h" 20 | 21 | std::ofstream ofs; 22 | 23 | void on_audio(const void* input, unsigned long nframes, void* user); 24 | 25 | AudioEncoderFAAC faac; 26 | bool must_run = true; 27 | 28 | void sighandler(int sig); 29 | 30 | int main() { 31 | 32 | AudioSettings audio_settings; 33 | audio_settings.samplerate = AV_AUDIO_SAMPLERATE_44100; 34 | audio_settings.mode = AV_AUDIO_MODE_STEREO; // meaning 2 channels 35 | audio_settings.bitrate = 64; 36 | audio_settings.bitsize = AV_AUDIO_BITSIZE_S16; 37 | audio_settings.in_bitsize = audio_settings.bitsize; 38 | audio_settings.in_interleaved = true; 39 | 40 | faac.setOutputFile(rx_get_exe_path() +"raw.aac"); 41 | 42 | if(!faac.setup(audio_settings)) { 43 | STREAMER_ERROR("Cannot setup faac. Stopping now.\n"); 44 | ::exit(EXIT_FAILURE); 45 | } 46 | 47 | if(!faac.initialize()) { 48 | STREAMER_ERROR("Cannot initialize faac. Stopping now.\n"); 49 | ::exit(EXIT_FAILURE); 50 | } 51 | 52 | faac.print(); 53 | 54 | std::string of = rx_get_exe_path()+"raw.pcm"; 55 | ofs.open(of.c_str(), std::ios::binary | std::ios::out); 56 | if(!ofs.is_open()) { 57 | printf("error: cannot open output file.\n"); 58 | ::exit(EXIT_FAILURE); 59 | } 60 | 61 | PAudio pa; 62 | 63 | pa.listDevices(); 64 | 65 | pa.setCallback(on_audio, NULL); 66 | 67 | if(!pa.openInputStream(pa.getDefaultInputDevice(), 2, paInt16, 44100, 1024)) { // faac.getSamplesNeededForEncoding())) { 68 | printf("error: cannot open input stream.\n"); 69 | ::exit(EXIT_FAILURE); 70 | } 71 | 72 | if(!pa.start()) { 73 | printf("error: cannot start the input stream.\n"); 74 | ::exit(EXIT_FAILURE); 75 | } 76 | 77 | printf("default input device: %d\n", pa.getDefaultInputDevice()); 78 | 79 | signal(SIGINT, sighandler); 80 | 81 | printf("audio in test"); 82 | while(must_run) { 83 | printf("..\n"); 84 | sleep(1); 85 | } 86 | 87 | if(ofs.is_open()) { 88 | ofs.close(); 89 | } 90 | 91 | return 0; 92 | } 93 | 94 | void on_audio(const void* input, unsigned long nframes, void* user) { 95 | 96 | size_t nbytes = nframes * sizeof(short int) * 2; 97 | 98 | #if 0 99 | 100 | printf("nbytes: %ld\n", nbytes); 101 | if(ofs.is_open()) { 102 | ofs.write((char*)input, nbytes); 103 | } 104 | 105 | #else 106 | 107 | uint8_t* ptr = (uint8_t*)input; 108 | AVPacket* pkt = new AVPacket(NULL); 109 | pkt->makeAudioPacket(); 110 | pkt->allocate(nbytes); 111 | pkt->data.assign(ptr, ptr+nbytes); 112 | 113 | FLVTag tag; 114 | faac.encodePacket(pkt, tag); 115 | 116 | delete pkt; 117 | pkt = NULL; 118 | 119 | #endif 120 | } 121 | 122 | 123 | void sighandler(int sig) { 124 | must_run = false; 125 | 126 | } 127 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/daemon/DaemonConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | */ 20 | #ifndef ROXLU_VIDEOSTREAMER_CONFIG_H 21 | #define ROXLU_VIDEOSTREAMER_CONFIG_H 22 | 23 | #include 24 | #include 25 | 26 | // @todo - replace this with VideoStreamerConfig! 27 | 28 | // ---------------------------------------------- 29 | 30 | struct StreamConfig { 31 | StreamConfig(); 32 | ~StreamConfig(); 33 | void reset(); 34 | void print(); 35 | bool usesVideo(); /* returns true when video is used, must be true for now */ 36 | bool usesAudio(); /* returns true when audio is used */ 37 | bool validate(); /* checks if all video settings are set and, if audio is set it checks these too; returns true when everything is ok */ 38 | 39 | int64_t id; 40 | 41 | /* ipc */ 42 | std::string address; /* socket/ipc address */ 43 | 44 | /* server */ 45 | std::string rtmp_url; 46 | 47 | /* video */ 48 | uint16_t width; 49 | uint16_t height; 50 | uint8_t fps; 51 | 52 | /* audio */ 53 | uint32_t samplerate; /* AV_AUDIO_SAMPLERATE_11025, AV_AUDIO_SAMPLERATE_22050, AV_AUDIO_SAMPLERATE__44100 */ 54 | uint32_t bitrate; /* bitrate in kilobits */ 55 | uint8_t bitsize; /* AV_AUDIO_BITSIZE_S8, AV_AUDIO_BITSIZE_S16, AV_AUDIO_BITSIZE_F32 */ 56 | uint8_t quality; /* 0-9, 0 = best, 9 = worst, 5 = ok */ 57 | uint8_t in_bitsize; /* AV_AUDIO_BITSIZE_S8, AV_AUDIO_BITSIZE_S16, AV_AUDIO_BITSIZE_F32, or nothing, then bitsize is used */ 58 | uint8_t in_interleaved; /* 0 = false, 1 = true */ 59 | uint8_t mode; /* AV_AUDIO_MODE_MONO, AV_AUDIO_MODE_STEREO */ 60 | }; 61 | 62 | // ---------------------------------------------- 63 | 64 | 65 | class DaemonConfig { 66 | public: 67 | DaemonConfig(); 68 | ~DaemonConfig(); 69 | typedef std::map::iterator iterator; 70 | iterator begin(); 71 | iterator end(); 72 | 73 | bool load(std::string filepath); 74 | 75 | public: 76 | Config conf; 77 | std::map configs; 78 | }; 79 | 80 | inline DaemonConfig::iterator DaemonConfig::begin() { 81 | return configs.begin(); 82 | } 83 | 84 | inline DaemonConfig::iterator DaemonConfig::end() { 85 | return configs.end(); 86 | } 87 | 88 | // ---------------------------------------------- 89 | 90 | inline bool StreamConfig::usesVideo() { 91 | return width || height || fps; 92 | } 93 | 94 | inline bool StreamConfig::usesAudio() { 95 | return samplerate || bitsize || quality; 96 | } 97 | 98 | #endif 99 | -------------------------------------------------------------------------------- /projects/grapher/src/grapher/opengl/OpenGLProfiler.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | // ------------------------------------------ 6 | 7 | OpenGLProfilerMarker::OpenGLProfilerMarker() 8 | :read_dx(0) 9 | ,write_dx(0) 10 | ,timestamp(0) 11 | ,graph_id(0) 12 | { 13 | } 14 | 15 | void OpenGLProfilerMarker::toggle() { 16 | } 17 | 18 | // ------------------------------------------ 19 | 20 | OpenGLProfiler::OpenGLProfiler() { 21 | glGenQueries(1, &qid); 22 | } 23 | 24 | OpenGLProfiler::~OpenGLProfiler() { 25 | } 26 | 27 | void OpenGLProfiler::addMarker(std::string name, int graphID) { 28 | OpenGLProfilerMarker marker; 29 | glGenQueries(NUM_QUERY_OBJECTS, marker.ids); 30 | for(int i = 0; i < (NUM_QUERY_OBJECTS - 1); ++i) { 31 | glQueryCounter(marker.ids[i], GL_TIMESTAMP); 32 | } 33 | 34 | marker.graph_id = graphID; 35 | marker.write_dx = NUM_QUERY_OBJECTS - 1; 36 | markers[name] = marker; 37 | } 38 | 39 | void OpenGLProfiler::update() { 40 | 41 | GLint is_ready = 0; 42 | 43 | std::map::iterator it = markers.begin(); 44 | while(it != markers.end()) { 45 | OpenGLProfilerMarker& m = it->second; 46 | glGetQueryObjectiv(m.ids[m.read_dx], GL_QUERY_RESULT_AVAILABLE, &is_ready); 47 | if(is_ready) { 48 | glGetQueryObjectui64v(m.ids[m.read_dx], GL_QUERY_RESULT, &m.timestamp); 49 | ++m.read_dx %= NUM_QUERY_OBJECTS; 50 | } 51 | else { 52 | printf("++ failed reading profiler marker, tried: %d. try to increase NUM_QUERY_OBJECTS\n", m.read_dx); 53 | } 54 | is_ready = 0; 55 | ++it; 56 | } 57 | 58 | GLuint64 prev_time = 0; 59 | GLuint64 diff_time = 0; 60 | 61 | for(std::vector::iterator it = measure_order.begin(); it != measure_order.end(); ++it) { 62 | OpenGLProfilerMarker& m = markers[(*it)]; 63 | if(prev_time) { 64 | diff_time = m.timestamp - prev_time; 65 | GRAPHER_ADD(m.graph_id, *it, diff_time); 66 | //printf("diff: %lld, diff ms: %f\n", diff_time, double(diff_time/1000000.0)); 67 | } 68 | prev_time = m.timestamp; 69 | } 70 | measure_order.clear(); 71 | } 72 | 73 | void OpenGLProfiler::measure(std::string name) { 74 | OpenGLProfilerMarker& marker = markers[name]; 75 | glQueryCounter(marker.ids[marker.write_dx], GL_TIMESTAMP); 76 | ++marker.write_dx %= NUM_QUERY_OBJECTS; 77 | 78 | measure_order.push_back(name); 79 | } 80 | 81 | 82 | // Public API 83 | // ------------------------------------------------ 84 | 85 | OpenGLProfiler* grapher_glprof = NULL; 86 | 87 | void glprof_init() { 88 | grapher_glprof = new OpenGLProfiler(); 89 | }; 90 | 91 | void glprof_measure(std::string marker) { 92 | if(!grapher_glprof) { 93 | printf("error: no OpenGLGrapher instance found; did you call GRAPHER_INIT()."); 94 | return; 95 | } 96 | grapher_glprof->measure(marker); 97 | } 98 | 99 | void glprof_add_marker(uint8_t id, std::string marker) { 100 | if(!grapher_glprof) { 101 | printf("error: no OpenGLGrapher instance found; did you call GRAPHER_INIT()."); 102 | return; 103 | } 104 | grapher_glprof->addMarker(marker, id); 105 | } 106 | 107 | void glprof_update() { 108 | if(!grapher_glprof) { 109 | printf("error: no OpenGLGrapher instance found; did you call GRAPHER_INIT()."); 110 | return; 111 | } 112 | grapher_glprof->update(); 113 | } 114 | -------------------------------------------------------------------------------- /projects/grapher/include/grapher/GraphConfigReader.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | # GraphConfig 20 | 21 | Used to load server and client graph configs. 22 | The server uses it for settings like window size, and tcp address. 23 | The client uses it to define the graphs you want to use. 24 | 25 | 26 | _Server config example, must be in the same path as the executable_ 27 | 28 | ````xml 29 | 30 | 31 |
tcp://127.0.0.1:7878
32 | 600 33 | 400 34 |
35 |
36 | ```` 37 | 38 | _Client config example_ 39 | 40 | ````xml 41 | 42 | 43 |
tcp://127.0.0.1:7878
44 |
45 | 46 | 47 | 0 48 | 700 49 | 300 50 | 10 51 | 5 52 | 10 53 | 15 54 | -100 55 | 100 56 | 57 | 58 | 1 59 | 700 60 | 200 61 | 10 62 | 5 63 | 10 64 | 15 65 | -100 66 | 100 67 | 68 | 69 | 70 |
71 | ```` 72 | 73 | */ 74 | #ifndef GRAPH_CONFIG_READER_H 75 | #define GRAPH_CONFIG_READER_H 76 | 77 | #include 78 | #include 79 | #include 80 | 81 | class GraphConfigReader { 82 | public: 83 | bool loadServerConfig(std::string filepath, ServerSettings& result); 84 | bool loadClientConfig(std::string filepath, ClientSettings& result); 85 | }; 86 | 87 | #endif 88 | -------------------------------------------------------------------------------- /projects/streamer/include/streamer/core/H264Parser.h: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | --------------------------------------------------------------------------------- 4 | 5 | oooo 6 | `888 7 | oooo d8b .ooooo. oooo ooo 888 oooo oooo 8 | `888""8P d88' `88b `88b..8P' 888 `888 `888 9 | 888 888 888 Y888' 888 888 888 10 | 888 888 888 .o8"'88b 888 888 888 11 | d888b `Y8bod8P' o88' 888o o888o `V88V"V8P' 12 | 13 | www.roxlu.com 14 | www.apollomedia.nl 15 | www.twitter.com/roxlu 16 | 17 | --------------------------------------------------------------------------------- 18 | 19 | 20 | # H264 Parser 21 | 22 | The _VideoStreamer_ lib makes use of h264 that gets muxed into 23 | FLV. This class is used to inspect some elementary fields from a 24 | h264 string. Because the nal units are all nicely separated we 25 | done need to do any parsing; we expect that each "data" ptr contains 26 | a valid nal unit. 27 | 28 | */ 29 | #ifndef ROXLU_H264_PARSER_H 30 | #define ROXLU_H264_PARSER_H 31 | 32 | #include 33 | #include 34 | 35 | struct nal_sps { 36 | nal_sps(); 37 | 38 | uint8_t profile_idc; 39 | uint8_t constraint_set0_flag; 40 | uint8_t constraint_set1_flag; 41 | uint8_t constraint_set2_flag; 42 | uint8_t constraint_set3_flag; 43 | uint8_t constraint_set4_flag; 44 | uint8_t constraint_set5_flag; 45 | uint8_t reserved_zero_2bits; 46 | uint8_t level_idc; 47 | 48 | }; 49 | 50 | 51 | struct NalUnit { 52 | NalUnit(); 53 | 54 | uint8_t forbidden_zero_bit; 55 | uint8_t nal_ref_idc; 56 | uint8_t nal_unit_type; 57 | 58 | nal_sps sps; 59 | }; 60 | 61 | 62 | 63 | 64 | class H264Parser { 65 | public: 66 | H264Parser(uint8_t* nal); 67 | bool parse(); 68 | bool parseSPS(NalUnit& n); 69 | bool parsePPS(NalUnit& n); 70 | 71 | uint8_t readBit(); 72 | uint8_t readBits(uint8_t nbits); 73 | uint8_t u(uint8_t nbits); /* unsigned integer using n-bits */ 74 | uint8_t u8(); /* read on byte */ 75 | uint8_t f(uint8_t nbits); /* fixed pattern bit string */ 76 | uint8_t b(); /* byte */ 77 | private: 78 | uint8_t* nal; 79 | uint32_t bit_offset; 80 | uint32_t byte_offset; 81 | }; 82 | 83 | 84 | inline uint8_t H264Parser::readBit() { 85 | uint8_t byte = nal[byte_offset]; 86 | uint8_t mask = 1 << (7 - bit_offset); 87 | 88 | ++bit_offset; 89 | if(bit_offset > 7) { 90 | bit_offset = 0; 91 | ++byte_offset; 92 | } 93 | 94 | return (byte & mask) ? 1 : 0; 95 | } 96 | 97 | inline uint8_t H264Parser::readBits(uint8_t nbits) { 98 | if(nbits > 7) { 99 | return 0; 100 | } 101 | uint8_t result = 0x00; 102 | uint8_t bitpos = 0; 103 | for(uint8_t i = 0; i < nbits; ++i) { 104 | bitpos = 7 - bit_offset; 105 | result |= (readBit() << bitpos); 106 | } 107 | 108 | return result; 109 | } 110 | 111 | inline uint8_t H264Parser::u8() { 112 | uint8_t result = nal[byte_offset]; 113 | byte_offset++; 114 | return result; 115 | } 116 | 117 | inline uint8_t H264Parser::u(uint8_t nbits) { 118 | return readBits(nbits); 119 | } 120 | 121 | inline uint8_t H264Parser::f(uint8_t nbits) { 122 | return u(nbits) ? 1: 0; 123 | } 124 | 125 | #endif 126 | -------------------------------------------------------------------------------- /projects/grapher/build/cmake/functions.sh: -------------------------------------------------------------------------------- 1 | # Supported compilers 2 | ROXLU_CLANG=1 3 | ROXLU_GCC=2 4 | 5 | # Create the build.debug, build.release, etc.. directories when they don't exist 6 | roxlu_check_build_dirs() { 7 | d=${PWD} 8 | bd=${d}/../../bin/ 9 | 10 | if [ ! -d ${d}/build.debug ] ; then 11 | mkdir ${d}/build.debug 12 | fi 13 | 14 | if [ ! -d ${d}/build.release ] ; then 15 | mkdir ${d}/build.release 16 | fi 17 | 18 | if [ ! -d ${d}/build.xcodeproject ] ; then 19 | mkdir ${d}/build.xcodeproject 20 | fi 21 | 22 | } 23 | 24 | roxlu_remove_build_dirs() { 25 | d=${PWD} 26 | 27 | if [ -d ${d}/build.release ] ; then 28 | rm -rf ${d}/build.release 29 | fi 30 | 31 | if [ -d ${d}/build.debug ] ; then 32 | rm -rf ${d}/build.debug 33 | fi 34 | 35 | if [ -d ${d}/build.xcodeproject ] ; then 36 | rm -rf ${d}/build.xcodeproject 37 | fi 38 | } 39 | 40 | 41 | # Set the export CC and CXX variables to the default compiler; we default to clang on mac, gcc on linux 42 | # but only when CC and CXX haven't been set yet 43 | # you can pass a parameter that defines the compiler: 44 | # e.g. roxlu_check_compiler ROXLU_CLANG 45 | # e.g. roxlu_check_compiler ROXLU_GCC 46 | roxlu_check_compiler() { 47 | 48 | if [ "${1}" = "" ] ; then 49 | return 50 | fi 51 | 52 | if [ ${1} = ROXLU_CLANG ] ; then 53 | roxlu_use_clang 54 | elif [ ${1} = ROXLU_GCC ] ; then 55 | roxlu_use_gcc 56 | else 57 | roxlu_use_clang 58 | fi 59 | } 60 | 61 | roxlu_use_clang() { 62 | 63 | if [ -f /usr/bin/clang ] ; then 64 | export CC="/usr/bin/clang" 65 | else 66 | echo "Cannot find clang" 67 | fi 68 | 69 | if [ -f /usr/bin/clang++ ] ; then 70 | export CXX="/usr/bin/clang++" 71 | else 72 | echo "Cannot find clang++" 73 | fi 74 | } 75 | 76 | roxlu_use_gcc() { 77 | 78 | if [ -f /usr/bin/gcc ] ; then 79 | export CC="/usr/bin/gcc" 80 | else 81 | echo "Cannot find gcc" 82 | fi 83 | 84 | 85 | if [ -f /usr/bin/g++ ] ; then 86 | export CXX="/usr/bin/g++" 87 | else 88 | echo "Cannot find g++" 89 | fi 90 | 91 | } 92 | 93 | roxlu_build_debug() { 94 | d=${PWD} 95 | cd ${d}/build.debug 96 | cmake -DCMAKE_BUILD_TYPE=Debug ../ 97 | make -j4 # VERBOSE=1 98 | make install 99 | } 100 | 101 | roxlu_build_release() { 102 | cd build.release 103 | cmake -DCMAKE_BUILD_TYPE=Release ../ 104 | make -j4 105 | make install 106 | } 107 | 108 | roxlu_create_xcodeproject() { 109 | d=${PWD} 110 | if [ -d ${d}/build.xcodeproject ] ; then 111 | rm -rf ${d}/build.xcodeproject 112 | fi 113 | 114 | if [ ! -d ${d}/build.xcodeproject ] ; then 115 | mkdir ${d}/build.xcodeproject 116 | fi 117 | 118 | 119 | cd ${d}/build.xcodeproject 120 | cmake -G Xcode ../ 121 | } 122 | 123 | roxlu_run_release() { 124 | d=${PWD} 125 | bd=${d}/../../bin 126 | appdir=${bd}/../ 127 | 128 | # get app name 129 | cd ${appdir} 130 | app=${PWD##*/} 131 | 132 | cd ${d} 133 | ./build_release.sh 134 | 135 | cd ${d}/../../install/bin 136 | 137 | ./${app} 138 | } 139 | 140 | roxlu_run_debug() { 141 | d=${PWD} 142 | bd=${d}/../../bin 143 | appdir=${bd}/../ 144 | 145 | # get app name 146 | cd ${appdir} 147 | app=${PWD##*/}_debug 148 | 149 | # make sure we have the build + data dirs 150 | cd ${d} 151 | 152 | ./build_debug.sh 153 | 154 | cd ${d}/../../../install/bin 155 | 156 | ./${app} 157 | 158 | } 159 | -------------------------------------------------------------------------------- /projects/streamer/src/streamer/amf/types/AMF0Object.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | AMF0Object::AMF0Object(BitStream& bs) 8 | :AMFType(AMF0_TYPE_OBJECT, bs) 9 | { 10 | } 11 | 12 | AMF0Object::~AMF0Object() { 13 | removeElements(); 14 | } 15 | 16 | void AMF0Object::removeElements() { 17 | for(std::vector::iterator it = values.begin(); it != values.end(); ++it) { 18 | AMF0Property* p = *it; 19 | delete p; 20 | p = NULL; 21 | } 22 | values.clear(); 23 | } 24 | 25 | void AMF0Object::print() { 26 | std::stringstream ss; 27 | 28 | for(std::vector::iterator it = values.begin(); it != values.end(); ++it) { 29 | AMF0Property* p = *it; 30 | AMFType* el = p->value; 31 | ss << p->name->value << " = "; 32 | switch(el->type) { 33 | case AMF0_TYPE_STRING: { 34 | AMF0String* str = static_cast(el); 35 | ss << str->value << "\n"; 36 | break; 37 | } 38 | case AMF0_TYPE_NUMBER: { 39 | AMF0Number* num = static_cast(el); 40 | ss << num->value << "\n"; 41 | break; 42 | } 43 | case AMF0_TYPE_BOOLEAN: { 44 | AMF0Boolean* b = static_cast(el); 45 | ss << ((b->value) ? 'Y' : 'N') << "\n"; 46 | break; 47 | } 48 | default: break; 49 | } 50 | } 51 | 52 | std::string str = ss.str(); 53 | printf("%s\n", str.c_str()); 54 | } 55 | 56 | void AMF0Object::add(std::string name, AMFType* v) { 57 | AMF0String* s = new AMF0String(bs); 58 | s->value = name; 59 | add(s, v); 60 | } 61 | 62 | void AMF0Object::add(AMF0String* name, AMFType* v) { 63 | AMF0Property* p = new AMF0Property(); 64 | p->name = name; 65 | p->value = v; 66 | values.push_back(p); 67 | } 68 | 69 | void AMF0Object::read() { 70 | /* 71 | uint8_t marker = bs.getU8(); 72 | if(marker != AMF0_TYPE_OBJECT) { 73 | printf("error: the current marker is not a valid object, marker = %02X\n", marker); 74 | return; 75 | } 76 | */ 77 | readElements(); 78 | } 79 | 80 | void AMF0Object::readElements() { 81 | while(true) { 82 | 83 | AMF0String* name = new AMF0String(bs); 84 | name->read(); 85 | 86 | uint8_t type = bs.getU8(); 87 | switch(type) { 88 | 89 | case AMF0_TYPE_NUMBER: { 90 | AMF0Number* el = new AMF0Number(bs); 91 | el->read(); 92 | add(name, el); 93 | break; 94 | } 95 | case AMF0_TYPE_BOOLEAN: { 96 | AMF0Boolean* el = new AMF0Boolean(bs); 97 | el->read(); 98 | add(name, el); 99 | break; 100 | } 101 | case AMF0_TYPE_STRING: { 102 | AMF0String* el = new AMF0String(bs); 103 | el->read(); 104 | add(name, el); 105 | break; 106 | } 107 | case AMF0_TYPE_OBJECT_END: { 108 | return; 109 | } 110 | default: { 111 | printf("unhandled ecma array element: %02X\n", type); 112 | return; 113 | } 114 | } 115 | } 116 | } 117 | 118 | void AMF0Object::write() { 119 | bs.putU8(AMF0_TYPE_OBJECT); 120 | writeElements(); 121 | } 122 | 123 | void AMF0Object::writeElements() { 124 | 125 | for(std::vector::iterator it = values.begin(); it != values.end(); ++it) { 126 | AMF0Property* p = *it; 127 | p->name->write(); 128 | bs.putU8(p->value->type); 129 | p->value->write(); 130 | } 131 | 132 | AMF0String str(bs); 133 | str.write(); 134 | 135 | bs.putU8(AMF0_TYPE_OBJECT_END); 136 | } 137 | -------------------------------------------------------------------------------- /applications/test_audio_in/build/cmake/functions.sh: -------------------------------------------------------------------------------- 1 | # Supported compilers 2 | ROXLU_CLANG=1 3 | ROXLU_GCC=2 4 | 5 | # Create the build.debug, build.release, etc.. directories when they don't exist 6 | roxlu_check_build_dirs() { 7 | d=${PWD} 8 | bd=${d}/../../bin/ 9 | 10 | if [ ! -d ${d}/build.debug ] ; then 11 | mkdir ${d}/build.debug 12 | fi 13 | 14 | if [ ! -d ${d}/build.release ] ; then 15 | mkdir ${d}/build.release 16 | fi 17 | 18 | if [ ! -d ${d}/build.xcodeproject ] ; then 19 | mkdir ${d}/build.xcodeproject 20 | fi 21 | } 22 | 23 | roxlu_remove_build_dirs() { 24 | d=${PWD} 25 | 26 | if [ -d ${d}/build.release ] ; then 27 | rm -rf ${d}/build.release 28 | fi 29 | 30 | if [ -d ${d}/build.debug ] ; then 31 | rm -rf ${d}/build.debug 32 | fi 33 | 34 | if [ -d ${d}/build.xcodeproject ] ; then 35 | rm -rf ${d}/build.xcodeproject 36 | fi 37 | } 38 | 39 | 40 | # Set the export CC and CXX variables to the default compiler; we default to clang on mac, gcc on linux 41 | # but only when CC and CXX haven't been set yet 42 | # you can pass a parameter that defines the compiler: 43 | # e.g. roxlu_check_compiler ROXLU_CLANG 44 | # e.g. roxlu_check_compiler ROXLU_GCC 45 | roxlu_check_compiler() { 46 | 47 | if [ "${1}" = "" ] ; then 48 | return 49 | fi 50 | 51 | if [ ${1} = ROXLU_CLANG ] ; then 52 | roxlu_use_clang 53 | elif [ ${1} = ROXLU_GCC ] ; then 54 | roxlu_use_gcc 55 | else 56 | roxlu_use_clang 57 | fi 58 | } 59 | 60 | roxlu_use_clang() { 61 | 62 | if [ -f /usr/bin/clang ] ; then 63 | export CC="/usr/bin/clang" 64 | else 65 | echo "Cannot find clang" 66 | fi 67 | 68 | if [ -f /usr/bin/clang++ ] ; then 69 | export CXX="/usr/bin/clang++" 70 | else 71 | echo "Cannot find clang++" 72 | fi 73 | } 74 | 75 | roxlu_use_gcc() { 76 | 77 | if [ -f /usr/bin/gcc ] ; then 78 | export CC="/usr/bin/gcc" 79 | else 80 | echo "Cannot find gcc" 81 | fi 82 | 83 | 84 | if [ -f /usr/bin/g++ ] ; then 85 | export CXX="/usr/bin/g++" 86 | else 87 | echo "Cannot find g++" 88 | fi 89 | 90 | } 91 | 92 | roxlu_build_debug() { 93 | d=${PWD} 94 | cd ${d}/build.debug 95 | cmake -DCMAKE_BUILD_TYPE=Debug ../ 96 | make -j4 # VERBOSE=1 97 | make install 98 | } 99 | 100 | roxlu_build_release() { 101 | cd build.release 102 | cmake -DCMAKE_BUILD_TYPE=Release ../ 103 | make -j4 104 | make install 105 | } 106 | 107 | roxlu_create_xcodeproject() { 108 | d=${PWD} 109 | if [ -d ${d}/build.xcodeproject ] ; then 110 | rm -rf ${d}/build.xcodeproject 111 | fi 112 | 113 | if [ ! -d ${d}/build.xcodeproject ] ; then 114 | mkdir ${d}/build.xcodeproject 115 | fi 116 | 117 | 118 | cd ${d}/build.xcodeproject 119 | cmake -G Xcode ../ 120 | } 121 | 122 | roxlu_run_release() { 123 | d=${PWD} 124 | bd=${d}/../../bin 125 | appdir=${bd}/../../ 126 | 127 | # get app name 128 | cd ${appdir} 129 | app=${PWD##*/} 130 | 131 | cd ${d} 132 | ./build_release.sh 133 | 134 | cd ${d}/../../install/bin 135 | 136 | ./${app} 137 | } 138 | 139 | roxlu_run_debug() { 140 | d=${PWD} 141 | bd=${d}/../../bin 142 | appdir=${bd}/../../ 143 | 144 | # get app name 145 | cd ${appdir} 146 | app=${PWD##*/}_debug 147 | 148 | # make sure we have the build + data dirs 149 | cd ${d} 150 | 151 | ./build_debug.sh 152 | 153 | cd ${d}/../../install/bin 154 | 155 | ./${app} 156 | 157 | } 158 | -------------------------------------------------------------------------------- /applications/test_faac/build/cmake/functions.sh: -------------------------------------------------------------------------------- 1 | # Supported compilers 2 | ROXLU_CLANG=1 3 | ROXLU_GCC=2 4 | 5 | # Create the build.debug, build.release, etc.. directories when they don't exist 6 | roxlu_check_build_dirs() { 7 | d=${PWD} 8 | bd=${d}/../../bin/ 9 | 10 | if [ ! -d ${d}/build.debug ] ; then 11 | mkdir ${d}/build.debug 12 | fi 13 | 14 | if [ ! -d ${d}/build.release ] ; then 15 | mkdir ${d}/build.release 16 | fi 17 | 18 | if [ ! -d ${d}/build.xcodeproject ] ; then 19 | mkdir ${d}/build.xcodeproject 20 | fi 21 | } 22 | 23 | roxlu_remove_build_dirs() { 24 | d=${PWD} 25 | 26 | if [ -d ${d}/build.release ] ; then 27 | rm -rf ${d}/build.release 28 | fi 29 | 30 | if [ -d ${d}/build.debug ] ; then 31 | rm -rf ${d}/build.debug 32 | fi 33 | 34 | if [ -d ${d}/build.xcodeproject ] ; then 35 | rm -rf ${d}/build.xcodeproject 36 | fi 37 | } 38 | 39 | 40 | # Set the export CC and CXX variables to the default compiler; we default to clang on mac, gcc on linux 41 | # but only when CC and CXX haven't been set yet 42 | # you can pass a parameter that defines the compiler: 43 | # e.g. roxlu_check_compiler ROXLU_CLANG 44 | # e.g. roxlu_check_compiler ROXLU_GCC 45 | roxlu_check_compiler() { 46 | 47 | if [ "${1}" = "" ] ; then 48 | return 49 | fi 50 | 51 | if [ ${1} = ROXLU_CLANG ] ; then 52 | roxlu_use_clang 53 | elif [ ${1} = ROXLU_GCC ] ; then 54 | roxlu_use_gcc 55 | else 56 | roxlu_use_clang 57 | fi 58 | } 59 | 60 | roxlu_use_clang() { 61 | 62 | if [ -f /usr/bin/clang ] ; then 63 | export CC="/usr/bin/clang" 64 | else 65 | echo "Cannot find clang" 66 | fi 67 | 68 | if [ -f /usr/bin/clang++ ] ; then 69 | export CXX="/usr/bin/clang++" 70 | else 71 | echo "Cannot find clang++" 72 | fi 73 | } 74 | 75 | roxlu_use_gcc() { 76 | 77 | if [ -f /usr/bin/gcc ] ; then 78 | export CC="/usr/bin/gcc" 79 | else 80 | echo "Cannot find gcc" 81 | fi 82 | 83 | 84 | if [ -f /usr/bin/g++ ] ; then 85 | export CXX="/usr/bin/g++" 86 | else 87 | echo "Cannot find g++" 88 | fi 89 | 90 | } 91 | 92 | roxlu_build_debug() { 93 | d=${PWD} 94 | cd ${d}/build.debug 95 | cmake -DCMAKE_BUILD_TYPE=Debug ../ 96 | make -j4 # VERBOSE=1 97 | make install 98 | } 99 | 100 | roxlu_build_release() { 101 | cd build.release 102 | cmake -DCMAKE_BUILD_TYPE=Release ../ 103 | make -j4 104 | make install 105 | } 106 | 107 | roxlu_create_xcodeproject() { 108 | d=${PWD} 109 | if [ -d ${d}/build.xcodeproject ] ; then 110 | rm -rf ${d}/build.xcodeproject 111 | fi 112 | 113 | if [ ! -d ${d}/build.xcodeproject ] ; then 114 | mkdir ${d}/build.xcodeproject 115 | fi 116 | 117 | 118 | cd ${d}/build.xcodeproject 119 | cmake -G Xcode ../ 120 | } 121 | 122 | roxlu_run_release() { 123 | d=${PWD} 124 | bd=${d}/../../bin 125 | appdir=${bd}/../../ 126 | 127 | # get app name 128 | cd ${appdir} 129 | app=${PWD##*/} 130 | 131 | cd ${d} 132 | ./build_release.sh 133 | 134 | cd ${d}/../../install/bin 135 | 136 | ./${app} 137 | } 138 | 139 | roxlu_run_debug() { 140 | d=${PWD} 141 | bd=${d}/../../bin 142 | appdir=${bd}/../../ 143 | 144 | # get app name 145 | cd ${appdir} 146 | app=${PWD##*/}_debug 147 | 148 | # make sure we have the build + data dirs 149 | cd ${d} 150 | 151 | ./build_debug.sh 152 | 153 | cd ${d}/../../install/bin 154 | 155 | ./${app} 156 | 157 | } 158 | -------------------------------------------------------------------------------- /applications/test_connection/build/cmake/functions.sh: -------------------------------------------------------------------------------- 1 | # Supported compilers 2 | ROXLU_CLANG=1 3 | ROXLU_GCC=2 4 | 5 | # Create the build.debug, build.release, etc.. directories when they don't exist 6 | roxlu_check_build_dirs() { 7 | d=${PWD} 8 | bd=${d}/../../bin/ 9 | 10 | if [ ! -d ${d}/build.debug ] ; then 11 | mkdir ${d}/build.debug 12 | fi 13 | 14 | if [ ! -d ${d}/build.release ] ; then 15 | mkdir ${d}/build.release 16 | fi 17 | 18 | if [ ! -d ${d}/build.xcodeproject ] ; then 19 | mkdir ${d}/build.xcodeproject 20 | fi 21 | } 22 | 23 | roxlu_remove_build_dirs() { 24 | d=${PWD} 25 | 26 | if [ -d ${d}/build.release ] ; then 27 | rm -rf ${d}/build.release 28 | fi 29 | 30 | if [ -d ${d}/build.debug ] ; then 31 | rm -rf ${d}/build.debug 32 | fi 33 | 34 | if [ -d ${d}/build.xcodeproject ] ; then 35 | rm -rf ${d}/build.xcodeproject 36 | fi 37 | } 38 | 39 | 40 | # Set the export CC and CXX variables to the default compiler; we default to clang on mac, gcc on linux 41 | # but only when CC and CXX haven't been set yet 42 | # you can pass a parameter that defines the compiler: 43 | # e.g. roxlu_check_compiler ROXLU_CLANG 44 | # e.g. roxlu_check_compiler ROXLU_GCC 45 | roxlu_check_compiler() { 46 | 47 | if [ "${1}" = "" ] ; then 48 | return 49 | fi 50 | 51 | if [ ${1} = ROXLU_CLANG ] ; then 52 | roxlu_use_clang 53 | elif [ ${1} = ROXLU_GCC ] ; then 54 | roxlu_use_gcc 55 | else 56 | roxlu_use_clang 57 | fi 58 | } 59 | 60 | roxlu_use_clang() { 61 | 62 | if [ -f /usr/bin/clang ] ; then 63 | export CC="/usr/bin/clang" 64 | else 65 | echo "Cannot find clang" 66 | fi 67 | 68 | if [ -f /usr/bin/clang++ ] ; then 69 | export CXX="/usr/bin/clang++" 70 | else 71 | echo "Cannot find clang++" 72 | fi 73 | } 74 | 75 | roxlu_use_gcc() { 76 | 77 | if [ -f /usr/bin/gcc ] ; then 78 | export CC="/usr/bin/gcc" 79 | else 80 | echo "Cannot find gcc" 81 | fi 82 | 83 | 84 | if [ -f /usr/bin/g++ ] ; then 85 | export CXX="/usr/bin/g++" 86 | else 87 | echo "Cannot find g++" 88 | fi 89 | 90 | } 91 | 92 | roxlu_build_debug() { 93 | d=${PWD} 94 | cd ${d}/build.debug 95 | cmake -DCMAKE_BUILD_TYPE=Debug ../ 96 | make -j4 # VERBOSE=1 97 | make install 98 | } 99 | 100 | roxlu_build_release() { 101 | cd build.release 102 | cmake -DCMAKE_BUILD_TYPE=Release ../ 103 | make -j4 104 | make install 105 | } 106 | 107 | roxlu_create_xcodeproject() { 108 | d=${PWD} 109 | if [ -d ${d}/build.xcodeproject ] ; then 110 | rm -rf ${d}/build.xcodeproject 111 | fi 112 | 113 | if [ ! -d ${d}/build.xcodeproject ] ; then 114 | mkdir ${d}/build.xcodeproject 115 | fi 116 | 117 | 118 | cd ${d}/build.xcodeproject 119 | cmake -G Xcode ../ 120 | } 121 | 122 | roxlu_run_release() { 123 | d=${PWD} 124 | bd=${d}/../../bin 125 | appdir=${bd}/../../ 126 | 127 | # get app name 128 | cd ${appdir} 129 | app=${PWD##*/} 130 | 131 | cd ${d} 132 | ./build_release.sh 133 | 134 | cd ${d}/../../install/bin 135 | 136 | ./${app} 137 | } 138 | 139 | roxlu_run_debug() { 140 | d=${PWD} 141 | bd=${d}/../../bin 142 | appdir=${bd}/../../ 143 | 144 | # get app name 145 | cd ${appdir} 146 | app=${PWD##*/}_debug 147 | 148 | # make sure we have the build + data dirs 149 | cd ${d} 150 | 151 | ./build_debug.sh 152 | 153 | cd ${d}/../../install/bin 154 | 155 | ./${app} 156 | 157 | } 158 | -------------------------------------------------------------------------------- /applications/yuv420p_grabber/build/cmake/functions.sh: -------------------------------------------------------------------------------- 1 | # Supported compilers 2 | ROXLU_CLANG=1 3 | ROXLU_GCC=2 4 | 5 | # Create the build.debug, build.release, etc.. directories when they don't exist 6 | roxlu_check_build_dirs() { 7 | d=${PWD} 8 | bd=${d}/../../bin/ 9 | 10 | if [ ! -d ${d}/build.debug ] ; then 11 | mkdir ${d}/build.debug 12 | fi 13 | 14 | if [ ! -d ${d}/build.release ] ; then 15 | mkdir ${d}/build.release 16 | fi 17 | 18 | if [ ! -d ${d}/build.xcodeproject ] ; then 19 | mkdir ${d}/build.xcodeproject 20 | fi 21 | } 22 | 23 | roxlu_remove_build_dirs() { 24 | d=${PWD} 25 | 26 | if [ -d ${d}/build.release ] ; then 27 | rm -rf ${d}/build.release 28 | fi 29 | 30 | if [ -d ${d}/build.debug ] ; then 31 | rm -rf ${d}/build.debug 32 | fi 33 | 34 | if [ -d ${d}/build.xcodeproject ] ; then 35 | rm -rf ${d}/build.xcodeproject 36 | fi 37 | } 38 | 39 | 40 | # Set the export CC and CXX variables to the default compiler; we default to clang on mac, gcc on linux 41 | # but only when CC and CXX haven't been set yet 42 | # you can pass a parameter that defines the compiler: 43 | # e.g. roxlu_check_compiler ROXLU_CLANG 44 | # e.g. roxlu_check_compiler ROXLU_GCC 45 | roxlu_check_compiler() { 46 | 47 | if [ "${1}" = "" ] ; then 48 | return 49 | fi 50 | 51 | if [ ${1} = ROXLU_CLANG ] ; then 52 | roxlu_use_clang 53 | elif [ ${1} = ROXLU_GCC ] ; then 54 | roxlu_use_gcc 55 | else 56 | roxlu_use_clang 57 | fi 58 | } 59 | 60 | roxlu_use_clang() { 61 | 62 | if [ -f /usr/bin/clang ] ; then 63 | export CC="/usr/bin/clang" 64 | else 65 | echo "Cannot find clang" 66 | fi 67 | 68 | if [ -f /usr/bin/clang++ ] ; then 69 | export CXX="/usr/bin/clang++" 70 | else 71 | echo "Cannot find clang++" 72 | fi 73 | } 74 | 75 | roxlu_use_gcc() { 76 | 77 | if [ -f /usr/bin/gcc ] ; then 78 | export CC="/usr/bin/gcc" 79 | else 80 | echo "Cannot find gcc" 81 | fi 82 | 83 | 84 | if [ -f /usr/bin/g++ ] ; then 85 | export CXX="/usr/bin/g++" 86 | else 87 | echo "Cannot find g++" 88 | fi 89 | 90 | } 91 | 92 | roxlu_build_debug() { 93 | d=${PWD} 94 | cd ${d}/build.debug 95 | cmake -DCMAKE_BUILD_TYPE=Debug ../ 96 | make -j4 # VERBOSE=1 97 | make install 98 | } 99 | 100 | roxlu_build_release() { 101 | cd build.release 102 | cmake -DCMAKE_BUILD_TYPE=Release ../ 103 | make -j4 104 | make install 105 | } 106 | 107 | roxlu_create_xcodeproject() { 108 | d=${PWD} 109 | if [ -d ${d}/build.xcodeproject ] ; then 110 | rm -rf ${d}/build.xcodeproject 111 | fi 112 | 113 | if [ ! -d ${d}/build.xcodeproject ] ; then 114 | mkdir ${d}/build.xcodeproject 115 | fi 116 | 117 | 118 | cd ${d}/build.xcodeproject 119 | cmake -G Xcode ../ 120 | } 121 | 122 | roxlu_run_release() { 123 | d=${PWD} 124 | bd=${d}/../../bin 125 | appdir=${bd}/../../ 126 | 127 | # get app name 128 | cd ${appdir} 129 | app=${PWD##*/} 130 | 131 | cd ${d} 132 | ./build_release.sh 133 | 134 | cd ${d}/../../install/bin 135 | 136 | ./${app} 137 | } 138 | 139 | roxlu_run_debug() { 140 | d=${PWD} 141 | bd=${d}/../../bin 142 | appdir=${bd}/../../ 143 | 144 | # get app name 145 | cd ${appdir} 146 | app=${PWD##*/}_debug 147 | 148 | # make sure we have the build + data dirs 149 | cd ${d} 150 | 151 | ./build_debug.sh 152 | 153 | cd ${d}/../../install/bin 154 | 155 | ./${app} 156 | 157 | } 158 | -------------------------------------------------------------------------------- /applications/test_multi_streamer/build/cmake/functions.sh: -------------------------------------------------------------------------------- 1 | # Supported compilers 2 | ROXLU_CLANG=1 3 | ROXLU_GCC=2 4 | 5 | # Create the build.debug, build.release, etc.. directories when they don't exist 6 | roxlu_check_build_dirs() { 7 | d=${PWD} 8 | bd=${d}/../../bin/ 9 | 10 | if [ ! -d ${d}/build.debug ] ; then 11 | mkdir ${d}/build.debug 12 | fi 13 | 14 | if [ ! -d ${d}/build.release ] ; then 15 | mkdir ${d}/build.release 16 | fi 17 | 18 | if [ ! -d ${d}/build.xcodeproject ] ; then 19 | mkdir ${d}/build.xcodeproject 20 | fi 21 | } 22 | 23 | roxlu_remove_build_dirs() { 24 | d=${PWD} 25 | 26 | if [ -d ${d}/build.release ] ; then 27 | rm -rf ${d}/build.release 28 | fi 29 | 30 | if [ -d ${d}/build.debug ] ; then 31 | rm -rf ${d}/build.debug 32 | fi 33 | 34 | if [ -d ${d}/build.xcodeproject ] ; then 35 | rm -rf ${d}/build.xcodeproject 36 | fi 37 | } 38 | 39 | 40 | # Set the export CC and CXX variables to the default compiler; we default to clang on mac, gcc on linux 41 | # but only when CC and CXX haven't been set yet 42 | # you can pass a parameter that defines the compiler: 43 | # e.g. roxlu_check_compiler ROXLU_CLANG 44 | # e.g. roxlu_check_compiler ROXLU_GCC 45 | roxlu_check_compiler() { 46 | 47 | if [ "${1}" = "" ] ; then 48 | return 49 | fi 50 | 51 | if [ ${1} = ROXLU_CLANG ] ; then 52 | roxlu_use_clang 53 | elif [ ${1} = ROXLU_GCC ] ; then 54 | roxlu_use_gcc 55 | else 56 | roxlu_use_clang 57 | fi 58 | } 59 | 60 | roxlu_use_clang() { 61 | 62 | if [ -f /usr/bin/clang ] ; then 63 | export CC="/usr/bin/clang" 64 | else 65 | echo "Cannot find clang" 66 | fi 67 | 68 | if [ -f /usr/bin/clang++ ] ; then 69 | export CXX="/usr/bin/clang++" 70 | else 71 | echo "Cannot find clang++" 72 | fi 73 | } 74 | 75 | roxlu_use_gcc() { 76 | 77 | if [ -f /usr/bin/gcc ] ; then 78 | export CC="/usr/bin/gcc" 79 | else 80 | echo "Cannot find gcc" 81 | fi 82 | 83 | 84 | if [ -f /usr/bin/g++ ] ; then 85 | export CXX="/usr/bin/g++" 86 | else 87 | echo "Cannot find g++" 88 | fi 89 | 90 | } 91 | 92 | roxlu_build_debug() { 93 | d=${PWD} 94 | cd ${d}/build.debug 95 | cmake -DCMAKE_BUILD_TYPE=Debug ../ 96 | make -j4 # VERBOSE=1 97 | make install 98 | } 99 | 100 | roxlu_build_release() { 101 | cd build.release 102 | cmake -DCMAKE_BUILD_TYPE=Release ../ 103 | make -j4 104 | make install 105 | } 106 | 107 | roxlu_create_xcodeproject() { 108 | d=${PWD} 109 | if [ -d ${d}/build.xcodeproject ] ; then 110 | rm -rf ${d}/build.xcodeproject 111 | fi 112 | 113 | if [ ! -d ${d}/build.xcodeproject ] ; then 114 | mkdir ${d}/build.xcodeproject 115 | fi 116 | 117 | 118 | cd ${d}/build.xcodeproject 119 | cmake -G Xcode ../ 120 | } 121 | 122 | roxlu_run_release() { 123 | d=${PWD} 124 | bd=${d}/../../bin 125 | appdir=${bd}/../../ 126 | 127 | # get app name 128 | cd ${appdir} 129 | app=${PWD##*/} 130 | 131 | cd ${d} 132 | ./build_release.sh 133 | 134 | cd ${d}/../../install/bin 135 | 136 | ./${app} 137 | } 138 | 139 | roxlu_run_debug() { 140 | d=${PWD} 141 | bd=${d}/../../bin 142 | appdir=${bd}/../../ 143 | 144 | # get app name 145 | cd ${appdir} 146 | app=${PWD##*/}_debug 147 | 148 | # make sure we have the build + data dirs 149 | cd ${d} 150 | 151 | ./build_debug.sh 152 | 153 | cd ${d}/../../install/bin 154 | 155 | ./${app} 156 | 157 | } 158 | --------------------------------------------------------------------------------