<ClInclude Include="memory\page_locked_allocator.h" />\r
<ClInclude Include="memory\safe_ptr.h" />\r
<ClInclude Include="env.h" />\r
- <ClInclude Include="object.h" />\r
<ClInclude Include="stdafx.h" />\r
<ClInclude Include="utility\assert.h" />\r
- <ClInclude Include="utility\printer.h" />\r
<ClInclude Include="utility\string.h" />\r
<ClInclude Include="utility\timer.h" />\r
<ClInclude Include="utility\tweener.h" />\r
<ClInclude Include="utility\assert.h">\r
<Filter>utility</Filter>\r
</ClInclude>\r
- <ClInclude Include="utility\printer.h">\r
- <Filter>utility</Filter>\r
- </ClInclude>\r
<ClInclude Include="utility\string.h">\r
<Filter>utility</Filter>\r
</ClInclude>\r
<ClInclude Include="utility\tweener.h">\r
<Filter>utility</Filter>\r
</ClInclude>\r
- <ClInclude Include="object.h" />\r
</ItemGroup>\r
</Project>
\ No newline at end of file
\r
#include "../memory/safe_ptr.h"\r
\r
-#include "../utility/printer.h"\r
-\r
+#include <functional>\r
#include <string>\r
#include <vector>\r
#include <map>\r
#include <boost/range/iterator_range.hpp>\r
#include <boost/circular_buffer.hpp>\r
\r
-namespace caspar { namespace diagnostics {\r
+namespace caspar {\r
+ \r
+typedef std::function<std::wstring()> printer;\r
+ \r
+namespace diagnostics {\r
\r
struct color\r
{\r
+++ /dev/null
-#pragma once\r
-\r
-#include <string>\r
-\r
-#include <tbb/spin_mutex.h>\r
-\r
-namespace caspar {\r
-\r
-//class object\r
-//{\r
-// mutable tbb::spin_mutex mutex_;\r
-// const object* parent_;\r
-//public:\r
-// object(const object* parent = nullptr){set_parent(parent);}\r
-//\r
-// std::wstring print() const\r
-// {\r
-// tbb::spin_mutex::scoped_lock lock(mutex_);\r
-// return (parent_ ? parent_->print() + L"/" : L"") + do_print();\r
-// }\r
-// \r
-// const object* get_parent() const\r
-// {\r
-// tbb::spin_mutex::scoped_lock lock(mutex_);\r
-// return parent_;\r
-// }\r
-//\r
-// void set_parent(const object* parent)\r
-// {\r
-// tbb::spin_mutex::scoped_lock lock(mutex_);\r
-// parent_ = parent != this ? parent : nullptr;\r
-// }\r
-//\r
-//private:\r
-//\r
-// virtual std::wstring do_print() const = 0;\r
-//};\r
-\r
-class object\r
-{\r
- mutable tbb::spin_mutex mutex_;\r
- const object* parent_;\r
-public:\r
- object(const object* parent = nullptr){set_parent(parent);}\r
-\r
- virtual std::wstring print() const\r
- {\r
- tbb::spin_mutex::scoped_lock lock(mutex_);\r
- return (parent_ ? parent_->print() + L"/" : L"");\r
- }\r
- \r
- const object* get_parent() const\r
- {\r
- tbb::spin_mutex::scoped_lock lock(mutex_);\r
- return parent_;\r
- }\r
-\r
- void set_parent(const object* parent)\r
- {\r
- tbb::spin_mutex::scoped_lock lock(mutex_);\r
- parent_ = parent != this ? parent : nullptr;\r
- }\r
-};\r
-\r
-}
\ No newline at end of file
+++ /dev/null
-#pragma once\r
-\r
-#include <string>\r
-#include <functional>\r
-#include <memory>\r
-\r
-namespace caspar {\r
-\r
-typedef std::function<std::wstring()> printer;\r
-\r
-}
\ No newline at end of file
#include "producer/layer.h"\r
\r
#include <common/concurrency/executor.h>\r
-#include <common/utility/printer.h>\r
\r
#include <boost/range/algorithm_ext/erase.hpp>\r
\r
implementation(int index, const video_format_desc& format_desc) \r
: index_(index)\r
, format_desc_(format_desc)\r
- , consumer_(new frame_consumer_device([=]{return print();}, format_desc))\r
- , mixer_(new frame_mixer_device([=]{return print();}, format_desc))\r
- , producer_(new frame_producer_device([=]{return print();}, safe_ptr<frame_factory>(mixer_))) \r
+ , consumer_(new frame_consumer_device(format_desc))\r
+ , mixer_(new frame_mixer_device(format_desc))\r
+ , producer_(new frame_producer_device(safe_ptr<frame_factory>(mixer_))) \r
, mixer_connection_(mixer_->connect([=](const safe_ptr<const read_frame>& frame){consumer_->send(frame);}))\r
, producer_connection_(producer_->connect([=](const std::vector<safe_ptr<basic_frame>>& frames){mixer_->send(frames);}))\r
{}\r
mixer_connection_.disconnect();\r
\r
consumer_->set_video_format_desc(format_desc_);\r
- mixer_.reset(new frame_mixer_device([=]{return print();}, format_desc_));\r
- producer_.reset(new frame_producer_device([=]{return print();}, safe_ptr<frame_factory>(mixer_)));\r
+ mixer_.reset(new frame_mixer_device(format_desc_));\r
+ producer_.reset(new frame_producer_device(safe_ptr<frame_factory>(mixer_)));\r
\r
mixer_connection_ = mixer_->connect([=](const safe_ptr<const read_frame>& frame){consumer_->send(frame);});\r
producer_connection_ = producer_->connect([=](const std::vector<safe_ptr<basic_frame>>& frames){mixer_->send(frames);});\r
#pragma once\r
\r
#include <common/memory/safe_ptr.h>\r
-#include <common/utility/printer.h>\r
\r
#include <boost/noncopyable.hpp>\r
\r
+#include <functional>\r
#include <string>\r
#include <vector>\r
\r
\r
virtual void send(const safe_ptr<const read_frame>& frame) = 0;\r
virtual size_t buffer_depth() const = 0;\r
- virtual void initialize(const video_format_desc& format_desc, const printer& parent_printer = nullptr) = 0;\r
+ virtual void initialize(const video_format_desc& format_desc) = 0;\r
virtual std::wstring print() const = 0;\r
\r
static const safe_ptr<frame_consumer>& empty()\r
{\r
virtual void send(const safe_ptr<const read_frame>&){}\r
virtual size_t buffer_depth() const{return 0;}\r
- virtual void initialize(const video_format_desc&, const printer&){}\r
+ virtual void initialize(const video_format_desc&){}\r
virtual std::wstring print() const {return L"empty";}\r
};\r
static safe_ptr<frame_consumer> consumer = make_safe<empty_frame_consumer>();\r
\r
struct frame_consumer_device::implementation\r
{ \r
- const printer parent_printer_;\r
-\r
boost::circular_buffer<safe_ptr<const read_frame>> buffer_;\r
\r
std::map<int, std::shared_ptr<frame_consumer>> consumers_; // Valid iterators after erase\r
\r
executor executor_; \r
public:\r
- implementation(const printer& parent_printer, const video_format_desc& format_desc) \r
- : parent_printer_(parent_printer)\r
- , format_desc_(format_desc)\r
+ implementation( const video_format_desc& format_desc) \r
+ : format_desc_(format_desc)\r
, executor_(L"frame_consumer_device")\r
{ \r
executor_.set_capacity(2);\r
\r
void add(int index, safe_ptr<frame_consumer>&& consumer)\r
{ \r
- consumer->initialize(format_desc_, [this]{return print();});\r
+ consumer->initialize(format_desc_);\r
executor_.invoke([&]\r
{\r
if(buffer_.capacity() < consumer->buffer_depth())\r
\r
std::wstring print() const\r
{\r
- return (parent_printer_ ? parent_printer_() + L"/" : L"") + L"consumer";\r
+ return L"frame_consumer_device";\r
}\r
\r
void set_video_format_desc(const video_format_desc& format_desc)\r
{\r
- auto p = [this]{return print();};\r
executor_.invoke([&]\r
{\r
format_desc_ = format_desc;\r
buffer_.clear();\r
BOOST_FOREACH(auto& consumer, consumers_)\r
- consumer.second->initialize(format_desc_, p);\r
+ consumer.second->initialize(format_desc_);\r
});\r
}\r
};\r
\r
-frame_consumer_device::frame_consumer_device(const printer& parent_printer, const video_format_desc& format_desc) : impl_(new implementation(parent_printer, format_desc)){}\r
+frame_consumer_device::frame_consumer_device(const video_format_desc& format_desc) : impl_(new implementation(format_desc)){}\r
void frame_consumer_device::add(int index, safe_ptr<frame_consumer>&& consumer){impl_->add(index, std::move(consumer));}\r
void frame_consumer_device::remove(int index){impl_->remove(index);}\r
void frame_consumer_device::send(const safe_ptr<const read_frame>& future_frame) { impl_->send(future_frame); }\r
#include "../consumer/frame_consumer.h"\r
\r
#include <common/memory/safe_ptr.h>\r
-#include <common/utility/printer.h>\r
\r
#include <vector>\r
\r
class frame_consumer_device : boost::noncopyable\r
{\r
public:\r
- explicit frame_consumer_device(const printer& parent_printer, const video_format_desc& format_desc);\r
+ explicit frame_consumer_device(const video_format_desc& format_desc);\r
\r
void add(int index, safe_ptr<frame_consumer>&& consumer);\r
void remove(int index);\r
std::wstring color_str_;\r
\r
public:\r
-\r
explicit color_producer(const std::wstring& color) \r
: color_str_(color)\r
, frame_(basic_frame::empty())\r
\r
virtual safe_ptr<basic_frame> receive() { return frame_; }\r
\r
- virtual std::wstring print() const { return frame_producer::print() + L"color[" + color_str_ + L"]"; }\r
+ virtual std::wstring print() const { return L"color[" + color_str_ + L"]"; }\r
};\r
\r
safe_ptr<frame_producer> create_color_producer(const std::vector<std::wstring>& params)\r
#pragma once\r
\r
#include <common/memory/safe_ptr.h>\r
-#include <common/object.h>\r
\r
#include "../producer/frame/basic_frame.h"\r
#include "../producer/frame/frame_factory.h"\r
\r
namespace caspar { namespace core {\r
\r
-class frame_producer : public object, boost::noncopyable\r
+class frame_producer : boost::noncopyable\r
{\r
public:\r
virtual ~frame_producer(){} \r
virtual void set_frame_factory(const safe_ptr<frame_factory>& frame_factory) = 0;\r
\r
virtual void param(const std::wstring&){}\r
+\r
+ virtual std::wstring print() const = 0;\r
\r
static const safe_ptr<frame_producer>& empty() // nothrow\r
{\r
{\r
virtual safe_ptr<basic_frame> receive(){return basic_frame::empty();}\r
virtual void set_frame_factory(const safe_ptr<frame_factory>&){}\r
- virtual void set_parent(const object* parent) {}\r
virtual std::wstring print() const { return L"empty";}\r
};\r
static safe_ptr<frame_producer> producer = make_safe<empty_frame_producer>();\r
#include "layer.h"\r
\r
#include <common/concurrency/executor.h>\r
-#include <common/utility/printer.h>\r
\r
#include <boost/range/algorithm_ext/erase.hpp>\r
#include <boost/lexical_cast.hpp>\r
\r
namespace caspar { namespace core {\r
\r
-struct frame_producer_device::implementation : public object, boost::noncopyable\r
+struct frame_producer_device::implementation : boost::noncopyable\r
{ \r
- const printer parent_printer_;\r
-\r
std::map<int, layer> layers_; \r
\r
const safe_ptr<frame_factory> factory_;\r
\r
mutable executor executor_;\r
public:\r
- implementation(const printer& parent_printer, const safe_ptr<frame_factory>& factory) \r
- : parent_printer_(parent_printer)\r
- , factory_(factory)\r
- , executor_(print())\r
+ implementation(const safe_ptr<frame_factory>& factory) \r
+ : factory_(factory)\r
+ , executor_(L"frame_producer_device")\r
{\r
executor_.start();\r
}\r
{\r
auto it = layers_.find(index);\r
if(it == layers_.end())\r
- it = layers_.insert(std::make_pair(index, layer(this, index))).first;\r
+ it = layers_.insert(std::make_pair(index, layer(index))).first;\r
return it->second;\r
}\r
\r
\r
std::wstring print() const\r
{\r
- return (parent_printer_ ? parent_printer_() + L"/" : L"") + L"producer";\r
+ return L"frame_producer_device";\r
}\r
};\r
\r
-frame_producer_device::frame_producer_device(const printer& parent_printer, const safe_ptr<frame_factory>& factory) : impl_(new implementation(parent_printer, factory)){}\r
+frame_producer_device::frame_producer_device(const safe_ptr<frame_factory>& factory) : impl_(new implementation(factory)){}\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
#include "frame_producer.h"\r
\r
#include <common/memory/safe_ptr.h>\r
-#include <common/utility/printer.h>\r
\r
#include <boost/noncopyable.hpp>\r
#include <boost/thread/future.hpp>\r
\r
boost::signals2::connection connect(const output_t::slot_type& subscriber);\r
\r
- explicit frame_producer_device(const printer& parent_printer, const safe_ptr<frame_factory>& factory);\r
+ explicit frame_producer_device(const safe_ptr<frame_factory>& factory);\r
frame_producer_device(frame_producer_device&& other);\r
void swap(frame_producer_device& other);\r
\r
#include <common/concurrency/executor.h>\r
#include <common/exception/exceptions.h>\r
#include <common/utility/assert.h>\r
-#include <common/utility/printer.h>\r
\r
#include "../producer/frame/basic_frame.h"\r
#include "../producer/frame/audio_transform.h"\r
\r
frame_producer_remover g_remover;\r
\r
-struct layer::implementation : public object, boost::noncopyable\r
+struct layer::implementation : boost::noncopyable\r
{ \r
- mutable tbb::spin_mutex printer_mutex_;\r
- printer parent_printer_;\r
- int index_;\r
+ tbb::atomic<int> index_;\r
\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(const object* parent, int index) \r
- : object(parent)\r
- , index_(index)\r
- , foreground_(frame_producer::empty())\r
+ implementation(int index) \r
+ : foreground_(frame_producer::empty())\r
, background_(frame_producer::empty())\r
, last_frame_(basic_frame::empty())\r
- , is_paused_(false){}\r
+ , is_paused_(false)\r
+ {\r
+ index_ = index;\r
+ }\r
\r
void load(const safe_ptr<frame_producer>& frame_producer, bool play_on_load, bool preview)\r
{ \r
- frame_producer->set_parent(this);\r
background_ = frame_producer;\r
is_paused_ = false;\r
\r
\r
auto following = foreground_->get_following_producer();\r
following->set_leading_producer(foreground_);\r
- following->set_parent(this);\r
g_remover.remove(std::move(foreground_));\r
foreground_ = following;\r
CASPAR_LOG(info) << foreground_->print() << L" Added.";\r
\r
std::wstring print() const\r
{\r
- tbb::spin_mutex::scoped_lock lock(printer_mutex_); // Child-producers may call print asynchronously to the producer thread.\r
- return object::print() + L"layer[" + boost::lexical_cast<std::wstring>(index_) + L"]";\r
+ return L"layer[" + boost::lexical_cast<std::wstring>(index_) + L"]";\r
}\r
};\r
\r
-layer::layer(const object* parent, int index) : impl_(new implementation(parent, index)){}\r
+layer::layer(int index) : impl_(new implementation(index)){}\r
layer::layer(layer&& other) : impl_(std::move(other.impl_)){}\r
layer& layer::operator=(layer&& other)\r
{\r
{\r
impl_.swap(other.impl_);\r
// Printer state is not swapped.\r
- tbb::spin_mutex::scoped_lock lock(impl_->printer_mutex_);\r
- std::swap(impl_->parent_printer_, other.impl_->parent_printer_);\r
std::swap(impl_->index_, other.impl_->index_);\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
#pragma once\r
\r
-#include <common/object.h>\r
#include <common/memory/safe_ptr.h>\r
-#include <common/utility/printer.h>\r
\r
#include <boost/noncopyable.hpp>\r
\r
class layer : boost::noncopyable\r
{\r
public:\r
- explicit layer(const object* parent = nullptr, int index = std::numeric_limits<int>::min()); // nothrow\r
+ explicit layer(int index = std::numeric_limits<int>::min()); // nothrow\r
layer(layer&& other); // nothrow\r
layer& operator=(layer&& other); // nothrow\r
\r
, dest_producer_(dest)\r
, source_producer_(frame_producer::empty())\r
{\r
- dest_producer_->set_parent(self_);\r
frame_buffer_.push_back(basic_frame::empty());\r
}\r
\r
void set_leading_producer(const safe_ptr<frame_producer>& producer)\r
{\r
source_producer_ = producer;\r
- source_producer_->set_parent(self_);\r
}\r
\r
safe_ptr<basic_frame> receive()\r
auto following = producer->get_following_producer();\r
following->set_frame_factory(safe_ptr<frame_factory>(frame_factory_));\r
following->set_leading_producer(producer);\r
- following->set_parent(self_);\r
producer = std::move(following);\r
}\r
catch(...)\r
return basic_frame(s_frame, d_frame);\r
}\r
\r
- virtual std::wstring print() const\r
+ std::wstring print() const\r
{\r
return L"transition[" + info_.name() + L":" + boost::lexical_cast<std::wstring>(info_.duration) + L"]";\r
}\r
safe_ptr<frame_producer> transition_producer::get_following_producer() const{return impl_->get_following_producer();}\r
void transition_producer::set_leading_producer(const safe_ptr<frame_producer>& producer) { impl_->set_leading_producer(producer); }\r
void transition_producer::set_frame_factory(const safe_ptr<frame_factory>& frame_factory) { impl_->set_frame_factory(frame_factory);}\r
-std::wstring transition_producer::print() const { return frame_producer::print();}// + impl_->print();}\r
+std::wstring transition_producer::print() const { return impl_->print();}\r
\r
}}\r
\r
explicit transition_producer(const safe_ptr<frame_producer>& destination, const transition_info& info);\r
transition_producer(transition_producer&& other);\r
\r
+ // frame_producer\r
virtual safe_ptr<basic_frame> receive();\r
-\r
virtual safe_ptr<frame_producer> get_following_producer() const;\r
-\r
virtual void set_leading_producer(const safe_ptr<frame_producer>& producer);\r
virtual void set_frame_factory(const safe_ptr<frame_factory>& frame_factory);\r
-\r
virtual std::wstring print() const;\r
private:\r
struct implementation;\r
\r
struct frame_mixer_device::implementation : boost::noncopyable\r
{ \r
- const printer parent_printer_;\r
const video_format_desc format_desc_;\r
\r
safe_ptr<diagnostics::graph> diag_;\r
\r
executor executor_;\r
public:\r
- implementation(const printer& parent_printer, const video_format_desc& format_desc) \r
- : parent_printer_(parent_printer)\r
- , format_desc_(format_desc)\r
+ implementation( const video_format_desc& format_desc) \r
+ : format_desc_(format_desc)\r
, diag_(diagnostics::create_graph(narrow(print())))\r
, image_mixer_(format_desc)\r
, executor_(print())\r
\r
std::wstring print() const\r
{\r
- return (parent_printer_ ? parent_printer_() + L"/" : L"") + L"mixer";\r
+ return L"frame_mixer_device";\r
}\r
};\r
\r
-frame_mixer_device::frame_mixer_device(const printer& parent_printer, const video_format_desc& format_desc) : impl_(new implementation(parent_printer, format_desc)){}\r
+frame_mixer_device::frame_mixer_device(const video_format_desc& format_desc) : impl_(new implementation(format_desc)){}\r
frame_mixer_device::frame_mixer_device(frame_mixer_device&& other) : impl_(std::move(other.impl_)){}\r
boost::signals2::connection frame_mixer_device::connect(const output_t::slot_type& subscriber){return impl_->connect(subscriber);}\r
void frame_mixer_device::send(const std::vector<safe_ptr<basic_frame>>& frames){impl_->send(frames);}\r
#include "audio/audio_mixer.h"\r
\r
#include <common/memory/safe_ptr.h>\r
-#include <common/utility/printer.h>\r
\r
#include <boost/signals2.hpp>\r
\r
\r
boost::signals2::connection connect(const output_t::slot_type& subscriber);\r
\r
- frame_mixer_device(const printer& parent_printer, const video_format_desc& format_desc);\r
+ frame_mixer_device(const video_format_desc& format_desc);\r
frame_mixer_device(frame_mixer_device&& other); // nothrow\r
\r
void send(const std::vector<safe_ptr<basic_frame>>& frames); // nothrow\r
\r
struct bluefish_consumer::implementation : boost::noncopyable\r
{\r
- printer parent_printer_;\r
std::wstring model_name_;\r
const unsigned int device_index_;\r
\r
CASPAR_LOG(info) << print() << L" Shutting down."; \r
}\r
\r
- void initialize(const core::video_format_desc& format_desc, const printer& parent_printer)\r
+ void initialize(const core::video_format_desc& format_desc)\r
{ \r
format_desc_ = format_desc;\r
- parent_printer_ = parent_printer;\r
\r
blue_.reset(BlueVelvetFactory4());\r
\r
\r
std::wstring print() const\r
{\r
- return (parent_printer_ ? parent_printer_() + L"/" : L"") + model_name_ + L" [" + boost::lexical_cast<std::wstring>(device_index_) + L"]";\r
+ return model_name_ + L" [" + boost::lexical_cast<std::wstring>(device_index_) + L"]";\r
}\r
};\r
\r
bluefish_consumer::bluefish_consumer(unsigned int device_index, bool embed_audio) : impl_(new implementation(device_index, embed_audio)){} \r
bluefish_consumer::bluefish_consumer(bluefish_consumer&& other) : impl_(std::move(other.impl_)){}\r
-void bluefish_consumer::initialize(const core::video_format_desc& format_desc, const printer& parent_printer)\r
+void bluefish_consumer::initialize(const core::video_format_desc& format_desc)\r
{\r
impl_.reset(new implementation(impl_->device_index_, impl_->embed_audio_));\r
- impl_->initialize(format_desc, parent_printer);\r
+ impl_->initialize(format_desc);\r
}\r
void bluefish_consumer::send(const safe_ptr<const core::read_frame>& frame){impl_->send(frame);}\r
size_t bluefish_consumer::buffer_depth() const{return impl_->buffer_depth();}\r
explicit bluefish_consumer(unsigned int device_index, bool embed_audio = false);\r
bluefish_consumer(bluefish_consumer&& other);\r
\r
- virtual void initialize(const core::video_format_desc& format_desc, const printer& parent_printer);\r
+ virtual void initialize(const core::video_format_desc& format_desc);\r
virtual void send(const safe_ptr<const core::read_frame>&);\r
virtual size_t buffer_depth() const;\r
virtual std::wstring print() const;\r
~co_init(){CoUninitialize();}\r
} co_;\r
\r
- const printer parent_printer_;\r
std::wstring model_name_;\r
const size_t device_index_;\r
tbb::atomic<bool> is_running_;\r
tbb::concurrent_bounded_queue<safe_ptr<const core::read_frame>> audio_frame_buffer_;\r
\r
public:\r
- decklink_output(const core::video_format_desc& format_desc, const printer& parent_printer, size_t device_index, bool embed_audio, bool internalKey) \r
- : parent_printer_(parent_printer)\r
- , model_name_(L"DECKLINK")\r
+ decklink_output(const core::video_format_desc& format_desc,size_t device_index, bool embed_audio, bool internalKey) \r
+ : model_name_(L"DECKLINK")\r
, device_index_(device_index)\r
, audio_container_(5)\r
, embed_audio_(embed_audio)\r
\r
std::wstring print() const\r
{\r
- return (parent_printer_ ? parent_printer_() + L"/" : L"") + model_name_ + L" [" + boost::lexical_cast<std::wstring>(device_index_) + L"]";\r
+ return model_name_ + L" [" + boost::lexical_cast<std::wstring>(device_index_) + L"]";\r
}\r
};\r
\r
});\r
}\r
\r
- void initialize(const core::video_format_desc& format_desc, const printer& parent_printer)\r
+ void initialize(const core::video_format_desc& format_desc)\r
{\r
executor_.invoke([&]\r
{\r
- input_.reset(new decklink_output(format_desc, parent_printer, device_index_, embed_audio_, internal_key_));\r
+ input_.reset(new decklink_output(format_desc, device_index_, embed_audio_, internal_key_));\r
});\r
}\r
\r
\r
decklink_consumer::decklink_consumer(size_t device_index, bool embed_audio, bool internalKey) : impl_(new implementation(device_index, embed_audio, internalKey)){}\r
decklink_consumer::decklink_consumer(decklink_consumer&& other) : impl_(std::move(other.impl_)){}\r
-void decklink_consumer::initialize(const core::video_format_desc& format_desc, const printer& parent_printer){impl_->initialize(format_desc, parent_printer);}\r
+void decklink_consumer::initialize(const core::video_format_desc& format_desc){impl_->initialize(format_desc);}\r
void decklink_consumer::send(const safe_ptr<const core::read_frame>& frame){impl_->send(frame);}\r
size_t decklink_consumer::buffer_depth() const{return impl_->buffer_depth();}\r
std::wstring decklink_consumer::print() const{return impl_->print();}\r
explicit decklink_consumer(size_t device_index, bool embed_audio = false, bool internal_key = false);\r
decklink_consumer(decklink_consumer&& other);\r
\r
- virtual void initialize(const core::video_format_desc& format_desc, const printer& parent_printer);\r
+ virtual void initialize(const core::video_format_desc& format_desc);\r
virtual void send(const safe_ptr<const core::read_frame>&);\r
virtual size_t buffer_depth() const;\r
virtual std::wstring print() const;\r
#include <common/exception/exceptions.h>\r
#include <common/utility/timer.h>\r
\r
+#include <core/producer/frame/frame_factory.h>\r
#include <core/producer/frame/write_frame.h>\r
\r
#include <tbb/concurrent_queue.h>\r
~co_init(){CoUninitialize();}\r
} co_;\r
\r
- const object* parent_;\r
const core::video_format_desc format_desc_;\r
std::wstring model_name_;\r
const size_t device_index_;\r
safe_ptr<core::basic_frame> tail_;\r
\r
public:\r
- decklink_input(const object* parent, const core::video_format_desc& format_desc, size_t device_index, const std::shared_ptr<core::frame_factory>& frame_factory)\r
- : parent_(parent)\r
- , format_desc_(format_desc)\r
+ decklink_input(const core::video_format_desc& format_desc, size_t device_index, const std::shared_ptr<core::frame_factory>& frame_factory)\r
+ : format_desc_(format_desc)\r
, device_index_(device_index)\r
, model_name_(L"decklink")\r
, frame_factory_(frame_factory)\r
frame_buffer_.try_pop(tail_);\r
return tail_;\r
}\r
-\r
+ \r
std::wstring print() const\r
{\r
- return static_cast<const core::frame_producer*>(parent_)->print() + L" [" + model_name_ + L"device:" + boost::lexical_cast<std::wstring>(device_index_) + L"]";\r
+ return L" [" + model_name_ + L"device:" + boost::lexical_cast<std::wstring>(device_index_) + L"]";\r
}\r
};\r
\r
executor_.start();\r
executor_.invoke([=]\r
{\r
- input_.reset(new decklink_input(this, format_desc_, device_index_, frame_factory));\r
+ input_.reset(new decklink_input(format_desc_, device_index_, frame_factory));\r
});\r
}\r
\r
\r
std::wstring print() const\r
{\r
- return (input_ ? input_->print() : L"Unknown Decklink [input-" + boost::lexical_cast<std::wstring>(device_index_) + L"]");\r
+ return input_ ? input_->print() : L"decklink_producer";\r
}\r
};\r
\r
\r
struct ffmpeg_consumer::implementation : boost::noncopyable\r
{ \r
- printer parent_printer_;\r
std::string filename_;\r
\r
// Audio\r
url_fclose(oc_->pb); // Close the output ffmpeg.\r
}\r
\r
- void initialize(const core::video_format_desc& format_desc, const printer& parent_printer)\r
+ void initialize(const core::video_format_desc& format_desc)\r
{\r
format_desc_ = format_desc;\r
- parent_printer_ = parent_printer;\r
executor_.start();\r
active_ = executor_.begin_invoke([]{});\r
\r
\r
std::wstring print() const\r
{\r
- return (parent_printer_ ? parent_printer_() + L"/" : L"") + L"ffmpeg[" + widen(filename_) + L"]";\r
+ return L"ffmpeg[" + widen(filename_) + L"]";\r
}\r
\r
AVStream* add_video_stream(enum CodecID codec_id)\r
ffmpeg_consumer::ffmpeg_consumer(ffmpeg_consumer&& other) : impl_(std::move(other.impl_)){}\r
void ffmpeg_consumer::send(const safe_ptr<const core::read_frame>& frame){impl_->send(frame);}\r
size_t ffmpeg_consumer::buffer_depth() const{return impl_->buffer_depth();}\r
-void ffmpeg_consumer::initialize(const core::video_format_desc& format_desc, const printer& parent_printer)\r
+void ffmpeg_consumer::initialize(const core::video_format_desc& format_desc)\r
{\r
impl_.reset(new implementation(impl_->filename_));\r
- impl_->initialize(format_desc, parent_printer);\r
+ impl_->initialize(format_desc);\r
}\r
std::wstring ffmpeg_consumer::print() const {return impl_->print();}\r
\r
explicit ffmpeg_consumer(const std::wstring& filename);\r
ffmpeg_consumer(ffmpeg_consumer&& other);\r
\r
- virtual void initialize(const core::video_format_desc& format_desc, const printer& parent_printer);\r
+ virtual void initialize(const core::video_format_desc& format_desc);\r
virtual void send(const safe_ptr<const core::read_frame>&);\r
virtual size_t buffer_depth() const;\r
virtual std::wstring print() const;\r
virtual void set_frame_factory(const safe_ptr<core::frame_factory>& frame_factory)\r
{\r
frame_factory_ = frame_factory;\r
- input_.reset(new input(safe_ptr<diagnostics::graph>(graph_), filename_, loop_, std::bind(&ffmpeg_producer::print, this)));\r
+ input_.reset(new input(safe_ptr<diagnostics::graph>(graph_), filename_, loop_));\r
video_decoder_.reset(input_->get_video_codec_context().get() ? new video_decoder(input_->get_video_codec_context().get(), frame_factory) : nullptr);\r
audio_decoder_.reset(input_->get_audio_codec_context().get() ? new audio_decoder(input_->get_audio_codec_context().get(), frame_factory->get_video_format_desc().fps) : nullptr);\r
\r
\r
virtual std::wstring print() const\r
{\r
- return frame_producer::print() + L"ffmpeg[" + boost::filesystem::wpath(filename_).filename() + L"]";\r
+ return L"ffmpeg[" + boost::filesystem::wpath(filename_).filename() + L"]";\r
}\r
};\r
\r
\r
#include <common/concurrency/executor.h>\r
#include <common/diagnostics/graph.h>\r
-#include <common/utility/printer.h>\r
\r
#include <tbb/concurrent_queue.h>\r
#include <tbb/queuing_mutex.h>\r
{ \r
static const size_t PACKET_BUFFER_COUNT = 50;\r
\r
- printer parent_printer_;\r
safe_ptr<diagnostics::graph> graph_;\r
\r
std::shared_ptr<AVFormatContext> format_context_; // Destroy this last\r
\r
executor executor_;\r
public:\r
- explicit implementation(const safe_ptr<diagnostics::graph>& graph, const std::wstring& filename, bool loop, const printer& parent_printer) \r
- : parent_printer_(parent_printer)\r
- , graph_(graph)\r
+ explicit implementation(const safe_ptr<diagnostics::graph>& graph, const std::wstring& filename, bool loop) \r
+ : graph_(graph)\r
, loop_(loop)\r
, video_s_index_(-1)\r
, audio_s_index_(-1)\r
\r
std::wstring print() const\r
{\r
- return (parent_printer_ ? parent_printer_() + L"/" : L"") + L"input";\r
+ return L"ffmpeg_input";\r
}\r
};\r
\r
-input::input(const safe_ptr<diagnostics::graph>& graph, const std::wstring& filename, bool loop, const printer& parent_printer) : impl_(new implementation(graph, filename, loop, parent_printer)){}\r
+input::input(const safe_ptr<diagnostics::graph>& graph, const std::wstring& filename, bool loop) : impl_(new implementation(graph, filename, loop)){}\r
const std::shared_ptr<AVCodecContext>& input::get_video_codec_context() const{return impl_->video_codec_context_;}\r
const std::shared_ptr<AVCodecContext>& input::get_audio_codec_context() const{return impl_->audio_codex_context_;}\r
bool input::is_eof() const{return impl_->is_eof();}\r
#pragma once\r
\r
#include <common/diagnostics/graph.h>\r
-#include <common/utility/printer.h>\r
\r
#include <tbb/cache_aligned_allocator.h>\r
\r
class input : boost::noncopyable\r
{\r
public:\r
- explicit input(const safe_ptr<diagnostics::graph>& graph, const std::wstring& filename, bool loop, const printer& parent_printer);\r
+ explicit input(const safe_ptr<diagnostics::graph>& graph, const std::wstring& filename, bool loop);\r
const std::shared_ptr<AVCodecContext>& get_video_codec_context() const;\r
const std::shared_ptr<AVCodecContext>& get_audio_codec_context() const;\r
\r
implementation(const cg_producer* self) \r
: self_(self)\r
, flash_producer_(create_flash_producer(boost::assign::list_of(env::template_host())))\r
- {\r
- flash_producer_->set_parent(self_);\r
- }\r
+ {}\r
\r
void clear()\r
{\r
flash_producer_ = create_flash_producer(boost::assign::list_of(env::template_host()));\r
- flash_producer_->set_parent(self_);\r
flash_producer_->set_frame_factory(safe_ptr<core::frame_factory>(frame_factory_));\r
}\r
\r
\r
std::wstring print() const\r
{\r
- return L"cg";\r
+ return flash_producer_->print();\r
}\r
};\r
\r
void cg_producer::update(int layer, const std::wstring& data){impl_->update(layer, data);}\r
void cg_producer::invoke(int layer, const std::wstring& label){impl_->invoke(layer, label);}\r
void cg_producer::set_frame_factory(const safe_ptr<core::frame_factory>& frame_factory){impl_->set_frame_factory(frame_factory);}\r
-std::wstring cg_producer::print() const{return frame_producer::print() + impl_->print();}\r
+std::wstring cg_producer::print() const{return impl_->print();}\r
\r
}
\ No newline at end of file
\r
#include <core/video_format.h>\r
\r
+#include <core/producer/frame/frame_factory.h>\r
#include <core/producer/frame/basic_frame.h>\r
#include <core/producer/frame/write_frame.h>\r
\r
~co_init(){CoUninitialize();}\r
} co_;\r
\r
- const object* parent_;\r
const std::wstring filename_;\r
const core::video_format_desc format_desc_;\r
\r
timer perf_timer_;\r
\r
public:\r
- flash_renderer(const object* parent, const safe_ptr<diagnostics::graph>& graph, const std::shared_ptr<core::frame_factory>& frame_factory, const std::wstring& filename) \r
- : parent_(parent)\r
- , graph_(graph)\r
+ flash_renderer(const safe_ptr<diagnostics::graph>& graph, const std::shared_ptr<core::frame_factory>& frame_factory, const std::wstring& filename) \r
+ : graph_(graph)\r
, filename_(filename)\r
, format_desc_(frame_factory->get_video_format_desc())\r
, frame_factory_(frame_factory)\r
\r
std::wstring print()\r
{\r
- return parent_->print();\r
+ return L"flash[" + boost::filesystem::wpath(filename_).filename() + L"]"; \r
}\r
-\r
+ \r
private:\r
\r
safe_ptr<core::basic_frame> render_simple_frame(bool underflow)\r
{\r
if(!renderer_)\r
{\r
- renderer_.reset(new flash_renderer(this, safe_ptr<diagnostics::graph>(graph_), frame_factory_, filename_));\r
+ renderer_.reset(new flash_renderer(safe_ptr<diagnostics::graph>(graph_), frame_factory_, filename_));\r
while(frame_buffer_.try_push(core::basic_frame::empty())){} \r
}\r
\r
\r
virtual std::wstring print() const\r
{ \r
- return frame_producer::print() + L"flash[" + boost::filesystem::wpath(filename_).filename() + L", " + \r
+ return L"flash[" + boost::filesystem::wpath(filename_).filename() + L", " + \r
boost::lexical_cast<std::wstring>(fps_) + \r
(interlaced(fps_, format_desc_) ? L"i" : L"p") + L"]"; \r
} \r
\r
virtual std::wstring print() const\r
{\r
- return frame_producer::print() + L"image_producer[" + filename_ + L"]";\r
+ return L"image_producer[" + filename_ + L"]";\r
}\r
};\r
\r
\r
struct oal_consumer::implementation : public sf::SoundStream, boost::noncopyable\r
{\r
- printer parent_printer_;\r
safe_ptr<diagnostics::graph> graph_;\r
timer perf_timer_;\r
\r
\r
core::video_format_desc format_desc_;\r
public:\r
- implementation(const core::video_format_desc& format_desc, const printer& parent_printer) \r
- : parent_printer_(parent_printer)\r
- , graph_(diagnostics::create_graph(narrow(print())))\r
+ implementation(const core::video_format_desc& format_desc) \r
+ : graph_(diagnostics::create_graph(narrow(print())))\r
, container_(5)\r
, format_desc_(format_desc)\r
{\r
\r
std::wstring print() const\r
{\r
- return (parent_printer_ ? parent_printer_() + L"/" : L"") + L"oal[default]";\r
+ return L"oal[default]";\r
}\r
};\r
\r
oal_consumer::oal_consumer(oal_consumer&& other) : impl_(std::move(other.impl_)){}\r
void oal_consumer::send(const safe_ptr<const core::read_frame>& frame){impl_->send(frame);}\r
size_t oal_consumer::buffer_depth() const{return impl_->buffer_depth();}\r
-void oal_consumer::initialize(const core::video_format_desc& format_desc, const printer& parent_printer){impl_.reset(new implementation(format_desc, parent_printer));}\r
+void oal_consumer::initialize(const core::video_format_desc& format_desc){impl_.reset(new implementation(format_desc));}\r
std::wstring oal_consumer::print() const { return impl_->print(); }\r
\r
safe_ptr<core::frame_consumer> create_oal_consumer(const std::vector<std::wstring>& params)\r
explicit oal_consumer();\r
oal_consumer(oal_consumer&& other);\r
\r
- virtual void initialize(const core::video_format_desc& format_desc, const printer& parent_printer); \r
+ virtual void initialize(const core::video_format_desc& format_desc); \r
\r
virtual void send(const safe_ptr<const core::read_frame>&);\r
virtual size_t buffer_depth() const;\r
struct ogl_consumer::implementation : boost::noncopyable\r
{ \r
timer clock_;\r
- printer parent_printer_;\r
boost::unique_future<void> active_;\r
\r
float width_;\r
CASPAR_LOG(info) << print() << L" Shutting down."; \r
}\r
\r
- void initialize(const core::video_format_desc& format_desc, const printer& parent_printer)\r
+ void initialize(const core::video_format_desc& format_desc)\r
{\r
if(!GLEE_VERSION_2_1)\r
BOOST_THROW_EXCEPTION(not_supported() << msg_info("Missing OpenGL 2.1 support."));\r
\r
format_desc_ = format_desc;\r
- parent_printer_ = parent_printer;\r
\r
square_width_ = format_desc_.width;\r
square_height_ = format_desc_.height;\r
\r
std::wstring print() const\r
{\r
- return (parent_printer_ ? parent_printer_() + L"/" : L"") + L"ogl[" + boost::lexical_cast<std::wstring>(screen_index_) + L"]";\r
+ return L"ogl[" + boost::lexical_cast<std::wstring>(screen_index_) + L"]";\r
}\r
\r
size_t buffer_depth() const{return 2;}\r
ogl_consumer::ogl_consumer(unsigned int screen_index, stretch stretch, bool windowed) : impl_(new implementation(screen_index, stretch, windowed)){}\r
void ogl_consumer::send(const safe_ptr<const core::read_frame>& frame){impl_->send(frame);}\r
size_t ogl_consumer::buffer_depth() const{return impl_->buffer_depth();}\r
-void ogl_consumer::initialize(const core::video_format_desc& format_desc, const printer& parent_printer)\r
+void ogl_consumer::initialize(const core::video_format_desc& format_desc)\r
{\r
impl_.reset(new implementation(impl_->screen_index_, impl_->stretch_, impl_->windowed_));\r
- impl_->initialize(format_desc, parent_printer);\r
+ impl_->initialize(format_desc);\r
}\r
std::wstring ogl_consumer::print() const {return impl_->print();}\r
\r
explicit ogl_consumer(unsigned int screen_index = 0, stretch stretch = stretch::fill, bool windowed = false);\r
ogl_consumer(ogl_consumer&& other);\r
\r
- virtual void initialize(const core::video_format_desc& format_desc, const printer& parent_printer);\r
+ virtual void initialize(const core::video_format_desc& format_desc);\r
virtual void send(const safe_ptr<const core::read_frame>&);\r
virtual size_t buffer_depth() const;\r
virtual std::wstring print() const;\r
return renderer_->get_frame();\r
}\r
\r
- std::wstring print() const{ return frame_producer::print() + L"silverlight"; } \r
+ std::wstring print() const{ return L"silverlight"; } \r
};\r
\r
safe_ptr<core::frame_producer> create_silverlight_producer(const std::vector<std::wstring>& params)\r