├── .clang-format ├── .dockerignore ├── .editorconfig ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yaml │ ├── config.yml │ └── feature_request.yaml └── workflows │ ├── linux-system.yml │ ├── linux.yml │ └── windows.yml ├── .gitignore ├── BUILDING.md ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── LICENSE ├── README.md ├── src ├── CMakeLists.txt ├── CMakeModules │ ├── Bootstrap_Linux.cmake │ ├── Bootstrap_Windows.cmake │ ├── CasparCG_Util.cmake │ ├── FindFFmpeg.cmake │ ├── FindFreeImage.cmake │ ├── FindSFML.cmake │ └── FindTBB.cmake ├── accelerator │ ├── CMakeLists.txt │ ├── StdAfx.h │ ├── accelerator.cpp │ ├── accelerator.h │ └── ogl │ │ ├── image │ │ ├── image_kernel.cpp │ │ ├── image_kernel.h │ │ ├── image_mixer.cpp │ │ ├── image_mixer.h │ │ ├── image_shader.cpp │ │ ├── image_shader.h │ │ ├── shader.frag │ │ └── shader.vert │ │ └── util │ │ ├── buffer.cpp │ │ ├── buffer.h │ │ ├── device.cpp │ │ ├── device.h │ │ ├── shader.cpp │ │ ├── shader.h │ │ ├── texture.cpp │ │ └── texture.h ├── common │ ├── CMakeLists.txt │ ├── array.h │ ├── assert.h │ ├── base64.cpp │ ├── base64.h │ ├── compiler │ │ └── vs │ │ │ └── disable_silly_warnings.h │ ├── diagnostics │ │ ├── graph.cpp │ │ └── graph.h │ ├── endian.h │ ├── enum_class.h │ ├── env.cpp │ ├── env.h │ ├── except.h │ ├── executor.h │ ├── filesystem.cpp │ ├── filesystem.h │ ├── forward.h │ ├── future.h │ ├── gl │ │ ├── gl_check.cpp │ │ └── gl_check.h │ ├── log.cpp │ ├── log.h │ ├── memory.h │ ├── memshfl.h │ ├── os │ │ ├── filesystem.h │ │ ├── linux │ │ │ ├── filesystem.cpp │ │ │ └── thread.cpp │ │ ├── thread.h │ │ └── windows │ │ │ ├── filesystem.cpp │ │ │ ├── thread.cpp │ │ │ └── windows.h │ ├── param.h │ ├── ptree.h │ ├── scope_exit.h │ ├── stdafx.cpp │ ├── stdafx.h │ ├── timer.h │ ├── tweener.cpp │ ├── tweener.h │ ├── utf.cpp │ └── utf.h ├── core │ ├── CMakeLists.txt │ ├── StdAfx.h │ ├── consumer │ │ ├── frame_consumer.cpp │ │ ├── frame_consumer.h │ │ ├── output.cpp │ │ └── output.h │ ├── diagnostics │ │ ├── call_context.cpp │ │ ├── call_context.h │ │ ├── osd_graph.cpp │ │ └── osd_graph.h │ ├── frame │ │ ├── draw_frame.cpp │ │ ├── draw_frame.h │ │ ├── frame.cpp │ │ ├── frame.h │ │ ├── frame_factory.h │ │ ├── frame_transform.cpp │ │ ├── frame_transform.h │ │ ├── frame_visitor.h │ │ ├── geometry.cpp │ │ ├── geometry.h │ │ └── pixel_format.h │ ├── fwd.h │ ├── mixer │ │ ├── audio │ │ │ ├── audio_mixer.cpp │ │ │ ├── audio_mixer.h │ │ │ └── audio_util.h │ │ ├── image │ │ │ ├── blend_modes.cpp │ │ │ ├── blend_modes.h │ │ │ └── image_mixer.h │ │ ├── mixer.cpp │ │ └── mixer.h │ ├── module_dependencies.h │ ├── monitor │ │ └── monitor.h │ ├── producer │ │ ├── cg_proxy.cpp │ │ ├── cg_proxy.h │ │ ├── color │ │ │ ├── color_producer.cpp │ │ │ └── color_producer.h │ │ ├── frame_producer.cpp │ │ ├── frame_producer.h │ │ ├── layer.cpp │ │ ├── layer.h │ │ ├── route │ │ │ ├── route_producer.cpp │ │ │ └── route_producer.h │ │ ├── separated │ │ │ ├── separated_producer.cpp │ │ │ └── separated_producer.h │ │ ├── stage.cpp │ │ ├── stage.h │ │ └── transition │ │ │ ├── sting_producer.cpp │ │ │ ├── sting_producer.h │ │ │ ├── transition_producer.cpp │ │ │ └── transition_producer.h │ ├── video_channel.cpp │ ├── video_channel.h │ ├── video_format.cpp │ └── video_format.h ├── modules │ ├── CMakeLists.txt │ ├── artnet │ │ ├── CMakeLists.txt │ │ ├── artnet.cpp │ │ ├── artnet.h │ │ ├── consumer │ │ │ ├── artnet_consumer.cpp │ │ │ └── artnet_consumer.h │ │ └── util │ │ │ ├── fixture_calculation.cpp │ │ │ └── fixture_calculation.h │ ├── bluefish │ │ ├── CMakeLists.txt │ │ ├── StdAfx.h │ │ ├── bluefish.cpp │ │ ├── bluefish.h │ │ ├── consumer │ │ │ ├── bluefish_consumer.cpp │ │ │ └── bluefish_consumer.h │ │ ├── interop │ │ │ ├── BlueDriver_p.h │ │ │ ├── BlueTypes.h │ │ │ └── BlueVelvetCFuncPtr.h │ │ ├── producer │ │ │ ├── bluefish_producer.cpp │ │ │ └── bluefish_producer.h │ │ └── util │ │ │ ├── blue_velvet.cpp │ │ │ ├── blue_velvet.h │ │ │ └── memory.h │ ├── decklink │ │ ├── CMakeLists.txt │ │ ├── StdAfx.h │ │ ├── consumer │ │ │ ├── config.cpp │ │ │ ├── config.h │ │ │ ├── decklink_consumer.cpp │ │ │ ├── decklink_consumer.h │ │ │ ├── frame.cpp │ │ │ ├── frame.h │ │ │ ├── monitor.cpp │ │ │ └── monitor.h │ │ ├── decklink.cpp │ │ ├── decklink.h │ │ ├── decklink_api.h │ │ ├── interop │ │ │ ├── DeckLinkAPIVersion.h │ │ │ ├── DeckLinkAPI_i.c │ │ │ └── DecklinkAPI.h │ │ ├── linux_interop │ │ │ ├── DeckLinkAPI.h │ │ │ ├── DeckLinkAPIConfiguration.h │ │ │ ├── DeckLinkAPIConfiguration_v10_11.h │ │ │ ├── DeckLinkAPIConfiguration_v10_2.h │ │ │ ├── DeckLinkAPIConfiguration_v10_4.h │ │ │ ├── DeckLinkAPIConfiguration_v10_5.h │ │ │ ├── DeckLinkAPIConfiguration_v10_9.h │ │ │ ├── DeckLinkAPIDeckControl.h │ │ │ ├── DeckLinkAPIDiscovery.h │ │ │ ├── DeckLinkAPIDispatch.cpp │ │ │ ├── DeckLinkAPIDispatch_v10_11.cpp │ │ │ ├── DeckLinkAPIDispatch_v10_8.cpp │ │ │ ├── DeckLinkAPIDispatch_v7_6.cpp │ │ │ ├── DeckLinkAPIDispatch_v8_0.cpp │ │ │ ├── DeckLinkAPIModes.h │ │ │ ├── DeckLinkAPITypes.h │ │ │ ├── DeckLinkAPIVersion.h │ │ │ ├── DeckLinkAPIVideoEncoderInput_v10_11.h │ │ │ ├── DeckLinkAPIVideoInput_v10_11.h │ │ │ ├── DeckLinkAPIVideoOutput_v10_11.h │ │ │ ├── DeckLinkAPI_v10_11.h │ │ │ ├── DeckLinkAPI_v10_2.h │ │ │ ├── DeckLinkAPI_v10_4.h │ │ │ ├── DeckLinkAPI_v10_5.h │ │ │ ├── DeckLinkAPI_v10_6.h │ │ │ ├── DeckLinkAPI_v10_9.h │ │ │ ├── DeckLinkAPI_v7_1.h │ │ │ ├── DeckLinkAPI_v7_3.h │ │ │ ├── DeckLinkAPI_v7_6.h │ │ │ ├── DeckLinkAPI_v7_9.h │ │ │ ├── DeckLinkAPI_v8_0.h │ │ │ ├── DeckLinkAPI_v8_1.h │ │ │ ├── DeckLinkAPI_v9_2.h │ │ │ ├── DeckLinkAPI_v9_9.h │ │ │ └── LinuxCOM.h │ │ ├── producer │ │ │ ├── decklink_producer.cpp │ │ │ └── decklink_producer.h │ │ └── util │ │ │ └── util.h │ ├── ffmpeg │ │ ├── CMakeLists.txt │ │ ├── StdAfx.h │ │ ├── consumer │ │ │ ├── ffmpeg_consumer.cpp │ │ │ └── ffmpeg_consumer.h │ │ ├── ffmpeg.cpp │ │ ├── ffmpeg.h │ │ ├── producer │ │ │ ├── av_input.cpp │ │ │ ├── av_input.h │ │ │ ├── av_producer.cpp │ │ │ ├── av_producer.h │ │ │ ├── ffmpeg_producer.cpp │ │ │ └── ffmpeg_producer.h │ │ └── util │ │ │ ├── av_assert.h │ │ │ ├── av_util.cpp │ │ │ └── av_util.h │ ├── html │ │ ├── CMakeLists.txt │ │ ├── html.cpp │ │ ├── html.h │ │ └── producer │ │ │ ├── html_cg_proxy.cpp │ │ │ ├── html_cg_proxy.h │ │ │ ├── html_producer.cpp │ │ │ └── html_producer.h │ ├── image │ │ ├── CMakeLists.txt │ │ ├── consumer │ │ │ ├── image_consumer.cpp │ │ │ └── image_consumer.h │ │ ├── image.cpp │ │ ├── image.h │ │ ├── producer │ │ │ ├── image_producer.cpp │ │ │ ├── image_producer.h │ │ │ ├── image_scroll_producer.cpp │ │ │ └── image_scroll_producer.h │ │ └── util │ │ │ ├── image_algorithms.cpp │ │ │ ├── image_algorithms.h │ │ │ ├── image_loader.cpp │ │ │ ├── image_loader.h │ │ │ └── image_view.h │ ├── newtek │ │ ├── CMakeLists.txt │ │ ├── StdAfx.h │ │ ├── consumer │ │ │ ├── newtek_ndi_consumer.cpp │ │ │ └── newtek_ndi_consumer.h │ │ ├── interop │ │ │ ├── Processing.NDI.DynamicLoad.h │ │ │ ├── Processing.NDI.Find.h │ │ │ ├── Processing.NDI.FrameSync.h │ │ │ ├── Processing.NDI.Lib.cplusplus.h │ │ │ ├── Processing.NDI.Lib.h │ │ │ ├── Processing.NDI.Recv.ex.h │ │ │ ├── Processing.NDI.Recv.h │ │ │ ├── Processing.NDI.Routing.h │ │ │ ├── Processing.NDI.Send.h │ │ │ ├── Processing.NDI.compat.h │ │ │ ├── Processing.NDI.deprecated.h │ │ │ ├── Processing.NDI.structs.h │ │ │ └── Processing.NDI.utilities.h │ │ ├── newtek.cpp │ │ ├── newtek.h │ │ ├── producer │ │ │ ├── newtek_ndi_producer.cpp │ │ │ └── newtek_ndi_producer.h │ │ └── util │ │ │ ├── ndi.cpp │ │ │ └── ndi.h │ ├── oal │ │ ├── CMakeLists.txt │ │ ├── consumer │ │ │ ├── oal_consumer.cpp │ │ │ └── oal_consumer.h │ │ ├── oal.cpp │ │ └── oal.h │ └── screen │ │ ├── CMakeLists.txt │ │ ├── consumer │ │ ├── screen.frag │ │ ├── screen.vert │ │ ├── screen_consumer.cpp │ │ └── screen_consumer.h │ │ ├── screen.cpp │ │ ├── screen.h │ │ └── util │ │ ├── x11_util.cpp │ │ └── x11_util.h ├── protocol │ ├── CMakeLists.txt │ ├── StdAfx.h │ ├── amcp │ │ ├── AMCPCommand.cpp │ │ ├── AMCPCommand.h │ │ ├── AMCPCommandQueue.cpp │ │ ├── AMCPCommandQueue.h │ │ ├── AMCPCommandsImpl.cpp │ │ ├── AMCPCommandsImpl.h │ │ ├── AMCPProtocolStrategy.cpp │ │ ├── AMCPProtocolStrategy.h │ │ ├── amcp_args.cpp │ │ ├── amcp_args.h │ │ ├── amcp_command_context.h │ │ ├── amcp_command_repository.cpp │ │ ├── amcp_command_repository.h │ │ ├── amcp_command_repository_wrapper.cpp │ │ ├── amcp_command_repository_wrapper.h │ │ └── amcp_shared.h │ ├── osc │ │ ├── client.cpp │ │ ├── client.h │ │ └── oscpack │ │ │ ├── MessageMappingOscPacketListener.h │ │ │ ├── OscException.h │ │ │ ├── OscHostEndianness.h │ │ │ ├── OscOutboundPacketStream.cpp │ │ │ ├── OscOutboundPacketStream.h │ │ │ ├── OscPacketListener.h │ │ │ ├── OscPrintReceivedElements.cpp │ │ │ ├── OscPrintReceivedElements.h │ │ │ ├── OscReceivedElements.cpp │ │ │ ├── OscReceivedElements.h │ │ │ ├── OscTypes.cpp │ │ │ └── OscTypes.h │ └── util │ │ ├── AsyncEventServer.cpp │ │ ├── AsyncEventServer.h │ │ ├── ClientInfo.h │ │ ├── ProtocolStrategy.h │ │ ├── http_request.cpp │ │ ├── http_request.h │ │ ├── lock_container.cpp │ │ ├── lock_container.h │ │ ├── protocol_strategy.h │ │ ├── strategy_adapters.cpp │ │ ├── strategy_adapters.h │ │ ├── tokenize.cpp │ │ └── tokenize.h ├── shell │ ├── CMakeLists.txt │ ├── CasparCG.ico │ ├── LiberationSans-Regular.ttf │ ├── casparcg.config │ ├── casparcg_auto_restart.bat │ ├── copy_deps.sh │ ├── included_modules.tmpl │ ├── liberation-fonts │ │ ├── AUTHORS │ │ ├── ChangeLog │ │ ├── LICENSE │ │ ├── LiberationMono-Regular.ttf │ │ ├── README │ │ └── TODO │ ├── linux_specific.cpp │ ├── main.cpp │ ├── platform_specific.h │ ├── resource.h │ ├── run.sh │ ├── server.cpp │ ├── server.h │ ├── shell.rc │ └── windows_specific.cpp ├── tools │ ├── CMakeLists.txt │ └── bin2c.cpp └── version.tmpl └── tools ├── linux ├── Dockerfile ├── build-in-docker ├── extract-from-docker ├── install-dependencies ├── launch-interactive ├── run_docker.sh └── start_docker.sh ├── update-format.sh ├── verify-format.sh └── windows ├── build.bat └── package.bat /.dockerignore: -------------------------------------------------------------------------------- 1 | src/packages 2 | src/cmake-build-* 3 | build-scripts 4 | build 5 | resources 6 | .git 7 | .vscode 8 | CMakeFiles 9 | casparcg_server 10 | 11 | dist 12 | build 13 | src/cmake-build-* 14 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 4 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yaml: -------------------------------------------------------------------------------- 1 | name: Bug report 🐛 2 | description: Use this if you've found a bug 3 | title: "Bug: [Short description of the bug]" 4 | labels: 5 | - type/bug 6 | 7 | body: 8 | - type: markdown 9 | attributes: 10 | value: | 11 | Before you post, make sure to check for existing bug reports of the issue: 12 | https://github.com/CasparCG/server/issues?q=+is%3Aissue+label%3Atype%2Fbug 13 | 14 | - type: textarea 15 | attributes: 16 | label: Observed Behavior 17 | description: What happened? 18 | validations: 19 | required: true 20 | 21 | - type: textarea 22 | attributes: 23 | label: Expected behaviour 24 | description: What did you expect to happen? 25 | validations: 26 | required: true 27 | 28 | - type: textarea 29 | attributes: 30 | label: Steps to reproduce 31 | description: How can we reproduce the issue? 32 | value: | 33 | 1. 34 | 2. 35 | 3. ... 36 | validations: 37 | required: true 38 | 39 | - type: textarea 40 | attributes: 41 | label: Environment 42 | description: What version of CasparCG and OS are you using? 43 | value: | 44 | * Commit: [e.g. ab1234c] 45 | * Server version: [e.g. v2.2] 46 | * Operating system: [e.g. Windows 10] 47 | validations: 48 | required: true 49 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Question or need help? 4 | url: https://casparcgforum.org/ 5 | about: Ask the community here. -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yaml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Suggest an idea for this project 3 | labels: 4 | - type/enhancement 5 | 6 | body: 7 | - type: markdown 8 | attributes: 9 | value: | 10 | Before you post, make sure to check for existing matching feature requests: 11 | https://github.com/CasparCG/server/issues?q=+is%3Aissue+label%3Atype%2Fbug 12 | 13 | - type: textarea 14 | attributes: 15 | label: Description 16 | description: How should the feature/enhancement work? 17 | validations: 18 | required: true 19 | 20 | - type: textarea 21 | attributes: 22 | label: Solution suggestion 23 | description: If you have any suggestions on how the solution should work, add that here. 24 | -------------------------------------------------------------------------------- /.github/workflows/linux-system.yml: -------------------------------------------------------------------------------- 1 | name: Build Linux with system dependencies 2 | 3 | on: 4 | push: 5 | # branches: [ "master" ] 6 | pull_request: 7 | branches: ["master"] 8 | 9 | jobs: 10 | build: 11 | strategy: 12 | fail-fast: false 13 | matrix: 14 | os: 15 | # - ubuntu-20.04 16 | - ubuntu-22.04 17 | 18 | runs-on: ${{ matrix.os }} 19 | 20 | steps: 21 | - uses: actions/checkout@v4 22 | 23 | - name: Setup environment 24 | run: | 25 | sudo apt-get update 26 | sudo ./tools/linux/install-dependencies 27 | 28 | sudo apt-get install -y libboost-all-dev \ 29 | libavcodec-dev \ 30 | libavformat-dev \ 31 | libavdevice-dev \ 32 | libavutil-dev \ 33 | libavfilter-dev \ 34 | libswscale-dev \ 35 | libpostproc-dev \ 36 | libswresample-dev 37 | 38 | - name: Run build 39 | run: | 40 | 41 | mkdir build 42 | cd build 43 | 44 | cmake ../src -DUSE_STATIC_BOOST=OFF -DUSE_SYSTEM_FFMPEG=ON 45 | make -j2 46 | 47 | env: 48 | CI: 1 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.dir 2 | *.vcxproj 3 | *.vcxproj.filters 4 | *.tlog 5 | *.sln 6 | .settings 7 | .vscode 8 | .idea 9 | .vs 10 | build 11 | dist 12 | CMakeFiles 13 | casparcg_server 14 | 15 | src/cmake-build-* 16 | src/.idea 17 | 18 | # debian build artifacts 19 | /debian 20 | /obj-* 21 | /tools/linux/deb 22 | -------------------------------------------------------------------------------- /src/accelerator/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | project (accelerator) 3 | 4 | set(SOURCES 5 | ogl/image/image_kernel.cpp 6 | ogl/image/image_mixer.cpp 7 | ogl/image/image_shader.cpp 8 | 9 | ogl/util/buffer.cpp 10 | ogl/util/device.cpp 11 | ogl/util/shader.cpp 12 | ogl/util/texture.cpp 13 | 14 | accelerator.cpp 15 | ) 16 | set(HEADERS 17 | ogl/image/image_kernel.h 18 | ogl/image/image_mixer.h 19 | ogl/image/image_shader.h 20 | 21 | ogl/util/buffer.h 22 | ogl/util/device.h 23 | ogl/util/shader.h 24 | ogl/util/texture.h 25 | 26 | ogl_image_vertex.h 27 | ogl_image_fragment.h 28 | 29 | accelerator.h 30 | StdAfx.h 31 | ) 32 | 33 | bin2c("ogl/image/shader.vert" "ogl_image_vertex.h" "caspar::accelerator::ogl" "vertex_shader") 34 | bin2c("ogl/image/shader.frag" "ogl_image_fragment.h" "caspar::accelerator::ogl" "fragment_shader") 35 | 36 | casparcg_add_library(accelerator SOURCES ${SOURCES} ${HEADERS}) 37 | target_include_directories(accelerator PRIVATE 38 | .. 39 | ${CMAKE_CURRENT_BINARY_DIR} 40 | ${GLEW_INCLUDE_PATH} 41 | ${SFML_INCLUDE_PATH} 42 | ) 43 | target_precompile_headers(accelerator PRIVATE "StdAfx.h") 44 | 45 | source_group(sources ./.*) 46 | source_group(sources\\cpu\\image cpu/image/.*) 47 | source_group(sources\\cpu\\util cpu/util/.*) 48 | source_group(sources\\ogl\\image ogl/image/.*) 49 | source_group(sources\\ogl\\util ogl/util/.*) 50 | 51 | target_link_libraries(accelerator common core) 52 | -------------------------------------------------------------------------------- /src/accelerator/StdAfx.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | -------------------------------------------------------------------------------- /src/accelerator/accelerator.cpp: -------------------------------------------------------------------------------- 1 | #include "accelerator.h" 2 | 3 | #include "ogl/image/image_mixer.h" 4 | #include "ogl/util/device.h" 5 | 6 | #include 7 | 8 | #include 9 | 10 | #include 11 | #include 12 | #include 13 | 14 | namespace caspar { namespace accelerator { 15 | 16 | struct accelerator::impl 17 | { 18 | std::shared_ptr ogl_device_; 19 | const core::video_format_repository format_repository_; 20 | 21 | impl(const core::video_format_repository format_repository) 22 | : format_repository_(format_repository) 23 | { 24 | } 25 | 26 | std::unique_ptr create_image_mixer(const int channel_id) 27 | { 28 | return std::make_unique( 29 | spl::make_shared_ptr(get_device()), channel_id, format_repository_.get_max_video_format_size()); 30 | } 31 | 32 | std::shared_ptr get_device() 33 | { 34 | if (!ogl_device_) { 35 | ogl_device_ = std::make_shared(); 36 | } 37 | 38 | return ogl_device_; 39 | } 40 | }; 41 | 42 | accelerator::accelerator(const core::video_format_repository format_repository) 43 | : impl_(std::make_unique(format_repository)) 44 | { 45 | } 46 | 47 | accelerator::~accelerator() {} 48 | 49 | std::unique_ptr accelerator::create_image_mixer(const int channel_id) 50 | { 51 | return impl_->create_image_mixer(channel_id); 52 | } 53 | 54 | std::shared_ptr accelerator::get_device() const 55 | { 56 | return std::dynamic_pointer_cast(impl_->get_device()); 57 | } 58 | 59 | }} // namespace caspar::accelerator 60 | -------------------------------------------------------------------------------- /src/accelerator/accelerator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace caspar { namespace accelerator { 13 | 14 | class accelerator_device 15 | { 16 | public: 17 | virtual boost::property_tree::wptree info() const = 0; 18 | virtual std::future gc() = 0; 19 | }; 20 | 21 | class accelerator 22 | { 23 | public: 24 | explicit accelerator(const core::video_format_repository format_repository); 25 | accelerator(accelerator&) = delete; 26 | ~accelerator(); 27 | 28 | accelerator& operator=(accelerator&) = delete; 29 | 30 | std::unique_ptr create_image_mixer(int channel_id); 31 | 32 | std::shared_ptr get_device() const; 33 | 34 | private: 35 | struct impl; 36 | std::unique_ptr impl_; 37 | }; 38 | 39 | }} // namespace caspar::accelerator 40 | -------------------------------------------------------------------------------- /src/accelerator/ogl/image/image_mixer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | namespace caspar { namespace accelerator { namespace ogl { 35 | 36 | class image_mixer final : public core::image_mixer 37 | { 38 | public: 39 | image_mixer(const spl::shared_ptr& ogl, int channel_id, const size_t max_frame_size); 40 | image_mixer(const image_mixer&) = delete; 41 | 42 | ~image_mixer(); 43 | 44 | image_mixer& operator=(const image_mixer&) = delete; 45 | 46 | std::future> operator()(const core::video_format_desc& format_desc) override; 47 | core::mutable_frame create_frame(const void* tag, const core::pixel_format_desc& desc) override; 48 | 49 | // core::image_mixer 50 | 51 | void push(const core::frame_transform& frame) override; 52 | void visit(const core::const_frame& frame) override; 53 | void pop() override; 54 | 55 | private: 56 | struct impl; 57 | std::shared_ptr impl_; 58 | }; 59 | 60 | }}} // namespace caspar::accelerator::ogl 61 | -------------------------------------------------------------------------------- /src/accelerator/ogl/image/image_shader.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | #include "image_shader.h" 22 | 23 | #include "../util/device.h" 24 | #include "../util/shader.h" 25 | 26 | #include "ogl_image_fragment.h" 27 | #include "ogl_image_vertex.h" 28 | 29 | namespace caspar { namespace accelerator { namespace ogl { 30 | 31 | std::weak_ptr g_shader; 32 | std::mutex g_shader_mutex; 33 | 34 | std::shared_ptr get_image_shader(const spl::shared_ptr& ogl) 35 | { 36 | std::lock_guard lock(g_shader_mutex); 37 | auto existing_shader = g_shader.lock(); 38 | 39 | if (existing_shader) { 40 | return existing_shader; 41 | } 42 | 43 | // The deleter is alive until the weak pointer is destroyed, so we have 44 | // to weakly reference ogl, to not keep it alive until atexit 45 | std::weak_ptr weak_ogl = ogl; 46 | 47 | auto deleter = [weak_ogl](shader* p) { 48 | auto ogl = weak_ogl.lock(); 49 | 50 | if (ogl) { 51 | ogl->dispatch_async([=] { delete p; }); 52 | } 53 | }; 54 | 55 | existing_shader.reset(new shader(std::string(vertex_shader), std::string(fragment_shader)), deleter); 56 | 57 | g_shader = existing_shader; 58 | 59 | return existing_shader; 60 | } 61 | 62 | }}} // namespace caspar::accelerator::ogl 63 | -------------------------------------------------------------------------------- /src/accelerator/ogl/image/image_shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace accelerator { namespace ogl { 27 | 28 | class shader; 29 | class device; 30 | 31 | enum class texture_id 32 | { 33 | plane0 = 0, 34 | plane1, 35 | plane2, 36 | plane3, 37 | local_key, 38 | layer_key, 39 | background 40 | }; 41 | 42 | std::shared_ptr get_image_shader(const spl::shared_ptr& ogl); 43 | 44 | }}} // namespace caspar::accelerator::ogl 45 | -------------------------------------------------------------------------------- /src/accelerator/ogl/image/shader.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | in vec4 TexCoordIn; 3 | in vec2 Position; 4 | 5 | out vec4 TexCoord; 6 | out vec4 TexCoord2; 7 | 8 | void main() 9 | { 10 | TexCoord = TexCoordIn; 11 | vec4 pos = vec4(Position, 0, 1); 12 | TexCoord2 = vec4(pos.xy, 0.0, 0.0); 13 | pos.x = pos.x*2.0 - 1.0; 14 | pos.y = pos.y*2.0 - 1.0; 15 | gl_Position = pos; 16 | } 17 | -------------------------------------------------------------------------------- /src/accelerator/ogl/util/buffer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | 27 | namespace caspar { namespace accelerator { namespace ogl { 28 | 29 | class buffer final 30 | { 31 | public: 32 | static boost::property_tree::wptree info(); 33 | 34 | buffer(int size, bool write); 35 | buffer(const buffer&) = delete; 36 | buffer(buffer&& other); 37 | ~buffer(); 38 | 39 | buffer& operator=(const buffer&) = delete; 40 | buffer& operator=(buffer&& other); 41 | 42 | void bind(); 43 | void unbind(); 44 | 45 | int id() const; 46 | void* data(); 47 | int size() const; 48 | bool write() const; 49 | 50 | private: 51 | struct impl; 52 | std::unique_ptr impl_; 53 | }; 54 | 55 | }}} // namespace caspar::accelerator::ogl 56 | -------------------------------------------------------------------------------- /src/accelerator/ogl/util/shader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | 29 | namespace caspar { namespace accelerator { namespace ogl { 30 | 31 | class shader final 32 | { 33 | shader(const shader&); 34 | shader& operator=(const shader&); 35 | 36 | public: 37 | shader(const std::string& vertex_source_str, const std::string& fragment_source_str); 38 | ~shader(); 39 | 40 | void set(const std::string& name, bool value); 41 | void set(const std::string& name, int value); 42 | void set(const std::string& name, float value); 43 | void set(const std::string& name, double value0, double value1); 44 | void set(const std::string& name, double value); 45 | 46 | GLint get_attrib_location(const char* name); 47 | 48 | template 49 | typename std::enable_if::value, void>::type set(const std::string& name, E value) 50 | { 51 | set(name, static_cast::type>(value)); 52 | } 53 | 54 | void use() const; 55 | 56 | int id() const; 57 | 58 | private: 59 | struct impl; 60 | std::unique_ptr impl_; 61 | }; 62 | 63 | }}} // namespace caspar::accelerator::ogl 64 | -------------------------------------------------------------------------------- /src/accelerator/ogl/util/texture.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace accelerator { namespace ogl { 27 | 28 | class texture final 29 | { 30 | public: 31 | texture(int width, int height, int stride); 32 | texture(const texture&) = delete; 33 | texture(texture&& other); 34 | ~texture(); 35 | 36 | texture& operator=(const texture&) = delete; 37 | texture& operator=(texture&& other); 38 | 39 | #ifdef WIN32 40 | void copy_from(int source); 41 | #endif 42 | void copy_from(class buffer& source); 43 | void copy_to(class buffer& dest); 44 | 45 | void attach(); 46 | void clear(); 47 | void bind(int index); 48 | void unbind(); 49 | 50 | int width() const; 51 | int height() const; 52 | int stride() const; 53 | int size() const; 54 | int id() const; 55 | 56 | private: 57 | struct impl; 58 | std::unique_ptr impl_; 59 | }; 60 | 61 | }}} // namespace caspar::accelerator::ogl 62 | -------------------------------------------------------------------------------- /src/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | project (common) 3 | 4 | set(SOURCES 5 | diagnostics/graph.cpp 6 | 7 | gl/gl_check.cpp 8 | 9 | base64.cpp 10 | env.cpp 11 | filesystem.cpp 12 | log.cpp 13 | tweener.cpp 14 | utf.cpp 15 | ) 16 | if (MSVC) 17 | list(APPEND SOURCES 18 | compiler/vs/disable_silly_warnings.h 19 | 20 | os/windows/filesystem.cpp 21 | os/windows/thread.cpp 22 | os/windows/windows.h 23 | ) 24 | else () 25 | list(APPEND SOURCES 26 | os/linux/filesystem.cpp 27 | os/linux/thread.cpp 28 | ) 29 | endif () 30 | set(HEADERS 31 | diagnostics/graph.h 32 | 33 | gl/gl_check.h 34 | 35 | os/filesystem.h 36 | os/thread.h 37 | 38 | array.h 39 | assert.h 40 | base64.h 41 | endian.h 42 | enum_class.h 43 | env.h 44 | executor.h 45 | except.h 46 | filesystem.h 47 | forward.h 48 | future.h 49 | log.h 50 | memory.h 51 | memshfl.h 52 | param.h 53 | ptree.h 54 | scope_exit.h 55 | stdafx.h 56 | timer.h 57 | tweener.h 58 | utf.h 59 | ) 60 | 61 | casparcg_add_library(common SOURCES ${SOURCES} ${HEADERS}) 62 | target_include_directories(common PRIVATE 63 | .. 64 | ${GLEW_INCLUDE_PATH} 65 | ) 66 | target_precompile_headers(common PRIVATE "stdafx.h") 67 | 68 | source_group(sources ./*) 69 | source_group(sources\\gl gl/*) 70 | source_group(sources\\diagnostics diagnostics/*) 71 | source_group(sources\\compiler\\vs compiler/vs/*) 72 | source_group(sources\\os\\windows os/windows/*) 73 | source_group(sources\\os os/*) 74 | -------------------------------------------------------------------------------- /src/common/base64.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Helge Norberg, helge.norberg@svt.se 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | 27 | namespace caspar { 28 | 29 | std::string to_base64(const char* data, size_t length); 30 | std::vector from_base64(const std::string& data); 31 | 32 | } // namespace caspar -------------------------------------------------------------------------------- /src/common/env.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace caspar { namespace env { 29 | 30 | void configure(const std::wstring& filename); 31 | 32 | const std::wstring& initial_folder(); 33 | const std::wstring& media_folder(); 34 | const std::wstring& log_folder(); 35 | const std::wstring& template_folder(); 36 | const std::wstring& data_folder(); 37 | const std::wstring& version(); 38 | 39 | bool log_to_file(); 40 | 41 | const boost::property_tree::wptree& properties(); 42 | 43 | void log_configuration_warnings(); 44 | 45 | }} // namespace caspar::env 46 | -------------------------------------------------------------------------------- /src/common/filesystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Helge Norberg, helge.norberg@svt.se 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace caspar { 29 | 30 | std::optional 31 | find_file_within_dir_or_absolute(const std::wstring& parent_dir, 32 | const std::wstring& filename, 33 | const std::function& is_valid_file); 34 | 35 | boost::filesystem::path get_relative(const boost::filesystem::path& file, const boost::filesystem::path& relative_to); 36 | boost::filesystem::path get_relative_without_extension(const boost::filesystem::path& file, 37 | const boost::filesystem::path& relative_to); 38 | 39 | } // namespace caspar 40 | -------------------------------------------------------------------------------- /src/common/forward.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #define FORWARD0(expr) expr 4 | #define FORWARD1(a1, expr) \ 5 | namespace a1 { \ 6 | expr; \ 7 | } 8 | #define FORWARD2(a1, a2, expr) \ 9 | namespace a1 { namespace a2 { \ 10 | expr; \ 11 | }} 12 | #define FORWARD3(a1, a2, a3, expr) \ 13 | namespace a1 { namespace a2 { namespace a3 { \ 14 | expr; \ 15 | }}} 16 | -------------------------------------------------------------------------------- /src/common/future.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace caspar { 8 | 9 | template 10 | auto flatten(F&& f) 11 | { 12 | return std::async(std::launch::deferred, [f = std::forward(f)]() mutable { return f.get().get(); }); 13 | } 14 | 15 | template 16 | bool is_ready(const F& future) 17 | { 18 | return future.wait_for(std::chrono::seconds(0)) == std::future_status::ready; 19 | } 20 | 21 | template 22 | auto make_ready_future(T&& value) 23 | { 24 | std::promise::type> p; 25 | p.set_value(std::forward(value)); 26 | return p.get_future(); 27 | } 28 | 29 | static std::future make_ready_future() 30 | { 31 | std::promise p; 32 | p.set_value(); 33 | return p.get_future(); 34 | } 35 | 36 | } // namespace caspar -------------------------------------------------------------------------------- /src/common/os/filesystem.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Helge Norberg, helge.norberg@svt.se 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | 27 | namespace caspar { 28 | 29 | std::optional find_case_insensitive(const std::wstring& case_insensitive); 30 | 31 | std::wstring clean_path(std::wstring path); 32 | 33 | std::wstring ensure_trailing_slash(std::wstring folder); 34 | 35 | } // namespace caspar 36 | -------------------------------------------------------------------------------- /src/common/os/linux/thread.cpp: -------------------------------------------------------------------------------- 1 | #include "../thread.h" 2 | #include "../../utf.h" 3 | #include 4 | #include 5 | 6 | namespace caspar { 7 | 8 | void set_thread_name(const std::wstring& name) { pthread_setname_np(pthread_self(), u8(name).c_str()); } 9 | 10 | void set_thread_realtime_priority() 11 | { 12 | pthread_t handle = pthread_self(); 13 | int policy; 14 | struct sched_param param; 15 | if (pthread_getschedparam(handle, &policy, ¶m) != 0) 16 | return; 17 | param.sched_priority = 2; 18 | pthread_setschedparam(handle, SCHED_FIFO, ¶m); 19 | } 20 | 21 | } // namespace caspar 22 | -------------------------------------------------------------------------------- /src/common/os/thread.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace caspar { 6 | 7 | void set_thread_name(const std::wstring& name); 8 | void set_thread_realtime_priority(); 9 | } // namespace caspar 10 | -------------------------------------------------------------------------------- /src/common/os/windows/filesystem.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Helge Norberg, helge.norberg@svt.se 20 | */ 21 | 22 | #include "../../stdafx.h" 23 | 24 | #include "../filesystem.h" 25 | 26 | #include 27 | #include 28 | 29 | namespace caspar { 30 | 31 | std::optional find_case_insensitive(const std::wstring& case_insensitive) 32 | { 33 | if (boost::filesystem::exists(case_insensitive)) 34 | return case_insensitive; 35 | 36 | return {}; 37 | } 38 | 39 | std::wstring clean_path(std::wstring path) { return path; } 40 | 41 | std::wstring ensure_trailing_slash(std::wstring folder) 42 | { 43 | auto last_char = folder.at(folder.length() - 1); 44 | if (last_char != L'/' && last_char != L'\\') 45 | folder.append(L"/"); 46 | 47 | return folder; 48 | } 49 | 50 | } // namespace caspar 51 | -------------------------------------------------------------------------------- /src/common/os/windows/thread.cpp: -------------------------------------------------------------------------------- 1 | #include "../thread.h" 2 | 3 | #include 4 | 5 | #include 6 | 7 | #include "../../utf.h" 8 | 9 | namespace caspar { 10 | 11 | typedef struct tagTHREADNAME_INFO 12 | { 13 | DWORD dwType; // must be 0x1000 14 | LPCSTR szName; // pointer to name (in user addr space) 15 | DWORD dwThreadID; // thread ID (-1=caller thread) 16 | DWORD dwFlags; // reserved for future use, must be zero 17 | } THREADNAME_INFO; 18 | 19 | inline void SetThreadName(DWORD dwThreadID, LPCSTR szThreadName) 20 | { 21 | THREADNAME_INFO info; 22 | { 23 | info.dwType = 0x1000; 24 | info.szName = szThreadName; 25 | info.dwThreadID = dwThreadID; 26 | info.dwFlags = 0; 27 | } 28 | __try { 29 | RaiseException(0x406D1388, 0, sizeof(info) / sizeof(ULONG_PTR), (ULONG_PTR*)&info); 30 | } __except (EXCEPTION_CONTINUE_EXECUTION) { 31 | } 32 | } 33 | 34 | void set_thread_name(const std::wstring& name) { SetThreadName(GetCurrentThreadId(), u8(name).c_str()); } 35 | 36 | void set_thread_realtime_priority() { SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); } 37 | 38 | } // namespace caspar 39 | -------------------------------------------------------------------------------- /src/common/os/windows/windows.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #undef _UNICODE 4 | #define _UNICODE 5 | #undef UNICODE 6 | #define UNICODE 7 | 8 | #undef NOMINMAX 9 | #define NOMINMAX 10 | 11 | #undef NOSERVICE 12 | #define NOSERVICE 13 | #undef NOMCX 14 | #define NOMCX 15 | 16 | #ifdef _MSC_VER 17 | #include 18 | #endif 19 | #ifndef _WIN32_WINNT 20 | #define _WIN32_WINNT _WIN32_WINNT_WIN7 21 | #endif 22 | 23 | #undef WIN32_LEAN_AND_MEAN 24 | #define WIN32_LEAN_AND_MEAN 25 | 26 | #include 27 | -------------------------------------------------------------------------------- /src/common/scope_exit.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "except.h" 4 | 5 | namespace caspar { 6 | 7 | namespace detail { 8 | template 9 | class scope_exit 10 | { 11 | scope_exit(const scope_exit&); 12 | scope_exit& operator=(const scope_exit&); 13 | 14 | public: 15 | template 16 | explicit scope_exit(T2&& func) 17 | : func_(std::forward(func)) 18 | , valid_(true) 19 | { 20 | } 21 | 22 | scope_exit(scope_exit&& other) 23 | : func_(std::move(other.func_)) 24 | , valid_(std::move(other.valid_)) 25 | { 26 | other.valid_ = false; 27 | } 28 | 29 | scope_exit& operator=(scope_exit&& other) 30 | { 31 | func_ = std::move(other.func_); 32 | valid_ = std::move(other.valid_); 33 | 34 | other.valid_ = false; 35 | 36 | return *this; 37 | } 38 | 39 | ~scope_exit() 40 | { 41 | try { 42 | if (valid_) 43 | func_(); 44 | } catch (...) { 45 | if (!std::uncaught_exception()) 46 | #pragma warning(push) 47 | #pragma warning(disable : 4297) 48 | throw; 49 | #pragma warning(pop) 50 | else 51 | CASPAR_LOG_CURRENT_EXCEPTION(); 52 | } 53 | } 54 | 55 | private: 56 | T func_; 57 | bool valid_; 58 | }; 59 | 60 | class scope_exit_helper 61 | { 62 | }; 63 | 64 | template 65 | scope_exit::type> operator+(scope_exit_helper /*unused*/, T&& exitScope) 66 | { 67 | return scope_exit::type>(std::forward(exitScope)); 68 | } 69 | } // namespace detail 70 | 71 | #define _CASPAR_EXIT_SCOPE_LINENAME_CAT(name, line) name##line 72 | #define _CASPAR_EXIT_SCOPE_LINENAME(name, line) _CASPAR_EXIT_SCOPE_LINENAME_CAT(name, line) 73 | #define CASPAR_SCOPE_EXIT \ 74 | auto _CASPAR_EXIT_SCOPE_LINENAME(EXIT, __LINE__) = ::caspar::detail::scope_exit_helper() + [&]() mutable 75 | 76 | } // namespace caspar 77 | -------------------------------------------------------------------------------- /src/common/stdafx.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #include "stdafx.h" 23 | -------------------------------------------------------------------------------- /src/common/timer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Helge Norberg, helge.norberg@svt.se 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { 27 | 28 | class timer 29 | { 30 | std::int_least64_t start_time_; 31 | 32 | public: 33 | timer() { start_time_ = now(); } 34 | 35 | void restart() { start_time_ = now(); } 36 | 37 | double elapsed() const { return static_cast(now() - start_time_) / 1000.0; } 38 | 39 | private: 40 | static std::int_least64_t now() 41 | { 42 | using namespace std::chrono; 43 | 44 | return duration_cast(high_resolution_clock::now().time_since_epoch()).count(); 45 | } 46 | }; 47 | 48 | } // namespace caspar 49 | -------------------------------------------------------------------------------- /src/common/utf.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | #include "utf.h" 22 | 23 | #pragma warning(push, 1) 24 | 25 | #include 26 | 27 | namespace caspar { 28 | 29 | std::wstring u16(const std::string& str) 30 | { 31 | return boost::locale::conv::utf_to_utf(str); // std::wstring(str.begin(), str.end()); 32 | } 33 | 34 | std::wstring u16(const std::wstring& str) { return str; } 35 | 36 | std::string u8(const std::wstring& str) 37 | { 38 | return boost::locale::conv::utf_to_utf(str); // std::string(str.begin(), str.end()); 39 | } 40 | 41 | std::string u8(const std::string& str) { return str; } 42 | 43 | } // namespace caspar 44 | -------------------------------------------------------------------------------- /src/common/utf.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { 27 | 28 | std::wstring u16(const std::string& str); 29 | std::wstring u16(const std::wstring& str); 30 | std::string u8(const std::wstring& str); 31 | std::string u8(const std::string& str); 32 | 33 | } // namespace caspar -------------------------------------------------------------------------------- /src/core/consumer/output.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "../fwd.h" 25 | #include "../monitor/monitor.h" 26 | 27 | #include 28 | #include 29 | 30 | #include 31 | 32 | #include 33 | 34 | FORWARD2(caspar, diagnostics, class graph); 35 | 36 | namespace caspar { namespace core { 37 | 38 | class output final 39 | { 40 | public: 41 | explicit output(const spl::shared_ptr& graph, 42 | const video_format_desc& format_desc, 43 | int channel_index); 44 | 45 | output(const output&) = delete; 46 | output& operator=(const output&) = delete; 47 | ~output(); 48 | 49 | // Send a frame to the output. If running an interlaced channel, two frames will be provided 50 | void operator()(const const_frame& frame, const const_frame& frame2, const video_format_desc& format_desc); 51 | 52 | void add(const spl::shared_ptr& consumer); 53 | void add(int index, const spl::shared_ptr& consumer); 54 | bool remove(const spl::shared_ptr& consumer); 55 | bool remove(int index); 56 | 57 | core::monitor::state state() const; 58 | 59 | private: 60 | struct impl; 61 | std::unique_ptr impl_; 62 | }; 63 | 64 | }} // namespace caspar::core 65 | -------------------------------------------------------------------------------- /src/core/diagnostics/call_context.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Helge Norberg, helge.norberg@svt.se 20 | */ 21 | 22 | #include "../StdAfx.h" 23 | 24 | #include "call_context.h" 25 | 26 | namespace caspar { namespace core { namespace diagnostics { 27 | 28 | thread_local call_context context; 29 | 30 | call_context& call_context::for_thread() { return context; } 31 | 32 | std::wstring call_context::to_string() const 33 | { 34 | if (video_channel == -1) 35 | return L"[]"; 36 | if (layer == -1) 37 | return L"[ch=" + std::to_wstring(video_channel) + L"]"; 38 | return L"[ch=" + std::to_wstring(video_channel) + L"; layer=" + std::to_wstring(layer) + L"]"; 39 | } 40 | 41 | }}} // namespace caspar::core::diagnostics 42 | -------------------------------------------------------------------------------- /src/core/diagnostics/call_context.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Helge Norberg, helge.norberg@svt.se 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace core { namespace diagnostics { 27 | 28 | struct call_context 29 | { 30 | int video_channel = -1; 31 | int layer = -1; 32 | 33 | static call_context& for_thread(); 34 | std::wstring to_string() const; 35 | }; 36 | 37 | class scoped_call_context 38 | { 39 | call_context saved_; 40 | 41 | scoped_call_context(const scoped_call_context&) = delete; 42 | scoped_call_context& operator=(const scoped_call_context&) = delete; 43 | 44 | public: 45 | scoped_call_context() { saved_ = call_context::for_thread(); } 46 | ~scoped_call_context() { call_context::for_thread() = saved_; } 47 | }; 48 | 49 | }}} // namespace caspar::core::diagnostics 50 | -------------------------------------------------------------------------------- /src/core/diagnostics/osd_graph.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | namespace caspar { namespace core { namespace diagnostics { namespace osd { 25 | 26 | void register_sink(); 27 | void show_graphs(bool value); 28 | void shutdown(); 29 | 30 | }}}} // namespace caspar::core::diagnostics::osd 31 | -------------------------------------------------------------------------------- /src/core/frame/frame_factory.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | namespace caspar { namespace core { 25 | 26 | class frame_factory 27 | { 28 | public: 29 | frame_factory() = default; 30 | frame_factory& operator=(const frame_factory&) = delete; 31 | virtual ~frame_factory() = default; 32 | 33 | frame_factory(const frame_factory&) = delete; 34 | 35 | virtual class mutable_frame create_frame(const void* video_stream_tag, const struct pixel_format_desc& desc) = 0; 36 | }; 37 | 38 | }} // namespace caspar::core 39 | -------------------------------------------------------------------------------- /src/core/frame/frame_visitor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | namespace caspar { namespace core { 25 | 26 | class frame_visitor 27 | { 28 | public: 29 | frame_visitor() = default; 30 | frame_visitor(const frame_visitor&) = delete; 31 | virtual ~frame_visitor() = default; 32 | 33 | frame_visitor& operator=(const frame_visitor&) = delete; 34 | 35 | virtual void push(const struct frame_transform& transform) = 0; 36 | virtual void visit(const class const_frame& frame) = 0; 37 | virtual void pop() = 0; 38 | }; 39 | 40 | }} // namespace caspar::core -------------------------------------------------------------------------------- /src/core/frame/geometry.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Niklas P Andersson, niklas.p.andersson@svt.se 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace caspar { namespace core { 29 | 30 | class frame_geometry 31 | { 32 | public: 33 | enum class geometry_type 34 | { 35 | quad 36 | }; 37 | 38 | struct coord 39 | { 40 | double vertex_x = 0.0; 41 | double vertex_y = 0.0; 42 | double texture_x = 0.0; 43 | double texture_y = 0.0; 44 | double texture_r = 0.0; 45 | double texture_q = 1.0; 46 | 47 | coord() = default; 48 | coord(double vertex_x, double vertex_y, double texture_x, double texture_y); 49 | 50 | bool operator==(const coord& other) const; 51 | }; 52 | 53 | frame_geometry(geometry_type type, std::vector data); 54 | 55 | geometry_type type() const; 56 | const std::vector& data() const; 57 | 58 | static const frame_geometry& get_default(); 59 | static const frame_geometry& get_default_vflip(); 60 | 61 | private: 62 | struct impl; 63 | spl::shared_ptr impl_; 64 | }; 65 | 66 | }} // namespace caspar::core 67 | -------------------------------------------------------------------------------- /src/core/frame/pixel_format.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace core { 27 | 28 | enum class pixel_format 29 | { 30 | gray = 0, 31 | bgra, 32 | rgba, 33 | argb, 34 | abgr, 35 | ycbcr, 36 | ycbcra, 37 | luma, 38 | bgr, 39 | rgb, 40 | uyvy, 41 | count, 42 | invalid, 43 | }; 44 | 45 | struct pixel_format_desc final 46 | { 47 | struct plane 48 | { 49 | int linesize = 0; 50 | int width = 0; 51 | int height = 0; 52 | int size = 0; 53 | int stride = 0; 54 | 55 | plane() = default; 56 | 57 | plane(int width, int height, int stride) 58 | : linesize(width * stride) 59 | , width(width) 60 | , height(height) 61 | , size(width * height * stride) 62 | , stride(stride) 63 | { 64 | } 65 | }; 66 | 67 | pixel_format_desc() = default; 68 | 69 | explicit pixel_format_desc(pixel_format format) 70 | : format(format) 71 | { 72 | } 73 | 74 | pixel_format format = pixel_format::invalid; 75 | std::vector planes; 76 | }; 77 | 78 | }} // namespace caspar::core 79 | -------------------------------------------------------------------------------- /src/core/fwd.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Sveriges Television AB http://casparcg.com/ 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | #pragma once 22 | 23 | #include 24 | 25 | FORWARD2(caspar, accelerator, class accelerator); 26 | FORWARD3(caspar, accelerator, ogl, class device); 27 | 28 | FORWARD2(caspar, core, class stage); 29 | FORWARD2(caspar, core, class mixer); 30 | FORWARD2(caspar, core, class output); 31 | FORWARD2(caspar, core, class image_mixer); 32 | FORWARD2(caspar, core, struct video_format_desc); 33 | FORWARD2(caspar, core, class frame_factory); 34 | FORWARD2(caspar, core, class frame_producer); 35 | FORWARD2(caspar, core, class frame_consumer); 36 | FORWARD2(caspar, core, class draw_frame); 37 | FORWARD2(caspar, core, class mutable_frame); 38 | FORWARD2(caspar, core, class const_frame); 39 | FORWARD2(caspar, core, class video_channel); 40 | FORWARD2(caspar, core, struct pixel_format_desc); 41 | FORWARD2(caspar, core, class cg_producer_registry); 42 | FORWARD2(caspar, core, struct frame_transform); 43 | FORWARD2(caspar, core, struct write_frame_consumer); 44 | FORWARD2(caspar, core, struct frame_producer_dependencies); 45 | FORWARD2(caspar, core, struct module_dependencies); 46 | FORWARD2(caspar, core, class frame_producer_registry); 47 | FORWARD2(caspar, core, class video_format_repository); 48 | -------------------------------------------------------------------------------- /src/core/mixer/audio/audio_mixer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | 34 | FORWARD2(caspar, diagnostics, class graph); 35 | 36 | namespace caspar { namespace core { 37 | 38 | class audio_mixer final : public frame_visitor 39 | { 40 | audio_mixer(const audio_mixer&); 41 | audio_mixer& operator=(const audio_mixer&); 42 | 43 | public: 44 | audio_mixer(spl::shared_ptr<::caspar::diagnostics::graph> graph); 45 | 46 | array operator()(const struct video_format_desc& format_desc, int nb_samples); 47 | void set_master_volume(float volume); 48 | float get_master_volume(); 49 | core::monitor::state state() const; 50 | 51 | void push(const struct frame_transform& transform) override; 52 | void visit(const class const_frame& frame) override; 53 | void pop() override; 54 | 55 | private: 56 | struct impl; 57 | spl::shared_ptr impl_; 58 | }; 59 | 60 | }} // namespace caspar::core 61 | -------------------------------------------------------------------------------- /src/core/mixer/audio/audio_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace caspar { namespace core { 29 | 30 | template 31 | std::vector audio_32_to_24(const T& audio_data) 32 | { 33 | auto size = std::distance(std::begin(audio_data), std::end(audio_data)); 34 | auto input8 = reinterpret_cast(&(*std::begin(audio_data))); 35 | auto output8 = std::vector(); 36 | 37 | output8.reserve(size * 3); 38 | for (int n = 0; n < size; ++n) { 39 | output8.push_back(input8[n * 4 + 1]); 40 | output8.push_back(input8[n * 4 + 2]); 41 | output8.push_back(input8[n * 4 + 3]); 42 | } 43 | 44 | return output8; 45 | } 46 | 47 | template 48 | std::vector audio_32_to_16(const T& audio_data) 49 | { 50 | auto size = std::distance(std::begin(audio_data), std::end(audio_data)); 51 | auto input32 = &(*std::begin(audio_data)); 52 | auto output16 = std::vector(); 53 | 54 | output16.reserve(size); 55 | for (int n = 0; n < size; ++n) 56 | output16.push_back((input32[n] >> 16) & 0xFFFF); 57 | 58 | return output16; 59 | } 60 | 61 | }} // namespace caspar::core -------------------------------------------------------------------------------- /src/core/mixer/image/blend_modes.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace core { 27 | 28 | enum class blend_mode 29 | { 30 | normal = 0, 31 | lighten, 32 | darken, 33 | multiply, 34 | average, 35 | add, 36 | subtract, 37 | difference, 38 | negation, 39 | exclusion, 40 | screen, 41 | overlay, 42 | soft_light, 43 | hard_light, 44 | color_dodge, 45 | color_burn, 46 | linear_dodge, 47 | linear_burn, 48 | linear_light, 49 | vivid_light, 50 | pin_light, 51 | hard_mix, 52 | reflect, 53 | glow, 54 | phoenix, 55 | contrast, 56 | saturation, 57 | color, 58 | luminosity, 59 | mix, 60 | blend_mode_count 61 | }; 62 | 63 | blend_mode get_blend_mode(const std::wstring& str); 64 | std::wstring get_blend_mode(blend_mode mode); 65 | 66 | }} // namespace caspar::core -------------------------------------------------------------------------------- /src/core/mixer/image/image_mixer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | namespace caspar { namespace core { 32 | 33 | class image_mixer 34 | : public frame_visitor 35 | , public frame_factory 36 | { 37 | image_mixer(const image_mixer&); 38 | image_mixer& operator=(const image_mixer&); 39 | 40 | public: 41 | image_mixer() {} 42 | virtual ~image_mixer() {} 43 | 44 | void push(const struct frame_transform& frame) override = 0; 45 | void visit(const class const_frame& frame) override = 0; 46 | void pop() override = 0; 47 | 48 | virtual std::future> operator()(const struct video_format_desc& format_desc) = 0; 49 | 50 | class mutable_frame create_frame(const void* tag, const struct pixel_format_desc& desc) override = 0; 51 | }; 52 | 53 | }} // namespace caspar::core 54 | -------------------------------------------------------------------------------- /src/core/mixer/mixer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | FORWARD2(caspar, diagnostics, class graph); 31 | 32 | namespace caspar { namespace core { 33 | 34 | class mixer final 35 | { 36 | mixer(const mixer&); 37 | mixer& operator=(const mixer&); 38 | 39 | public: 40 | explicit mixer(int channel_index, 41 | spl::shared_ptr graph, 42 | spl::shared_ptr image_mixer); 43 | 44 | const_frame operator()(std::vector frames, const video_format_desc& format_desc, int nb_samples); 45 | 46 | void set_master_volume(float volume); 47 | float get_master_volume(); 48 | 49 | mutable_frame create_frame(const void* tag, const pixel_format_desc& desc); 50 | 51 | core::monitor::state state() const; 52 | 53 | private: 54 | struct impl; 55 | spl::shared_ptr impl_; 56 | }; 57 | 58 | }} // namespace caspar::core -------------------------------------------------------------------------------- /src/core/producer/color/color_producer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | namespace caspar { namespace core { 33 | 34 | bool try_get_color(const std::wstring& str, uint32_t& value); 35 | 36 | spl::shared_ptr create_color_producer(const spl::shared_ptr& frame_factory, 37 | uint32_t value); 38 | spl::shared_ptr create_color_producer(const spl::shared_ptr& frame_factory, 39 | const std::vector& params); 40 | draw_frame create_color_frame(void* tag, const spl::shared_ptr& frame_factory, uint32_t value); 41 | draw_frame 42 | create_color_frame(void* tag, const spl::shared_ptr& frame_factory, const std::wstring& color); 43 | 44 | }} // namespace caspar::core 45 | -------------------------------------------------------------------------------- /src/core/producer/layer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "frame_producer.h" 25 | 26 | #include "../fwd.h" 27 | #include "../monitor/monitor.h" 28 | 29 | #include 30 | 31 | namespace caspar { namespace core { 32 | 33 | class layer final 34 | { 35 | layer(const layer&); 36 | layer& operator=(const layer&); 37 | 38 | public: 39 | explicit layer(const core::video_format_desc format_desc); 40 | layer(layer&& other); 41 | 42 | layer& operator=(layer&& other); 43 | 44 | void swap(layer& other); 45 | 46 | void load(spl::shared_ptr producer, bool preview, bool auto_play = false); 47 | void play(); 48 | void preview(); 49 | void pause(); 50 | void resume(); 51 | void stop(); 52 | 53 | draw_frame receive(const video_field field, int nb_samples); 54 | draw_frame receive_background(const video_field field, int nb_samples); 55 | 56 | core::monitor::state state() const; 57 | 58 | spl::shared_ptr foreground() const; 59 | spl::shared_ptr background() const; 60 | bool has_background() const; 61 | 62 | private: 63 | struct impl; 64 | spl::shared_ptr impl_; 65 | }; 66 | 67 | }} // namespace caspar::core 68 | -------------------------------------------------------------------------------- /src/core/producer/route/route_producer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | namespace caspar { namespace core { 30 | 31 | class route_control 32 | { 33 | public: 34 | virtual ~route_control() {} 35 | 36 | virtual int get_source_channel() const = 0; 37 | virtual int get_source_layer() const = 0; 38 | 39 | virtual void set_cross_channel(bool cross) = 0; 40 | }; 41 | 42 | spl::shared_ptr create_route_producer(const core::frame_producer_dependencies& dependencies, 43 | const std::vector& params); 44 | 45 | }} // namespace caspar::core 46 | -------------------------------------------------------------------------------- /src/core/producer/separated/separated_producer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace core { 27 | 28 | spl::shared_ptr create_separated_producer(const spl::shared_ptr& fill, 29 | const spl::shared_ptr& key); 30 | 31 | }} // namespace caspar::core -------------------------------------------------------------------------------- /src/core/producer/transition/sting_producer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018 Norsk rikskringkasting AS 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Julian Waller, julian@superfly.tv 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "../../fwd.h" 25 | #include "../../video_format.h" 26 | 27 | #include 28 | 29 | #include 30 | 31 | namespace caspar { namespace core { 32 | 33 | struct sting_info 34 | { 35 | std::wstring mask_filename = L""; 36 | std::wstring overlay_filename = L""; 37 | uint32_t trigger_point = 0; 38 | uint32_t audio_fade_start = 0; 39 | uint32_t audio_fade_duration = UINT32_MAX; 40 | }; 41 | 42 | spl::shared_ptr create_sting_producer(const frame_producer_dependencies& dependencies, 43 | const spl::shared_ptr& destination, 44 | sting_info& info); 45 | 46 | }} // namespace caspar::core 47 | -------------------------------------------------------------------------------- /src/core/producer/transition/transition_producer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "../../fwd.h" 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | namespace caspar { namespace core { 32 | 33 | enum class transition_type 34 | { 35 | cut, 36 | mix, 37 | push, 38 | slide, 39 | wipe, 40 | count 41 | }; 42 | 43 | enum class transition_direction 44 | { 45 | from_left, 46 | from_right, 47 | count 48 | }; 49 | 50 | struct transition_info 51 | { 52 | int duration = 0; 53 | transition_direction direction = transition_direction::from_left; 54 | transition_type type = transition_type::cut; 55 | caspar::tweener tweener{L"linear"}; 56 | }; 57 | 58 | bool try_match_transition(const std::wstring& message, transition_info& transitionInfo); 59 | 60 | spl::shared_ptr create_transition_producer(const spl::shared_ptr& destination, 61 | const transition_info& info); 62 | 63 | }} // namespace caspar::core 64 | -------------------------------------------------------------------------------- /src/modules/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | project("modules") 3 | 4 | add_subdirectory(image) 5 | add_subdirectory(ffmpeg) 6 | add_subdirectory(oal) 7 | add_subdirectory(decklink) 8 | add_subdirectory(screen) 9 | add_subdirectory(newtek) 10 | add_subdirectory(artnet) 11 | 12 | if (ENABLE_HTML) 13 | add_subdirectory(html) 14 | endif () 15 | 16 | if (MSVC) 17 | add_subdirectory(bluefish) 18 | endif() 19 | 20 | -------------------------------------------------------------------------------- /src/modules/artnet/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | project (artnet) 3 | 4 | set(SOURCES 5 | consumer/artnet_consumer.cpp 6 | 7 | artnet.cpp 8 | ) 9 | set(HEADERS 10 | consumer/artnet_consumer.h 11 | 12 | artnet.h 13 | util/fixture_calculation.cpp util/fixture_calculation.h 14 | ) 15 | 16 | casparcg_add_module_project(artnet 17 | SOURCES ${SOURCES} ${HEADERS} 18 | INIT_FUNCTION "artnet::init" 19 | ) 20 | target_include_directories(artnet PRIVATE 21 | .. 22 | ../.. 23 | ) 24 | 25 | set_target_properties(artnet PROPERTIES FOLDER modules) 26 | source_group(sources\\consumer consumer/*) 27 | source_group(sources\\util util/*) 28 | source_group(sources ./*) 29 | 30 | -------------------------------------------------------------------------------- /src/modules/artnet/artnet.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Eliyah Sundström eliyah@sundstroem.com 20 | */ 21 | 22 | #include "artnet.h" 23 | 24 | #define WIN32_LEAN_AND_MEAN 25 | 26 | #include "consumer/artnet_consumer.h" 27 | 28 | #include 29 | 30 | #include 31 | 32 | namespace caspar { namespace artnet { 33 | 34 | void init(const core::module_dependencies& dependencies) 35 | { 36 | dependencies.consumer_registry->register_preconfigured_consumer_factory(L"artnet", create_preconfigured_consumer); 37 | } 38 | 39 | }} // namespace caspar::artnet 40 | -------------------------------------------------------------------------------- /src/modules/artnet/artnet.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Eliyah Sundström eliyah@sundstroem.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace artnet { 27 | 28 | void init(const core::module_dependencies& dependencies); 29 | 30 | }} // namespace caspar::artnet 31 | -------------------------------------------------------------------------------- /src/modules/artnet/consumer/artnet_consumer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Eliyah Sundström eliyah@sundstroem.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "../util/fixture_calculation.h" 25 | 26 | #include 27 | 28 | #include 29 | 30 | #include 31 | #include 32 | 33 | namespace caspar { namespace artnet { 34 | 35 | spl::shared_ptr 36 | create_preconfigured_consumer(const boost::property_tree::wptree& ptree, 37 | const core::video_format_repository& format_repository, 38 | const std::vector>& channels); 39 | }} // namespace caspar::artnet 40 | -------------------------------------------------------------------------------- /src/modules/bluefish/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | project (bluefish) 3 | 4 | set(SOURCES 5 | consumer/bluefish_consumer.cpp 6 | producer/bluefish_producer.cpp 7 | util/blue_velvet.cpp 8 | bluefish.cpp 9 | ) 10 | set(HEADERS 11 | consumer/bluefish_consumer.h 12 | producer/bluefish_producer.h 13 | util/blue_velvet.h 14 | util/memory.h 15 | bluefish.h 16 | StdAfx.h 17 | ) 18 | 19 | casparcg_add_module_project(bluefish 20 | SOURCES ${SOURCES} ${HEADERS} 21 | INIT_FUNCTION "bluefish::init" 22 | ) 23 | target_include_directories(bluefish PRIVATE 24 | .. 25 | ../.. 26 | ${FFMPEG_INCLUDE_PATH} 27 | ) 28 | target_precompile_headers(bluefish PRIVATE "StdAfx.h") 29 | 30 | set_target_properties(bluefish PROPERTIES FOLDER modules) 31 | source_group(sources ./*) 32 | source_group(sources\\consumer consumer/*) 33 | source_group(sources\\producer producer/*) 34 | source_group(sources\\util util/*) 35 | source_group(sources\\interop interop/*) 36 | 37 | target_link_libraries(bluefish ffmpeg) 38 | -------------------------------------------------------------------------------- /src/modules/bluefish/StdAfx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #if defined _DEBUG && defined _MSC_VER 23 | #include 24 | #endif 25 | 26 | #define NOMINMAX 27 | 28 | #include 29 | 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | 40 | #include 41 | #include 42 | // #include 45 | #include 46 | 47 | #include 48 | #include 49 | -------------------------------------------------------------------------------- /src/modules/bluefish/bluefish.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace bluefish { 27 | 28 | std::wstring get_version(); 29 | void init(const core::module_dependencies& dependencies); 30 | 31 | }} // namespace caspar::bluefish 32 | -------------------------------------------------------------------------------- /src/modules/bluefish/consumer/bluefish_consumer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | * James Wise, james.wise@bluefish444.com 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | 32 | namespace caspar { namespace bluefish { 33 | 34 | spl::shared_ptr 35 | create_consumer(const std::vector& params, 36 | const core::video_format_repository& format_repository, 37 | const std::vector>& channels); 38 | 39 | spl::shared_ptr 40 | create_preconfigured_consumer(const boost::property_tree::wptree& ptree, 41 | const core::video_format_repository& format_repository, 42 | const std::vector>& channels); 43 | 44 | }} // namespace caspar::bluefish 45 | -------------------------------------------------------------------------------- /src/modules/bluefish/interop/BlueTypes.h: -------------------------------------------------------------------------------- 1 | //////////////////////////////////////////////////////////////////////////// 2 | // File: BlueTypes.h 3 | // 4 | // Description: Declaration for Bluefish types 5 | // 6 | // (C) Copyright 2017 by Bluefish Technologies Pty Ltd. All Rights Reserved. 7 | //////////////////////////////////////////////////////////////////////////// 8 | 9 | 10 | #ifndef HG_BLUE_TYPES_HG 11 | #define HG_BLUE_TYPES_HG 12 | 13 | 14 | #define BLUE_TRUE 1 15 | #define BLUE_FALSE 0 16 | 17 | typedef int BERR; 18 | typedef int BErr; 19 | typedef long long BGERROR; 20 | typedef void BLUE_VOID; 21 | typedef int BLUE_BOOL; 22 | typedef unsigned char BLUE_U8; 23 | typedef unsigned short BLUE_U16; 24 | typedef unsigned int BLUE_U32; 25 | typedef unsigned long long BLUE_U64; 26 | typedef char BLUE_S8; 27 | typedef short BLUE_S16; 28 | typedef int BLUE_S32; 29 | typedef long long BLUE_S64; 30 | typedef BLUE_U8 BLUE_UINT8; 31 | typedef BLUE_U16 BLUE_UINT16; 32 | typedef BLUE_U32 BLUE_UINT32; 33 | typedef BLUE_U64 BLUE_UINT64; 34 | typedef BLUE_S8 BLUE_INT8; 35 | typedef BLUE_S16 BLUE_INT16; 36 | typedef BLUE_S32 BLUE_INT32; 37 | typedef BLUE_S64 BLUE_INT64; 38 | 39 | // TODO: maybe make a macro to do all this ifndef def etuff. 40 | #ifdef __linux__ 41 | 42 | #ifndef ULONG 43 | #define ULONG BLUE_U32 44 | #endif 45 | #ifndef BOOLEAN 46 | #define BOOLEAN bool 47 | #endif 48 | #ifndef BOOL 49 | #define BOOL bool 50 | #endif 51 | #ifndef LPVOID 52 | #define LPVOID void* 53 | #endif 54 | #ifndef LPDWORD 55 | #define LPDWORD BLUE_U32* 56 | #endif 57 | #ifndef LPOVERLAPPED 58 | #define LPOVERLAPPED void* 59 | #endif 60 | 61 | typedef void* PVOID; 62 | typedef void* PVOID64; 63 | typedef BLUE_U64 LARGE_INTEGER; 64 | typedef BLUE_U32 DWORD; 65 | #endif 66 | 67 | #endif //#define HG_BLUE_TYPES_HG 68 | -------------------------------------------------------------------------------- /src/modules/bluefish/producer/bluefish_producer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | * satchit puthenveetil 21 | * James Wise, james.wise@bluefish444.com 22 | */ 23 | 24 | #pragma once 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | namespace caspar { namespace bluefish { 32 | 33 | spl::shared_ptr create_producer(const core::frame_producer_dependencies& dependencies, 34 | const std::vector& params); 35 | 36 | }} // namespace caspar::bluefish 37 | -------------------------------------------------------------------------------- /src/modules/decklink/consumer/decklink_consumer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | 28 | #include 29 | 30 | #include 31 | #include 32 | 33 | namespace caspar { namespace decklink { 34 | 35 | spl::shared_ptr 36 | create_consumer(const std::vector& params, 37 | const core::video_format_repository& format_repository, 38 | const std::vector>& channels); 39 | spl::shared_ptr 40 | create_preconfigured_consumer(const boost::property_tree::wptree& ptree, 41 | const core::video_format_repository& format_repository, 42 | const std::vector>& channels); 43 | 44 | }} // namespace caspar::decklink 45 | -------------------------------------------------------------------------------- /src/modules/decklink/consumer/frame.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Julian Waller, julian@superfly.tv 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "../StdAfx.h" 25 | 26 | #include "config.h" 27 | 28 | #include "../decklink_api.h" 29 | 30 | #include 31 | #include 32 | 33 | #include 34 | 35 | namespace caspar { namespace decklink { 36 | 37 | std::shared_ptr convert_frame_for_port(const core::video_format_desc& channel_format_desc, 38 | const core::video_format_desc& decklink_format_desc, 39 | const port_configuration& config, 40 | const core::const_frame& frame1, 41 | const core::const_frame& frame2, 42 | BMDFieldDominance field_dominance); 43 | 44 | }} // namespace caspar::decklink -------------------------------------------------------------------------------- /src/modules/decklink/consumer/monitor.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Julian Waller, julian@superfly.tv 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "config.h" 25 | 26 | #include 27 | 28 | namespace caspar { namespace decklink { 29 | 30 | core::monitor::state get_state_for_config(const configuration& config, const core::video_format_desc& channel_format); 31 | 32 | }} // namespace caspar::decklink -------------------------------------------------------------------------------- /src/modules/decklink/decklink.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace decklink { 27 | 28 | std::wstring get_version(); 29 | void init(const core::module_dependencies& dependencies); 30 | 31 | }} // namespace caspar::decklink 32 | -------------------------------------------------------------------------------- /src/modules/decklink/interop/DeckLinkAPIVersion.h: -------------------------------------------------------------------------------- 1 | /* -LICENSE-START- 2 | * ** Copyright (c) 2014 Blackmagic Design 3 | * ** 4 | * ** Permission is hereby granted, free of charge, to any person or organization 5 | * ** obtaining a copy of the software and accompanying documentation covered by 6 | * ** this license (the "Software") to use, reproduce, display, distribute, 7 | * ** execute, and transmit the Software, and to prepare derivative works of the 8 | * ** Software, and to permit third-parties to whom the Software is furnished to 9 | * ** do so, all subject to the following: 10 | * ** 11 | * ** The copyright notices in the Software and this entire statement, including 12 | * ** the above license grant, this restriction and the following disclaimer, 13 | * ** must be included in all copies of the Software, in whole or in part, and 14 | * ** all derivative works of the Software, unless such copies or derivative 15 | * ** works are solely in the form of machine-executable object code generated by 16 | * ** a source language processor. 17 | * ** 18 | * ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | * ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | * ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | * ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | * ** DEALINGS IN THE SOFTWARE. 25 | * ** -LICENSE-END- 26 | * */ 27 | 28 | /* DeckLinkAPIVersion.h */ 29 | 30 | #ifndef __DeckLink_API_Version_h__ 31 | #define __DeckLink_API_Version_h__ 32 | 33 | #define BLACKMAGIC_DECKLINK_API_VERSION 0x0b000000 34 | #define BLACKMAGIC_DECKLINK_API_VERSION_STRING "11.0" 35 | 36 | #endif // __DeckLink_API_Version_h__ 37 | 38 | -------------------------------------------------------------------------------- /src/modules/decklink/linux_interop/DeckLinkAPIVersion.h: -------------------------------------------------------------------------------- 1 | /* -LICENSE-START- 2 | * ** Copyright (c) 2014 Blackmagic Design 3 | * ** 4 | * ** Permission is hereby granted, free of charge, to any person or organization 5 | * ** obtaining a copy of the software and accompanying documentation covered by 6 | * ** this license (the "Software") to use, reproduce, display, distribute, 7 | * ** execute, and transmit the Software, and to prepare derivative works of the 8 | * ** Software, and to permit third-parties to whom the Software is furnished to 9 | * ** do so, all subject to the following: 10 | * ** 11 | * ** The copyright notices in the Software and this entire statement, including 12 | * ** the above license grant, this restriction and the following disclaimer, 13 | * ** must be included in all copies of the Software, in whole or in part, and 14 | * ** all derivative works of the Software, unless such copies or derivative 15 | * ** works are solely in the form of machine-executable object code generated by 16 | * ** a source language processor. 17 | * ** 18 | * ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | * ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | * ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | * ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | * ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | * ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | * ** DEALINGS IN THE SOFTWARE. 25 | * ** -LICENSE-END- 26 | * */ 27 | 28 | /* DeckLinkAPIVersion.h */ 29 | 30 | #ifndef __DeckLink_API_Version_h__ 31 | #define __DeckLink_API_Version_h__ 32 | 33 | #define BLACKMAGIC_DECKLINK_API_VERSION 0x0b000000 34 | #define BLACKMAGIC_DECKLINK_API_VERSION_STRING "11.0" 35 | 36 | #endif // __DeckLink_API_Version_h__ 37 | 38 | -------------------------------------------------------------------------------- /src/modules/decklink/linux_interop/DeckLinkAPI_v10_4.h: -------------------------------------------------------------------------------- 1 | /* -LICENSE-START- 2 | ** Copyright (c) 2015 Blackmagic Design 3 | ** 4 | ** Permission is hereby granted, free of charge, to any person or organization 5 | ** obtaining a copy of the software and accompanying documentation covered by 6 | ** this license (the "Software") to use, reproduce, display, distribute, 7 | ** execute, and transmit the Software, and to prepare derivative works of the 8 | ** Software, and to permit third-parties to whom the Software is furnished to 9 | ** do so, all subject to the following: 10 | ** 11 | ** The copyright notices in the Software and this entire statement, including 12 | ** the above license grant, this restriction and the following disclaimer, 13 | ** must be included in all copies of the Software, in whole or in part, and 14 | ** all derivative works of the Software, unless such copies or derivative 15 | ** works are solely in the form of machine-executable object code generated by 16 | ** a source language processor. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | ** DEALINGS IN THE SOFTWARE. 25 | ** -LICENSE-END- 26 | */ 27 | 28 | #ifndef BMD_DECKLINKAPI_v10_4_H 29 | #define BMD_DECKLINKAPI_v10_4_H 30 | 31 | #include "DeckLinkAPI.h" 32 | 33 | // Type Declarations 34 | 35 | /* Enum BMDDeckLinkConfigurationID - DeckLink Configuration ID */ 36 | 37 | typedef uint32_t BMDDeckLinkConfigurationID_v10_4; 38 | enum _BMDDeckLinkConfigurationID_v10_4 { 39 | 40 | /* Video output flags */ 41 | 42 | bmdDeckLinkConfigSingleLinkVideoOutput_v10_4 = /* 'sglo' */ 0x73676C6F, 43 | }; 44 | 45 | #endif /* defined(BMD_DECKLINKAPI_v10_4_H) */ 46 | -------------------------------------------------------------------------------- /src/modules/decklink/linux_interop/DeckLinkAPI_v10_5.h: -------------------------------------------------------------------------------- 1 | /* -LICENSE-START- 2 | ** Copyright (c) 2015 Blackmagic Design 3 | ** 4 | ** Permission is hereby granted, free of charge, to any person or organization 5 | ** obtaining a copy of the software and accompanying documentation covered by 6 | ** this license (the "Software") to use, reproduce, display, distribute, 7 | ** execute, and transmit the Software, and to prepare derivative works of the 8 | ** Software, and to permit third-parties to whom the Software is furnished to 9 | ** do so, all subject to the following: 10 | ** 11 | ** The copyright notices in the Software and this entire statement, including 12 | ** the above license grant, this restriction and the following disclaimer, 13 | ** must be included in all copies of the Software, in whole or in part, and 14 | ** all derivative works of the Software, unless such copies or derivative 15 | ** works are solely in the form of machine-executable object code generated by 16 | ** a source language processor. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | ** DEALINGS IN THE SOFTWARE. 25 | ** -LICENSE-END- 26 | */ 27 | 28 | #ifndef BMD_DECKLINKAPI_v10_5_H 29 | #define BMD_DECKLINKAPI_v10_5_H 30 | 31 | #include "DeckLinkAPI.h" 32 | 33 | // Type Declarations 34 | 35 | /* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */ 36 | 37 | typedef uint32_t BMDDeckLinkAttributeID_v10_5; 38 | enum _BMDDeckLinkAttributeID_v10_5 { 39 | 40 | /* Integers */ 41 | 42 | BMDDeckLinkDeviceBusyState_v10_5 = /* 'dbst' */ 0x64627374, 43 | }; 44 | 45 | #endif /* defined(BMD_DECKLINKAPI_v10_5_H) */ 46 | 47 | -------------------------------------------------------------------------------- /src/modules/decklink/linux_interop/DeckLinkAPI_v10_6.h: -------------------------------------------------------------------------------- 1 | /* -LICENSE-START- 2 | ** Copyright (c) 2016 Blackmagic Design 3 | ** 4 | ** Permission is hereby granted, free of charge, to any person or organization 5 | ** obtaining a copy of the software and accompanying documentation covered by 6 | ** this license (the "Software") to use, reproduce, display, distribute, 7 | ** execute, and transmit the Software, and to prepare derivative works of the 8 | ** Software, and to permit third-parties to whom the Software is furnished to 9 | ** do so, all subject to the following: 10 | ** 11 | ** The copyright notices in the Software and this entire statement, including 12 | ** the above license grant, this restriction and the following disclaimer, 13 | ** must be included in all copies of the Software, in whole or in part, and 14 | ** all derivative works of the Software, unless such copies or derivative 15 | ** works are solely in the form of machine-executable object code generated by 16 | ** a source language processor. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | ** DEALINGS IN THE SOFTWARE. 25 | ** -LICENSE-END- 26 | */ 27 | 28 | #ifndef BMD_DECKLINKAPI_v10_6_H 29 | #define BMD_DECKLINKAPI_v10_6_H 30 | 31 | #include "DeckLinkAPI.h" 32 | 33 | // Type Declarations 34 | 35 | /* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */ 36 | 37 | typedef uint32_t BMDDeckLinkAttributeID_c10_6; 38 | enum _BMDDeckLinkAttributeID_v10_6 { 39 | 40 | /* Flags */ 41 | 42 | BMDDeckLinkSupportsDesktopDisplay_v10_6 = /* 'extd' */ 0x65787464, 43 | }; 44 | 45 | typedef uint32_t BMDIdleVideoOutputOperation_v10_6; 46 | enum _BMDIdleVideoOutputOperation_v10_6 { 47 | bmdIdleVideoOutputDesktop_v10_6 = /* 'desk' */ 0x6465736B 48 | }; 49 | 50 | #endif /* defined(BMD_DECKLINKAPI_v10_6_H) */ 51 | -------------------------------------------------------------------------------- /src/modules/decklink/linux_interop/DeckLinkAPI_v10_9.h: -------------------------------------------------------------------------------- 1 | /* -LICENSE-START- 2 | ** Copyright (c) 2017 Blackmagic Design 3 | ** 4 | ** Permission is hereby granted, free of charge, to any person or organization 5 | ** obtaining a copy of the software and accompanying documentation covered by 6 | ** this license (the "Software") to use, reproduce, display, distribute, 7 | ** execute, and transmit the Software, and to prepare derivative works of the 8 | ** Software, and to permit third-parties to whom the Software is furnished to 9 | ** do so, all subject to the following: 10 | ** 11 | ** The copyright notices in the Software and this entire statement, including 12 | ** the above license grant, this restriction and the following disclaimer, 13 | ** must be included in all copies of the Software, in whole or in part, and 14 | ** all derivative works of the Software, unless such copies or derivative 15 | ** works are solely in the form of machine-executable object code generated by 16 | ** a source language processor. 17 | ** 18 | ** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 19 | ** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 20 | ** FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT 21 | ** SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE 22 | ** FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, 23 | ** ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 24 | ** DEALINGS IN THE SOFTWARE. 25 | ** -LICENSE-END- 26 | */ 27 | 28 | #ifndef BMD_DECKLINKAPI_v10_9_H 29 | #define BMD_DECKLINKAPI_v10_9_H 30 | 31 | #include "DeckLinkAPI.h" 32 | 33 | // Type Declarations 34 | 35 | /* Enum BMDDeckLinkAttributeID - DeckLink Attribute ID */ 36 | 37 | typedef uint32_t BMDDeckLinkConfigurationID_v10_9; 38 | enum _BMDDeckLinkConfigurationID_v10_9 { 39 | 40 | /* Flags */ 41 | 42 | bmdDeckLinkConfig1080pNotPsF_v10_9 = 'fpro', 43 | }; 44 | 45 | #endif /* defined(BMD_DECKLINKAPI_v10_9_H) */ 46 | -------------------------------------------------------------------------------- /src/modules/decklink/producer/decklink_producer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | namespace caspar { namespace decklink { 30 | 31 | spl::shared_ptr create_producer(const core::frame_producer_dependencies& dependencies, 32 | const std::vector& params); 33 | 34 | }} // namespace caspar::decklink 35 | -------------------------------------------------------------------------------- /src/modules/ffmpeg/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | project (ffmpeg) 3 | 4 | set(SOURCES 5 | producer/av_producer.cpp 6 | producer/av_input.cpp 7 | util/av_util.cpp 8 | producer/ffmpeg_producer.cpp 9 | consumer/ffmpeg_consumer.cpp 10 | 11 | ffmpeg.cpp 12 | ) 13 | set(HEADERS 14 | util/av_assert.h 15 | producer/av_producer.h 16 | producer/av_input.h 17 | util/av_util.h 18 | producer/ffmpeg_producer.h 19 | consumer/ffmpeg_consumer.h 20 | 21 | ffmpeg.h 22 | StdAfx.h 23 | ) 24 | 25 | casparcg_add_module_project(ffmpeg 26 | SOURCES ${SOURCES} ${HEADERS} 27 | INIT_FUNCTION "ffmpeg::init" 28 | UNINIT_FUNCTION "ffmpeg::uninit" 29 | ) 30 | 31 | target_include_directories(ffmpeg PRIVATE 32 | .. 33 | ../.. 34 | ${FFMPEG_INCLUDE_PATH} 35 | ) 36 | target_precompile_headers(ffmpeg PRIVATE "StdAfx.h") 37 | 38 | set_target_properties(ffmpeg PROPERTIES FOLDER modules) 39 | source_group(sources ./*) 40 | source_group(sources\\consumer ./consumer/.*) 41 | source_group(sources\\producer ./producer/.*) 42 | source_group(sources\\util ./util/.*) 43 | 44 | if (MSVC) 45 | # target_link_libraries(ffmpeg 46 | # ) 47 | else() 48 | target_link_libraries(ffmpeg 49 | ${FFMPEG_LIBRARIES} 50 | ) 51 | endif() 52 | -------------------------------------------------------------------------------- /src/modules/ffmpeg/consumer/ffmpeg_consumer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | namespace caspar { namespace ffmpeg { 34 | 35 | spl::shared_ptr 36 | create_consumer(const std::vector& params, 37 | const core::video_format_repository& format_repository, 38 | const std::vector>& channels); 39 | spl::shared_ptr 40 | create_preconfigured_consumer(const boost::property_tree::wptree&, 41 | const core::video_format_repository& format_repository, 42 | const std::vector>& channels); 43 | 44 | }} // namespace caspar::ffmpeg 45 | -------------------------------------------------------------------------------- /src/modules/ffmpeg/ffmpeg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | namespace caspar { namespace ffmpeg { 25 | 26 | void init(const core::module_dependencies& dependencies); 27 | void uninit(); 28 | std::shared_ptr temporary_enable_quiet_logging_for_thread(bool enable); 29 | void enable_quiet_logging_for_thread(); 30 | bool is_logging_quiet_for_thread(); 31 | 32 | }} // namespace caspar::ffmpeg 33 | -------------------------------------------------------------------------------- /src/modules/ffmpeg/producer/av_input.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | 15 | #include 16 | 17 | #include 18 | 19 | struct AVPacket; 20 | struct AVFormatContext; 21 | 22 | namespace caspar { namespace ffmpeg { 23 | 24 | class Input 25 | { 26 | public: 27 | Input(const std::string& filename, std::shared_ptr graph, std::optional seekable); 28 | ~Input(); 29 | 30 | static int interrupt_cb(void* ctx); 31 | 32 | bool try_pop(std::shared_ptr& packet); 33 | 34 | AVFormatContext* operator->(); 35 | 36 | AVFormatContext* const operator->() const; 37 | 38 | void reset(); 39 | void abort(); 40 | bool eof() const; 41 | void seek(int64_t ts, bool flush = true); 42 | 43 | private: 44 | void internal_reset(); 45 | 46 | std::optional seekable_; 47 | 48 | std::string filename_; 49 | std::shared_ptr graph_; 50 | 51 | mutable std::mutex ic_mutex_; 52 | std::shared_ptr ic_; 53 | std::condition_variable ic_cond_; 54 | 55 | tbb::concurrent_bounded_queue> buffer_; 56 | 57 | std::atomic eof_{false}; 58 | 59 | std::atomic abort_request_{false}; 60 | boost::thread thread_; 61 | }; 62 | 63 | }} // namespace caspar::ffmpeg 64 | -------------------------------------------------------------------------------- /src/modules/ffmpeg/producer/av_producer.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | namespace caspar { namespace ffmpeg { 13 | 14 | class AVProducer 15 | { 16 | public: 17 | AVProducer(std::shared_ptr frame_factory, 18 | core::video_format_desc format_desc, 19 | std::string name, 20 | std::string path, 21 | std::optional vfilter, 22 | std::optional afilter, 23 | std::optional start, 24 | std::optional seek, 25 | std::optional duration, 26 | std::optional loop, 27 | int seekable); 28 | 29 | core::draw_frame prev_frame(const core::video_field field); 30 | core::draw_frame next_frame(const core::video_field field); 31 | bool is_ready(); 32 | 33 | AVProducer& seek(int64_t time); 34 | int64_t time() const; 35 | 36 | AVProducer& loop(bool loop); 37 | bool loop() const; 38 | 39 | AVProducer& start(int64_t start); 40 | int64_t start() const; 41 | 42 | AVProducer& duration(int64_t duration); 43 | int64_t duration() const; 44 | 45 | caspar::core::monitor::state state() const; 46 | 47 | private: 48 | struct Impl; 49 | std::shared_ptr impl_; 50 | }; 51 | 52 | }} // namespace caspar::ffmpeg 53 | -------------------------------------------------------------------------------- /src/modules/ffmpeg/producer/ffmpeg_producer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | namespace caspar { namespace ffmpeg { 32 | 33 | spl::shared_ptr create_producer(const core::frame_producer_dependencies& dependencies, 34 | const std::vector& params); 35 | 36 | }} // namespace caspar::ffmpeg 37 | -------------------------------------------------------------------------------- /src/modules/ffmpeg/util/av_util.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | #include 9 | #include 10 | #include 11 | 12 | struct AVFrame; 13 | struct AVPacket; 14 | struct AVFilterContext; 15 | struct AVCodecContext; 16 | struct AVDictionary; 17 | 18 | namespace caspar { namespace ffmpeg { 19 | 20 | std::shared_ptr alloc_frame(); 21 | std::shared_ptr alloc_packet(); 22 | 23 | core::pixel_format get_pixel_format(AVPixelFormat pix_fmt); 24 | core::pixel_format_desc pixel_format_desc(AVPixelFormat pix_fmt, int width, int height, std::vector& data_map); 25 | core::mutable_frame make_frame(void* tag, 26 | core::frame_factory& frame_factory, 27 | std::shared_ptr video, 28 | std::shared_ptr audio); 29 | 30 | std::shared_ptr make_av_video_frame(const core::const_frame& frame, const core::video_format_desc& format_des); 31 | std::shared_ptr make_av_audio_frame(const core::const_frame& frame, const core::video_format_desc& format_des); 32 | 33 | AVDictionary* to_dict(std::map&& map); 34 | std::map to_map(AVDictionary** dict); 35 | 36 | }} // namespace caspar::ffmpeg 37 | -------------------------------------------------------------------------------- /src/modules/html/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | project (html) 3 | 4 | set(SOURCES 5 | producer/html_cg_proxy.cpp 6 | producer/html_producer.cpp 7 | 8 | html.cpp 9 | ) 10 | set(HEADERS 11 | producer/html_cg_proxy.h 12 | producer/html_producer.h 13 | 14 | html.h 15 | ) 16 | 17 | casparcg_add_module_project(html 18 | SOURCES ${SOURCES} ${HEADERS} 19 | INIT_FUNCTION "html::init" 20 | UNINIT_FUNCTION "html::uninit" 21 | CLI_INTERCEPTOR "html::intercept_command_line" 22 | ) 23 | 24 | target_include_directories(html PRIVATE 25 | .. 26 | ../.. 27 | ${CEF_INCLUDE_PATH} 28 | ) 29 | target_link_libraries(html ${CEF_LIB}) 30 | 31 | set_target_properties(html PROPERTIES FOLDER modules) 32 | source_group(sources\\producer producer/*) 33 | source_group(sources ./*) 34 | -------------------------------------------------------------------------------- /src/modules/html/html.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Sveriges Television AB http://casparcg.com/ 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | namespace caspar { namespace html { 31 | 32 | const std::string REMOVE_MESSAGE_NAME = "CasparCGRemove"; 33 | const std::string LOG_MESSAGE_NAME = "CasparCGLog"; 34 | 35 | bool intercept_command_line(int argc, char** argv); 36 | void init(const core::module_dependencies& dependencies); 37 | void uninit(); 38 | void invoke(const std::function& func); 39 | std::future begin_invoke(const std::function& func); 40 | 41 | }} // namespace caspar::html 42 | -------------------------------------------------------------------------------- /src/modules/html/producer/html_cg_proxy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Sveriges Television AB http://casparcg.com/ 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Helge Norberg, helge.norberg@svt.se 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | 28 | namespace caspar { namespace html { 29 | 30 | class html_cg_proxy : public core::cg_proxy 31 | { 32 | public: 33 | explicit html_cg_proxy(const spl::shared_ptr& producer); 34 | ~html_cg_proxy(); 35 | 36 | void add(int layer, 37 | const std::wstring& template_name, 38 | bool play_on_load, 39 | const std::wstring& start_from_label, 40 | const std::wstring& data) override; 41 | void remove(int layer) override; 42 | void play(int layer) override; 43 | void stop(int layer) override; 44 | void next(int layer) override; 45 | void update(int layer, const std::wstring& data) override; 46 | std::wstring invoke(int layer, const std::wstring& label) override; 47 | 48 | private: 49 | struct impl; 50 | spl::shared_ptr impl_; 51 | }; 52 | 53 | }} // namespace caspar::html 54 | -------------------------------------------------------------------------------- /src/modules/html/producer/html_producer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Sveriges Television AB http://casparcg.com/ 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | namespace caspar { namespace html { 32 | 33 | spl::shared_ptr create_producer(const core::frame_producer_dependencies& dependencies, 34 | const std::vector& params); 35 | spl::shared_ptr create_cg_producer(const core::frame_producer_dependencies& dependencies, 36 | const std::vector& params); 37 | 38 | }} // namespace caspar::html 39 | -------------------------------------------------------------------------------- /src/modules/image/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | project (image) 3 | 4 | set(SOURCES 5 | consumer/image_consumer.cpp 6 | 7 | producer/image_producer.cpp 8 | 9 | producer/image_scroll_producer.cpp 10 | 11 | util/image_algorithms.cpp 12 | util/image_loader.cpp 13 | 14 | image.cpp 15 | ) 16 | set(HEADERS 17 | consumer/image_consumer.h 18 | 19 | producer/image_producer.h 20 | 21 | producer/image_scroll_producer.h 22 | 23 | util/image_algorithms.h 24 | util/image_loader.h 25 | util/image_view.h 26 | 27 | image.h 28 | ) 29 | 30 | casparcg_add_module_project(image 31 | SOURCES ${SOURCES} ${HEADERS} 32 | INIT_FUNCTION "image::init" 33 | ) 34 | target_include_directories(image PRIVATE 35 | .. 36 | ../.. 37 | ${FREEIMAGE_INCLUDE_PATH} 38 | ) 39 | 40 | set_target_properties(image PROPERTIES FOLDER modules) 41 | source_group(sources\\consumer consumer/*) 42 | source_group(sources\\producer producer/*) 43 | source_group(sources\\util util/*) 44 | source_group(sources ./*) 45 | 46 | if(MSVC) 47 | target_link_libraries(image 48 | FreeImage.lib 49 | ) 50 | else() 51 | target_link_libraries(image 52 | freeimage 53 | ) 54 | endif() 55 | 56 | -------------------------------------------------------------------------------- /src/modules/image/consumer/image_consumer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | #include 30 | #include 31 | 32 | namespace caspar { namespace image { 33 | 34 | spl::shared_ptr 35 | create_consumer(const std::vector& params, 36 | const core::video_format_repository& format_repository, 37 | const std::vector>& channels); 38 | 39 | }} // namespace caspar::image 40 | -------------------------------------------------------------------------------- /src/modules/image/image.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #include "image.h" 23 | 24 | #define WIN32_LEAN_AND_MEAN 25 | #include 26 | 27 | #include "consumer/image_consumer.h" 28 | #include "producer/image_producer.h" 29 | #include "producer/image_scroll_producer.h" 30 | 31 | #include 32 | 33 | namespace caspar { namespace image { 34 | 35 | std::wstring version() { return u16(FreeImage_GetVersion()); } 36 | 37 | void init(const core::module_dependencies& dependencies) 38 | { 39 | FreeImage_Initialise(); 40 | dependencies.producer_registry->register_producer_factory(L"Image Scroll Producer", create_scroll_producer); 41 | dependencies.producer_registry->register_producer_factory(L"Image Producer", create_producer); 42 | dependencies.consumer_registry->register_consumer_factory(L"Image Consumer", create_consumer); 43 | } 44 | 45 | void uninit() { FreeImage_DeInitialise(); } 46 | 47 | }} // namespace caspar::image 48 | -------------------------------------------------------------------------------- /src/modules/image/image.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace image { 27 | 28 | void init(const core::module_dependencies& dependencies); 29 | void uninit(); 30 | 31 | }} // namespace caspar::image 32 | -------------------------------------------------------------------------------- /src/modules/image/producer/image_producer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | namespace caspar { namespace image { 30 | 31 | spl::shared_ptr create_producer(const core::frame_producer_dependencies& dependencies, 32 | const std::vector& params); 33 | 34 | }} // namespace caspar::image -------------------------------------------------------------------------------- /src/modules/image/producer/image_scroll_producer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | /* 3 | * Copyright (c) 2011 Sveriges Television AB 4 | * 5 | * This file is part of CasparCG (www.casparcg.com). 6 | * 7 | * CasparCG is free software: you can redistribute it and/or modify 8 | * it under the terms of the GNU General Public License as published by 9 | * the Free Software Foundation, either version 3 of the License, or 10 | * (at your option) any later version. 11 | * 12 | * CasparCG is distributed in the hope that it will be useful, 13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 | * GNU General Public License for more details. 16 | * 17 | * You should have received a copy of the GNU General Public License 18 | * along with CasparCG. If not, see . 19 | * 20 | * Author: Robert Nagy, ronag89@gmail.com 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | namespace caspar { namespace image { 31 | 32 | spl::shared_ptr create_scroll_producer(const core::frame_producer_dependencies& dependencies, 33 | const std::vector& params); 34 | 35 | }} // namespace caspar::image 36 | -------------------------------------------------------------------------------- /src/modules/image/util/image_algorithms.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Sveriges Television AB http://casparcg.com/ 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Helge Norberg, helge.norberg@svt.se.com 20 | */ 21 | 22 | #include "image_algorithms.h" 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace caspar { namespace image { 29 | 30 | std::vector> get_line_points(int num_pixels, double angle_radians) 31 | { 32 | std::vector> line_points; 33 | line_points.reserve(num_pixels); 34 | 35 | double delta_x = std::cos(angle_radians); 36 | double delta_y = -std::sin(angle_radians); // In memory is revered 37 | double max_delta = std::max(std::abs(delta_x), std::abs(delta_y)); 38 | double amplification = 1.0 / max_delta; 39 | delta_x *= amplification; 40 | delta_y *= amplification; 41 | 42 | for (int i = 1; i <= num_pixels; ++i) 43 | line_points.push_back(std::make_pair(static_cast(std::floor(delta_x * static_cast(i) + 0.5)), 44 | static_cast(std::floor(delta_y * static_cast(i) + 0.5)))); 45 | 46 | return std::move(line_points); 47 | } 48 | 49 | }} // namespace caspar::image 50 | -------------------------------------------------------------------------------- /src/modules/image/util/image_loader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | struct FIBITMAP; 31 | 32 | namespace caspar { namespace image { 33 | 34 | std::shared_ptr load_image(const std::wstring& filename); 35 | std::shared_ptr load_png_from_memory(const void* memory_location, size_t size); 36 | 37 | bool is_valid_file(const boost::filesystem::path& filename); 38 | 39 | }} // namespace caspar::image 40 | -------------------------------------------------------------------------------- /src/modules/newtek/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | project (newtek) 3 | 4 | set(SOURCES 5 | consumer/newtek_ndi_consumer.cpp 6 | 7 | producer/newtek_ndi_producer.cpp 8 | 9 | util/ndi.cpp 10 | 11 | newtek.cpp 12 | 13 | ) 14 | set(HEADERS 15 | consumer/newtek_ndi_consumer.h 16 | 17 | producer/newtek_ndi_producer.h 18 | 19 | util/ndi.h 20 | 21 | newtek.h 22 | 23 | interop/Processing.NDI.compat.h 24 | interop/Processing.NDI.deprecated.h 25 | interop/Processing.NDI.DynamicLoad.h 26 | interop/Processing.NDI.Find.h 27 | interop/Processing.NDI.FrameSync.h 28 | interop/Processing.NDI.Lib.cplusplus.h 29 | interop/Processing.NDI.Lib.h 30 | interop/Processing.NDI.Recv.ex.h 31 | interop/Processing.NDI.Recv.h 32 | interop/Processing.NDI.Routing.h 33 | interop/Processing.NDI.Send.h 34 | interop/Processing.NDI.structs.h 35 | interop/Processing.NDI.utilities.h 36 | 37 | StdAfx.h 38 | ) 39 | 40 | casparcg_add_module_project(newtek 41 | SOURCES ${SOURCES} ${HEADERS} 42 | INIT_FUNCTION "newtek::init" 43 | ) 44 | target_include_directories(newtek PRIVATE 45 | .. 46 | ../.. 47 | ${FFMPEG_INCLUDE_PATH} 48 | ) 49 | target_precompile_headers(newtek PRIVATE "StdAfx.h") 50 | 51 | set_target_properties(newtek PROPERTIES FOLDER modules) 52 | source_group(sources\\consumer consumer/*) 53 | source_group(sources\\producer producer/*) 54 | source_group(sources\\interop interop/*) 55 | source_group(sources\\util util/*) 56 | source_group(sources ./*) 57 | 58 | target_link_libraries(newtek 59 | ffmpeg 60 | ) 61 | -------------------------------------------------------------------------------- /src/modules/newtek/StdAfx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Sveriges Television AB http://casparcg.com/ 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #ifdef _DEBUG 23 | #include 24 | #endif 25 | 26 | #define NOMINMAX 27 | 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | 38 | #include 39 | 40 | #include 41 | #include 42 | 43 | #include 44 | -------------------------------------------------------------------------------- /src/modules/newtek/consumer/newtek_ndi_consumer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Sveriges Television AB http://casparcg.com/ 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Krzysztof Zegzula, zegzulakrzysztof@gmail.com 20 | * based on work of Robert Nagy, ronag89@gmail.com work 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | namespace caspar { namespace newtek { 34 | 35 | spl::shared_ptr 36 | create_ndi_consumer(const std::vector& params, 37 | const core::video_format_repository& format_repository, 38 | const std::vector>& channels); 39 | spl::shared_ptr 40 | create_preconfigured_ndi_consumer(const boost::property_tree::wptree& ptree, 41 | const core::video_format_repository& format_repository, 42 | const std::vector>& channels); 43 | 44 | }} // namespace caspar::newtek 45 | -------------------------------------------------------------------------------- /src/modules/newtek/interop/Processing.NDI.compat.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | // NOTE : The following MIT license applies to this file ONLY and not to the SDK as a whole. Please review 4 | // the SDK documentation for the description of the full license terms, which are also provided in the file 5 | // "NDI License Agreement.pdf" within the SDK or online at http://new.tk/ndisdk_license/. Your use of any 6 | // part of this SDK is acknowledgment that you agree to the SDK license terms. The full NDI SDK may be 7 | // downloaded at http://ndi.tv/ 8 | // 9 | //*********************************************************************************************************** 10 | // 11 | // Copyright (C)2014-2021, NewTek, inc. 12 | // 13 | // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and 14 | // associated documentation files(the "Software"), to deal in the Software without restriction, including 15 | // without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and / or sell 16 | // copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the 17 | // following conditions : 18 | // 19 | // The above copyright notice and this permission notice shall be included in all copies or substantial 20 | // portions of the Software. 21 | // 22 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT 23 | // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO 24 | // EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 25 | // IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR 26 | // THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27 | // 28 | //*********************************************************************************************************** 29 | 30 | #ifndef __cplusplus 31 | #include 32 | #endif 33 | 34 | #include 35 | 36 | #ifndef INFINITE 37 | //#define INFINITE INFINITE 38 | static const uint32_t INFINITE = 0xFFFFFFFF; 39 | #endif 40 | -------------------------------------------------------------------------------- /src/modules/newtek/newtek.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Sveriges Television AB http://casparcg.com/ 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #include "newtek.h" 23 | 24 | #include "consumer/newtek_ndi_consumer.h" 25 | #include "producer/newtek_ndi_producer.h" 26 | 27 | #include "util/ndi.h" 28 | 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | namespace caspar { namespace newtek { 35 | 36 | void init(const core::module_dependencies& dependencies) 37 | { 38 | try { 39 | dependencies.consumer_registry->register_consumer_factory(L"NDI Consumer", create_ndi_consumer); 40 | dependencies.consumer_registry->register_preconfigured_consumer_factory(L"ndi", 41 | create_preconfigured_ndi_consumer); 42 | 43 | dependencies.producer_registry->register_producer_factory(L"NDI Producer", create_ndi_producer); 44 | 45 | dependencies.command_repository->register_command(L"Query Commands", L"NDI LIST", ndi::list_command, 0); 46 | 47 | bool autoload = caspar::env::properties().get(L"configuration.ndi.auto-load", false); 48 | if (autoload) 49 | ndi::load_library(); 50 | 51 | } catch (...) { 52 | } 53 | } 54 | 55 | }} // namespace caspar::newtek 56 | -------------------------------------------------------------------------------- /src/modules/newtek/newtek.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Sveriges Television AB http://casparcg.com/ 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace newtek { 27 | 28 | void init(const core::module_dependencies& dependencies); 29 | 30 | }} // namespace caspar::newtek -------------------------------------------------------------------------------- /src/modules/newtek/producer/newtek_ndi_producer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2018 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Krzysztof Zegzula, zegzulakrzysztof@gmail.com 20 | * based on work of Robert Nagy, ronag89@gmail.com 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | 33 | namespace caspar { namespace newtek { 34 | 35 | spl::shared_ptr create_ndi_producer(const core::frame_producer_dependencies& dependencies, 36 | const std::vector& params); 37 | 38 | }} // namespace caspar::newtek 39 | -------------------------------------------------------------------------------- /src/modules/newtek/util/ndi.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Sveriges Television AB http://casparcg.com/ 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Krzysztof Zegzula, zegzulakrzysztof@gmail.com 20 | */ 21 | #pragma once 22 | 23 | #include "../interop/Processing.NDI.Lib.h" 24 | #include "protocol/amcp/amcp_command_context.h" 25 | #include 26 | 27 | namespace caspar { namespace newtek { namespace ndi { 28 | 29 | const std::wstring& dll_name(); 30 | NDIlib_v5* load_library(); 31 | std::map get_current_sources(); 32 | void not_initialized(); 33 | void not_installed(); 34 | 35 | std::wstring list_command(protocol::amcp::command_context& ctx); 36 | 37 | }}} // namespace caspar::newtek::ndi 38 | -------------------------------------------------------------------------------- /src/modules/oal/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | project (oal) 3 | 4 | set(SOURCES 5 | consumer/oal_consumer.cpp 6 | 7 | oal.cpp 8 | ) 9 | set(HEADERS 10 | consumer/oal_consumer.h 11 | 12 | oal.h 13 | ) 14 | 15 | casparcg_add_module_project(oal 16 | SOURCES ${SOURCES} ${HEADERS} 17 | INIT_FUNCTION "oal::init" 18 | ) 19 | target_include_directories(oal PRIVATE 20 | .. 21 | ../.. 22 | ${FFMPEG_INCLUDE_PATH} 23 | ${OPENAL_INCLUDE_PATH} 24 | ) 25 | 26 | set_target_properties(oal PROPERTIES FOLDER modules) 27 | source_group(sources\\consumer consumer/*) 28 | source_group(sources ./*) 29 | 30 | if(MSVC) 31 | target_link_libraries(oal 32 | OpenAL32) 33 | else() 34 | target_link_libraries(oal 35 | openal) 36 | endif() 37 | -------------------------------------------------------------------------------- /src/modules/oal/consumer/oal_consumer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | 28 | #include 29 | 30 | #include 31 | 32 | namespace caspar { namespace oal { 33 | 34 | spl::shared_ptr 35 | create_consumer(const std::vector& params, 36 | const core::video_format_repository& format_repository, 37 | const std::vector>& channels); 38 | spl::shared_ptr 39 | create_preconfigured_consumer(const boost::property_tree::wptree&, 40 | const core::video_format_repository& format_repository, 41 | const std::vector>& channels); 42 | 43 | }} // namespace caspar::oal 44 | -------------------------------------------------------------------------------- /src/modules/oal/oal.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #include "oal.h" 23 | 24 | #include "consumer/oal_consumer.h" 25 | 26 | #include 27 | 28 | namespace caspar { namespace oal { 29 | 30 | void init(const core::module_dependencies& dependencies) 31 | { 32 | dependencies.consumer_registry->register_consumer_factory(L"System Audio Consumer", create_consumer); 33 | dependencies.consumer_registry->register_preconfigured_consumer_factory(L"system-audio", 34 | create_preconfigured_consumer); 35 | } 36 | 37 | }} // namespace caspar::oal 38 | -------------------------------------------------------------------------------- /src/modules/oal/oal.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace oal { 27 | 28 | void init(const core::module_dependencies& dependencies); 29 | 30 | }} // namespace caspar::oal 31 | -------------------------------------------------------------------------------- /src/modules/screen/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | project (screen) 3 | 4 | set(SOURCES 5 | consumer/screen_consumer.cpp 6 | 7 | screen.cpp 8 | ) 9 | set(HEADERS 10 | consumer/screen_consumer.h 11 | 12 | consumer_screen_vertex.h 13 | consumer_screen_fragment.h 14 | 15 | screen.h 16 | ) 17 | 18 | bin2c("consumer/screen.vert" "consumer_screen_vertex.h" "caspar::screen" "vertex_shader") 19 | bin2c("consumer/screen.frag" "consumer_screen_fragment.h" "caspar::screen" "fragment_shader") 20 | 21 | if (MSVC) 22 | else () 23 | list(APPEND HEADERS 24 | util/x11_util.h 25 | ) 26 | list(APPEND SOURCES 27 | util/x11_util.cpp 28 | ) 29 | endif () 30 | 31 | casparcg_add_module_project(screen 32 | SOURCES ${SOURCES} ${HEADERS} 33 | INIT_FUNCTION "screen::init" 34 | ) 35 | target_include_directories(screen PRIVATE 36 | .. 37 | ../.. 38 | ${CMAKE_CURRENT_BINARY_DIR} 39 | ${GLEW_INCLUDE_PATH} 40 | ${SFML_INCLUDE_PATH} 41 | ${FFMPEG_INCLUDE_PATH} 42 | ) 43 | 44 | set_target_properties(screen PROPERTIES FOLDER modules) 45 | source_group(sources\\consumer consumer/*) 46 | source_group(sources ./*) 47 | 48 | target_link_libraries(screen accelerator ffmpeg) 49 | -------------------------------------------------------------------------------- /src/modules/screen/consumer/screen.vert: -------------------------------------------------------------------------------- 1 | #version 450 2 | in vec4 TexCoordIn; 3 | in vec2 Position; 4 | 5 | out vec4 TexCoord; 6 | 7 | void main() 8 | { 9 | TexCoord = TexCoordIn; 10 | gl_Position = vec4(Position, 0, 1); 11 | } 12 | -------------------------------------------------------------------------------- /src/modules/screen/consumer/screen_consumer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | 28 | #include 29 | #include 30 | 31 | namespace caspar { namespace screen { 32 | 33 | spl::shared_ptr 34 | create_consumer(const std::vector& params, 35 | const core::video_format_repository& format_repository, 36 | const std::vector>& channels); 37 | spl::shared_ptr 38 | create_preconfigured_consumer(const boost::property_tree::wptree& ptree, 39 | const core::video_format_repository& format_repository, 40 | const std::vector>& channels); 41 | 42 | }} // namespace caspar::screen 43 | -------------------------------------------------------------------------------- /src/modules/screen/screen.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #include "screen.h" 23 | 24 | #include "consumer/screen_consumer.h" 25 | 26 | #include 27 | 28 | namespace caspar { namespace screen { 29 | 30 | void init(const core::module_dependencies& dependencies) 31 | { 32 | dependencies.consumer_registry->register_consumer_factory(L"Screen Consumer", create_consumer); 33 | dependencies.consumer_registry->register_preconfigured_consumer_factory(L"screen", create_preconfigured_consumer); 34 | } 35 | 36 | }} // namespace caspar::screen 37 | -------------------------------------------------------------------------------- /src/modules/screen/screen.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { namespace screen { 27 | 28 | void init(const core::module_dependencies& dependencies); 29 | 30 | }} // namespace caspar::screen 31 | -------------------------------------------------------------------------------- /src/modules/screen/util/x11_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Julian Waller, git@julusian.co.uk 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | bool window_always_on_top(const sf::Window& window); 27 | -------------------------------------------------------------------------------- /src/protocol/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | project (protocol) 3 | 4 | set(SOURCES 5 | amcp/AMCPCommand.cpp 6 | amcp/AMCPCommandQueue.cpp 7 | amcp/AMCPCommandsImpl.cpp 8 | amcp/AMCPProtocolStrategy.cpp 9 | amcp/amcp_command_repository.cpp 10 | amcp/amcp_args.cpp 11 | amcp/amcp_command_repository_wrapper.cpp 12 | 13 | osc/oscpack/OscOutboundPacketStream.cpp 14 | osc/oscpack/OscPrintReceivedElements.cpp 15 | osc/oscpack/OscReceivedElements.cpp 16 | osc/oscpack/OscTypes.cpp 17 | 18 | osc/client.cpp 19 | 20 | util/AsyncEventServer.cpp 21 | util/lock_container.cpp 22 | util/strategy_adapters.cpp 23 | util/http_request.cpp 24 | util/tokenize.cpp 25 | ) 26 | 27 | set(HEADERS 28 | amcp/AMCPCommand.h 29 | amcp/AMCPCommandQueue.h 30 | amcp/AMCPCommandsImpl.h 31 | amcp/AMCPProtocolStrategy.h 32 | amcp/amcp_command_repository.h 33 | amcp/amcp_command_repository_wrapper.h 34 | amcp/amcp_shared.h 35 | amcp/amcp_args.h 36 | amcp/amcp_command_context.h 37 | 38 | osc/oscpack/MessageMappingOscPacketListener.h 39 | osc/oscpack/OscException.h 40 | osc/oscpack/OscHostEndianness.h 41 | osc/oscpack/OscOutboundPacketStream.h 42 | osc/oscpack/OscPacketListener.h 43 | osc/oscpack/OscPrintReceivedElements.h 44 | osc/oscpack/OscReceivedElements.h 45 | osc/oscpack/OscTypes.h 46 | 47 | osc/client.h 48 | 49 | util/AsyncEventServer.h 50 | util/ClientInfo.h 51 | util/lock_container.h 52 | util/ProtocolStrategy.h 53 | util/protocol_strategy.h 54 | util/strategy_adapters.h 55 | util/http_request.h 56 | util/tokenize.h 57 | 58 | StdAfx.h 59 | ) 60 | 61 | casparcg_add_library(protocol SOURCES ${SOURCES} ${HEADERS}) 62 | target_include_directories(protocol PRIVATE 63 | .. 64 | ) 65 | target_precompile_headers(protocol PRIVATE "StdAfx.h") 66 | 67 | source_group(sources\\amcp amcp/*) 68 | source_group(sources\\cii cii/*) 69 | source_group(sources\\clk clk/*) 70 | source_group(sources\\log log/*) 71 | source_group(sources\\osc\\oscpack osc/oscpack/*) 72 | source_group(sources\\osc osc/*) 73 | source_group(sources\\util util/*) 74 | source_group(sources ./*) 75 | 76 | target_link_libraries(protocol common core) 77 | -------------------------------------------------------------------------------- /src/protocol/StdAfx.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Nicklas P Andersson 20 | */ 21 | 22 | #define NOMINMAX 23 | #define WIN32_LEAN_AND_MEAN 24 | 25 | #if defined(_MSC_VER) 26 | #ifndef _SCL_SECURE_NO_WARNINGS 27 | #define _SCL_SECURE_NO_WARNINGS 28 | #endif 29 | #ifndef _CRT_SECURE_NO_WARNINGS 30 | #define _CRT_SECURE_NO_WARNINGS 31 | #endif 32 | #endif 33 | 34 | #if defined _DEBUG && defined _MSC_VER 35 | #include 36 | #endif 37 | 38 | #include 39 | #include 40 | #include 41 | #include 42 | #include 43 | #include 44 | #include 45 | #include 46 | #include 47 | #include 48 | #include 49 | 50 | #include 51 | #include 52 | #include 53 | 54 | #include 55 | #include 56 | 57 | #include 58 | #include 59 | 60 | #include 61 | -------------------------------------------------------------------------------- /src/protocol/amcp/AMCPCommandQueue.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Nicklas P Andersson 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "AMCPCommand.h" 25 | 26 | #include 27 | #include 28 | 29 | namespace caspar { namespace protocol { namespace amcp { 30 | 31 | class AMCPCommandQueue 32 | { 33 | public: 34 | using ptr_type = spl::shared_ptr; 35 | 36 | AMCPCommandQueue(const std::wstring& name, const spl::shared_ptr>& channels); 37 | ~AMCPCommandQueue(); 38 | 39 | void AddCommand(std::shared_ptr command); 40 | void Execute(std::shared_ptr cmd) const; 41 | 42 | private: 43 | executor executor_; 44 | const spl::shared_ptr> channels_; 45 | }; 46 | 47 | }}} // namespace caspar::protocol::amcp 48 | -------------------------------------------------------------------------------- /src/protocol/amcp/AMCPCommandsImpl.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Nicklas P Andersson 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "amcp_command_context.h" 25 | #include "amcp_command_repository_wrapper.h" 26 | 27 | namespace caspar { namespace protocol { namespace amcp { 28 | 29 | void register_commands(std::shared_ptr& repo); 30 | 31 | }}} // namespace caspar::protocol::amcp 32 | -------------------------------------------------------------------------------- /src/protocol/amcp/AMCPProtocolStrategy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Nicklas P Andersson 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "../util/ClientInfo.h" 25 | 26 | #include 27 | 28 | #include "amcp_command_repository.h" 29 | 30 | #include 31 | 32 | namespace caspar { namespace protocol { namespace amcp { 33 | 34 | IO::protocol_strategy_factory::ptr 35 | create_char_amcp_strategy_factory(const std::wstring& name, const spl::shared_ptr& repo); 36 | 37 | IO::protocol_strategy_factory::ptr 38 | create_wchar_amcp_strategy_factory(const std::wstring& name, const spl::shared_ptr& repo); 39 | 40 | }}} // namespace caspar::protocol::amcp 41 | -------------------------------------------------------------------------------- /src/protocol/amcp/amcp_args.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Julian Waller, julian@superfly.tv 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | namespace caspar { namespace protocol { namespace amcp { 29 | 30 | inline bool is_args_token(const std::wstring& message) 31 | { 32 | return (message[0] == L'(' && message[message.size() - 1] == L')'); 33 | } 34 | 35 | inline bool 36 | get_arg_value(const std::map& args, const std::wstring& key, std::wstring& value) 37 | { 38 | auto it = args.find(boost::to_upper_copy(key)); 39 | if (it != args.end()) { 40 | value = it->second; 41 | return true; 42 | } 43 | return false; 44 | } 45 | 46 | inline bool get_bool_arg(const std::map& args, const std::wstring& key) 47 | { 48 | std::wstring value; 49 | if (get_arg_value(args, key, value)) { 50 | return (value != L"0" && boost::to_upper_copy(value) != L"FALSE"); 51 | } 52 | return false; 53 | } 54 | 55 | std::map tokenize_args(const std::wstring& message); 56 | 57 | }}} // namespace caspar::protocol::amcp 58 | -------------------------------------------------------------------------------- /src/protocol/amcp/amcp_command_repository.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Helge Norberg, helge.norberg@svt.se 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "../util/ClientInfo.h" 25 | #include "AMCPCommand.h" 26 | 27 | #include 28 | 29 | #include 30 | 31 | namespace caspar { namespace protocol { namespace amcp { 32 | 33 | class amcp_command_repository 34 | { 35 | public: 36 | amcp_command_repository(const spl::shared_ptr>& channels); 37 | 38 | std::shared_ptr 39 | parse_command(IO::ClientInfoPtr client, std::list tokens, const std::wstring& request_id) const; 40 | bool check_channel_lock(IO::ClientInfoPtr client, int channel_index) const; 41 | 42 | const spl::shared_ptr>& channels() const; 43 | 44 | void register_command(std::wstring category, std::wstring name, amcp_command_func command, int min_num_params); 45 | 46 | void 47 | register_channel_command(std::wstring category, std::wstring name, amcp_command_func command, int min_num_params); 48 | 49 | private: 50 | struct impl; 51 | spl::shared_ptr impl_; 52 | 53 | amcp_command_repository(const amcp_command_repository&) = delete; 54 | amcp_command_repository& operator=(const amcp_command_repository&) = delete; 55 | }; 56 | 57 | }}} // namespace caspar::protocol::amcp 58 | -------------------------------------------------------------------------------- /src/protocol/amcp/amcp_shared.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "../util/ClientInfo.h" 4 | #include "../util/lock_container.h" 5 | #include 6 | #include 7 | #include 8 | 9 | namespace caspar { namespace protocol { namespace amcp { 10 | 11 | class channel_context 12 | { 13 | public: 14 | explicit channel_context() {} 15 | explicit channel_context(std::shared_ptr c, 16 | std::shared_ptr s, 17 | const std::wstring& lifecycle_key) 18 | : raw_channel(std::move(c)) 19 | , stage(std::move(s)) 20 | , lock(std::make_shared(lifecycle_key)) 21 | , lifecycle_key_(lifecycle_key) 22 | { 23 | } 24 | const std::shared_ptr raw_channel; 25 | const std::shared_ptr stage; 26 | const std::shared_ptr lock; 27 | const std::wstring lifecycle_key_; 28 | }; 29 | 30 | struct command_context_simple 31 | { 32 | const IO::ClientInfoPtr client; 33 | const int channel_index; 34 | const int layer_id; 35 | const std::vector parameters; 36 | 37 | int layer_index(int default_ = 0) const { return layer_id == -1 ? default_ : layer_id; } 38 | 39 | command_context_simple(IO::ClientInfoPtr client, 40 | int channel_index, 41 | int layer_id, 42 | const std::vector& parameters) 43 | : client(std::move(client)) 44 | , channel_index(channel_index) 45 | , layer_id(layer_id) 46 | , parameters(parameters) 47 | { 48 | } 49 | }; 50 | 51 | typedef std::function(const command_context_simple& args, 52 | const spl::shared_ptr>& channels)> 53 | amcp_command_func; 54 | 55 | }}} // namespace caspar::protocol::amcp 56 | -------------------------------------------------------------------------------- /src/protocol/osc/client.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2013 Sveriges Television AB http://casparcg.com/ 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | * Author: Helge Norberg, helge.norberg@svt.se 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | 27 | #include 28 | #include 29 | 30 | namespace caspar { namespace protocol { namespace osc { 31 | 32 | class client 33 | { 34 | client(const client&); 35 | client& operator=(const client&); 36 | 37 | public: 38 | client(std::shared_ptr service); 39 | 40 | client(client&&); 41 | 42 | /** 43 | * Get a subscription token that ensures that OSC messages are sent to the 44 | * given endpoint as long as the token is alive. It will stop sending when 45 | * the token is dropped unless another token to the same endpoint has 46 | * previously been checked out. 47 | * 48 | * @param endpoint The UDP endpoint to send OSC messages to. 49 | * 50 | * @return The token. It is ok for the token to outlive the client 51 | */ 52 | std::shared_ptr get_subscription_token(const boost::asio::ip::udp::endpoint& endpoint); 53 | 54 | ~client(); 55 | 56 | client& operator=(client&&); 57 | 58 | void send(const core::monitor::state& state); 59 | 60 | private: 61 | struct impl; 62 | spl::shared_ptr impl_; 63 | }; 64 | 65 | }}} // namespace caspar::protocol::osc 66 | -------------------------------------------------------------------------------- /src/protocol/osc/oscpack/OscTypes.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | oscpack -- Open Sound Control packet manipulation library 3 | http://www.audiomulch.com/~rossb/oscpack 4 | 5 | Copyright (c) 2004-2005 Ross Bencina 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining 8 | a copy of this software and associated documentation files 9 | (the "Software"), to deal in the Software without restriction, 10 | including without limitation the rights to use, copy, modify, merge, 11 | publish, distribute, sublicense, and/or sell copies of the Software, 12 | and to permit persons to whom the Software is furnished to do so, 13 | subject to the following conditions: 14 | 15 | The above copyright notice and this permission notice shall be 16 | included in all copies or substantial portions of the Software. 17 | 18 | Any person wishing to distribute modifications to the Software is 19 | requested to send the modifications to the original developer so that 20 | they can be incorporated into the canonical version. 21 | 22 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 23 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 24 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 25 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR 26 | ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 27 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 28 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29 | */ 30 | #include "OscTypes.h" 31 | 32 | namespace osc { 33 | 34 | BundleInitiator BeginBundleImmediate(1); 35 | BundleTerminator EndBundle; 36 | MessageTerminator EndMessage; 37 | NilType Nil; 38 | InfinitumType Infinitum; 39 | 40 | } // namespace osc 41 | -------------------------------------------------------------------------------- /src/protocol/util/AsyncEventServer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * copyright (c) 2010 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG. 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | */ 20 | 21 | // AsyncEventServer.h: interface for the AsyncServer class. 22 | ////////////////////////////////////////////////////////////////////// 23 | #pragma once 24 | 25 | #include "protocol_strategy.h" 26 | 27 | #include 28 | 29 | #include 30 | 31 | namespace caspar { namespace IO { 32 | 33 | using lifecycle_factory_t = 34 | std::function>(const std::string& ipv4_address)>; 35 | 36 | class AsyncEventServer 37 | { 38 | public: 39 | explicit AsyncEventServer(std::shared_ptr service, 40 | const protocol_strategy_factory::ptr& protocol, 41 | unsigned short port); 42 | ~AsyncEventServer(); 43 | 44 | void add_client_lifecycle_object_factory(const lifecycle_factory_t& lifecycle_factory); 45 | 46 | struct implementation; 47 | 48 | private: 49 | spl::shared_ptr impl_; 50 | 51 | AsyncEventServer(const AsyncEventServer&) = delete; 52 | AsyncEventServer& operator=(const AsyncEventServer&) = delete; 53 | }; 54 | 55 | }} // namespace caspar::IO 56 | -------------------------------------------------------------------------------- /src/protocol/util/ClientInfo.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Nicklas P Andersson 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include "protocol_strategy.h" 29 | #include 30 | 31 | namespace caspar { namespace IO { 32 | 33 | typedef spl::shared_ptr> ClientInfoPtr; 34 | typedef std::shared_ptr> ClientInfoPtrStd; 35 | 36 | struct ConsoleClientInfo : public client_connection 37 | { 38 | void send(std::wstring&& data, bool skip_log) override 39 | { 40 | std::wcout << L"#" + caspar::log::replace_nonprintable_copy(data, L'?') << std::flush; 41 | } 42 | void disconnect() override {} 43 | std::wstring address() const override { return L"Console"; } 44 | void add_lifecycle_bound_object(const std::wstring& key, const std::shared_ptr& lifecycle_bound) override {} 45 | std::shared_ptr remove_lifecycle_bound_object(const std::wstring& key) override 46 | { 47 | return std::shared_ptr(); 48 | } 49 | }; 50 | 51 | }} // namespace caspar::IO 52 | -------------------------------------------------------------------------------- /src/protocol/util/ProtocolStrategy.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Nicklas P Andersson 20 | */ 21 | 22 | #pragma once 23 | 24 | #include "ClientInfo.h" 25 | #include 26 | 27 | namespace caspar { namespace IO { 28 | 29 | class IProtocolStrategy 30 | { 31 | public: 32 | virtual ~IProtocolStrategy() {} 33 | 34 | virtual void Parse(const std::wstring& msg, ClientInfoPtr pClientInfo) = 0; 35 | virtual std::string GetCodepage() const = 0; 36 | }; 37 | using ProtocolStrategyPtr = std::shared_ptr; 38 | 39 | }} // namespace caspar::IO 40 | -------------------------------------------------------------------------------- /src/protocol/util/http_request.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace caspar { namespace http { 7 | 8 | struct HTTPResponse 9 | { 10 | unsigned int status_code; 11 | std::string status_message; 12 | std::map headers; 13 | std::string body; 14 | }; 15 | 16 | HTTPResponse request(const std::string& host, const std::string& port, const std::string& path); 17 | 18 | std::string url_encode(const std::string& str); 19 | 20 | }} // namespace caspar::http 21 | -------------------------------------------------------------------------------- /src/protocol/util/lock_container.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "protocol_strategy.h" 6 | 7 | namespace caspar { namespace IO { 8 | 9 | class lock_container 10 | { 11 | public: 12 | lock_container(const std::wstring& lifecycle_key); 13 | ~lock_container(); 14 | 15 | bool check_access(client_connection::ptr conn); 16 | bool try_lock(const std::wstring& lock_phrase, client_connection::ptr conn); 17 | void release_lock(client_connection::ptr conn); 18 | void clear_locks(); 19 | 20 | private: 21 | struct impl; 22 | spl::unique_ptr impl_; 23 | 24 | lock_container(const lock_container&) = delete; 25 | lock_container& operator=(const lock_container&) = delete; 26 | }; 27 | }} // namespace caspar::IO 28 | -------------------------------------------------------------------------------- /src/protocol/util/tokenize.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see .* 18 | */ 19 | 20 | #pragma once 21 | 22 | #include 23 | #include 24 | 25 | namespace caspar { namespace IO { 26 | 27 | std::size_t tokenize(const std::wstring& message, std::list& pTokenVector); 28 | 29 | }} // namespace caspar::IO 30 | -------------------------------------------------------------------------------- /src/shell/CasparCG.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrkno/sofie-casparcg-server/e1df927e5075050e3f7a7c6542eabc45ca735b01/src/shell/CasparCG.ico -------------------------------------------------------------------------------- /src/shell/LiberationSans-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrkno/sofie-casparcg-server/e1df927e5075050e3f7a7c6542eabc45ca735b01/src/shell/LiberationSans-Regular.ttf -------------------------------------------------------------------------------- /src/shell/casparcg_auto_restart.bat: -------------------------------------------------------------------------------- 1 | @Echo off 2 | 3 | IF EXIST scanner.exe ( 4 | start scanner.exe 5 | ) 6 | 7 | :Start 8 | SET ERRORLEVEL 0 9 | 10 | casparcg.exe 11 | 12 | if ERRORLEVEL 5 goto :Start 13 | -------------------------------------------------------------------------------- /src/shell/copy_deps.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | function usage() 4 | { 5 | cat << EOU 6 | Useage: bash $0 7 | EOU 8 | exit 1 9 | } 10 | 11 | #Validate the inputs 12 | [[ $# < 2 ]] && usage 13 | 14 | #Check if the paths are vaild 15 | [[ ! -e $1 ]] && echo "Not a vaild input $1" && exit 1 16 | [[ -d $2 ]] || echo "No such directory $2 creating..."&& mkdir -p "$2" 17 | 18 | #Get the library dependencies 19 | export LD_LIBRARY_PATH=/opt/boost/lib 20 | echo "Collecting the shared library dependencies for $1..." 21 | deps=$(ldd $1 | awk 'BEGIN{ORS=" "}$1\ 22 | ~/^\//{print $1}$3~/^\//{print $3}'\ 23 | | sed 's/,$/\n/') 24 | echo "Copying the dependencies to $2" 25 | 26 | #Copy the deps 27 | for dep in $deps 28 | do 29 | if [[ $dep = *"ld-linux-x86-64.so"* ]] || [[ $dep = *"libc.so"* ]] || [[ $dep = *"libstdc++.so"* ]]; then 30 | echo "Skipping $dep" 31 | else 32 | echo "Copying $dep to $2" 33 | cp "$dep" "$2" 34 | fi 35 | done 36 | 37 | # Dynamic deps 38 | cp "/usr/lib/x86_64-linux-gnu/nss/libsoftokn3.so" "$2" 39 | cp "/usr/lib/x86_64-linux-gnu/nss/libnssckbi.so" "$2" 40 | 41 | echo "Done!" 42 | -------------------------------------------------------------------------------- /src/shell/included_modules.tmpl: -------------------------------------------------------------------------------- 1 | /* 2 | * Generated file. 3 | */ 4 | 5 | #pragma once 6 | 7 | #include 8 | 9 | #include 10 | ${CASPARCG_MODULE_INCLUDE_STATEMENTS} 11 | 12 | namespace caspar { 13 | 14 | static bool intercept_command_line_args(int argc, char** argv) 15 | {${CASPARCG_MODULE_COMMAND_LINE_ARG_INTERCEPTORS_STATEMENTS} 16 | return false; 17 | } 18 | 19 | static void initialize_modules(const core::module_dependencies& dependencies) 20 | {${CASPARCG_MODULE_INIT_STATEMENTS}} 21 | 22 | static void uninitialize_modules() 23 | { 24 | ${CASPARCG_MODULE_UNINIT_STATEMENTS}} 25 | 26 | } 27 | -------------------------------------------------------------------------------- /src/shell/liberation-fonts/AUTHORS: -------------------------------------------------------------------------------- 1 | AUTHORS 2 | 3 | Current Contributors (sorted alphabetically): 4 | - Pravin Satpute 5 | Project Owner (Current) 6 | Red Hat, Inc. 7 | 8 | Previous Contributors 9 | 10 | - Steve Matteson 11 | Original Designer 12 | Ascender, Inc. 13 | -------------------------------------------------------------------------------- /src/shell/liberation-fonts/ChangeLog: -------------------------------------------------------------------------------- 1 | * Thu Oct 04 2012 Pravin Satpute 2 | - Resolved "Glyphs with multiple unicode encodings inhibit subsetting" #851790 3 | - Resolved #851791, #854601 and #851825 4 | - Following GASP table version as per Liberation old version. (Anti-aliasing disabled) 5 | - Added support for Serbian glyphs for wikipedia #657849 6 | - In Monospace fonts, isFixedPitch bit set via script for getting it recognized as Monospace in putty.exe 7 | 8 | * Fri Jul 06 2012 Pravin Satpute 9 | - Initial version of Liberation fonts based on croscore fonts version 1.21.0 10 | - Converted TTF files into SFD files to be open source. 11 | - Update Copyright and License file 12 | - set fsType bit to 0, Installable Embedding is allowed. 13 | - Absolute value in HHeadAscent/Descent values for maintaining Metric compatibility. 14 | 15 | -------------------------------------------------------------------------------- /src/shell/liberation-fonts/LiberationMono-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrkno/sofie-casparcg-server/e1df927e5075050e3f7a7c6542eabc45ca735b01/src/shell/liberation-fonts/LiberationMono-Regular.ttf -------------------------------------------------------------------------------- /src/shell/liberation-fonts/TODO: -------------------------------------------------------------------------------- 1 | Here are todo for next release 2 | 1) Serbian glyph for wikipedia https://bugzilla.redhat.com/show_bug.cgi?id=657849 3 | - Improving shape of S_BE https://bugzilla.redhat.com/show_bug.cgi?id=657849#c96 4 | 2) Liberation Mono not recognizing as Mono in Windows application #861003 5 | - presently it is patch, we have to update zero width characters to fixed width 6 | -------------------------------------------------------------------------------- /src/shell/linux_specific.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Helge Norberg, helge.norberg@svt.se 20 | */ 21 | 22 | #include "platform_specific.h" 23 | 24 | #include 25 | #include 26 | 27 | #include 28 | 29 | #include 30 | 31 | namespace caspar { 32 | 33 | void setup_prerequisites() 34 | { 35 | // Enable utf8 console input and output 36 | std::wcout.sync_with_stdio(false); 37 | std::wcout.imbue(std::locale("")); 38 | std::wcin.imbue(std::locale("")); 39 | 40 | XInitThreads(); 41 | 42 | std::set_terminate([] { CASPAR_LOG_CURRENT_EXCEPTION(); }); 43 | } 44 | 45 | void setup_console_window() 46 | { 47 | // TODO: implement. 48 | } 49 | 50 | void increase_process_priority() 51 | { 52 | // TODO: implement. 53 | } 54 | 55 | void wait_for_keypress() 56 | { 57 | // TODO: implement if desirable. 58 | } 59 | 60 | std::shared_ptr setup_debugging_environment() 61 | { 62 | // TODO: implement if applicable. 63 | return nullptr; 64 | } 65 | 66 | void wait_for_remote_debugging() 67 | { 68 | // TODO: implement if applicable. 69 | } 70 | 71 | } // namespace caspar 72 | -------------------------------------------------------------------------------- /src/shell/platform_specific.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Helge Norberg, helge.norberg@svt.se 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | namespace caspar { 27 | 28 | void setup_prerequisites(); 29 | void setup_console_window(); 30 | void increase_process_priority(); 31 | void wait_for_keypress(); 32 | std::shared_ptr setup_debugging_environment(); 33 | void wait_for_remote_debugging(); 34 | 35 | } // namespace caspar 36 | -------------------------------------------------------------------------------- /src/shell/resource.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nrkno/sofie-casparcg-server/e1df927e5075050e3f7a7c6542eabc45ca735b01/src/shell/resource.h -------------------------------------------------------------------------------- /src/shell/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | RET=5 4 | 5 | while [ $RET -eq 5 ] 6 | do 7 | LD_LIBRARY_PATH=lib bin/casparcg "$@" 8 | RET=$? 9 | done 10 | 11 | -------------------------------------------------------------------------------- /src/shell/server.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2011 Sveriges Television AB 3 | * 4 | * This file is part of CasparCG (www.casparcg.com). 5 | * 6 | * CasparCG is free software: you can redistribute it and/or modify 7 | * it under the terms of the GNU General Public License as published by 8 | * the Free Software Foundation, either version 3 of the License, or 9 | * (at your option) any later version. 10 | * 11 | * CasparCG is distributed in the hope that it will be useful, 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 | * GNU General Public License for more details. 15 | * 16 | * You should have received a copy of the GNU General Public License 17 | * along with CasparCG. If not, see . 18 | * 19 | * Author: Robert Nagy, ronag89@gmail.com 20 | */ 21 | 22 | #pragma once 23 | 24 | #include 25 | 26 | #include 27 | #include 28 | 29 | namespace caspar { 30 | 31 | class server final 32 | { 33 | public: 34 | explicit server(std::function shutdown_server_now); 35 | void start(); 36 | spl::shared_ptr get_amcp_command_repository() const; 37 | 38 | private: 39 | struct impl; 40 | std::shared_ptr impl_; 41 | 42 | server(const server&) = delete; 43 | server& operator=(const server&) = delete; 44 | }; 45 | 46 | } // namespace caspar 47 | -------------------------------------------------------------------------------- /src/tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required (VERSION 3.16) 2 | 3 | add_executable(bin2c bin2c.cpp) 4 | target_compile_features(bin2c PRIVATE cxx_std_17) 5 | 6 | target_include_directories(bin2c PRIVATE ..) 7 | 8 | function(bin2c source_file dest_file namespace obj_name) 9 | ADD_CUSTOM_COMMAND( 10 | OUTPUT ${dest_file} 11 | COMMAND bin2c ${namespace} ${obj_name} ${CMAKE_CURRENT_SOURCE_DIR}/${source_file} > ${CMAKE_CURRENT_BINARY_DIR}/${dest_file} 12 | DEPENDS bin2c ${CMAKE_CURRENT_SOURCE_DIR}/${source_file} 13 | ) 14 | endfunction() 15 | -------------------------------------------------------------------------------- /src/tools/bin2c.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | 6 | int main(int argc, char** argv) 7 | { 8 | if (argc != 4) { 9 | fprintf(stderr, "Usage: %s \"namespace\" \"constant_name\" \"input_filename\"\n", argv[0]); 10 | return -1; 11 | } 12 | char* fn = argv[3]; 13 | FILE* f = fopen(fn, "rb"); 14 | 15 | if (f == nullptr) { 16 | fprintf(stderr, "Error opening file: %s\n", strerror(errno)); 17 | return -1; 18 | } 19 | 20 | int count = 0; 21 | char* pch = strtok(argv[1], "::"); 22 | while (pch != nullptr) { 23 | printf("namespace %s {\n", pch); 24 | pch = strtok(nullptr, "::"); 25 | count++; 26 | } 27 | 28 | printf("const char %s[] = {\n", argv[2]); 29 | unsigned long n = 0; 30 | while (!feof(f)) { 31 | unsigned char c; 32 | if (fread(&c, 1, 1, f) == 0) 33 | break; 34 | if ('\r' == c) // ignore carret return 35 | continue; 36 | printf("0x%.2X,", (int)c); 37 | ++n; 38 | if (n % 10 == 0) 39 | printf("\n"); 40 | } 41 | fclose(f); 42 | printf("0x00\n};\n"); 43 | 44 | for (int i = 0; i < count; i++) 45 | printf("}\n"); 46 | 47 | return 0; 48 | } 49 | -------------------------------------------------------------------------------- /src/version.tmpl: -------------------------------------------------------------------------------- 1 | #define CASPAR_GEN ${CONFIG_VERSION_MAJOR} 2 | #define CASPAR_MAJOR ${CONFIG_VERSION_MINOR} 3 | #define CASPAR_MINOR ${CONFIG_VERSION_BUG} 4 | #define CASPAR_TAG "${CONFIG_VERSION_TAG}" 5 | #define CASPAR_HASH "${CONFIG_VERSION_GIT_HASH}" 6 | -------------------------------------------------------------------------------- /tools/linux/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM docker.io/buildpack-deps:jammy as build-casparcg 2 | ADD tools/linux/install-dependencies / 3 | 4 | RUN apt-get update && /install-dependencies 5 | 6 | RUN mkdir /source && mkdir /build && mkdir /install 7 | 8 | COPY ./src /source 9 | 10 | WORKDIR /build 11 | 12 | ARG CC 13 | ARG CXX 14 | ARG GIT_HASH 15 | 16 | RUN cmake -GNinja /source 17 | 18 | # ensure ffmpeg dependencies are installed 19 | RUN apt-get update && ./_deps/ffmpeg-lib-src/ffmpeg/install-ffmpeg-dependencies 20 | 21 | RUN ninja 22 | 23 | # Find a better way to copy deps 24 | RUN ln -s /build/staging /staging && \ 25 | /source/shell/copy_deps.sh /staging/bin/casparcg /staging/lib 26 | 27 | FROM docker.io/nvidia/opengl:1.2-glvnd-devel-ubuntu22.04 28 | COPY --from=build-casparcg /staging /opt/casparcg 29 | 30 | RUN set -ex; \ 31 | apt-get update; \ 32 | DEBIAN_FRONTEND="noninteractive" apt-get install -y --no-install-recommends \ 33 | tzdata \ 34 | libc++1 \ 35 | libnss3 \ 36 | fontconfig \ 37 | ; \ 38 | rm -rf /var/lib/apt/lists/* 39 | 40 | WORKDIR /opt/casparcg 41 | 42 | ADD tools/linux/run_docker.sh ./ 43 | CMD ["./run_docker.sh"] 44 | -------------------------------------------------------------------------------- /tools/linux/build-in-docker: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | 3 | source $(dirname "$0")/image-versions 4 | 5 | GIT_HASH=$(git rev-parse --verify --short HEAD) 6 | 7 | docker build -t casparcg/server \ 8 | --build-arg CC \ 9 | --build-arg CXX \ 10 | --build-arg PROC_COUNT \ 11 | --build-arg GIT_HASH \ 12 | -f $PWD/tools/linux/Dockerfile $PWD 13 | 14 | -------------------------------------------------------------------------------- /tools/linux/extract-from-docker: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | tempContainer=$(docker create casparcg/server) 3 | docker cp $tempContainer:/opt/casparcg ./casparcg_server 4 | docker rm -v $tempContainer 5 | -------------------------------------------------------------------------------- /tools/linux/install-dependencies: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | apt-get install -yq --no-install-recommends \ 4 | autoconf \ 5 | automake \ 6 | cmake \ 7 | ninja-build \ 8 | curl \ 9 | bzip2 \ 10 | clang \ 11 | g++ \ 12 | gcc \ 13 | git \ 14 | gperf \ 15 | libtool \ 16 | make \ 17 | perl \ 18 | pkg-config \ 19 | python3 \ 20 | zlib1g-dev \ 21 | libexpat1-dev \ 22 | lsb-release \ 23 | libglew-dev \ 24 | libfreeimage-dev \ 25 | libtbb-dev \ 26 | libopenal-dev \ 27 | libxcursor-dev \ 28 | libxinerama-dev \ 29 | libxi-dev \ 30 | libsfml-dev \ 31 | libxrandr-dev \ 32 | libudev-dev \ 33 | libglu1-mesa-dev \ 34 | libboost-all-dev \ 35 | libnss3-dev -------------------------------------------------------------------------------- /tools/linux/launch-interactive: -------------------------------------------------------------------------------- 1 | #! /bin/bash 2 | docker run --rm -it casparcg/server /bin/bash 3 | -------------------------------------------------------------------------------- /tools/linux/run_docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z "$DISPLAY" ]; then 4 | echo "DISPLAY is not set" 5 | exit 9 6 | fi 7 | 8 | if [ ! -d /tmp/.X11-unix ]; then 9 | echo "X11 socket not found" 10 | exit 9 11 | fi 12 | 13 | if [ ! -f /root/.Xauthority ]; then 14 | echo "Xauthority not found" 15 | exit 9 16 | fi 17 | 18 | ./run.sh 19 | -------------------------------------------------------------------------------- /tools/linux/start_docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | CMD="docker run --rm -it" 4 | 5 | # bind AMCP Ports 6 | CMD="$CMD -p 5250:5250" 7 | 8 | # passthrough config 9 | CMD="$CMD -v $PWD/casparcg.config:/opt/casparcg/casparcg.config:ro" 10 | 11 | # passthrough media folder 12 | CMD="$CMD -v $PWD/media:/opt/casparcg/media" 13 | 14 | ## DO NOT EDIT BELOW THIS LINE 15 | 16 | HAS_NVIDIA_RUNTIME=$(docker info | grep -i nvidia) 17 | if [ ! -z "$HAS_NVIDIA_RUNTIME" ]; then 18 | CMD="$CMD --runtime=nvidia" 19 | else 20 | # assume intel, so setup for that 21 | CMD="$CMD --device /dev/dri" 22 | fi 23 | 24 | DECKLINK_API_SO="/usr/lib/libDeckLinkAPI.so" 25 | if [ -f "$DECKLINK_API_SO" ]; then 26 | CMD="$CMD -v $DECKLINK_API_SO:$DECKLINK_API_SO:ro" 27 | 28 | for dev in /dev/blackmagic/*; do 29 | if [ -f "$dev" ]; then 30 | CMD="$CMD --device $dev" 31 | fi 32 | done 33 | fi 34 | 35 | if [ ! -z "$XAUTHORITY" ]; then 36 | CMD="$CMD -v $XAUTHORITY:/root/.Xauthority:ro" 37 | elif [ -f "$HOME/.Xauthority" ]; then 38 | CMD="$CMD -v $HOME/.Xauthority:/root/.Xauthority:ro" 39 | else 40 | echo "Failed to find Xauthority file" 41 | exit 9 42 | fi 43 | 44 | CMD="$CMD -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro" 45 | 46 | CMD="$CMD casparcg/server" 47 | 48 | echo "Executing command: $CMD" 49 | 50 | # Run it! 51 | $CMD 52 | -------------------------------------------------------------------------------- /tools/update-format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # args needed to format inline. can be overridden to use script for otehr purposes 4 | CLANG_ARGS=${CLANG_ARGS:--i} 5 | 6 | SOURCE_FILES=`find ./src/ \( -name \*.cpp -type f -or -name \*.h -type f \) -not -path "./src/packages/*" -not -path "*interop*" -not -path "./src/cmake*"` 7 | BAD_FILES=0 8 | for SOURCE_FILE in $SOURCE_FILES 9 | do 10 | export FORMATTING_ISSUE_COUNT=`clang-format $CLANG_ARGS $SOURCE_FILE | grep offset | wc -l` 11 | if [ "$FORMATTING_ISSUE_COUNT" -gt "0" ]; then 12 | echo "Source file $SOURCE_FILE contains formatting issues." 13 | BAD_FILES=1 14 | fi 15 | done 16 | 17 | if [ $BAD_FILES ]; then 18 | exit 1 19 | fi 20 | -------------------------------------------------------------------------------- /tools/verify-format.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # override args to diff changes 4 | export CLANG_ARGS=-output-replacements-xml 5 | 6 | SCRIPT_ROOT=$(dirname "${0}")/.. 7 | "${SCRIPT_ROOT}/tools/update-format.sh" 8 | -------------------------------------------------------------------------------- /tools/windows/build.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set BUILD_ARCHIVE_NAME=casparcg_server 4 | set BUILD_VCVARSALL=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat 5 | set BUILD_7ZIP=C:\Program Files\7-Zip\7z.exe 6 | 7 | @REM Github Actions has Enterprise available 8 | if DEFINED CI set BUILD_VCVARSALL=C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvars64.bat 9 | 10 | :: Clean and enter shadow build folder 11 | echo Cleaning... 12 | if exist dist rmdir dist /s /q || goto :error 13 | mkdir dist || goto :error 14 | 15 | :: Setup VC++ environment 16 | echo Setting up VC++... 17 | call "%BUILD_VCVARSALL%" amd64 || goto :error 18 | 19 | :: Run cmake 20 | cd dist || goto :error 21 | cmake -G "Visual Studio 16 2019" -A x64 ..\src || goto :error 22 | 23 | :: Build with MSBuild 24 | echo Building... 25 | msbuild "CasparCG Server.sln" /t:Clean /p:Configuration=Release || goto :error 26 | msbuild "CasparCG Server.sln" /p:Configuration=Release /m:%NUMBER_OF_PROCESSORS% || goto :error 27 | 28 | :: Create server folder to later zip 29 | set SERVER_FOLDER=casparcg_server 30 | call ..\tools\windows\package.bat .. 31 | 32 | :: Create zip file 33 | echo Creating zip... 34 | if exist "%BUILD_ARCHIVE_NAME%.zip" unlink "%BUILD_ARCHIVE_NAME%.zip" || goto :error 35 | "%BUILD_7ZIP%" a "%BUILD_ARCHIVE_NAME%.zip" ".\%SERVER_FOLDER%\*" || goto :error 36 | 37 | :: Skip exiting with failure 38 | goto :EOF 39 | 40 | :error 41 | exit /b %errorlevel% 42 | -------------------------------------------------------------------------------- /tools/windows/package.bat: -------------------------------------------------------------------------------- 1 | if exist "%SERVER_FOLDER%" rmdir "%SERVER_FOLDER%" /s /q 2 | 3 | xcopy shell\Release "%SERVER_FOLDER%" /E /I /Y 4 | xcopy flashtemplatehost-prefix\src\flashtemplatehost "%SERVER_FOLDER%\" /E /I /Y 5 | 6 | copy %1\src\shell\casparcg_auto_restart.bat "%SERVER_FOLDER%\" 7 | 8 | echo Copying documentation... 9 | copy %1\CHANGELOG.md "%SERVER_FOLDER%" 10 | copy %1\LICENSE "%SERVER_FOLDER%" 11 | copy %1\README.md "%SERVER_FOLDER%" 12 | 13 | if exist "%MEDIA_SCANNER_FOLDER%" xcopy "%MEDIA_SCANNER_FOLDER%" "%SERVER_FOLDER%" /E /I /Y --------------------------------------------------------------------------------