]> git.sesse.net Git - casparcg/commitdiff
Refactored to use non-static data member initializers where it makes sense. Mixes...
authorHelge Norberg <helge.norberg@svt.se>
Fri, 20 Feb 2015 20:22:27 +0000 (21:22 +0100)
committerHelge Norberg <helge.norberg@svt.se>
Fri, 20 Feb 2015 20:22:27 +0000 (21:22 +0100)
42 files changed:
accelerator/cpu/image/image_mixer.cpp
accelerator/ogl/image/image_kernel.h
accelerator/ogl/image/image_mixer.cpp
common/blocking_bounded_queue_adapter.h
common/blocking_priority_queue.h
common/diagnostics/graph.cpp
common/polling_filesystem_monitor.cpp
core/consumer/output.cpp
core/consumer/port.cpp
core/frame/frame.cpp
core/frame/frame_transform.cpp
core/frame/frame_transform.h
core/interaction/interaction_aggregator.h
core/mixer/audio/audio_mixer.cpp
core/mixer/mixer.cpp
core/producer/layer.cpp
core/producer/separated/separated_producer.cpp
core/producer/text/text_producer.cpp
core/producer/text/utils/string_metrics.h
core/producer/text/utils/text_info.h
core/producer/text/utils/texture_atlas.cpp
core/producer/transition/transition_producer.cpp
core/producer/transition/transition_producer.h
core/video_channel.cpp
core/video_format.cpp
modules/decklink/consumer/decklink_consumer.cpp
modules/decklink/producer/decklink_producer.cpp
modules/ffmpeg/consumer/ffmpeg_consumer.cpp
modules/ffmpeg/producer/audio/audio_decoder.cpp
modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/ffmpeg/producer/filter/filter.cpp
modules/ffmpeg/producer/input/input.cpp
modules/ffmpeg/producer/muxer/frame_muxer.cpp
modules/flash/producer/flash_producer.cpp
modules/image/producer/image_producer.cpp
modules/image/producer/image_scroll_producer.cpp
modules/image/util/image_algorithms.h
modules/image/util/image_view.h
modules/oal/consumer/oal_consumer.cpp
modules/psd/misc.h
modules/screen/consumer/screen_consumer.cpp
protocol/clk/CLKProtocolStrategy.cpp

index 64ed053624262cfbde4161ea92986bc0cbca9ecb..1a04dfd3ec595b04271596430423f8cdc8a9d0a5 100644 (file)
@@ -73,12 +73,11 @@ namespace caspar { namespace accelerator { namespace cpu {
                
 struct item
 {
-       core::pixel_format_desc                 pix_desc;
+       core::pixel_format_desc                 pix_desc        = core::pixel_format::invalid;
        std::array<const uint8_t*, 4>   data;
        core::image_transform                   transform;
 
        item()
-               : pix_desc(core::pixel_format::invalid)
        {
                data.fill(0);
        }
index 3a7320ba38b20c499d65740060806c3fd0e52ab3..c0ed0ee838cfa60304b99ded56c3819a3e60706d 100644 (file)
@@ -39,22 +39,15 @@ enum class keyer
 
 struct draw_params final
 {
-       core::pixel_format_desc                                         pix_desc;
+       core::pixel_format_desc                                         pix_desc        = core::pixel_format::invalid;
        std::vector<spl::shared_ptr<class texture>>     textures;
        core::image_transform                                           transform;
        core::frame_geometry                                            geometry;
-       core::blend_mode                                                        blend_mode;
-       keyer                                                                           keyer;
+       core::blend_mode                                                        blend_mode      = core::blend_mode::normal;
+       keyer                                                                           keyer           = keyer::linear;
        std::shared_ptr<class texture>                          background;
        std::shared_ptr<class texture>                          local_key;
        std::shared_ptr<class texture>                          layer_key;
-
-       draw_params() 
-               : pix_desc(core::pixel_format::invalid)
-               , blend_mode(core::blend_mode::normal)
-               , keyer(keyer::linear)
-       {
-       }
 };
 
 class image_kernel final
index 014ff196d4d699ba496a9e3a5f6a11e72fdbdbad..fa9a900ef375b8073fc6c8aaa77f85ca8e2e3ff8 100644 (file)
@@ -54,15 +54,10 @@ typedef std::shared_future<std::shared_ptr<texture>> future_texture;
 
 struct item
 {
-       core::pixel_format_desc                                                         pix_desc;
-       std::vector<future_texture>                                                     textures;
-       core::image_transform                                                           transform;
-       core::frame_geometry                                                            geometry;
-
-       item()
-               : pix_desc(core::pixel_format::invalid)
-       {
-       }
+       core::pixel_format_desc         pix_desc        = core::pixel_format::invalid;
+       std::vector<future_texture>     textures;
+       core::image_transform           transform;
+       core::frame_geometry            geometry;
 };
 
 struct layer
index e229f58d5e57b0bf43e56648239212d9aa74f325..56e7f9c4be064c76c237d22dca59c44bc27eb7b3 100644 (file)
@@ -53,11 +53,11 @@ public:
        typedef typename Q::value_type value_type;
        typedef unsigned int size_type;
 private:
-       semaphore space_available_;
-       semaphore elements_available_;
-       Q queue_;
-       mutable boost::mutex capacity_mutex_;
-       size_type capacity_;
+       mutable boost::mutex    capacity_mutex_;
+       size_type                               capacity_;
+       semaphore                               space_available_                = capacity_;
+       semaphore                               elements_available_             = 0;
+       Q                                               queue_;
 public:
        /**
         * Constructor.
@@ -65,9 +65,7 @@ public:
         * @param capacity The capacity of the queue.
         */
        blocking_bounded_queue_adapter(size_type capacity)
-               : space_available_(capacity)
-               , elements_available_(0)
-               , capacity_(capacity)
+               : capacity_(capacity)
        {
        }
 
index 7fd7e19fd3b4843e625ec7fbb34cbbc1d10de6b8..0bde37656fda0e0427b152228bcfd8f75915d79f 100644 (file)
@@ -45,11 +45,11 @@ class blocking_priority_queue
 public:
        typedef unsigned int size_type;
 private:       
-       std::map<Prio, tbb::concurrent_queue<T>, std::greater<Prio>> queues_by_priority_;
-       semaphore space_available_;
-       semaphore elements_available_;
-       mutable boost::mutex capacity_mutex_;
-       size_type capacity_;
+       std::map<Prio, tbb::concurrent_queue<T>, std::greater<Prio>>    queues_by_priority_;
+       size_type                                                                                                               capacity_;
+       semaphore                                                                                                               space_available_        = capacity_;
+       semaphore                                                                                                               elements_available_     = 0u;
+       mutable boost::mutex                                                                                    capacity_mutex_;
 public:
        /**
         * Constructor.
@@ -60,9 +60,7 @@ public:
         */
        template<class PrioList>
        blocking_priority_queue(size_type capacity, const PrioList& priorities)
-               : space_available_(capacity)
-               , elements_available_(0u)
-               , capacity_(capacity)
+               : capacity_(capacity)
        {
                for (Prio priority : priorities)
                {
index c8ea356d75920f10e1b525f085c4a90cae6470b3..03846f9d6f375dd24af94881a85e526c24b1e2ce 100644 (file)
@@ -98,7 +98,7 @@ class context : public drawable
        
        std::list<std::weak_ptr<drawable>> drawables_;
                
-       executor executor_;
+       executor executor_ = L"diagnostics";
 public:                                        
 
        static void register_drawable(const std::shared_ptr<drawable>& drawable)
@@ -125,7 +125,7 @@ public:
                get_instance().reset();
        }
 private:
-       context() : executor_(L"diagnostics")
+       context()
        {
                executor_.begin_invoke([=]
                {                       
@@ -294,10 +294,9 @@ struct graph::impl : public drawable
 
        tbb::spin_mutex mutex_;
        std::wstring text_;
-       bool auto_reset_;
+       bool auto_reset_ = false;
 
        impl()
-               : auto_reset_(false)
        {
        }
                
index ccef76741c2ce0affefe56e2d75b4a0bff48ee59..249c1285bededc13c6f5ecc3ecbe5805ab44671d 100644 (file)
@@ -71,14 +71,14 @@ public:
 
 class directory_monitor
 {
-       bool report_already_existing_;
-       boost::filesystem::wpath folder_;
-       filesystem_event events_mask_;
-       filesystem_monitor_handler handler_;
-       initial_files_handler initial_files_handler_;
-       bool first_scan_;
-       std::map<boost::filesystem::wpath, std::time_t> files_;
-       std::map<boost::filesystem::wpath, uintmax_t> being_written_sizes_;
+       bool                                                                                    report_already_existing_;
+       boost::filesystem::wpath                                                folder_;
+       filesystem_event                                                                events_mask_;
+       filesystem_monitor_handler                                              handler_;
+       initial_files_handler                                                   initial_files_handler_;
+       bool                                                                                    first_scan_                                     = true;
+       std::map<boost::filesystem::wpath, std::time_t> files_;
+       std::map<boost::filesystem::wpath, uintmax_t>   being_written_sizes_;
 public:
        directory_monitor(
                        bool report_already_existing,
@@ -91,7 +91,6 @@ public:
                , events_mask_(events_mask)
                , handler_(exception_protected_handler(handler))
                , initial_files_handler_(initial_files_handler)
-               , first_scan_(true)
        {
        }
 
index 38fd8cf23a3ab4f26cdf3959e0bf45ff6ebb588c..95259ab3cf83c04ab23a67f64ea4527cbaef7d21 100644 (file)
@@ -53,20 +53,18 @@ namespace caspar { namespace core {
 struct output::impl
 {              
        spl::shared_ptr<diagnostics::graph>     graph_;
-       spl::shared_ptr<monitor::subject>       monitor_subject_;
+       spl::shared_ptr<monitor::subject>       monitor_subject_        = spl::make_shared<monitor::subject>("/output");
        const int                                                       channel_index_;
        video_format_desc                                       format_desc_;
        std::map<int, port>                                     ports_; 
        prec_timer                                                      sync_timer_;
        boost::circular_buffer<const_frame>     frames_;
-       executor                                                        executor_;              
+       executor                                                        executor_                       = { L"output" };
 public:
        impl(spl::shared_ptr<diagnostics::graph> graph, const video_format_desc& format_desc, int channel_index) 
                : graph_(std::move(graph))
-               , monitor_subject_(spl::make_shared<monitor::subject>("/output"))
                , channel_index_(channel_index)
                , format_desc_(format_desc)
-               , executor_(L"output")
        {
                graph_->set_color("consume-time", diagnostics::color(1.0f, 0.4f, 0.0f, 0.8));
        }       
index 07f51e1704608387c3a6b1c1765c5e5daf5dce55..2964f908752183abb027e83f7691a64cd3b67173 100644 (file)
@@ -12,16 +12,14 @@ namespace caspar { namespace core {
 
 struct port::impl
 {
-       spl::shared_ptr<monitor::subject>       monitor_subject_;
-       std::shared_ptr<frame_consumer>         consumer_;
        int                                                                     index_;
+       spl::shared_ptr<monitor::subject>       monitor_subject_ = spl::make_shared<monitor::subject>("/port" + boost::lexical_cast<std::string>(index_));
+       std::shared_ptr<frame_consumer>         consumer_;
        int                                                                     channel_index_;
 public:
        impl(int index, int channel_index, spl::shared_ptr<frame_consumer> consumer)
-               : monitor_subject_(spl::make_shared<monitor::subject>(
-                               "/port" + boost::lexical_cast<std::string>(index)))
+               : index_(index)
                , consumer_(std::move(consumer))
-               , index_(index)
                , channel_index_(channel_index)
        {
                consumer_->monitor_output().attach_parent(monitor_subject_);
index 3c0a092ffdb05881ba2bf774ba9d43f0aac8623f..d52658350c9cb6612229ab971fa4774fb0c28bc3 100644 (file)
@@ -42,14 +42,13 @@ struct mutable_frame::impl : boost::noncopyable
        core::audio_buffer                                                      audio_data_;
        const core::pixel_format_desc                           desc_;
        const void*                                                                     tag_;
-       core::frame_geometry                                            geometry_;
+       core::frame_geometry                                            geometry_               = frame_geometry::get_default();
        
        impl(std::vector<array<std::uint8_t>> buffers, audio_buffer audio_buffer, const void* tag, const core::pixel_format_desc& desc) 
                : buffers_(std::move(buffers))
                , audio_data_(std::move(audio_buffer))
                , desc_(desc)
                , tag_(tag)
-               , geometry_(frame_geometry::get_default())
        {
                for (auto& buffer : buffers_)
                        if(!buffer.data())
index 6c73f98ebbdb1edf53419b3bc9e154afcbad716a..47f8afa2f2f59dfe96cb670d305373b633fe3bc7 100644 (file)
 #include "frame_transform.h"
 
 #include <boost/range/algorithm/equal.hpp>
-#include <boost/range/algorithm/fill.hpp>
 
 namespace caspar { namespace core {
                
 // image_transform
 
-image_transform::image_transform() 
-       : opacity(1.0)
-       , brightness(1.0)
-       , contrast(1.0)
-       , saturation(1.0)
-       , field_mode(field_mode::progressive)
-       , is_key(false)
-       , is_mix(false)
-       , is_still(false)
-{
-       boost::range::fill(fill_translation, 0.0);
-       boost::range::fill(fill_scale, 1.0);
-       boost::range::fill(clip_translation, 0.0);
-       boost::range::fill(clip_scale, 1.0);
-}
-
 image_transform& image_transform::operator*=(const image_transform &other)
 {
        opacity                                 *= other.opacity;       
@@ -138,12 +121,6 @@ bool operator!=(const image_transform& lhs, const image_transform& rhs)
 }
 
 // audio_transform
-               
-audio_transform::audio_transform() 
-       : volume(1.0)
-       , is_still(false)
-{
-}
 
 audio_transform& audio_transform::operator*=(const audio_transform &other)
 {
index 65b9568495a52af3927300b0ff2de5aac1c26626..a1ec57179fdeea75a63a79b15477b138c1b7b8a8 100644 (file)
@@ -30,40 +30,33 @@ namespace caspar { namespace core {
                        
 struct levels final
 {
-       levels() 
-               : min_input(0.0)
-               , max_input(1.0)
-               , gamma(1.0)
-               , min_output(0.0)
-               , max_output(1.0)
-       {               
-       }
-       double min_input;
-       double max_input;
-       double gamma;
-       double min_output;
-       double max_output;
+       double min_input        = 0.0;
+       double max_input        = 1.0;
+       double gamma            = 1.0;
+       double min_output       = 0.0;
+       double max_output       = 1.0;
 };
 
 struct image_transform final
 {
-public:
-       image_transform();
-
-       double                                  opacity;
-       double                                  contrast;
-       double                                  brightness;
-       double                                  saturation;
-       boost::array<double, 2> fill_translation; 
-       boost::array<double, 2> fill_scale; 
-       boost::array<double, 2> clip_translation;  
-       boost::array<double, 2> clip_scale;  
+       double                                  opacity                         = 1.0;
+       double                                  contrast                        = 1.0;
+       double                                  brightness                      = 1.0;
+       double                                  saturation                      = 1.0;
+
+       // A bug in VS 2013 prevents us from writing:
+       // boost::array<double, 2> fill_translation = { { 0.0, 0.0 } };
+       // See http://blogs.msdn.com/b/vcblog/archive/2014/08/19/the-future-of-non-static-data-member-initialization.aspx
+       boost::array<double, 2> fill_translation        = boost::array<double, 2> { { 0.0, 0.0 } };
+       boost::array<double, 2> fill_scale                      = boost::array<double, 2> { { 1.0, 1.0 } };
+       boost::array<double, 2> clip_translation        = boost::array<double, 2> { { 0.0, 0.0 } };
+       boost::array<double, 2> clip_scale                      = boost::array<double, 2> { { 1.0, 1.0 } };
        levels                                  levels;
 
-       field_mode                              field_mode;
-       bool                                    is_key;
-       bool                                    is_mix;
-       bool                                    is_still;
+       field_mode                              field_mode                      = field_mode::progressive;
+       bool                                    is_key                          = false;
+       bool                                    is_mix                          = false;
+       bool                                    is_still                        = false;
        
        image_transform& operator*=(const image_transform &other);
        image_transform operator*(const image_transform &other) const;
@@ -76,11 +69,8 @@ bool operator!=(const image_transform& lhs, const image_transform& rhs);
 
 struct audio_transform final
 {
-public:
-       audio_transform();
-
-       double  volume;
-       bool    is_still;
+       double  volume          = 1.0;
+       bool    is_still        = false;
        
        audio_transform& operator*=(const audio_transform &other);
        audio_transform operator*(const audio_transform &other) const;
index d1c5e5a7c4dbd38ce456ae1464b79cc95890dc7b..9c4614681af45c611fabe340fae3102db9c73615 100644 (file)
@@ -44,11 +44,10 @@ class interaction_aggregator
 
 
        boost::optional<interaction_target> clicked_and_held_;
-       int num_buttons_clicked_and_held_;
+       int num_buttons_clicked_and_held_                                               = 0;
 public:
        interaction_aggregator(const collission_detector& collission_detector)
                : collission_detector_(collission_detector)
-               , num_buttons_clicked_and_held_(0)
        {
        }
 
index 88752cb31fde3620f08d909a00c90399dbbeb751..b0f404212e4b0f53bb42b65e12a681a4ea2fd1ee 100644 (file)
@@ -60,12 +60,7 @@ struct audio_stream
 {
        audio_transform         prev_transform;
        audio_buffer_ps         audio_data;
-       bool                            is_still;
-
-       audio_stream() 
-               : is_still(false)
-       {
-       }
+       bool                            is_still                = false;
 };
 
 struct audio_mixer::impl : boost::noncopyable
@@ -75,12 +70,10 @@ struct audio_mixer::impl : boost::noncopyable
        std::vector<audio_item>                         items_;
        std::vector<int>                                        audio_cadence_;
        video_format_desc                                       format_desc_;
-       float                                                           master_volume_;
-       float                                                           previous_master_volume_;
+       float                                                           master_volume_                  = 1.0f;
+       float                                                           previous_master_volume_ = master_volume_;
 public:
        impl()
-               : master_volume_(1.0f)
-               , previous_master_volume_(master_volume_)
        {
                transform_stack_.push(core::audio_transform());
        }
index 38f5b72304c017d77ba565f531e3636377696c6c..9008921bf49d47e10e890aceb5f065fcfb378a8a 100644 (file)
@@ -61,14 +61,12 @@ struct mixer::impl : boost::noncopyable
        
        std::unordered_map<int, blend_mode>     blend_modes_;
                        
-       executor executor_;
+       executor executor_                                                                      = L"mixer";
 
 public:
        impl(spl::shared_ptr<diagnostics::graph> graph, spl::shared_ptr<image_mixer> image_mixer) 
                : graph_(std::move(graph))
-               , audio_mixer_()
                , image_mixer_(std::move(image_mixer))
-               , executor_(L"mixer")
        {                       
                graph_->set_color("mix-time", diagnostics::color(1.0f, 0.0f, 0.9f, 0.8));
        }       
index 59ac66e9c62599f0be31986e307bb8ac74ed35a3..b158510dbb7709bfdb1b6c35d51614f8c67da0d1 100644 (file)
@@ -37,10 +37,10 @@ namespace caspar { namespace core {
 struct layer::impl
 {                              
        spl::shared_ptr<monitor::subject>       monitor_subject_;
-       spl::shared_ptr<frame_producer>         foreground_;
-       spl::shared_ptr<frame_producer>         background_;
+       spl::shared_ptr<frame_producer>         foreground_                     = frame_producer::empty();
+       spl::shared_ptr<frame_producer>         background_                     = frame_producer::empty();;
        boost::optional<int32_t>                        auto_play_delta_;
-       bool                                                            is_paused_;
+       bool                                                            is_paused_                      = false;
 
 public:
        impl(int index) 
@@ -48,9 +48,6 @@ public:
                                "/layer/" + boost::lexical_cast<std::string>(index)))
 //             , foreground_event_subject_("")
 //             , background_event_subject_("background")
-               , foreground_(frame_producer::empty())
-               , background_(frame_producer::empty())
-               , is_paused_(false)
        {
 //             foreground_event_subject_.subscribe(event_subject_);
 //             background_event_subject_.subscribe(event_subject_);
index 2a0607368fda8146be57aa1780c5aaddca691259..4818f574a16f101c122bba8b0bb36b58d196b402 100644 (file)
@@ -36,20 +36,17 @@ namespace caspar { namespace core {
 class separated_producer : public frame_producer_base
 {              
        spl::shared_ptr<monitor::subject>       monitor_subject_;
-       spl::shared_ptr<monitor::subject>       key_monitor_subject_;
+       spl::shared_ptr<monitor::subject>       key_monitor_subject_    = spl::make_shared<monitor::subject>("/keyer");
 
        spl::shared_ptr<frame_producer> fill_producer_;
        spl::shared_ptr<frame_producer> key_producer_;
-       draw_frame                                              fill_;
-       draw_frame                                              key_;
+       draw_frame                                              fill_                                           = core::draw_frame::late();
+       draw_frame                                              key_                                            = core::draw_frame::late();
                        
 public:
        explicit separated_producer(const spl::shared_ptr<frame_producer>& fill, const spl::shared_ptr<frame_producer>& key) 
-               : key_monitor_subject_(spl::make_shared<monitor::subject>("/keyer"))
-               , fill_producer_(fill)
+               : fill_producer_(fill)
                , key_producer_(key)
-               , fill_(core::draw_frame::late())
-               , key_(core::draw_frame::late())
        {
                CASPAR_LOG(info) << print() << L" Initialized";
 
index 0b0936786e82e4b1f7aac55740fedadc6903be16..c5aedac322fa0cd95c0345e6051a7b4e82efc9fd 100644 (file)
@@ -142,9 +142,9 @@ struct text_producer::impl
        variable_impl<double> current_bearing_y_;
        variable_impl<double> current_protrude_under_y_;
        draw_frame frame_;
-       text::texture_atlas atlas_;
+       text::texture_atlas atlas_                                                              { 512, 512, 4 };
        text::texture_font font_;
-       bool dirty_;
+       bool dirty_                                                                                             = false;
 
 public:
        explicit impl(const spl::shared_ptr<frame_factory>& frame_factory, int x, int y, const std::wstring& str, text::text_info& text_info, long parent_width, long parent_height, bool standalone) 
@@ -152,9 +152,7 @@ public:
                , constraints_(parent_width, parent_height)
                , x_(x), y_(y), parent_width_(parent_width), parent_height_(parent_height)
                , standalone_(standalone)
-               , atlas_(512,512,4)
                , font_(atlas_, text::find_font_file(text_info), !standalone)
-               , dirty_(false)
        {
                //TODO: examine str to determine which unicode_blocks to load
                font_.load_glyphs(text::unicode_block::Basic_Latin, text_info.color);
index a159f3116ef79c34d9a147236c019c2ef583c628..a0f06b854153540c5156ff31cd88c86e9f9866d1 100644 (file)
@@ -4,11 +4,9 @@ namespace caspar { namespace core { namespace text {
 
        struct string_metrics
        {
-               string_metrics()
-                               : width(0), bearingY(0), protrudeUnderY(0), height(0) {}
-               int width;
-               int bearingY;
-               int protrudeUnderY;
-               int height;
+               int width                       = 0;
+               int bearingY            = 0;
+               int protrudeUnderY      = 0;
+               int height                      = 0;
        };
 }}}
\ No newline at end of file
index c3b90df3ffcff5b9a0f3684fcbfe6b133850943f..aafb6948c7db28e608e9b4c4fd916335813c8ca4 100644 (file)
@@ -10,21 +10,14 @@ namespace caspar { namespace core { namespace text {
                std::wstring font;
                std::wstring font_file;
 
-               float size;
+               float size                                              = 0.0f;
                color<float> color;
                //int shadow_distance;
                //int shadow_size;
                //float shadow_spread;
                //color<float> shadow_color;
-               int baseline_shift;
-               int tracking;
-
-               text_info()
-                       : size(0.0f)
-                       , baseline_shift(0)
-                       , tracking(0)
-               {
-               }
+               int baseline_shift                              = 0;
+               int tracking                                    = 0;
        };
 
 }}}
\ No newline at end of file
index e322cdfd812a778fc2b91037181dcceb3a4b9fd4..9d42a629c0ca8f6ccd646b33ec44e8ec941f1e3d 100644 (file)
@@ -52,17 +52,26 @@ private:
        typedef std::list<node> node_list;
        typedef std::list<node>::iterator node_iterator;
 
+       node_list nodes_;
+
+       size_t width_;
+       size_t height_;
+       size_t depth_;
+
+       std::vector<unsigned char> data_;
+       size_t used_                                            = 0;
+
 public:
-       impl(const size_t width, const size_t height, const size_t depth) : width_(width), height_(height), depth_(depth), used_(0), data_(width*height*depth, 0)
+       impl(const size_t width, const size_t height, const size_t depth) : width_(width), height_(height), depth_(depth), data_(width*height*depth, 0)
        {
                // We want a one pixel border around the whole atlas to avoid any artefact when sampling texture
-               node n = {1, 1, (int)width_ - 2};
+               node n = {1, 1, static_cast<int>(width_) - 2};
                nodes_.push_back(n);
        }
 
        rect get_region(int width, int height)
        {
-               rect region = {0,0,(int)width,(int)height};
+               rect region = { 0, 0, static_cast<int>(width), static_cast<int>(height) };
 
                int best_height = INT_MAX;
                int best_width = INT_MAX;
@@ -203,15 +212,6 @@ private:
                                ++it;
                }
        }
-
-       node_list nodes_;
-
-       size_t width_;
-       size_t height_;
-       size_t depth_;
-
-       std::vector<unsigned char> data_;
-       size_t used_;
 };
 
 texture_atlas::texture_atlas(const size_t w, const size_t h, const size_t d) : impl_(new impl(w, h, d)) {}
index 89bd8ed92163e84b20d42f24fd2ed760cd9d6a6e..126326c8cd7fe911f0a83fdeac87576e8969e905 100644 (file)
@@ -38,23 +38,20 @@ class transition_producer : public frame_producer_base
 {      
        spl::shared_ptr<monitor::subject>       monitor_subject_;
        const field_mode                                        mode_;
-       int                                                                     current_frame_;
+       int                                                                     current_frame_          = 0;
        
        const transition_info                           info_;
                
        spl::shared_ptr<frame_producer>         dest_producer_;
-       spl::shared_ptr<frame_producer>         source_producer_;
+       spl::shared_ptr<frame_producer>         source_producer_        = frame_producer::empty();
 
-       bool                                                            paused_;
+       bool                                                            paused_                         = false;
                
 public:
        explicit transition_producer(const field_mode& mode, const spl::shared_ptr<frame_producer>& dest, const transition_info& info) 
                : mode_(mode)
-               , current_frame_(0)
                , info_(info)
                , dest_producer_(dest)
-               , source_producer_(frame_producer::empty())
-               , paused_(false)
        {
                dest->monitor_output().attach_parent(monitor_subject_);
 
index 32bad662d2e3bf91c933b52abf68fa7002825e5a..dc4ec0bb825ee086dc85e2faa096e24d8d3508e4 100644 (file)
@@ -49,16 +49,10 @@ enum class transition_direction
 
 struct transition_info
 {
-       transition_info() 
-               : type(transition_type::cut)
-               , duration(0)
-               , direction(transition_direction::from_left)
-               , tweener(L"linear"){}
-               
-       int                                             duration;
-       transition_direction    direction;
-       transition_type                 type;
-       tweener                                 tweener;
+       int                                             duration        = 0;
+       transition_direction    direction       = transition_direction::from_left;
+       transition_type                 type            = transition_type::cut;
+       tweener                                 tweener         = { L"linear" };
 };
 
 spl::shared_ptr<class frame_producer> create_transition_producer(const field_mode& mode, const spl::shared_ptr<class frame_producer>& destination, const transition_info& info);
index 0deabf3cefea0211cf6cd681bc896b24130aaaaa..e4d3e64f331d4df13f81ac02bf7471a3e491e752 100644 (file)
@@ -63,7 +63,7 @@ struct video_channel::impl final
        caspar::core::mixer                                                             mixer_;
        caspar::core::stage                                                             stage_; 
 
-       executor                                                                                executor_;
+       executor                                                                                executor_                       = L"video_channel";
 public:
        impl(int index, const core::video_format_desc& format_desc, std::unique_ptr<image_mixer> image_mixer)  
                : monitor_subject_(spl::make_shared<monitor::subject>(
@@ -74,7 +74,6 @@ public:
                , image_mixer_(std::move(image_mixer))
                , mixer_(graph_, image_mixer_)
                , stage_(graph_)
-               , executor_(L"video_channel")
        {
                graph_->set_color("tick-time", diagnostics::color(0.0f, 0.6f, 0.9f));   
                graph_->set_text(print());
index 0b80917e2c256a0f1a3b8577e924c34928d83ad1..64575d2171f6b1caee570a658bf0659d1a717d70 100644 (file)
@@ -78,7 +78,7 @@ video_format_desc::video_format_desc(
        , square_width(square_width)
        , square_height(square_height)
        , field_mode(field_mode)
-       , fps((double)time_scale/(double)duration)
+       , fps(static_cast<double>(time_scale) / static_cast<double>(duration))
        , time_scale(time_scale)
        , duration(duration)
        , field_count(field_mode == field_mode::progressive ? 1 : 2)
index 4822fc6dbfef0f4327188860ae7fc6cd0520c088..d35c0b51ab922bdc47ca616c2301d00e4381747a 100644 (file)
@@ -67,22 +67,12 @@ struct configuration
                default_latency
        };
 
-       int                     device_index;
-       bool            embedded_audio;
-       keyer_t         keyer;
-       latency_t       latency;
-       bool            key_only;
-       int                     base_buffer_depth;
-       
-       configuration()
-               : device_index(1)
-               , embedded_audio(true)
-               , keyer(keyer_t::default_keyer)
-               , latency(latency_t::default_latency)
-               , key_only(false)
-               , base_buffer_depth(3)
-       {
-       }
+       int                     device_index            = 1;
+       bool            embedded_audio          = true;
+       keyer_t         keyer                           = keyer_t::default_keyer;
+       latency_t       latency                         = latency_t::default_latency;
+       bool            key_only                        = false;
+       int                     base_buffer_depth       = 3;
        
        int buffer_depth() const
        {
@@ -180,27 +170,27 @@ struct decklink_consumer : public IDeckLinkVideoOutputCallback, public IDeckLink
        const int                                                       channel_index_;
        const configuration                                     config_;
 
-       CComPtr<IDeckLink>                                      decklink_;
-       CComQIPtr<IDeckLinkOutput>                      output_;
-       CComQIPtr<IDeckLinkConfiguration>       configuration_;
-       CComQIPtr<IDeckLinkKeyer>                       keyer_;
-       CComQIPtr<IDeckLinkAttributes>          attributes_;
+       CComPtr<IDeckLink>                                      decklink_                                                       = get_device(config_.device_index);
+       CComQIPtr<IDeckLinkOutput>                      output_                                                         = decklink_;
+       CComQIPtr<IDeckLinkConfiguration>       configuration_                                          = decklink_;
+       CComQIPtr<IDeckLinkKeyer>                       keyer_                                                          = decklink_;
+       CComQIPtr<IDeckLinkAttributes>          attributes_                                                     = decklink_;
 
        tbb::spin_mutex                                         exception_mutex_;
        std::exception_ptr                                      exception_;
 
        tbb::atomic<bool>                                       is_running_;
                
-       const std::wstring                                      model_name_;
+       const std::wstring                                      model_name_                                                     = get_model_name(decklink_);
        const core::video_format_desc           format_desc_;
-       const int                                                       buffer_size_;
+       const int                                                       buffer_size_                                            = config_.buffer_depth(); // Minimum buffer-size 3.
 
-       long long                                                       video_scheduled_;
-       long long                                                       audio_scheduled_;
+       long long                                                       video_scheduled_                                        = 0;
+       long long                                                       audio_scheduled_                                        = 0;
 
-       int                                                                     preroll_count_;
+       int                                                                     preroll_count_                                          = 0;
                
-       boost::circular_buffer<std::vector<int32_t>>    audio_container_;
+       boost::circular_buffer<std::vector<int32_t>>    audio_container_                { buffer_size_ + 1 };
 
        tbb::concurrent_bounded_queue<core::const_frame> video_frame_buffer_;
        tbb::concurrent_bounded_queue<core::const_frame> audio_frame_buffer_;
@@ -213,18 +203,7 @@ public:
        decklink_consumer(const configuration& config, const core::video_format_desc& format_desc, int channel_index) 
                : channel_index_(channel_index)
                , config_(config)
-               , decklink_(get_device(config.device_index))
-               , output_(decklink_)
-               , configuration_(decklink_)
-               , keyer_(decklink_)
-               , attributes_(decklink_)
-               , model_name_(get_model_name(decklink_))
                , format_desc_(format_desc)
-               , buffer_size_(config.buffer_depth()) // Minimum buffer-size 3.
-               , video_scheduled_(0)
-               , audio_scheduled_(0)
-               , preroll_count_(0)
-               , audio_container_(buffer_size_+1)
        {
                is_running_ = true;
                                
index 5ecd153fbfe3769395bab32c5399b7ec83a35099..a762f6c4c221c4c73b4595ae66a6b1f49375e55a 100644 (file)
@@ -80,49 +80,42 @@ namespace caspar { namespace decklink {
                
 class decklink_producer : boost::noncopyable, public IDeckLinkInputCallback
 {      
+       const int                                                                               device_index_;
        core::monitor::subject                                                  monitor_subject_;
        spl::shared_ptr<diagnostics::graph>                             graph_;
        boost::timer                                                                    tick_timer_;
 
-       CComPtr<IDeckLink>                                                              decklink_;
-       CComQIPtr<IDeckLinkInput>                                               input_;
-       CComQIPtr<IDeckLinkAttributes >                                 attributes_;
+       CComPtr<IDeckLink>                                                              decklink_                       = get_device(device_index_);
+       CComQIPtr<IDeckLinkInput>                                               input_                          = decklink_;
+       CComQIPtr<IDeckLinkAttributes >                                 attributes_                     = decklink_;
        
-       const std::wstring                                                              model_name_;
-       const int                                                                               device_index_;
+       const std::wstring                                                              model_name_                     = get_model_name(decklink_);
        const std::wstring                                                              filter_;
        
-       std::vector<int>                                                                audio_cadence_;
-       boost::circular_buffer<size_t>                                  sync_buffer_;
-       ffmpeg::frame_muxer                                                             muxer_;
-                       
-       spl::shared_ptr<core::frame_factory>                    frame_factory_;
        core::video_format_desc                                                 in_format_desc_;
        core::video_format_desc                                                 out_format_desc_;
-       core::constraints                                                               constraints_;
+       std::vector<int>                                                                audio_cadence_          = out_format_desc_.audio_cadence;
+       boost::circular_buffer<size_t>                                  sync_buffer_            { audio_cadence_.size() };
+       spl::shared_ptr<core::frame_factory>                    frame_factory_;
+       ffmpeg::frame_muxer                                                             muxer_                          { in_format_desc_.fps, frame_factory_, out_format_desc_, filter_ };
+                       
+       core::constraints                                                               constraints_            { in_format_desc_.width, in_format_desc_.height };
 
        tbb::concurrent_bounded_queue<core::draw_frame> frame_buffer_;
 
        std::exception_ptr                                                              exception_;             
 
 public:
-       decklink_producer(const core::video_format_desc& in_format_desc, 
-                                         int device_index, 
-                                         const spl::shared_ptr<core::frame_factory>& frame_factory, 
-                                         const core::video_format_desc& out_format_desc, 
-                                         const std::wstring& filter)
-               : decklink_(get_device(device_index))
-               , input_(decklink_)
-               , attributes_(decklink_)
-               , model_name_(get_model_name(decklink_))
-               , device_index_(device_index)
+       decklink_producer(
+                       const core::video_format_desc& in_format_desc, 
+                       int device_index, 
+                       const spl::shared_ptr<core::frame_factory>& frame_factory, 
+                       const core::video_format_desc& out_format_desc, 
+                       const std::wstring& filter)
+               : device_index_(device_index)
                , filter_(filter)
                , in_format_desc_(in_format_desc)
                , out_format_desc_(out_format_desc)
-               , constraints_(in_format_desc.width, in_format_desc.height)
-               , muxer_(in_format_desc.fps, frame_factory, out_format_desc, filter)
-               , audio_cadence_(out_format_desc.audio_cadence)
-               , sync_buffer_(out_format_desc.audio_cadence.size())
                , frame_factory_(frame_factory)
        {       
                frame_buffer_.set_capacity(2);
index e2edd0c976d60e1912da5ba6639708e2830bf485..2a60c6721a1e5a0243ce7e9306fb83ac4b4df21e 100644 (file)
@@ -259,7 +259,7 @@ struct ffmpeg_consumer : boost::noncopyable
 {              
        const spl::shared_ptr<diagnostics::graph>       graph_;
        const std::string                                                       filename_;              
-       const std::shared_ptr<AVFormatContext>          oc_;
+       const std::shared_ptr<AVFormatContext>          oc_                                     { avformat_alloc_context(), av_free };
        const core::video_format_desc                           format_desc_;   
 
        core::monitor::subject                                          monitor_subject_;
@@ -276,7 +276,7 @@ struct ffmpeg_consumer : boost::noncopyable
        std::shared_ptr<SwrContext>                                     swr_;
        std::shared_ptr<SwsContext>                                     sws_;
 
-       int64_t                                                                         frame_number_;
+       int64_t                                                                         frame_number_           = 0;
 
        output_format                                                           output_format_;
        bool                                                                            key_only_;
@@ -285,9 +285,7 @@ struct ffmpeg_consumer : boost::noncopyable
 public:
        ffmpeg_consumer(const std::string& filename, const core::video_format_desc& format_desc, std::vector<option> options, bool key_only)
                : filename_(filename)
-               , oc_(avformat_alloc_context(), av_free)
                , format_desc_(format_desc)
-               , frame_number_(0)
                , output_format_(format_desc, filename, options)
                , key_only_(key_only)
                , executor_(print())
index 4a47a6253580383e8d8ab46b92653412faf63be1..3442aa7c7e2cc0382ca899953b25fcd90e91953e 100644 (file)
@@ -62,10 +62,22 @@ struct audio_decoder::impl : boost::noncopyable
        core::monitor::subject                                                                          monitor_subject_;
        input*                                                                                                          input_;
        int                                                                                                                     index_;
-       const spl::shared_ptr<AVCodecContext>                                           codec_context_;         
        const core::video_format_desc                                                           format_desc_;
-
-       std::shared_ptr<SwrContext>                                                                     swr_;
+       const spl::shared_ptr<AVCodecContext>                                           codec_context_ = open_codec(input_->context(), AVMEDIA_TYPE_AUDIO, index_);
+
+       std::shared_ptr<SwrContext>                                                                     swr_                            {
+                                                                                                                                                                               swr_alloc_set_opts(
+                                                                                                                                                                                               nullptr,
+                                                                                                                                                                                               av_get_default_channel_layout(format_desc_.audio_channels),
+                                                                                                                                                                                               AV_SAMPLE_FMT_S32,
+                                                                                                                                                                                               format_desc_.audio_sample_rate,
+                                                                                                                                                                                               get_channel_layout(codec_context_.get()),
+                                                                                                                                                                                               codec_context_->sample_fmt,
+                                                                                                                                                                                               codec_context_->sample_rate,
+                                                                                                                                                                                               0,
+                                                                                                                                                                                               nullptr),
+                                                                                                                                                                               [](SwrContext* p){swr_free(&p); }
+                                                                                                                                                                       };
 
        std::vector<uint8_t, tbb::cache_aligned_allocator<int8_t>>      buffer_;
 
@@ -76,11 +88,7 @@ public:
                : input_(&in)
                , format_desc_(format_desc)     
                , codec_context_(open_codec(input_->context(), AVMEDIA_TYPE_AUDIO, index_))
-               , swr_(swr_alloc_set_opts(nullptr,
-                                                                               av_get_default_channel_layout(format_desc_.audio_channels), AV_SAMPLE_FMT_S32, format_desc_.audio_sample_rate,
-                                                                               get_channel_layout(codec_context_.get()), codec_context_->sample_fmt, codec_context_->sample_rate,
-                                                                               0, nullptr), [](SwrContext* p){swr_free(&p);})
-               , buffer_(480000*4)
+               , buffer_(480000 * 4)
        {               
                if(!swr_)
                        CASPAR_THROW_EXCEPTION(bad_alloc());
index ad1e718a32eebc69b67e1430aee92f329b871643..f316fb1103f3c667c596ed445901666d518653d1 100644 (file)
@@ -91,7 +91,7 @@ struct ffmpeg_producer : public core::frame_producer_base
 {
        spl::shared_ptr<core::monitor::subject>                 monitor_subject_;
        const std::wstring                                                              filename_;
-       const std::wstring                                                              path_relative_to_media_;
+       const std::wstring                                                              path_relative_to_media_ = get_relative_or_original(filename_, env::media_folder());
        
        const spl::shared_ptr<diagnostics::graph>               graph_;
                                        
@@ -100,7 +100,7 @@ struct ffmpeg_producer : public core::frame_producer_base
 
        input                                                                                   input_; 
 
-       const double                                                                    fps_;
+       const double                                                                    fps_                                    = read_fps(input_.context(), format_desc_.fps);
        const uint32_t                                                                  start_;
                
        std::unique_ptr<video_decoder>                                  video_decoder_;
@@ -108,7 +108,7 @@ struct ffmpeg_producer : public core::frame_producer_base
        frame_muxer                                                                             muxer_;
        core::constraints                                                               constraints_;
        
-       core::draw_frame                                                                last_frame_;
+       core::draw_frame                                                                last_frame_                             = core::draw_frame::empty();
 
        boost::optional<uint32_t>                                               seek_target_;
        
@@ -121,14 +121,12 @@ public:
                                                         uint32_t start, 
                                                         uint32_t length) 
                : filename_(filename)
-               , path_relative_to_media_(get_relative_or_original(filename, env::media_folder()))
                , frame_factory_(frame_factory)         
                , format_desc_(format_desc)
                , input_(graph_, filename_, loop, start, length)
                , fps_(read_fps(input_.context(), format_desc_.fps))
                , muxer_(fps_, frame_factory, format_desc_, filter)
                , start_(start)
-               , last_frame_(core::draw_frame::empty())
        {
                graph_->set_color("frame-time", diagnostics::color(0.1f, 1.0f, 0.1f));
                graph_->set_color("underflow", diagnostics::color(0.6f, 0.3f, 0.9f));   
index 1a349b0528f6c262be14ee2d5fed417a5670032c..2df066439f6edb48f02c5d04b19b7dcc99ed9990 100644 (file)
@@ -69,14 +69,14 @@ struct filter::implementation
     AVFilterContext*                           video_graph_out_; 
                
        implementation(
-               int in_width,
-               int in_height,
-               boost::rational<int> in_time_base,
-               boost::rational<int> in_frame_rate,
-               boost::rational<int> in_sample_aspect_ratio,
-               AVPixelFormat in_pix_fmt,
-               std::vector<AVPixelFormat> out_pix_fmts,
-               const std::string& filtergraph) 
+                       int in_width,
+                       int in_height,
+                       boost::rational<int> in_time_base,
+                       boost::rational<int> in_frame_rate,
+                       boost::rational<int> in_sample_aspect_ratio,
+                       AVPixelFormat in_pix_fmt,
+                       std::vector<AVPixelFormat> out_pix_fmts,
+                       const std::string& filtergraph) 
                : filtergraph_(boost::to_lower_copy(filtergraph))
        {
                if(out_pix_fmts.empty())
index a6611d37e7934e27e509dbeca597f43e0df953ac..855d6c8ec709ff01c2916beee737144992a9e0d8 100644 (file)
@@ -104,37 +104,31 @@ public:
                
 struct input::impl : boost::noncopyable
 {              
-       const spl::shared_ptr<diagnostics::graph>                                       graph_;
+       const spl::shared_ptr<diagnostics::graph>       graph_;
 
-       const spl::shared_ptr<AVFormatContext>                                          format_context_; // Destroy this last
-       const int                                                                                                       default_stream_index_;
-                       
-       const std::wstring                                                                                      filename_;
-       tbb::atomic<uint32_t>                                                                           start_;         
-       tbb::atomic<uint32_t>                                                                           length_;
-       tbb::atomic<bool>                                                                                       loop_;
-       double                                                                                                          fps_;
-       uint32_t                                                                                                        frame_number_;
-       
-       stream                                                                                                          video_stream_;
-       stream                                                                                                          audio_stream_;
+       const std::wstring                                                      filename_;
+       const spl::shared_ptr<AVFormatContext>          format_context_                 = open_input(filename_); // Destroy this last
+       const int                                                                       default_stream_index_   = av_find_default_stream_index(format_context_.get());
+
+       tbb::atomic<uint32_t>                                           start_;         
+       tbb::atomic<uint32_t>                                           length_;
+       tbb::atomic<bool>                                                       loop_;
+       double                                                                          fps_                                    = read_fps(*format_context_, 0.0);
+       uint32_t                                                                        frame_number_                   = 0;
+
+       stream                                                                          video_stream_                   = av_find_best_stream(format_context_.get(), AVMEDIA_TYPE_VIDEO, -1, -1, 0, 0);
+       stream                                                                          audio_stream_                   = av_find_best_stream(format_context_.get(), AVMEDIA_TYPE_AUDIO, -1, -1, 0, 0);
 
-       boost::optional<uint32_t>                                                                       seek_target_;
+       boost::optional<uint32_t>                                       seek_target_;
 
-       tbb::atomic<bool>                                                                                       is_running_;
-       boost::mutex                                                                                            mutex_;
-       boost::condition_variable                                                                       cond_;
-       boost::thread                                                                                           thread_;
+       tbb::atomic<bool>                                                       is_running_;
+       boost::mutex                                                            mutex_;
+       boost::condition_variable                                       cond_;
+       boost::thread                                                           thread_;
        
        impl(const spl::shared_ptr<diagnostics::graph> graph, const std::wstring& filename, const bool loop, const uint32_t start, const uint32_t length) 
                : graph_(graph)
-               , format_context_(open_input(filename))         
-               , default_stream_index_(av_find_default_stream_index(format_context_.get()))
                , filename_(filename)
-               , frame_number_(0)
-               , fps_(read_fps(*format_context_, 0.0))
-               , video_stream_(av_find_best_stream(format_context_.get(), AVMEDIA_TYPE_VIDEO, -1, -1, 0, 0))
-               , audio_stream_(av_find_best_stream(format_context_.get(), AVMEDIA_TYPE_AUDIO, -1, -1, 0, 0))
        {               
                start_                  = start;
                length_                 = length;
index 5e9ac89cbe7da71b7c0b743e37d95fc07db7a5ba..12f63cc8919b1dde9b23d413665e3d059f03d479 100644 (file)
@@ -69,26 +69,23 @@ struct frame_muxer::impl : boost::noncopyable
        std::queue<core::mutable_frame>                                 video_stream_;
        core::audio_buffer                                                              audio_stream_;
        std::queue<draw_frame>                                                  frame_buffer_;
-       display_mode                                                                    display_mode_;
+       display_mode                                                                    display_mode_                   = display_mode::invalid;
        const double                                                                    in_fps_;
        const video_format_desc                                                 format_desc_;
        
-       std::vector<int>                                                                audio_cadence_;
+       std::vector<int>                                                                audio_cadence_                  = format_desc_.audio_cadence;
                        
        spl::shared_ptr<core::frame_factory>                    frame_factory_;
        
        std::unique_ptr<filter>                                                 filter_;
        const std::wstring                                                              filter_str_;
-       bool                                                                                    force_deinterlacing_;
+       bool                                                                                    force_deinterlacing_    = env::properties().get(L"configuration.force-deinterlace", true);
                
        impl(double in_fps, const spl::shared_ptr<core::frame_factory>& frame_factory, const core::video_format_desc& format_desc, const std::wstring& filter_str)
-               : display_mode_(display_mode::invalid)
-               , in_fps_(in_fps)
+               : in_fps_(in_fps)
                , format_desc_(format_desc)
-               , audio_cadence_(format_desc_.audio_cadence)
                , frame_factory_(frame_factory)
                , filter_str_(filter_str)
-               , force_deinterlacing_(env::properties().get(L"configuration.force-deinterlace", true))
        {               
                // Note: Uses 1 step rotated cadence for 1001 modes (1602, 1602, 1601, 1602, 1601)
                // This cadence fills the audio mixer most optimally.
index 1215ddf1e62af3e54f5432e2dbfd2c3d35bbdab9..dba3acb8cecd7eeafd421df7f4bb9853a6fcec92 100644 (file)
@@ -151,10 +151,9 @@ class flash_renderer
 {      
        struct com_init
        {
-               HRESULT result_;
+               HRESULT result_ = CoInitialize(nullptr);
 
                com_init()
-                       : result_(CoInitialize(nullptr))
                {
                        if(FAILED(result_))
                                CASPAR_THROW_EXCEPTION(caspar_exception() << msg_info("Failed to initialize com-context for flash-player"));
@@ -167,34 +166,32 @@ class flash_renderer
                }
        } com_init_;
 
-       core::monitor::subject&                                         monitor_subject_;
+       core::monitor::subject&                                                 monitor_subject_;
 
-       const std::wstring                                                      filename_;
+       const std::wstring                                                              filename_;
+       const int                                                                               width_;
+       const int                                                                               height_;
 
-       const std::shared_ptr<core::frame_factory>      frame_factory_;
+       const std::shared_ptr<core::frame_factory>              frame_factory_;
        
-       CComObject<caspar::flash::FlashAxContainer>* ax_;
-       core::draw_frame                                                        head_;
-       bitmap                                                                          bmp_;
+       CComObject<caspar::flash::FlashAxContainer>*    ax_                                     = nullptr;
+       core::draw_frame                                                                head_                           = core::draw_frame::empty();
+       bitmap                                                                                  bmp_                            { width_, height_ };
        
-       spl::shared_ptr<diagnostics::graph>                     graph_;
+       spl::shared_ptr<diagnostics::graph>                             graph_;
        
-       prec_timer                                                                      timer_;
+       prec_timer                                                                              timer_;
 
-       const int                                                                       width_;
-       const int                                                                       height_;
        
 public:
        flash_renderer(core::monitor::subject& monitor_subject, const spl::shared_ptr<diagnostics::graph>& graph, const std::shared_ptr<core::frame_factory>& frame_factory, const std::wstring& filename, int width, int height) 
                : monitor_subject_(monitor_subject)
                , graph_(graph)
                , filename_(filename)
-               , frame_factory_(frame_factory)
-               , ax_(nullptr)
-               , head_(core::draw_frame::empty())
-               , bmp_(width, height)
                , width_(width)
                , height_(height)
+               , frame_factory_(frame_factory)
+               , bmp_(width, height)
        {               
                graph_->set_color("frame-time", diagnostics::color(0.1f, 1.0f, 0.1f));
                graph_->set_color("param", diagnostics::color(1.0f, 0.5f, 0.0f));       
@@ -330,8 +327,8 @@ struct flash_producer : public core::frame_producer_base
        const core::video_format_desc                                   format_desc_;
        const int                                                                               width_;
        const int                                                                               height_;
-       core::constraints                                                               constraints_;
-       const int                                                                               buffer_size_;
+       core::constraints                                                               constraints_            { static_cast<double>(width_), static_cast<double>(height_) };
+       const int                                                                               buffer_size_            = env::properties().get(L"configuration.flash.buffer-depth", format_desc_.fps > 30.0 ? 4 : 2);
 
        tbb::atomic<int>                                                                fps_;
 
@@ -345,7 +342,7 @@ struct flash_producer : public core::frame_producer_base
        boost::timer                                                                    tick_timer_;
        std::unique_ptr<flash_renderer>                                 renderer_;
        
-       executor                                                                                executor_;      
+       executor                                                                                executor_                       = L"flash_producer";
 public:
        flash_producer(const spl::shared_ptr<core::frame_factory>& frame_factory, const core::video_format_desc& format_desc, const std::wstring& filename, int width, int height) 
                : filename_(filename)           
@@ -353,9 +350,6 @@ public:
                , format_desc_(format_desc)
                , width_(width > 0 ? width : format_desc.width)
                , height_(height > 0 ? height : format_desc.height)
-               , constraints_(width_, height_)
-               , buffer_size_(env::properties().get(L"configuration.flash.buffer-depth", format_desc.fps > 30.0 ? 4 : 2))
-               , executor_(L"flash_producer")
        {       
                fps_ = 0;
         
index bcdbda865d3a7bf30c340b51d2d9fd11fa1b67c1..b6ce1fbf7f42ab0fb91006badd3f193f95b8094d 100644 (file)
@@ -75,13 +75,12 @@ struct image_producer : public core::frame_producer_base
        core::monitor::subject                                          monitor_subject_;
        const std::wstring                                                      description_;
        const spl::shared_ptr<core::frame_factory>      frame_factory_;
-       core::draw_frame                                                        frame_;
+       core::draw_frame                                                        frame_                          = core::draw_frame::empty();
        core::constraints                                                       constraints_;
        
        image_producer(const spl::shared_ptr<core::frame_factory>& frame_factory, const std::wstring& description) 
                : description_(description)
                , frame_factory_(frame_factory)
-               , frame_(core::draw_frame::empty())     
        {
                load(load_image(description_));
 
@@ -91,7 +90,6 @@ struct image_producer : public core::frame_producer_base
        image_producer(const spl::shared_ptr<core::frame_factory>& frame_factory, const void* png_data, size_t size) 
                : description_(L"png from memory")
                , frame_factory_(frame_factory)
-               , frame_(core::draw_frame::empty())     
        {
                load(load_png_from_memory(png_data, size));
 
index 6b98ee1f3ba92af6bc09b80e91c407790a183fb4..3140f2c11af00ba7403967875f57a8a795f7019b 100644 (file)
@@ -63,28 +63,25 @@ struct image_scroll_producer : public core::frame_producer_base
        int                                                             height_;
        core::constraints                               constraints_;
 
-       double                                                  delta_;
+       double                                                  delta_                          = 0.0;
        double                                                  speed_;
 
-       int                                                             start_offset_x_;
-       int                                                             start_offset_y_;
+       int                                                             start_offset_x_         = 0;
+       int                                                             start_offset_y_         = 0;
        bool                                                    progressive_;
        
        explicit image_scroll_producer(
-               const spl::shared_ptr<core::frame_factory>& frame_factory, 
-               const core::video_format_desc& format_desc, 
-               const std::wstring& filename, 
-               double speed,
-               double duration,
-               int motion_blur_px = 0,
-               bool premultiply_with_alpha = false,
-               bool progressive = false)
+                       const spl::shared_ptr<core::frame_factory>& frame_factory,
+                       const core::video_format_desc& format_desc,
+                       const std::wstring& filename,
+                       double speed,
+                       double duration,
+                       int motion_blur_px = 0,
+                       bool premultiply_with_alpha = false,
+                       bool progressive = false)
                : filename_(filename)
-               , delta_(0)
                , format_desc_(format_desc)
                , speed_(speed)
-               , start_offset_x_(0)
-               , start_offset_y_(0)
                , progressive_(progressive)
        {
                auto bitmap = load_image(filename_);
index 839d84e39b4d8e360bc2dbc98bd2e7fba80c51a9..cbd3aa707daa546da68c56d41ef7d2bce68df49e 100644 (file)
@@ -34,14 +34,12 @@ namespace caspar { namespace image {
  */
 class rgba_weighting
 {
-       int r, g, b, a;
-       int total_weight;
+       int r = 0;
+       int g = 0;
+       int b = 0;
+       int a = 0;
+       int total_weight = 0;
 public:
-       rgba_weighting()
-               : r(0), g(0), b(0), a(0), total_weight(0)
-       {
-       }
-
        template<class RGBAPixel>
        inline void add_pixel(const RGBAPixel& pixel, uint8_t weight)
        {
index c9694fdee4301577689d0c6d3946a4bf8556d109..b6a8b24b1a223164f598334805fc7967415d4361 100644 (file)
@@ -199,6 +199,14 @@ struct image_stride_iterator : public boost::filter_iterator<is_within_view<Pack
 template<class PackedPixel>
 class image_sub_view
 {
+private:
+       image_view<PackedPixel> root_view_;
+       int                                             relative_to_root_x_;
+       int                                             relative_to_root_y_;
+       int                                             width_;
+       int                                             height_;
+       PackedPixel*                    raw_begin_                              = root_view_.relative(root_view_.begin(), relative_to_root_x_, relative_to_root_y_);
+       PackedPixel*                    raw_end_                                = root_view_.relative(raw_begin_, width_ - 1, height_ - 1) + 1;
 public:
        typedef PackedPixel pixel_type;
 
@@ -208,8 +216,6 @@ public:
                , relative_to_root_y_(y)
                , width_(width)
                , height_(height)
-               , raw_begin_(root_view.relative(root_view.begin(), x, y))
-               , raw_end_(root_view.relative(raw_begin_, width - 1, height_ - 1) + 1)
        {
        }
 
@@ -264,14 +270,6 @@ public:
        {
                return root_view_.subview(relative_to_root_x_ + x, relative_to_root_y_ + y, width, height);
        }
-private:
-       image_view<PackedPixel> root_view_;
-       int relative_to_root_x_;
-       int relative_to_root_y_;
-       int width_;
-       int height_;
-       PackedPixel* raw_begin_;
-       PackedPixel* raw_end_;
 };
 
 }}
index 9e28d318071aa4a0dba38feb9d353dc976559a2a..60c87c781e303e32db5af930a21614512ad1aab4 100644 (file)
@@ -54,13 +54,11 @@ typedef std::vector<int16_t, tbb::cache_aligned_allocator<int16_t>> audio_buffer
 
 class device
 {
-       ALCdevice*                                                                                      device_;
-       ALCcontext*                                                                                     context_;
+       ALCdevice*              device_         = nullptr;
+       ALCcontext*             context_        = nullptr;
 
 public:
        device()
-               : device_(0)
-               , context_(0)
        {
                device_ = alcOpenDevice(nullptr);
 
@@ -107,20 +105,17 @@ struct oal_consumer : public core::frame_consumer
 
        spl::shared_ptr<diagnostics::graph>     graph_;
        boost::timer                                            perf_timer_;
-       int                                                                     channel_index_;
+       int                                                                     channel_index_          = -1;
        
        core::video_format_desc                         format_desc_;
 
-       ALuint                                                          source_;
+       ALuint                                                          source_                         = 0;
        std::array<ALuint, 3>                           buffers_;
 
-       executor                                                        executor_;
+       executor                                                        executor_                       = L"oal_consumer";
 
 public:
        oal_consumer() 
-               : channel_index_(-1)
-               , source_(0)
-               , executor_(L"oal_consumer")
        {
                buffers_.assign(0);
 
index 079a497085183ee80ee1c849bfe4df8a9e471b71..691062077d8997b0ef86385ca5d8dac521c22aec 100644 (file)
@@ -38,13 +38,10 @@ struct point
 template<typename T>
 struct color
 {
-       color() : red(0), green(0), blue(0), alpha(0)
-       {}
-
-       T red;
-       T green;
-       T blue;
-       T alpha;
+       T red           = 0;
+       T green         = 0;
+       T blue          = 0;
+       T alpha         = 0;
 
        unsigned long to_uint32()
        {
index 4ce6ef3cbe03e8d18efe41c7f1e139669620be3a..cd2262e4f4692addc1b9bf0fccea369079b8afd5 100644 (file)
@@ -91,28 +91,15 @@ struct configuration
                aspect_invalid,
        };
                
-       std::wstring    name;
-       int                             screen_index;
-       stretch                 stretch;
-       bool                    windowed;
-       bool                    auto_deinterlace;
-       bool                    key_only;
-       aspect_ratio    aspect; 
-       bool                    vsync;
-       bool                    interactive;
-
-       configuration()
-               : name(L"ogl")
-               , screen_index(0)
-               , stretch(stretch::fill)
-               , windowed(true)
-               , auto_deinterlace(true)
-               , key_only(false)
-               , aspect(aspect_ratio::aspect_invalid)
-               , vsync(true)
-               , interactive(true)
-       {
-       }
+       std::wstring    name                            = L"ogl";
+       int                             screen_index            = 0;
+       stretch                 stretch                         = stretch::fill;
+       bool                    windowed                        = true;
+       bool                    auto_deinterlace        = true;
+       bool                    key_only                        = false;
+       aspect_ratio    aspect                          = aspect_ratio::aspect_invalid;
+       bool                    vsync                           = true;
+       bool                    interactive                     = true;
 };
 
 struct screen_consumer : boost::noncopyable
@@ -121,17 +108,17 @@ struct screen_consumer : boost::noncopyable
        core::video_format_desc                                                         format_desc_;
        int                                                                                                     channel_index_;
 
-       GLuint                                                                                          texture_;
-       std::vector<GLuint>                                                                     pbos_;
+       GLuint                                                                                          texture_                = 0;
+       std::vector<GLuint>                                                                     pbos_                   = std::vector<GLuint> { 0, 0 };
                        
        float                                                                                           width_;
        float                                                                                           height_;
        int                                                                                                     screen_x_;
        int                                                                                                     screen_y_;
-       int                                                                                                     screen_width_;
-       int                                                                                                     screen_height_;
-       int                                                                                                     square_width_;
-       int                                                                                                     square_height_;
+       int                                                                                                     screen_width_   = format_desc_.width;
+       int                                                                                                     screen_height_  = format_desc_.height;
+       int                                                                                                     square_width_   = format_desc_.square_width;
+       int                                                                                                     square_height_  = format_desc_.square_height;
 
        sf::Window                                                                                      window_;
 
@@ -157,12 +144,6 @@ public:
                : config_(config)
                , format_desc_(format_desc)
                , channel_index_(channel_index)
-               , texture_(0)
-               , pbos_(2, 0)   
-               , screen_width_(format_desc.width)
-               , screen_height_(format_desc.height)
-               , square_width_(format_desc.square_width)
-               , square_height_(format_desc.square_height)             
                , sink_(sink)
                , filter_([&]() -> ffmpeg::filter
                {                       
index c89246a71b2b22a70c59dc745f3d3e285e5b327d..37f050a0c2bd70ee613441d49f37b4b3e4dffb40 100644 (file)
@@ -37,12 +37,24 @@ namespace caspar { namespace protocol { namespace CLK {
 
 class CLKProtocolStrategy : public IO::protocol_strategy<wchar_t>
 {
+       enum class ParserState
+       {
+               ExpectingNewCommand,
+               ExpectingCommand,
+               ExpectingParameter
+       };
+
+       ParserState     currentState_                                                           = ParserState::ExpectingNewCommand;
+       std::wstringstream currentCommandString_;
+       std::wstring command_name_;
+       std::vector<std::wstring> parameters_;
+       clk_command_processor& command_processor_;
+       IO::client_connection<wchar_t>::ptr client_connection_;
 public:
        CLKProtocolStrategy(
-               const IO::client_connection<wchar_t>::ptr& client_connection,
-               clk_command_processor& command_processor) 
-               : currentState_(ParserState::ExpectingNewCommand)
-               , command_processor_(command_processor)
+                       const IO::client_connection<wchar_t>::ptr& client_connection,
+                       clk_command_processor& command_processor) 
+               : command_processor_(command_processor)
                , client_connection_(client_connection)
        {
        }
@@ -129,20 +141,6 @@ private:
                command_name_.clear();
                parameters_.clear();
        }
-
-       enum class ParserState
-       {
-               ExpectingNewCommand,
-               ExpectingCommand,
-               ExpectingParameter
-       };
-
-       ParserState     currentState_;
-       std::wstringstream currentCommandString_;
-       std::wstring command_name_;
-       std::vector<std::wstring> parameters_;
-       clk_command_processor& command_processor_;
-       IO::client_connection<wchar_t>::ptr client_connection_;
 };
 
 clk_protocol_strategy_factory::clk_protocol_strategy_factory(