#include "../StdAfx.h"
#include "frame_producer.h"
+#include "cg_proxy.h"
#include "../frame/draw_frame.h"
#include "../frame/frame_transform.h"
const spl::shared_ptr<core::frame_factory>& frame_factory,
const std::vector<spl::shared_ptr<video_channel>>& channels,
const video_format_desc& format_desc,
- const spl::shared_ptr<const frame_producer_registry> producer_registry)
+ const spl::shared_ptr<const frame_producer_registry> producer_registry,
+ const spl::shared_ptr<const cg_producer_registry> cg_registry)
: frame_factory(frame_factory)
, channels(channels)
, format_desc(format_desc)
, producer_registry(producer_registry)
+ , cg_registry(cg_registry)
{
}
constraints(double width, double height);
constraints();
};
-
+
// Interface
class frame_producer : public interaction_sink
{
public:
// Static Members
-
+
static const spl::shared_ptr<frame_producer>& empty();
// Constructors
frame_producer(){}
- virtual ~frame_producer(){}
+ virtual ~frame_producer(){}
- // Methods
+ // Methods
virtual draw_frame receive() = 0;
virtual std::future<std::wstring> call(const std::vector<std::wstring>& params) = 0;
virtual variable& get_variable(const std::wstring& name) = 0;
virtual const std::vector<std::wstring>& get_variables() const = 0;
-
+
// monitor::observable
virtual monitor::subject& monitor_output() = 0;
virtual bool collides(double x, double y) const override { return false; }
// Properties
-
+
virtual void paused(bool value) = 0;
virtual std::wstring print() const = 0;
virtual uint32_t frame_number() const = 0;
virtual draw_frame last_frame() = 0;
virtual constraints& pixel_constraints() = 0;
- virtual void leading_producer(const spl::shared_ptr<frame_producer>&) {}
+ virtual void leading_producer(const spl::shared_ptr<frame_producer>&) {}
};
class frame_producer_base : public frame_producer
{
public:
frame_producer_base();
- virtual ~frame_producer_base(){}
+ virtual ~frame_producer_base(){}
- // Methods
+ // Methods
virtual std::future<std::wstring> call(const std::vector<std::wstring>& params) override;
virtual variable& get_variable(const std::wstring& name) override;
virtual const std::vector<std::wstring>& get_variables() const override;
-
+
// monitor::observable
-
+
// Properties
-
- void paused(bool value) override;
+
+ void paused(bool value) override;
uint32_t nb_frames() const override;
uint32_t frame_number() const override;
virtual draw_frame last_frame() override;
std::vector<spl::shared_ptr<video_channel>> channels;
video_format_desc format_desc;
spl::shared_ptr<const frame_producer_registry> producer_registry;
+ spl::shared_ptr<const cg_producer_registry> cg_registry;
frame_producer_dependencies(
const spl::shared_ptr<core::frame_factory>& frame_factory,
const std::vector<spl::shared_ptr<video_channel>>& channels,
const video_format_desc& format_desc,
- const spl::shared_ptr<const frame_producer_registry> producer_registry);
+ const spl::shared_ptr<const frame_producer_registry> producer_registry,
+ const spl::shared_ptr<const cg_producer_registry> cg_registry);
};
typedef std::function<spl::shared_ptr<core::frame_producer>(const frame_producer_dependencies&, const std::vector<std::wstring>&)> producer_factory_t;
#include <common/filesystem.h>
#include "producer/frame_producer.h"
+#include "producer/cg_proxy.h"
#include "consumer/frame_consumer.h"
#include "mixer/mixer.h"
#include "mixer/image/image_mixer.h"
thumbnail_creator thumbnail_creator_;
spl::shared_ptr<media_info_repository> media_info_repo_;
spl::shared_ptr<const frame_producer_registry> producer_registry_;
+ spl::shared_ptr<const cg_producer_registry> cg_registry_;
bool mipmap_;
filesystem_monitor::ptr monitor_;
public:
const thumbnail_creator& thumbnail_creator,
spl::shared_ptr<media_info_repository> media_info_repo,
spl::shared_ptr<const frame_producer_registry> producer_registry,
+ spl::shared_ptr<const cg_producer_registry> cg_registry,
bool mipmap)
: media_path_(media_path)
, thumbnails_path_(thumbnails_path)
, thumbnail_creator_(thumbnail_creator)
, media_info_repo_(std::move(media_info_repo))
, producer_registry_(std::move(producer_registry))
+ , cg_registry_(std::move(cg_registry))
, mipmap_(mipmap)
, monitor_(monitor_factory.create(
media_path,
continue;
auto relative_without_extension = get_relative_without_extension(path, thumbnails_path_);
- bool no_corresponding_media_file = relative_without_extensions.find(relative_without_extension.wstring())
+ bool no_corresponding_media_file = relative_without_extensions.find(relative_without_extension.wstring())
== relative_without_extensions.end();
if (no_corresponding_media_file)
try
{
- raw_frame = producer_registry_->create_thumbnail(frame_producer_dependencies(image_mixer_, {}, format_desc_, producer_registry_), media_file.wstring());
+ raw_frame = producer_registry_->create_thumbnail(frame_producer_dependencies(image_mixer_, {}, format_desc_, producer_registry_, cg_registry_), media_file.wstring());
media_info_repo_->remove(file.wstring());
media_info_repo_->get(file.wstring());
}
const thumbnail_creator& thumbnail_creator,
spl::shared_ptr<media_info_repository> media_info_repo,
spl::shared_ptr<const frame_producer_registry> producer_registry,
+ spl::shared_ptr<const cg_producer_registry> cg_registry,
bool mipmap)
: impl_(new impl(
monitor_factory,
thumbnail_creator,
media_info_repo,
producer_registry,
+ cg_registry,
mipmap))
{
}
const thumbnail_creator& thumbnail_creator,
spl::shared_ptr<media_info_repository> media_info_repo,
spl::shared_ptr<const frame_producer_registry> producer_registry,
+ spl::shared_ptr<const cg_producer_registry> cg_registry,
bool mipmap);
~thumbnail_generator();
void generate(const std::wstring& media_file);
channel->frame_factory(),
get_channels(ctx),
channel->video_format_desc(),
- ctx.producer_registry);
+ ctx.producer_registry,
+ ctx.cg_registry);
}
// Basic Commands
* Author: Nicklas P Andersson
*/
-
+
#pragma once
#include <core/video_channel.h>
spl::shared_ptr<core::video_channel> GetChannel() const { return pChannel_; }
spl::shared_ptr<core::cg_producer_registry> get_cg_registry() const { return cg_registry_; }
spl::shared_ptr<const core::frame_producer_registry> get_producer_registry() const { return producer_registry_; }
- core::frame_producer_dependencies get_dependencies() const { return core::frame_producer_dependencies(GetChannel()->frame_factory(), channels_, GetChannel()->video_format_desc(), producer_registry_); }
+ core::frame_producer_dependencies get_dependencies() const { return core::frame_producer_dependencies(GetChannel()->frame_factory(), channels_, GetChannel()->video_format_desc(), producer_registry_, cg_registry_); }
void DisplayMediaFile(const std::wstring& filename);
void DisplayTemplate(const std::wstring& titleName);
TitleHolder() : titleName(L""), pframe_producer(core::frame_producer::empty()) {}
TitleHolder(const std::wstring& name, spl::shared_ptr<core::frame_producer> pFP) : titleName(name), pframe_producer(pFP) {}
TitleHolder(const TitleHolder& th) : titleName(th.titleName), pframe_producer(th.pframe_producer) {}
- TitleHolder& operator=(const TitleHolder& th)
+ TitleHolder& operator=(const TitleHolder& th)
{
titleName = th.titleName;
pframe_producer = th.pframe_producer;
return *this;
}
- bool operator==(const TitleHolder& rhs)
+ bool operator==(const TitleHolder& rhs)
{
return pframe_producer == rhs.pframe_producer;
}
\r
void send_to_flash(const std::wstring& data)\r
{\r
- if (!clock_loaded_) \r
+ if (!clock_loaded_)\r
{\r
- core::frame_producer_dependencies dependencies(channel_->frame_factory(), channels_, channel_->video_format_desc(), producer_registry_);\r
+ core::frame_producer_dependencies dependencies(channel_->frame_factory(), channels_, channel_->video_format_desc(), producer_registry_, cg_registry_);\r
cg_registry_->get_or_create_proxy(channel_, dependencies, core::cg_proxy::DEFAULT_LAYER, L"hawrysklocka/clock")->add(\r
0, L"hawrysklocka/clock", true, L"", data);\r
clock_loaded_ = true;\r
{\r
cg_registry_->get_proxy(channel_, core::cg_proxy::DEFAULT_LAYER)->update(0, data);\r
}\r
- \r
+\r
CASPAR_LOG(info) << L"CLK: Clockdata sent: " << data;\r
}\r
\r
{\r
std::wstringstream stream;\r
\r
- stream << L"<templateData>"; \r
+ stream << L"<templateData>";\r
stream << L"<componentData id=\"command\">";\r
stream << L"<command id=\"" << command_name << "\"";\r
- \r
+\r
std::vector<std::wstring>::const_iterator it = parameters.begin();\r
std::vector<std::wstring>::const_iterator end = parameters.end();\r
\r
}\r
\r
clk_command_handler create_send_xml_handler(\r
- const std::wstring& command_name, \r
- bool expect_clock, \r
- bool expect_time, \r
+ const std::wstring& command_name,\r
+ bool expect_clock,\r
+ bool expect_time,\r
const spl::shared_ptr<command_context>& context)\r
{\r
return [=] (const std::vector<std::wstring>& params)\r
auto context = spl::make_shared<command_context>(channels, channel, cg_registry, producer_registry);\r
\r
processor\r
- .add_handler(L"DUR", \r
+ .add_handler(L"DUR",\r
create_send_xml_handler(L"DUR", true, true, context))\r
- .add_handler(L"NEWDUR", \r
+ .add_handler(L"NEWDUR",\r
create_send_xml_handler(L"NEWDUR", true, true, context))\r
- .add_handler(L"UNTIL", \r
+ .add_handler(L"UNTIL",\r
create_send_xml_handler(L"UNTIL", true, true, context))\r
- .add_handler(L"NEXTEVENT", \r
+ .add_handler(L"NEXTEVENT",\r
create_send_xml_handler(L"NEXTEVENT", true, false, context))\r
- .add_handler(L"STOP", \r
+ .add_handler(L"STOP",\r
create_send_xml_handler(L"STOP", true, false, context))\r
- .add_handler(L"ADD", \r
+ .add_handler(L"ADD",\r
create_send_xml_handler(L"ADD", true, true, context))\r
- .add_handler(L"SUB", \r
+ .add_handler(L"SUB",\r
create_send_xml_handler(L"SUB", true, true, context))\r
- .add_handler(L"TIMELINE_LOAD", \r
+ .add_handler(L"TIMELINE_LOAD",\r
create_send_xml_handler(L"TIMELINE_LOAD", false, false, context))\r
- .add_handler(L"TIMELINE_PLAY", \r
+ .add_handler(L"TIMELINE_PLAY",\r
create_send_xml_handler(L"TIMELINE_PLAY", false, false, context))\r
- .add_handler(L"TIMELINE_STOP", \r
+ .add_handler(L"TIMELINE_STOP",\r
create_send_xml_handler(L"TIMELINE_STOP", false, false, context))\r
.add_handler(L"RESET", [=] (const std::vector<std::wstring>& params)\r
{\r
&image::write_cropped_png,
media_info_repo_,
producer_registry_,
+ cg_registry_,
pt.get(L"configuration.thumbnails.mipmap", true)));
}