output_(draw());\r
executor_.begin_invoke([=]{tick();});\r
}\r
- \r
- layer& get_layer(int index)\r
- {\r
- auto it = layers_.find(index);\r
- if(it == layers_.end())\r
- it = layers_.insert(std::make_pair(index, layer(index))).first;\r
- return it->second;\r
- }\r
- \r
+ \r
std::vector<safe_ptr<basic_frame>> draw()\r
{ \r
std::vector<safe_ptr<basic_frame>> frames(layers_.size(), basic_frame::empty());\r
return frames;\r
}\r
\r
- void load(int index, const safe_ptr<frame_producer>& producer, bool play_on_load, bool preview)\r
+ void load(int index, const safe_ptr<frame_producer>& producer, bool preview)\r
{\r
- executor_.invoke([&]{get_layer(index).load(producer, play_on_load, preview);});\r
+ executor_.invoke([&]{layers_[index].load(producer, preview);});\r
}\r
\r
void pause(int index)\r
{ \r
- executor_.invoke([&]{get_layer(index).pause();});\r
+ executor_.invoke([&]{layers_[index].pause();});\r
}\r
\r
void play(int index)\r
{ \r
- executor_.invoke([&]{get_layer(index).play();});\r
+ executor_.invoke([&]{layers_[index].play();});\r
}\r
\r
void stop(int index)\r
{ \r
- executor_.invoke([&]{get_layer(index).stop();});\r
+ executor_.invoke([&]{layers_[index].stop();});\r
}\r
\r
void clear(int index)\r
{\r
executor_.invoke([&]\r
{\r
- get_layer(index).swap(layers_[other_index]);\r
+ layers_[index].swap(layers_[other_index]);\r
});\r
}\r
\r
\r
auto func = [&]\r
{\r
- get_layer(index).swap(other.impl_->layers_.at(other_index)); \r
+ layers_[index].swap(other.impl_->layers_.at(other_index)); \r
\r
CASPAR_LOG(info) << print() << L" Swapped layer " << index << L" with " << other.impl_->print() << L" layer " << other_index << L"."; \r
};\r
\r
auto func = [&]\r
{\r
- std::set<int> my_indices;\r
- BOOST_FOREACH(auto& pair, layers_)\r
- my_indices.insert(pair.first);\r
+ auto sel_first = [](const decltype(*layers_.begin())& pair){return pair.first;};\r
\r
- std::set<int> other_indicies;\r
- BOOST_FOREACH(auto& pair, other.impl_->layers_)\r
- other_indicies.insert(pair.first);\r
- \r
- std::vector<int> indices;\r
- std::set_union(my_indices.begin(), my_indices.end(), other_indicies.begin(), other_indicies.end(), std::back_inserter(indices));\r
- \r
- BOOST_FOREACH(auto index, indices)\r
- get_layer(index).swap(other.impl_->get_layer(index));\r
+ std::set<int> indices;\r
+ std::transform(layers_.begin(), layers_.end(), std::inserter(indices, indices.begin()), sel_first);\r
+ std::transform(other.impl_->layers_.begin(), other.impl_->layers_.end(), std::inserter(indices, indices.begin()), sel_first);\r
+ std::for_each(indices.begin(), indices.end(), [&](int index)\r
+ {\r
+ layers_[index].swap(other.impl_->layers_[index]);\r
+ }); \r
\r
CASPAR_LOG(info) << print() << L" Swapped layers with " << other.impl_->print() << L".";\r
};\r
frame_producer_device::frame_producer_device(frame_producer_device&& other) : impl_(std::move(other.impl_)){}\r
boost::signals2::connection frame_producer_device::connect(const output_t::slot_type& subscriber){return impl_->connect(subscriber);}\r
void frame_producer_device::swap(frame_producer_device& other){impl_->swap(other);}\r
-void frame_producer_device::load(int index, const safe_ptr<frame_producer>& producer, bool play_on_load, bool preview){impl_->load(index, producer, play_on_load, preview);}\r
+void frame_producer_device::load(int index, const safe_ptr<frame_producer>& producer, bool preview){impl_->load(index, producer, preview);}\r
void frame_producer_device::pause(int index){impl_->pause(index);}\r
void frame_producer_device::play(int index){impl_->play(index);}\r
void frame_producer_device::stop(int index){impl_->stop(index);}\r
frame_producer_device(frame_producer_device&& other);\r
void swap(frame_producer_device& other);\r
\r
- void load(int index, const safe_ptr<frame_producer>& producer, bool play_on_load = false, bool preview = false);\r
+ void load(int index, const safe_ptr<frame_producer>& producer, bool preview = false);\r
void pause(int index);\r
void play(int index);\r
void stop(int index);\r
\r
struct layer::implementation : boost::noncopyable\r
{ \r
- int index_; \r
safe_ptr<frame_producer> foreground_;\r
safe_ptr<frame_producer> background_;\r
safe_ptr<basic_frame> last_frame_;\r
bool is_paused_;\r
public:\r
- implementation(int index) \r
- : index_(index)\r
- , foreground_(frame_producer::empty())\r
+ implementation() \r
+ : foreground_(frame_producer::empty())\r
, background_(frame_producer::empty())\r
, last_frame_(basic_frame::empty())\r
, is_paused_(false){}\r
\r
void resume()\r
{\r
- if(is_paused_)\r
- CASPAR_LOG(info) << foreground_->print() << L" Resumed.";\r
is_paused_ = false;\r
}\r
\r
- void load(const safe_ptr<frame_producer>& producer, bool play_on_load, bool preview)\r
+ void load(const safe_ptr<frame_producer>& producer, bool preview)\r
{ \r
background_ = producer;\r
\r
- if(play_on_load)\r
- play(); \r
- else if(preview)\r
+ if(preview)\r
{\r
play();\r
receive();\r
pause();\r
}\r
-\r
- CASPAR_LOG(info) << producer->print() << L" Loaded.";\r
}\r
\r
void play()\r
background_->set_leading_producer(foreground_);\r
foreground_ = background_;\r
background_ = frame_producer::empty();\r
- CASPAR_LOG(info) << foreground_->print() << L" Active.";\r
}\r
resume();\r
}\r
\r
return last_frame_;\r
}\r
- \r
- std::wstring print() const\r
- {\r
- return L"layer[" + boost::lexical_cast<std::wstring>(index_) + L"]";\r
- }\r
};\r
\r
-layer::layer(int index) : impl_(new implementation(index)){}\r
+layer::layer() : impl_(new implementation()){}\r
layer::layer(layer&& other) : impl_(std::move(other.impl_)){}\r
layer& layer::operator=(layer&& other)\r
{\r
}\r
void layer::swap(layer& other)\r
{ \r
- impl_->foreground_.swap(other.impl_->foreground_);\r
- impl_->background_.swap(other.impl_->background_);\r
- impl_->last_frame_.swap(other.impl_->last_frame_);\r
- std::swap(impl_->is_paused_ , other.impl_->is_paused_ );\r
+ impl_.swap(other.impl_);\r
}\r
-void layer::load(const safe_ptr<frame_producer>& frame_producer, bool play_on_load, bool preview){return impl_->load(frame_producer, play_on_load, preview);} \r
+void layer::load(const safe_ptr<frame_producer>& frame_producer, bool preview){return impl_->load(frame_producer, preview);} \r
void layer::play(){impl_->play();}\r
void layer::pause(){impl_->pause();}\r
void layer::stop(){impl_->stop();}\r
safe_ptr<basic_frame> layer::receive() {return impl_->receive();}\r
safe_ptr<frame_producer> layer::foreground() const { return impl_->foreground_;}\r
safe_ptr<frame_producer> layer::background() const { return impl_->background_;}\r
-std::wstring layer::print() const { return impl_->print();}\r
}}
\ No newline at end of file
class layer : boost::noncopyable\r
{\r
public:\r
- explicit layer(int index = std::numeric_limits<int>::min()); // nothrow\r
+ layer(); // nothrow\r
layer(layer&& other); // nothrow\r
layer& operator=(layer&& other); // nothrow\r
\r
void swap(layer& other); // nothrow \r
\r
- void load(const safe_ptr<frame_producer>& producer, bool play_on_load, bool preview); // nothrow\r
+ void load(const safe_ptr<frame_producer>& producer, bool preview); // nothrow\r
void play(); // nothrow\r
void pause(); // nothrow\r
void stop(); // nothrow\r
safe_ptr<frame_producer> background() const; // nothrow\r
\r
safe_ptr<basic_frame> receive(); // nothrow\r
-\r
- std::wstring print() const;\r
private:\r
struct implementation;\r
std::shared_ptr<implementation> impl_;\r
{\r
_parameters[0] = _parameters[0];\r
auto pFP = create_producer(GetChannel()->mixer(), _parameters); \r
- GetChannel()->producer()->load(GetLayerIndex(), pFP, false, true);\r
+ GetChannel()->producer()->load(GetLayerIndex(), pFP, true);\r
\r
CASPAR_LOG(info) << "Loaded " << _parameters[0] << TEXT(" successfully");\r
\r
BOOST_THROW_EXCEPTION(file_not_found() << msg_info(_parameters.size() > 0 ? narrow(_parameters[0]) : ""));\r
\r
auto pFP2 = create_transition_producer(GetChannel()->get_video_format_desc(), pFP, transitionInfo);\r
- bool autoPlay = std::find(_parameters.begin(), _parameters.end(), TEXT("AUTOPLAY")) != _parameters.end();\r
- GetChannel()->producer()->load(GetLayerIndex(), pFP2, autoPlay); // TODO: LOOP\r
+ GetChannel()->producer()->load(GetLayerIndex(), pFP2); // TODO: LOOP\r
\r
CASPAR_LOG(info) << "Loaded " << _parameters[0] << TEXT(" successfully to background");\r
SetReplyString(TEXT("202 LOADBG OK\r\n"));\r
{\r
try\r
{\r
+ if(!_parameters.empty())\r
+ {\r
+ LoadbgCommand lbg;\r
+ lbg.SetChannel(GetChannel());\r
+ lbg.SetChannelIndex(GetChannelIndex());\r
+ lbg.SetLayerIntex(GetLayerIndex());\r
+ lbg.SetClientInfo(GetClientInfo());\r
+ for(auto it = _parameters.begin(); it != _parameters.end(); ++it)\r
+ lbg.AddParameter(*it);\r
+ if(!lbg.Execute())\r
+ CASPAR_LOG(warning) << " Failed to play.";\r
+ }\r
+\r
GetChannel()->producer()->play(GetLayerIndex());\r
+ \r
SetReplyString(TEXT("202 PLAY OK\r\n"));\r
return true;\r
}\r
<?xml version="1.0" encoding="utf-8"?>\r
<configuration>\r
<paths>\r
- <media-path>C:\\Casparcg\\_media\\</media-path>\r
- <log-path>C:\\Casparcg\\_log\\</log-path>\r
- <data-path>C:\\Casparcg\\_data\\</data-path>\r
- <template-path>C:\\Casparcg\\</template-path>\r
+ <media-path>F:\\Casparcg\\_media\\</media-path>\r
+ <log-path>F:\\Casparcg\\_log\\</log-path>\r
+ <data-path>F:\\Casparcg\\_data\\</data-path>\r
+ <template-path>F:\\Casparcg\\_templates\\</template-path>\r
<template-host>cg.fth.18</template-host>\r
</paths>\r
<diagnostics>\r
<channel>\r
<videomode>1080i5000</videomode>\r
<consumers>\r
- <!--<decklink>\r
+ <decklink>\r
<device>1</device>\r
<embedded-audio>true</embedded-audio>\r
<internal-key>false</internal-key>\r
- </decklink>-->\r
+ </decklink>\r
<ogl>\r
<device>0</device>\r
<stretch>uniform</stretch>\r