bool reusable_producer_instance;
};
- struct name {};
- struct extension {};
-
mutable boost::mutex mutex_;
std::map<std::wstring, record> records_by_extension_;
public:
return records_by_extension_.find(extension) != records_by_extension_.end();
}
+
+ std::wstring get_cg_producer_name(const std::wstring& filename) const
+ {
+ auto record = find_record(filename);
+
+ if (!record)
+ CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info(filename + L" is not a cg template."));
+
+ return record->name;
+ }
private:
boost::optional<record> find_record(const std::wstring& filename) const
{
return impl_->is_cg_extension(extension);
}
+std::wstring cg_producer_registry::get_cg_producer_name(const std::wstring& filename) const
+{
+ return impl_->get_cg_producer_name(filename);
+}
+
}}
const std::wstring& filename) const;
std::string read_meta_info(const std::wstring& filename) const;
bool is_cg_extension(const std::wstring& extension) const;
+ std::wstring get_cg_producer_name(const std::wstring& filename) const;
private:
struct impl;
spl::shared_ptr<impl> impl_;
struct scene_producer::impl
{
+ std::wstring producer_name_;
constraints pixel_constraints_;
video_format_desc format_desc_;
std::list<layer> layers_;
bool removed_ = false;
bool going_to_mark_ = false;
- impl(int width, int height, const video_format_desc& format_desc)
- : pixel_constraints_(width, height)
+ impl(std::wstring producer_name, int width, int height, const video_format_desc& format_desc)
+ : producer_name_(std::move(producer_name))
+ , pixel_constraints_(width, height)
, format_desc_(format_desc)
, aggregator_([=] (double x, double y) { return collission_detect(x, y); })
{
std::wstring print() const
{
- return L"scene[]";
+ return L"scene[type=" + name() + L"]";
}
std::wstring name() const
{
- return L"scene";
+ return producer_name_;
}
boost::property_tree::wptree info() const
{
boost::property_tree::wptree info;
info.add(L"type", L"scene");
+ info.add(L"producer-name", name());
info.add(L"frame-number", frame_number_.get());
for (auto& var : variables_)
}
};
-scene_producer::scene_producer(int width, int height, const video_format_desc& format_desc)
- : impl_(new impl(width, height, format_desc))
+scene_producer::scene_producer(std::wstring producer_name, int width, int height, const video_format_desc& format_desc)
+ : impl_(new impl(std::move(producer_name), width, height, format_desc))
{
}
class scene_producer : public frame_producer_base
{
public:
- scene_producer(int width, int height, const video_format_desc& format_desc);
+ scene_producer(std::wstring producer_name, int width, int height, const video_format_desc& format_desc);
~scene_producer();
draw_frame receive_impl() override;
int width = root.get<int>(L"scene.<xmlattr>.width");
int height = root.get<int>(L"scene.<xmlattr>.height");
- auto scene = spl::make_shared<scene_producer>(width, height, dependencies.format_desc);
+ auto scene = spl::make_shared<scene_producer>(L"scene", width, height, dependencies.format_desc);
for (auto elem : root.get_child(L"scene.variables"))
{
psd_document doc;
doc.parse(*found_file);
- spl::shared_ptr<core::scene::scene_producer> root(spl::make_shared<core::scene::scene_producer>(doc.width(), doc.height(), dependencies.format_desc));
+ auto root = spl::make_shared<core::scene::scene_producer>(L"psd", doc.width(), doc.height(), dependencies.format_desc);
layer_link_constructor link_constructor;
void init(core::module_dependencies dependencies)
{
dependencies.cg_registry->register_cg_producer(
- L"scene",
+ L"psd",
{ L".psd" },
[](const std::wstring& filename) { return ""; },
[](const spl::shared_ptr<core::frame_producer>& producer)
auto str = relativePath.replace_extension(L"").generic_wstring();
boost::trim_if(str, boost::is_any_of("\\/"));
+ auto template_type = cg_registry->get_cg_producer_name(str);
+
replyString << L"\"" << str
<< L"\" " << sizeWStr
<< L" " << writeTimeWStr
+ << L" " << template_type
<< L"\r\n";
}
}