]> git.sesse.net Git - casparcg/commitdiff
2.1.0: Fixed missing audio.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 6 Feb 2012 15:09:34 +0000 (15:09 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 6 Feb 2012 15:09:34 +0000 (15:09 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.1.0@2279 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

core/frame/draw_frame.cpp
core/frame/draw_frame.h
core/mixer/audio/audio_mixer.cpp
core/producer/layer.cpp
core/producer/transition/transition_producer.cpp
modules/ffmpeg/producer/ffmpeg_producer.cpp

index b95157c87aa0c5c47d730fa06a42f35ca7a53b19..842770aed4e9525087cceea05d2ee66318438cd0 100644 (file)
@@ -90,7 +90,7 @@ spl::shared_ptr<draw_frame> draw_frame::interlace(const spl::shared_ptr<draw_fra
                return frame2;\r
 \r
        auto my_frame1 = spl::make_shared<draw_frame>(frame1);\r
-       auto my_frame2 = draw_frame::mute_audio(spl::make_shared<draw_frame>(frame2));\r
+       auto my_frame2 = spl::make_shared<draw_frame>(frame2);\r
        if(mode == field_mode::upper)\r
        {\r
                my_frame1->get_frame_transform().field_mode = field_mode::upper;        \r
@@ -137,7 +137,7 @@ spl::shared_ptr<draw_frame> draw_frame::mask(const spl::shared_ptr<draw_frame>&
        return spl::make_shared<draw_frame>(std::move(frames));\r
 }\r
        \r
-spl::shared_ptr<draw_frame> draw_frame::mute_audio(const spl::shared_ptr<draw_frame>& frame)\r
+spl::shared_ptr<draw_frame> draw_frame::mute(const spl::shared_ptr<draw_frame>& frame)\r
 {\r
        auto frame2 = spl::make_shared<draw_frame>(frame);\r
        frame2->get_frame_transform().volume = 0.0;\r
index ae496499881f321fc4d8e94392f5b5f14585fc45..f8d0f97a27309b87c4e509c52630f2e9f2ee1d82 100644 (file)
@@ -51,7 +51,7 @@ public:
        static spl::shared_ptr<draw_frame> interlace(const spl::shared_ptr<draw_frame>& frame1, const spl::shared_ptr<draw_frame>& frame2, field_mode mode);\r
        static spl::shared_ptr<draw_frame> over(const spl::shared_ptr<draw_frame>& frame1, const spl::shared_ptr<draw_frame>& frame2);\r
        static spl::shared_ptr<draw_frame> mask(const spl::shared_ptr<draw_frame>& fill, const spl::shared_ptr<draw_frame>& key);\r
-       static spl::shared_ptr<draw_frame> mute_audio(const spl::shared_ptr<draw_frame>& frame);\r
+       static spl::shared_ptr<draw_frame> mute(const spl::shared_ptr<draw_frame>& frame);\r
                \r
        static const spl::shared_ptr<draw_frame>& eof();\r
        static const spl::shared_ptr<draw_frame>& empty();\r
index 91a2105dc60258952aba54a9a237578d40c2b718..30fa6b58cfa040f4ad9f100dba24d9652160607a 100644 (file)
@@ -111,6 +111,7 @@ public:
                }               \r
                \r
                std::map<const void*, audio_stream>     next_audio_streams;\r
+               std::vector<const void*> used_tags;\r
 \r
                BOOST_FOREACH(auto& item, items_)\r
                {                       \r
@@ -119,7 +120,14 @@ public:
                        auto next_transform = item.transform;\r
                        auto prev_transform = next_transform;\r
 \r
-                       const auto it = audio_streams_.find(item.tag);\r
+                       auto tag = item.tag;\r
+\r
+                       if(boost::range::find(used_tags, tag) != used_tags.end())\r
+                               continue;\r
+                       \r
+                       used_tags.push_back(tag);\r
+\r
+                       const auto it = audio_streams_.find(tag);\r
                        if(it != audio_streams_.end())\r
                        {       \r
                                prev_transform  = it->second.prev_transform;\r
@@ -139,8 +147,8 @@ public:
                        for(size_t n = 0; n < item.audio_data.size(); ++n)\r
                                next_audio.push_back(item.audio_data[n] * (prev_volume + (n/format_desc_.audio_channels) * alpha));\r
                                                                                \r
-                       next_audio_streams[item.tag].prev_transform  = std::move(next_transform); // Store all active tags, inactive tags will be removed at the end.\r
-                       next_audio_streams[item.tag].audio_data          = std::move(next_audio);                       \r
+                       next_audio_streams[tag].prev_transform  = std::move(next_transform); // Store all active tags, inactive tags will be removed at the end.\r
+                       next_audio_streams[tag].audio_data               = std::move(next_audio);                       \r
                }                               \r
 \r
                items_.clear();\r
index d0c8a422d77baed7e2fef26980136e47bc8a2c8c..136696148c115b806ae944d61d5825e5be51a7f2 100644 (file)
@@ -97,11 +97,11 @@ public:
                try\r
                {\r
                        if(is_paused_)\r
-                               return draw_frame::mute_audio(foreground_->last_frame());\r
+                               return draw_frame::mute(foreground_->last_frame());\r
                \r
                        auto frame = receive_and_follow(foreground_, flags.value());\r
                        if(frame == core::draw_frame::late())\r
-                               return draw_frame::mute_audio(foreground_->last_frame());\r
+                               return draw_frame::mute(foreground_->last_frame());\r
                        \r
                        ++frame_number_;\r
 \r
index 8e4f9d7bc840c4e42be014e2bc30c4c4fe998b82..f6ab65e7df78c9b830770a5d52fb424f942bfa09 100644 (file)
@@ -126,18 +126,14 @@ struct transition_producer : public frame_producer
                \r
                // For interlaced transitions. Seperate fields into seperate frames which are transitioned accordingly.\r
                \r
+               src_frame->get_frame_transform().volume = 1.0-delta2;\r
                auto s_frame1 = spl::make_shared<draw_frame>(src_frame);\r
                auto s_frame2 = spl::make_shared<draw_frame>(src_frame);\r
-\r
-               s_frame1->get_frame_transform().volume = 0.0;\r
-               s_frame2->get_frame_transform().volume = 1.0-delta2;\r
-\r
+               \r
+               dest_frame->get_frame_transform().volume = delta2;\r
                auto d_frame1 = spl::make_shared<draw_frame>(dest_frame);\r
                auto d_frame2 = spl::make_shared<draw_frame>(dest_frame);\r
                \r
-               d_frame1->get_frame_transform().volume = 0.0;\r
-               d_frame2->get_frame_transform().volume = delta2;\r
-\r
                if(info_.type == transition_type::mix)\r
                {\r
                        d_frame1->get_frame_transform().opacity = delta1;       \r
index e62129316409cfc4c7bb34109274643e27f76e35..b19ebb885d7961971dee696455f7dbfba1b60440 100644 (file)
@@ -163,7 +163,7 @@ public:
 \r
        virtual spl::shared_ptr<core::draw_frame> last_frame() const override\r
        {\r
-               return core::draw_frame::mute_audio(last_frame_);\r
+               return core::draw_frame::mute(last_frame_);\r
        }\r
 \r
        virtual uint32_t nb_frames() const override\r