]> git.sesse.net Git - casparcg/commitdiff
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sat, 26 Feb 2011 23:40:10 +0000 (23:40 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sat, 26 Feb 2011 23:40:10 +0000 (23:40 +0000)
casparcg.sln
core/producer/layer.cpp
core/producer/transition/transition_producer.cpp
mixer/audio/audio_mixer.cpp
mixer/frame/draw_frame.cpp
mixer/image/image_transform.cpp

index 0263c22f2f8301191eb116bebdeae2ba73530f5d..060c3f5ba50c3015e6c29de97a9e5c5d03cecf4a 100644 (file)
@@ -13,6 +13,11 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "protocol", "protocol\protoc
 EndProject\r
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mixer", "mixer\mixer.vcxproj", "{477E12A4-1B28-4FF7-B46D-76606BDD1891}"\r
 EndProject\r
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{32079541-68ED-4319-91FB-0FF041642679}"\r
+       ProjectSection(SolutionItems) = preProject\r
+               ..\CasparCG 2.0 Preliminary Change Log.txt = ..\CasparCG 2.0 Preliminary Change Log.txt\r
+       EndProjectSection\r
+EndProject\r
 Global\r
        GlobalSection(SubversionScc) = preSolution\r
                Svn-Managed = True\r
index 62004e194cb7449759ee8a1ed9fcc353bf4c4ddc..11be6d174652ae65c9e3abf92010b8242da0f1be 100644 (file)
@@ -18,25 +18,25 @@ namespace caspar { namespace core {
 class frame_producer_remover\r
 {\r
        executor executor_;\r
+       tbb::atomic<int> count_;\r
 \r
        void do_remove(safe_ptr<frame_producer>& producer)\r
        {\r
-               auto name = producer->print();\r
-               CASPAR_LOG(info) << "removing: " << name;\r
                producer = frame_producer::empty();\r
-               CASPAR_LOG(info) << "removed: " << name;\r
+               CASPAR_LOG(info) << L"frame_remover[" + boost::lexical_cast<std::wstring>(--count_) + L"] removed: " << producer->print();\r
        }\r
 public:\r
 \r
        frame_producer_remover()\r
        {\r
                executor_.start();\r
+               count_ = 0;\r
        }\r
 \r
        void remove(safe_ptr<frame_producer>&& producer)\r
        {\r
                CASPAR_ASSERT(producer.unique());\r
-               CASPAR_ASSERT(executor_.empty());\r
+               CASPAR_LOG(info) << L"frame_remover[" + boost::lexical_cast<std::wstring>(++count_) + L"] removing: " << producer->print();\r
                executor_.begin_invoke(std::bind(&frame_producer_remover::do_remove, this, std::move(producer)));\r
        }\r
 };\r
@@ -78,6 +78,7 @@ public:
                {\r
                        background_->set_leading_producer(foreground_);\r
                        foreground_ = background_;\r
+                       CASPAR_LOG(info) << foreground_->print() << L" started";\r
                        background_ = frame_producer::empty();\r
                }\r
                is_paused_ = false;\r
@@ -120,6 +121,7 @@ public:
                                following->set_leading_producer(foreground_);\r
                                g_remover.remove(std::move(foreground_));\r
                                foreground_ = following;\r
+                               CASPAR_LOG(info) << foreground_->print() << L" started";\r
 \r
                                last_frame_ = receive();\r
                        }\r
index db5cbaa9be2c9716caf5e2cb5a70197c2bafd9db..7824bc65c53696e747c7e1224f34ca64002715c0 100644 (file)
@@ -40,6 +40,9 @@ struct transition_producer::implementation : boost::noncopyable
        safe_ptr<frame_producer>        source_producer_;\r
 \r
        std::shared_ptr<frame_factory>  frame_factory_;\r
+       video_format_desc                               format_desc_;\r
+\r
+       std::vector<safe_ptr<draw_frame>> frame_buffer_;\r
        \r
        implementation(const safe_ptr<frame_producer>& dest, const transition_info& info) \r
                : current_frame_(0)\r
@@ -47,12 +50,14 @@ struct transition_producer::implementation : boost::noncopyable
                , dest_producer_(dest)\r
                , source_producer_(frame_producer::empty())\r
        {\r
+               frame_buffer_.push_back(draw_frame::empty());\r
        }\r
                                \r
        void initialize(const safe_ptr<frame_factory>& frame_factory)\r
        {\r
                dest_producer_->initialize(frame_factory);\r
                frame_factory_ = frame_factory;\r
+               format_desc_ = frame_factory_->get_video_format_desc();\r
        }\r
 \r
        safe_ptr<frame_producer> get_following_producer() const\r
@@ -96,7 +101,7 @@ struct transition_producer::implementation : boost::noncopyable
                {\r
                        CASPAR_LOG_CURRENT_EXCEPTION();\r
                        producer = frame_producer::empty();\r
-                       CASPAR_LOG(warning) << "Failed to receive frame. Removed producer from transition.";\r
+                       CASPAR_LOG(warning) << print() << " Failed to receive frame. Removed producer from transition.";\r
                }\r
 \r
                if(frame == draw_frame::eof())\r
@@ -112,7 +117,7 @@ struct transition_producer::implementation : boost::noncopyable
                        {\r
                                CASPAR_LOG_CURRENT_EXCEPTION();\r
                                producer = frame_producer::empty();\r
-                               CASPAR_LOG(warning) << "Failed to initialize following producer.";\r
+                               CASPAR_LOG(warning) << print() << " Failed to initialize following producer.";\r
                        }\r
 \r
                        return render_sub_frame(producer);\r
@@ -129,33 +134,54 @@ struct transition_producer::implementation : boost::noncopyable
                        return src_frame != draw_frame::eof() ? src_frame : draw_frame::empty();\r
                                                                                \r
                double alpha = static_cast<double>(current_frame_)/static_cast<double>(info_.duration);\r
+               double half_alpha_step = 0.5*1.0/static_cast<double>(info_.duration);\r
+               \r
+               double dir = info_.direction == transition_direction::from_left ? 1.0 : -1.0;           \r
+               \r
+               // For interalced transitions; seperate fields into seperate frames which are transitioned accordingly.\r
 \r
-               auto my_src_frame = draw_frame(src_frame);\r
-               auto my_dest_frame = draw_frame(dest_frame);\r
+               auto s_frame1 = make_safe<draw_frame>(src_frame);\r
+               auto s_frame2 = make_safe<draw_frame>(src_frame);\r
 \r
-               my_src_frame.get_audio_transform().set_gain(1.0-alpha);\r
-               my_dest_frame.get_audio_transform().set_gain(alpha);\r
+               s_frame1->get_audio_transform().set_gain(0);\r
+               s_frame2->get_audio_transform().set_gain(1.0-alpha);\r
 \r
-               double dir = info_.direction == transition_direction::from_left ? 1.0 : -1.0;           \r
+               auto d_frame1 = make_safe<draw_frame>(dest_frame);\r
+               auto d_frame2 = make_safe<draw_frame>(dest_frame);\r
                \r
+               d_frame1->get_audio_transform().set_gain(0);\r
+               d_frame2->get_audio_transform().set_gain(alpha);\r
+\r
                if(info_.type == transition::mix)\r
-                       my_dest_frame.get_image_transform().set_opacity(alpha);         \r
-               else if(info_.type == transition::slide)                        \r
-                       my_dest_frame.get_image_transform().set_image_translation((-1.0+alpha)*dir, 0.0);                       \r
+               {\r
+                       d_frame1->get_image_transform().set_opacity(alpha-half_alpha_step);     \r
+                       d_frame2->get_image_transform().set_opacity(alpha);     \r
+               }\r
+               else if(info_.type == transition::slide)\r
+               {\r
+                       d_frame1->get_image_transform().set_image_translation((-1.0+alpha-half_alpha_step)*dir, 0.0);   \r
+                       d_frame2->get_image_transform().set_image_translation((-1.0+alpha)*dir, 0.0);           \r
+               }\r
                else if(info_.type == transition::push)\r
                {\r
-                       my_dest_frame.get_image_transform().set_image_translation((-1.0+alpha)*dir, 0.0);\r
-                       my_src_frame.get_image_transform().set_image_translation((0.0+alpha)*dir, 0.0);         \r
+                       d_frame1->get_image_transform().set_image_translation((-1.0+alpha-half_alpha_step)*dir, 0.0);\r
+                       d_frame2->get_image_transform().set_image_translation((-1.0+alpha)*dir, 0.0);\r
+\r
+                       s_frame1->get_image_transform().set_image_translation((0.0+alpha-half_alpha_step)*dir, 0.0);    \r
+                       s_frame2->get_image_transform().set_image_translation((0.0+alpha)*dir, 0.0);            \r
                }\r
                else if(info_.type == transition::wipe)         \r
-                       my_dest_frame.get_image_transform().set_mask_scale(alpha, 1.0);                 \r
-\r
-               return draw_frame(std::move(my_src_frame), std::move(my_dest_frame));\r
+               {\r
+                       d_frame1->get_image_transform().set_mask_scale(alpha-half_alpha_step, 1.0);     \r
+                       d_frame2->get_image_transform().set_mask_scale(alpha, 1.0);                     \r
+               }\r
+               \r
+               return draw_frame(draw_frame::interlace(s_frame1, s_frame2, format_desc_.mode), draw_frame::interlace(d_frame1, d_frame2, format_desc_.mode));\r
        }\r
 \r
        std::wstring print() const\r
        {\r
-               return L"transition[" + (dest_producer_->print()) + L"]";\r
+               return L"transition[" + source_producer_->print() + L"->" + dest_producer_->print() + L"]";\r
        }\r
 };\r
 \r
index 7359bd93ee9f3e50b0fd6627098158d60488c73e..f90164886e63528c47cad243879da30265e36776 100644 (file)
@@ -27,6 +27,9 @@ public:
                        audio_data_.resize(audio_data.size(), 0);\r
 \r
                double gain = transform_stack_.top().get_gain();\r
+               if(gain < 0.001)\r
+                       return;\r
+\r
                tbb::parallel_for\r
                (\r
                        tbb::blocked_range<size_t>(0, audio_data.size()),\r
index efa5f70ab94d1712b200b4ae4c613837176346e1..717e6f2e2050d0491cb16a0d88af60c4629a149d 100644 (file)
@@ -103,7 +103,7 @@ audio_transform& draw_frame::get_audio_transform() { return impl_->audio_transfo
 safe_ptr<draw_frame> draw_frame::interlace(const safe_ptr<draw_frame>& frame1, const safe_ptr<draw_frame>& frame2, video_mode::type mode)\r
 {                      \r
        if(frame1 == frame2 || mode == video_mode::progressive)\r
-               return frame1;\r
+               return frame2;\r
 \r
        auto my_frame1 = make_safe<draw_frame>(frame1);\r
        auto my_frame2 = make_safe<draw_frame>(frame2);\r
index 7e3496a8f676a9d8a8261d0d1fa3d4bdcceb59d8..0a953c371256f475e238901b6562e312c98b4b98 100644 (file)
@@ -92,7 +92,8 @@ video_mode::type image_transform::get_mode() const
 image_transform& image_transform::operator*=(const image_transform &other)\r
 {\r
        opacity_ *= other.opacity_;\r
-       mode_ = other.mode_;\r
+       if(other.mode_ != video_mode::invalid)\r
+               mode_ = other.mode_;\r
        gain_ *= other.gain_;\r
        fill_translation_[0] += other.fill_translation_[0]*fill_scale_[0];\r
        fill_translation_[1] += other.fill_translation_[1]*fill_scale_[1];\r