]> git.sesse.net Git - casparcg/blobdiff - modules/html/producer/html_producer.cpp
[html] cosmetics
[casparcg] / modules / html / producer / html_producer.cpp
index 1f7321eab2ec10aa4f5bf0f7b6871ed2b1672e72..c624a4ebb7cddcebd586963336a68a2da57ad5fb 100644 (file)
@@ -354,9 +354,8 @@ namespace caspar {
                                {
                                        return frames_.size();
                                });
-                               bool has_frames = num_frames >= format_desc.field_count;
 
-                               if (has_frames)
+                               if (num_frames >= format_desc.field_count)
                                {
                                        if (format_desc.field_mode != core::field_mode::progressive)
                                        {
@@ -384,9 +383,9 @@ namespace caspar {
                                                });
                                        }
                                }
-                               else if (num_frames == 1) // Interlaced but only on frame
+                               else if (num_frames == 1) // Interlaced but only one frame
                                {                         // available. Probably the last frame
-                                                             // of end of some animation sequence
+                                                         // of some animation sequence.
                                        auto frame = pop();
 
                                        lock(last_frame_mutex_, [&]
@@ -539,7 +538,10 @@ namespace caspar {
                                }
                                else if (boost::regex_match(param, what, invoke_exp))
                                {
-                                       javascript = (boost::wformat(L"%1%()") % boost::algorithm::trim_copy_if(what["VALUE"].str(), boost::is_any_of(" \""))).str();
+                                       auto function_call = boost::algorithm::trim_copy_if(what["VALUE"].str(), boost::is_any_of(" \""));
+
+                                       // Append empty () if no parameter list has been given
+                                       javascript = boost::ends_with(function_call, ")") ? function_call : function_call + L"()";
                                }
 
                                client_->execute_javascript(javascript);