]> git.sesse.net Git - casparcg/blobdiff - modules/html/producer/html_producer.cpp
[html] cosmetics
[casparcg] / modules / html / producer / html_producer.cpp
index 9689a25e208e49a7dc03e5332eec02ce52477c37..c624a4ebb7cddcebd586963336a68a2da57ad5fb 100644 (file)
@@ -350,12 +350,12 @@ namespace caspar {
                                timer.tick(0.0);
                                const auto& format_desc = frame_factory_->get_video_format_desc();
 
-                               bool has_frames = lock(frames_mutex_, [&]
+                               auto num_frames = lock(frames_mutex_, [&]
                                {
-                                       return frames_.size() >= format_desc.field_count;
+                                       return frames_.size();
                                });
 
-                               if (has_frames)
+                               if (num_frames >= format_desc.field_count)
                                {
                                        if (format_desc.field_mode != core::field_mode::progressive)
                                        {
@@ -383,6 +383,20 @@ namespace caspar {
                                                });
                                        }
                                }
+                               else if (num_frames == 1) // Interlaced but only one frame
+                               {                         // available. Probably the last frame
+                                                         // of some animation sequence.
+                                       auto frame = pop();
+
+                                       lock(last_frame_mutex_, [&]
+                                       {
+                                               last_progressive_frame_ = frame;
+                                               last_frame_ = frame;
+                                       });
+
+                                       timer.tick(1.0 / (format_desc.fps * format_desc.field_count));
+                                       invoke_requested_animation_frames();
+                               }
                                else
                                {
                                        graph_->set_tag("late-frame");
@@ -524,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);