Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Named pipe consumer #1335

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ endif ()

if (MSVC)
add_subdirectory(flash)
add_subdirectory(bluefish)
add_subdirectory(bluefish)
add_subdirectory(pipe)
endif()

add_subdirectory(image)
31 changes: 31 additions & 0 deletions src/modules/pipe/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
cmake_minimum_required (VERSION 2.6)
project (pipe)

set(SOURCES
consumer/pipe_consumer.cpp

pipe.cpp
)
set(HEADERS
consumer/pipe_consumer.h

pipe.h
)

add_library(pipe ${SOURCES} ${HEADERS})
configure_file("${PROJECT_SOURCE_DIR}/packages.config" "${CMAKE_CURRENT_BINARY_DIR}/packages.config")

include_directories(..)
include_directories(../..)
include_directories(${BOOST_INCLUDE_PATH})
include_directories(${TBB_INCLUDE_PATH})

set_target_properties(pipe PROPERTIES FOLDER modules)
source_group(sources\\consumer consumer/*)
source_group(sources ./*)

target_link_libraries(pipe common core)

casparcg_add_include_statement("modules/pipe/pipe.h")
casparcg_add_init_statement("pipe::init" "pipe")
casparcg_add_module_project("pipe")
856 changes: 856 additions & 0 deletions src/modules/pipe/consumer/pipe_consumer.cpp

Large diffs are not rendered by default.

41 changes: 41 additions & 0 deletions src/modules/pipe/consumer/pipe_consumer.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright (c) 2011 Sveriges Television AB <[email protected]>
*
* This file is part of CasparCG (www.casparcg.com).
*
* CasparCG is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CasparCG is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Philip Starkey, https://github.com/philipstarkey
* Author: Robert Nagy, [email protected]
*/

#pragma once

#include <common/memory.h>

#include <core/fwd.h>

#include <boost/property_tree/ptree.hpp>
#include <vector>

namespace caspar { namespace pipe {

spl::shared_ptr<core::frame_consumer>
create_consumer(const std::vector<std::wstring>& params,
const std::vector<spl::shared_ptr<core::video_channel>>& channels);
spl::shared_ptr<core::frame_consumer>
create_preconfigured_consumer(const boost::property_tree::wptree& ptree,
const std::vector<spl::shared_ptr<core::video_channel>>& channels);

}} // namespace caspar::pipe
4 changes: 4 additions & 0 deletions src/modules/pipe/packages.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="boost" version="1.66.0.0" targetFramework="native" />
</packages>
37 changes: 37 additions & 0 deletions src/modules/pipe/pipe.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright (c) 2011 Sveriges Television AB <[email protected]>
*
* This file is part of CasparCG (www.casparcg.com).
*
* CasparCG is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CasparCG is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Philip Starkey, https://github.com/philipstarkey
* Author: Robert Nagy, [email protected]
*/

#include "pipe.h"

#include "consumer/pipe_consumer.h"

//#include <core/consumer/frame_consumer.h>

namespace caspar { namespace pipe {

void init(core::module_dependencies dependencies)
{
dependencies.consumer_registry->register_consumer_factory(L"Pipe Consumer", create_consumer);
dependencies.consumer_registry->register_preconfigured_consumer_factory(L"pipe", create_preconfigured_consumer);
}

}} // namespace caspar::pipe
31 changes: 31 additions & 0 deletions src/modules/pipe/pipe.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2011 Sveriges Television AB <[email protected]>
*
* This file is part of CasparCG (www.casparcg.com).
*
* CasparCG is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* CasparCG is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with CasparCG. If not, see <http://www.gnu.org/licenses/>.
*
* Author: Philip Starkey, https://github.com/philipstarkey
* Author: Robert Nagy, [email protected]
*/

#pragma once

#include <core/module_dependencies.h>

namespace caspar { namespace pipe {

void init(core::module_dependencies dependencies);

}} // namespace caspar::pipe
9 changes: 9 additions & 0 deletions src/modules/pipe/pipe/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# CMakeList.txt : CMake project for pipe, include source and define
# project specific logic here.
#
cmake_minimum_required (VERSION 3.8)

# Add source to this project's executable.
add_executable (pipe "pipe.cpp" "pipe.h")

# TODO: Add tests and install targets if needed.
12 changes: 12 additions & 0 deletions src/modules/pipe/pipe/pipe.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// pipe.cpp : Defines the entry point for the application.
//

#include "pipe.h"

using namespace std;

int main()
{
cout << "Hello CMake." << endl;
return 0;
}
8 changes: 8 additions & 0 deletions src/modules/pipe/pipe/pipe.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// pipe.h : Include file for standard system include files,
// or project specific include files.

#pragma once

#include <iostream>

// TODO: Reference additional headers your program requires here.
11 changes: 11 additions & 0 deletions src/shell/casparcg.config
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,17 @@
<path>[file|url]</path>
<args>[most ffmpeg arguments related to filtering and output codecs]</args>
</ffmpeg>
<pipe>
<name>[custom name]</name>
<index>1 [1...]</index>
<video-pipe-name>\\.\pipe\CasparCGVideo [pipe path (optional only if audio pipe name specified)]</video-pipe-name>
<audio-pipe-name>\\.\pipe\CasparCGAudio [pipe path (optional only if video pipe name specified)]</audio-pipe-name>
<single-pipe>false [true|false] (true = send both audio and video data down a single pipe)</single-pipe>
<buffer-size>3.0 (number of seconds to buffer before dropping frames)</buffer-size>
<auto-reconnect>false [true|false] (true = recreate/reconnect to pipe(s) if a pipe is closed or writes fail)</auto-reconnect>
<realtime>true [true|false] (true = do not buffer frames between pipe reconnection. Only valid if auto-reconnect=true)</realtime>
<existing-pipe>false [true|false] (true = connect to an existing pipe. false = explicitly create a named pipe)</existing-pipe>
</pipe>
</consumers>
</channel>
</channels>
Expand Down