]> 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>
Fri, 14 Jan 2011 11:30:23 +0000 (11:30 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Fri, 14 Jan 2011 11:30:23 +0000 (11:30 +0000)
core/consumer/bluefish/bluefish_consumer.cpp
core/processor/pixel_format.h
core/producer/decklink/decklink_producer.cpp
core/producer/ffmpeg/ffmpeg_producer.cpp
core/producer/ffmpeg/input.cpp
core/producer/flash/flash_producer.cpp
core/producer/layer.cpp
core/producer/layer.h
core/producer/transition/transition_producer.cpp

index e49ed37550234a13e1ffe0e7fa9c3d21ba6d035a..423b93826e2ba4cab28fec5f098ecdb9184eeb14 100644 (file)
@@ -85,8 +85,8 @@ struct consumer::implementation : boost::noncopyable
                        \r
        std::shared_ptr<CBlueVelvet4> blue_;\r
        \r
-       unsigned int device_index_;\r
-       video_format_desc format_desc_;\r
+       const unsigned int device_index_;\r
+       const video_format_desc format_desc_;\r
                \r
        unsigned long   mem_fmt_;\r
        unsigned long   upd_fmt_;\r
@@ -96,7 +96,7 @@ struct consumer::implementation : boost::noncopyable
        \r
        std::array<blue_dma_buffer_ptr, 3> reserved_frames_;    \r
 \r
-       bool embed_audio_;\r
+       const bool embed_audio_;\r
 \r
 public:\r
        implementation::implementation(const video_format_desc& format_desc, unsigned int device_index, bool embed_audio) \r
index 44c88ca01fc5105fa3cd19d87cb8b7ae109533a6..f23d1289dfae63b2454c00e6d3bb2a3db6beccce 100644 (file)
@@ -23,14 +23,25 @@ struct pixel_format_desc
 {\r
        struct plane\r
        {\r
-               plane() : linesize(0), width(0), height(0), size(0), channels(0){}\r
-               plane(size_t width, size_t height, size_t channels)\r
-                       : linesize(width*channels), width(width), height(height), size(width*height*channels), channels(channels){}\r
                size_t linesize;\r
                size_t width;\r
                size_t height;\r
                size_t size;\r
                size_t channels;\r
+\r
+               plane() \r
+                       : linesize(0)\r
+                       , width(0)\r
+                       , height(0)\r
+                       , size(0)\r
+                       , channels(0){}\r
+\r
+               plane(size_t width, size_t height, size_t channels)\r
+                       : linesize(width*channels)\r
+                       , width(width)\r
+                       , height(height)\r
+                       , size(width*height*channels)\r
+                       , channels(channels){}\r
        };\r
 \r
        pixel_format_desc() : pix_fmt(pixel_format::invalid){}\r
index ccab6660f8bb134829fcbdd286f8c65742e98cba..9023ad2a9a5b5182ab3876067e4e117e039515ae 100644 (file)
@@ -194,8 +194,7 @@ class decklink_producer : public frame_producer
 {\r
        executor executor_;\r
        \r
-       video_format_desc format_desc_;\r
-\r
+       const video_format_desc format_desc_;\r
        const size_t device_index_;\r
 \r
        std::unique_ptr<decklink_input> input_;\r
index b8ccdfd8b65cbfbfb57a22e21c629e2a664e6bb3..8168e6ab37ab8ebcc146e19dc197154c71190d98 100644 (file)
@@ -23,7 +23,6 @@ namespace caspar { namespace core { namespace ffmpeg{
        \r
 struct ffmpeg_producer : public frame_producer\r
 {\r
-       bool                                                            is_running_;\r
        input                                                           input_;                 \r
        std::unique_ptr<audio_decoder>          audio_decoder_;\r
        std::unique_ptr<video_decoder>          video_decoder_;\r
@@ -41,8 +40,7 @@ struct ffmpeg_producer : public frame_producer
 \r
 public:\r
        explicit ffmpeg_producer(const std::wstring& filename, bool loop, double start_time = 0, double end_time = -1.0) \r
-               : is_running_(true)\r
-               , filename_(filename)\r
+               : filename_(filename)\r
                , last_frame_(draw_frame(draw_frame::empty()))\r
                , input_(filename, loop, start_time, end_time)\r
                , video_decoder_(new video_decoder(input_.get_video_codec_context().get()))             \r
@@ -56,7 +54,7 @@ public:
                \r
        virtual safe_ptr<draw_frame> receive()\r
        {\r
-               while(is_running_ && ouput_channel_.empty() && !input_.is_eof())\r
+               while(ouput_channel_.empty() && !input_.is_eof())\r
                {       \r
                        aligned_buffer video_packet;\r
                        if(video_frame_channel_.size() < 3)     \r
@@ -71,17 +69,8 @@ public:
                        { // Video Decoding and Scaling\r
                                if(!video_packet.empty() && video_decoder_)\r
                                {\r
-                                       try\r
-                                       {\r
-                                               auto frame = video_decoder_->execute(video_packet);\r
-                                               video_frame_channel_.push_back(std::move(frame));\r
-                                       }\r
-                                       catch(...)\r
-                                       {\r
-                                               CASPAR_LOG_CURRENT_EXCEPTION();\r
-                                               video_decoder_.reset();\r
-                                               is_running_ = false;\r
-                                       }       \r
+                                       auto frame = video_decoder_->execute(video_packet);\r
+                                       video_frame_channel_.push_back(std::move(frame));\r
                                }\r
                        }, \r
                        [&] \r
@@ -125,7 +114,7 @@ public:
                        last_frame_->audio_volume(0.0); // last_frame should not have audio\r
                        ouput_channel_.pop();\r
                }\r
-               else if(input_.is_eof() || !is_running_)\r
+               else if(input_.is_eof())\r
                        return draw_frame::eof();\r
 \r
                return result;\r
index 1b160608b4b8658d55f48bd7a148eb5160060b36..b5af0d087f064f0c71ddac5d9b8e60174b44de90 100644 (file)
@@ -34,16 +34,16 @@ struct input::implementation : boost::noncopyable
        long long end_frame_;\r
        long long frame_count_;\r
 \r
-       std::shared_ptr<AVFormatContext>        format_context_;        // Destroy this last\r
+       std::shared_ptr<AVFormatContext> format_context_;       // Destroy this last\r
 \r
-       std::shared_ptr<AVCodecContext>         video_codec_context_;\r
-       std::shared_ptr<AVCodecContext>         audio_codex_context_;\r
+       std::shared_ptr<AVCodecContext> video_codec_context_;\r
+       std::shared_ptr<AVCodecContext> audio_codex_context_;\r
        \r
-       const std::wstring                                      filename_;\r
+       const std::wstring filename_;\r
 \r
-       tbb::atomic<bool>                                       loop_;\r
-       int                                                                     video_s_index_;\r
-       int                                                                     audio_s_index_;\r
+       bool loop_;\r
+       int video_s_index_;\r
+       int     audio_s_index_;\r
 \r
        tbb::atomic<size_t>     buffer_size_;\r
        \r
@@ -56,7 +56,8 @@ struct input::implementation : boost::noncopyable
 \r
 public:\r
        explicit implementation(const std::wstring& filename, bool loop, double start_time, double end_time) \r
-               : video_s_index_(-1)\r
+               : loop_(loop)\r
+               , video_s_index_(-1)\r
                , audio_s_index_(-1)\r
                , filename_(filename)\r
        {               \r
@@ -65,9 +66,7 @@ public:
                \r
                static boost::once_flag avcodec_init_flag = BOOST_ONCE_INIT;\r
                boost::call_once(avcodec_init, avcodec_init_flag);      \r
-\r
-               loop_ = loop;   \r
-               \r
+                               \r
                int errn;\r
                AVFormatContext* weak_format_context_;\r
                if((errn = -av_open_input_file(&weak_format_context_, narrow(filename).c_str(), nullptr, 0, nullptr)) > 0)\r
index 585e31dffe076b7a7a4c8bbef7607c679556479c..b91a109269e5e42f0c46d7f35faf49064d58fa96 100644 (file)
@@ -59,9 +59,10 @@ class flash_renderer
                }\r
        } co_;\r
 \r
-       std::wstring filename_;\r
+       const std::wstring filename_;\r
+       const video_format_desc format_desc_;\r
+\r
        std::shared_ptr<frame_processor_device> frame_processor_;\r
-       video_format_desc format_desc_;\r
        \r
        BYTE* bmp_data_;        \r
        std::shared_ptr<void> hdc_;\r
@@ -72,13 +73,13 @@ class flash_renderer
 \r
 public:\r
        flash_renderer(const std::shared_ptr<frame_processor_device>& frame_processor, const std::wstring& filename) \r
-               : head_(draw_frame::empty())\r
+               : filename_(filename)\r
+               , format_desc_(frame_processor->get_video_format_desc())\r
+               , frame_processor_(frame_processor)\r
                , bmp_data_(nullptr)\r
-               , ax_(nullptr)\r
-               , filename_(filename)\r
                , hdc_(CreateCompatibleDC(0), DeleteDC)\r
-               , frame_processor_(frame_processor)\r
-               , format_desc_(frame_processor->get_video_format_desc())\r
+               , ax_(nullptr)\r
+               , head_(draw_frame::empty())\r
        {\r
                CASPAR_LOG(info) << print() << L" Started";\r
                \r
@@ -138,7 +139,7 @@ public:
                        return draw_frame::empty();\r
 \r
                auto frame = render_simple_frame();\r
-               if(format_desc_.mode != video_mode::progressive && ax_->GetFPS()/2.0 - format_desc_.fps >= 0.0)\r
+               if(ax_->GetFPS()/2.0 - format_desc_.fps >= 0.0)\r
                        frame = draw_frame::interlace(frame, render_simple_frame(), format_desc_.mode);\r
                return frame;\r
        }\r
index 7679ce283c175abb4e1edc3ab1f29b5b7b4d889b..229cb0c89f48e5d841a68456b9ccf9ffaf24ac50 100644 (file)
@@ -11,11 +11,11 @@ namespace caspar { namespace core {
 \r
 struct layer::implementation : boost::noncopyable\r
 {                                      \r
-       tbb::atomic<bool>                       is_paused_;\r
-       safe_ptr<draw_frame>            last_frame_;\r
        safe_ptr<frame_producer>        foreground_;\r
        safe_ptr<frame_producer>        background_;\r
+       safe_ptr<draw_frame>            last_frame_;\r
        const int                                       index_;\r
+       bool                                            is_paused_;\r
 \r
 public:\r
        implementation(int index) \r
@@ -23,15 +23,13 @@ public:
                , background_(frame_producer::empty())\r
                , last_frame_(draw_frame::empty())\r
                , index_(index) \r
-       {\r
-               is_paused_ = false;\r
-       }\r
+               , is_paused_(false){}\r
        \r
-       void load(const safe_ptr<frame_producer>& frame_producer, bool autoplay)\r
+       void load(const safe_ptr<frame_producer>& frame_producer, bool play_on_load)\r
        {                       \r
                background_ = frame_producer;\r
                CASPAR_LOG(info) << print() << " " << frame_producer->print() << " => background";\r
-               if(autoplay)\r
+               if(play_on_load)\r
                        play();                 \r
        }\r
 \r
@@ -123,7 +121,7 @@ layer& layer::operator=(layer&& other)
        other.impl_ = nullptr;\r
        return *this;\r
 }\r
-void layer::load(const safe_ptr<frame_producer>& frame_producer, bool autoplay){return impl_->load(frame_producer, autoplay);} \r
+void layer::load(const safe_ptr<frame_producer>& frame_producer, bool play_on_load){return impl_->load(frame_producer, play_on_load);} \r
 void layer::preview(const safe_ptr<frame_producer>& frame_producer){return impl_->preview(frame_producer);}    \r
 void layer::play(){impl_->play();}\r
 void layer::pause(){impl_->pause();}\r
index dabb839fb548711349e834574d9b6ccc76c9d11d..a31aaba8bc33ae99424880eb6457e382888efc8f 100644 (file)
@@ -16,7 +16,7 @@ public:
        layer(layer&& other); // nothrow\r
        layer& operator=(layer&& other); // nothrow\r
        \r
-       void load(const safe_ptr<frame_producer>& producer, bool autoplay = false); // nothrow\r
+       void load(const safe_ptr<frame_producer>& producer, bool play_on_load = false); // nothrow\r
        void preview(const safe_ptr<frame_producer>& producer); // nothrow\r
        void play(); // nothrow\r
        void pause(); // nothrow\r
index a067e86e1109b3bbbda3fdb9f59b1368a7a2e5a8..7b9c0ae2fb4cea6d82ea541a5a73866ca624676e 100644 (file)
@@ -23,7 +23,6 @@
 \r
 #include "../../video_format.h"\r
 #include "../../processor/draw_frame.h"\r
-#include "../../processor/draw_frame.h"\r
 #include "../../processor/frame_processor_device.h"\r
 \r
 #include <boost/range/algorithm/copy.hpp>\r