]> git.sesse.net Git - casparcg/blobdiff - modules/flash/producer/flash_producer.cpp
2.0.2: ct-producer uses complete path.
[casparcg] / modules / flash / producer / flash_producer.cpp
index 8f3f957590bd165afb46a2ec07c0494379ae3324..9ac975017b3b4aa683611be3aee444a7ebe42d5e 100644 (file)
@@ -95,28 +95,35 @@ struct template_host
 \r
 template_host get_template_host(const core::video_format_desc& desc)\r
 {\r
-       std::vector<template_host> template_hosts;\r
-       BOOST_FOREACH(auto& xml_mapping, env::properties().get_child("configuration.producers.template-hosts"))\r
+       try\r
        {\r
-               try\r
+               std::vector<template_host> template_hosts;\r
+               BOOST_FOREACH(auto& xml_mapping, env::properties().get_child("configuration.producers.template-hosts"))\r
                {\r
-                       template_host template_host;\r
-                       template_host.field_mode                = xml_mapping.second.get("video-mode", narrow(desc.name));\r
-                       template_host.filename                  = xml_mapping.second.get("filename", "cg.fth");\r
-                       template_host.width                             = xml_mapping.second.get("width", desc.width);\r
-                       template_host.height                    = xml_mapping.second.get("height", desc.height);\r
-                       template_hosts.push_back(template_host);\r
+                       try\r
+                       {\r
+                               template_host template_host;\r
+                               template_host.field_mode                = xml_mapping.second.get("video-mode", narrow(desc.name));\r
+                               template_host.filename                  = xml_mapping.second.get("filename", "cg.fth");\r
+                               template_host.width                             = xml_mapping.second.get("width", desc.width);\r
+                               template_host.height                    = xml_mapping.second.get("height", desc.height);\r
+                               template_hosts.push_back(template_host);\r
+                       }\r
+                       catch(...){}\r
                }\r
-               catch(...){}\r
-       }\r
 \r
-       auto template_host_it = boost::find_if(template_hosts, [&](template_host template_host){return template_host.field_mode == narrow(desc.name);});\r
-       if(template_host_it == template_hosts.end())\r
-               template_host_it = boost::find_if(template_hosts, [&](template_host template_host){return template_host.field_mode == "";});\r
+               auto template_host_it = boost::find_if(template_hosts, [&](template_host template_host){return template_host.field_mode == narrow(desc.name);});\r
+               if(template_host_it == template_hosts.end())\r
+                       template_host_it = boost::find_if(template_hosts, [&](template_host template_host){return template_host.field_mode == "";});\r
+\r
+               if(template_host_it != template_hosts.end())\r
+                       return *template_host_it;\r
+       }\r
+       catch(...)\r
+       {\r
+               CASPAR_LOG(info) << L" Found no correct template-host configuration. Using cg.fth.";\r
+       }\r
 \r
-       if(template_host_it != template_hosts.end())\r
-               return *template_host_it;\r
-       \r
        template_host template_host;\r
        template_host.filename = "cg.fth";\r
        template_host.width = desc.width;\r
@@ -238,6 +245,11 @@ public:
                return head_;\r
        }\r
 \r
+       bool is_empty() const\r
+       {\r
+               return ax_->IsEmpty();\r
+       }\r
+\r
        double fps() const\r
        {\r
                return ax_->GetFPS();   \r
@@ -302,7 +314,7 @@ public:
                graph_->set_value("output-buffer-count", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity()));\r
 \r
                auto frame = core::basic_frame::late();\r
-               if(!frame_buffer_.try_pop(frame))\r
+               if(!frame_buffer_.try_pop(frame) && context_)\r
                        graph_->add_tag("underflow");\r
 \r
                return frame;\r
@@ -389,6 +401,12 @@ public:
                                        frame_buffer_.push(frame);\r
                                }\r
 \r
+                               if(context_->is_empty())\r
+                               {\r
+                                       context_.reset(nullptr);\r
+                                       return;\r
+                               }\r
+\r
                                graph_->set_value("output-buffer-count", static_cast<float>(frame_buffer_.size())/static_cast<float>(frame_buffer_.capacity()));        \r
                                fps_.fetch_and_store(static_cast<int>(context_->fps()*100.0));                          \r
                                graph_->update_text(narrow(print()));\r