]> git.sesse.net Git - casparcg/commitdiff
[general] Added cg_producer_registry as dependency in frame_producer_dependencies
authorHelge Norberg <helge.norberg@svt.se>
Mon, 20 Feb 2017 16:56:17 +0000 (17:56 +0100)
committerHelge Norberg <helge.norberg@svt.se>
Mon, 20 Feb 2017 16:56:17 +0000 (17:56 +0100)
core/producer/frame_producer.cpp
core/producer/frame_producer.h
core/thumbnail_generator.cpp
core/thumbnail_generator.h
protocol/amcp/AMCPCommandsImpl.cpp
protocol/cii/CIIProtocolStrategy.h
protocol/clk/clk_commands.cpp
shell/server.cpp

index 46ca3e4162f7a8cc682e4f568ff3eaa2e263dbda..e26432f97fe92637484a9037164a56d1af73c5cc 100644 (file)
@@ -22,6 +22,7 @@
 #include "../StdAfx.h"
 
 #include "frame_producer.h"
+#include "cg_proxy.h"
 
 #include "../frame/draw_frame.h"
 #include "../frame/frame_transform.h"
@@ -71,11 +72,13 @@ frame_producer_dependencies::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)
        : frame_factory(frame_factory)
        , channels(channels)
        , format_desc(format_desc)
        , producer_registry(producer_registry)
+       , cg_registry(cg_registry)
 {
 }
 
index cf7fb402ac8f6a7e4d42a70b50d9e13a850301c8..81a0523539a693889966edf5e21faf248c31d9ed 100644 (file)
@@ -54,7 +54,7 @@ struct constraints
        constraints(double width, double height);
        constraints();
 };
-       
+
 // Interface
 class frame_producer : public interaction_sink
 {
@@ -63,21 +63,21 @@ 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;
@@ -87,7 +87,7 @@ public:
        virtual bool collides(double x, double y) const override { return false; }
 
        // Properties
-       
+
 
        virtual void                                                            paused(bool value) = 0;
        virtual std::wstring                                            print() const = 0;
@@ -97,26 +97,26 @@ public:
        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;
@@ -138,12 +138,14 @@ struct frame_producer_dependencies
        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;
index a80702c8a9dcf62f765b0f1b415a9ae6d32bc3ae..7f41ed3a3c5d8348b3f6dc2f13ec506c5762d77f 100644 (file)
@@ -38,6 +38,7 @@
 #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"
@@ -88,6 +89,7 @@ private:
        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:
@@ -103,6 +105,7 @@ 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)
@@ -115,6 +118,7 @@ public:
                , 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,
@@ -156,7 +160,7 @@ public:
                                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)
@@ -257,7 +261,7 @@ public:
 
                        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());
                        }
@@ -324,6 +328,7 @@ thumbnail_generator::thumbnail_generator(
                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,
@@ -336,6 +341,7 @@ thumbnail_generator::thumbnail_generator(
                                thumbnail_creator,
                                media_info_repo,
                                producer_registry,
+                               cg_registry,
                                mipmap))
 {
 }
index 22634e219bb1d221156a7d897c753649f1c66dd0..584f4374ad177f592d11f81893c72988a2e31aeb 100644 (file)
@@ -52,6 +52,7 @@ 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);
        ~thumbnail_generator();
        void generate(const std::wstring& media_file);
index 45382b452119b6360bee81a18ec1707e99020ae6..b877bf90d4d2fc10924bd77f6c41b6b1b746293d 100644 (file)
@@ -306,7 +306,8 @@ core::frame_producer_dependencies get_producer_dependencies(const std::shared_pt
                        channel->frame_factory(),
                        get_channels(ctx),
                        channel->video_format_desc(),
-                       ctx.producer_registry);
+                       ctx.producer_registry,
+                       ctx.cg_registry);
 }
 
 // Basic Commands
index 46e2fc9e1f1f765c82a71973610c86f98cf25953..0c41c41b625abfbb3c35b4137b1cc3d1c77b32cc 100644 (file)
@@ -19,7 +19,7 @@
 * Author: Nicklas P Andersson
 */
 
+
 #pragma once
 
 #include <core/video_channel.h>
@@ -53,7 +53,7 @@ public:
        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);
@@ -65,14 +65,14 @@ public:
                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;
                }
index 5832f9feab49e1a70e567d2f6cc8b667daab95a9..d853f02b759b67c3bb4b503ca0220ad26d97ef4b 100644 (file)
@@ -60,9 +60,9 @@ public:
 \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
@@ -71,7 +71,7 @@ public:
                {\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
@@ -107,10 +107,10 @@ std::wstring get_xml(
 {\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
@@ -147,9 +147,9 @@ std::wstring get_xml(
 }\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
@@ -169,25 +169,25 @@ void add_command_handlers(
        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
index 172979fdd239d402baafce2c80b245f4f6ea1138..763659c29ebff0ed81c035d4dc12af702164ba7d 100644 (file)
@@ -388,6 +388,7 @@ struct server::impl : boost::noncopyable
                        &image::write_cropped_png,
                        media_info_repo_,
                        producer_registry_,
+                       cg_registry_,
                        pt.get(L"configuration.thumbnails.mipmap", true)));
        }