]> git.sesse.net Git - casparcg/commitdiff
* Implemented "template type" column in TLS command. Current possible values are...
authorHelge Norberg <helge.norberg@svt.se>
Fri, 9 Oct 2015 14:29:47 +0000 (16:29 +0200)
committerHelge Norberg <helge.norberg@svt.se>
Fri, 9 Oct 2015 14:29:47 +0000 (16:29 +0200)
core/producer/cg_proxy.cpp
core/producer/cg_proxy.h
core/producer/scene/scene_producer.cpp
core/producer/scene/scene_producer.h
core/producer/scene/xml_scene_producer.cpp
modules/psd/psd_scene_producer.cpp
protocol/amcp/AMCPCommandsImpl.cpp

index 83099f2a3ab3ab768b58f9a48404473acc459dff..be5bf421f2e8e002be59cc9df5ce0e794e84d7b0 100644 (file)
@@ -75,9 +75,6 @@ private:
                bool                                    reusable_producer_instance;
        };
 
-       struct name {};
-       struct extension {};
-
        mutable boost::mutex                    mutex_;
        std::map<std::wstring, record>  records_by_extension_;
 public:
@@ -199,6 +196,16 @@ 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
        {
@@ -278,4 +285,9 @@ bool cg_producer_registry::is_cg_extension(const std::wstring& extension) 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);
+}
+
 }}
index 77713a663711a731871f005af093388a51f0dc90..93be32c0eee85a1c0de79672b537ad3b8964e37a 100644 (file)
@@ -90,6 +90,7 @@ public:
                        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_;
index 88d03e21e01a466e7a9b5c55f298b7fd972ac814..78d919343acd72bdc0997dd079882f96ea9aed63 100644 (file)
@@ -118,6 +118,7 @@ struct marker
 
 struct scene_producer::impl
 {
+       std::wstring                                                                                    producer_name_;
        constraints                                                                                             pixel_constraints_;
        video_format_desc                                                                               format_desc_;
        std::list<layer>                                                                                layers_;
@@ -134,8 +135,9 @@ struct scene_producer::impl
        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); })
        {
@@ -491,18 +493,19 @@ struct scene_producer::impl
 
        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_)
@@ -539,8 +542,8 @@ struct scene_producer::impl
        }
 };
 
-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))
 {
 }
 
index 21710d213670627b449d5318eca5c1a7e3bd2f83..d86cbe1e8f0c24fd93005bb2287cf2c831cade00 100644 (file)
@@ -111,7 +111,7 @@ mark_action get_mark_action(const std::wstring& name);
 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;
index 8ad65fa249deed79e8caa8f519b0b0afaa29067c..bc97a3f6ca3b0ce1c912f9dac11f4edd55ea50e6 100644 (file)
@@ -99,7 +99,7 @@ spl::shared_ptr<core::frame_producer> create_xml_scene_producer(
        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"))
        {
index 8f088b4e39a4596453c12c82e9615eceab277c83..df956699c81a2a07626a239d0b5897f19ced015c 100644 (file)
@@ -363,7 +363,7 @@ spl::shared_ptr<core::frame_producer> create_psd_scene_producer(const core::fram
        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;
 
@@ -467,7 +467,7 @@ spl::shared_ptr<core::frame_producer> create_psd_scene_producer(const core::fram
 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)
index 62df79337ce760ba5b228d0d9df5bb3e72ae12a4..0bce9354c99421268b777d5678515cac3df5f203 100644 (file)
@@ -266,9 +266,12 @@ std::wstring ListTemplates(const spl::shared_ptr<core::cg_producer_registry>& cg
                        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";
                }
        }