]> git.sesse.net Git - casparcg/blobdiff - modules/flash/producer/flash_producer.cpp
2.0.2: flash_producer: Automatically find correct template-host based on file extensi...
[casparcg] / modules / flash / producer / flash_producer.cpp
index 9ac975017b3b4aa683611be3aee444a7ebe42d5e..aa03e29807fa4c7db71db952e7c9828c25b8a921 100644 (file)
@@ -44,6 +44,7 @@
 #include <boost/filesystem.hpp>\r
 #include <boost/thread.hpp>\r
 #include <boost/timer.hpp>\r
+#include <boost/algorithm/string.hpp>\r
 \r
 #include <functional>\r
 \r
@@ -121,11 +122,20 @@ template_host get_template_host(const core::video_format_desc& desc)
        }\r
        catch(...)\r
        {\r
-               CASPAR_LOG(info) << L" Found no correct template-host configuration. Using cg.fth.";\r
        }\r
-\r
+               \r
        template_host template_host;\r
        template_host.filename = "cg.fth";\r
+\r
+       for(auto it = boost::filesystem2::wdirectory_iterator(env::template_folder()); it != boost::filesystem2::wdirectory_iterator(); ++it)\r
+       {\r
+               if(boost::iequals(it->path().extension(), L"." + desc.name))\r
+               {\r
+                       template_host.filename = narrow(it->filename());\r
+                       break;\r
+               }\r
+       }\r
+\r
        template_host.width = desc.width;\r
        template_host.height = desc.height;\r
        return template_host;\r