]> git.sesse.net Git - casparcg/commitdiff
2.0.0.2: Improved int type size safety.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 26 May 2011 20:55:47 +0000 (20:55 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Thu, 26 May 2011 20:55:47 +0000 (20:55 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@815 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

19 files changed:
core/mixer/audio/audio_mixer.cpp
core/mixer/audio/audio_mixer.h
core/mixer/frame_mixer_device.cpp
core/mixer/frame_mixer_device.h
core/mixer/read_frame.cpp
core/mixer/read_frame.h
core/mixer/write_frame.cpp
core/mixer/write_frame.h
core/producer/color/color_producer.cpp
core/producer/frame_producer.cpp
core/producer/frame_producer.h
core/producer/frame_producer_device.cpp
core/producer/frame_producer_device.h
modules/ffmpeg/producer/audio/audio_decoder.cpp
modules/ffmpeg/producer/audio/audio_decoder.h
protocol/StdAfx.h
shell/caspar.config
shell/main.cpp
shell/shell.vcxproj

index 687812e219fa489acedec765626c04e950e49fb6..598842bd3477da470a74f6aea77dcd20bbec69d3 100644 (file)
@@ -28,7 +28,7 @@ namespace caspar { namespace core {
        \r
 struct audio_mixer::implementation\r
 {\r
-       std::deque<std::vector<short>> audio_data_;\r
+       std::vector<int16_t> audio_data_;\r
        std::stack<core::audio_transform> transform_stack_;\r
 \r
        std::map<int, core::audio_transform> prev_audio_transforms_;\r
@@ -38,9 +38,6 @@ public:
        implementation()\r
        {\r
                transform_stack_.push(core::audio_transform());\r
-\r
-               // frame delay\r
-               audio_data_.push_back(std::vector<short>());\r
        }\r
        \r
        void begin(const core::basic_frame& frame)\r
@@ -56,8 +53,8 @@ public:
                auto& audio_data = frame.audio_data();\r
                auto tag = frame.tag(); // Get the identifier for the audio-stream.\r
 \r
-               if(audio_data_.back().empty())\r
-                       audio_data_.back().resize(audio_data.size(), 0);\r
+               if(audio_data_.empty())\r
+                       audio_data_.resize(audio_data.size(), 0);\r
                \r
                auto next = transform_stack_.top();\r
                auto prev = next;\r
@@ -74,10 +71,10 @@ public:
                \r
                static const int BASE = 1<<15;\r
 \r
-               auto next_gain = static_cast<int>(next.get_gain()*BASE);\r
-               auto prev_gain = static_cast<int>(prev.get_gain()*BASE);\r
+               auto next_gain = static_cast<int32_t>(next.get_gain()*BASE);\r
+               auto prev_gain = static_cast<int32_t>(prev.get_gain()*BASE);\r
                \r
-               int n_samples = audio_data_.back().size();\r
+               int n_samples = audio_data_.size();\r
 \r
                tbb::parallel_for\r
                (\r
@@ -88,9 +85,9 @@ public:
                                {\r
                                        int sample_gain = (prev_gain - (prev_gain * n)/n_samples) + (next_gain * n)/n_samples;\r
                                        \r
-                                       int sample = (static_cast<int>(audio_data[n])*sample_gain)/BASE;\r
+                                       int sample = (static_cast<int32_t>(audio_data[n])*sample_gain)/BASE;\r
                                        \r
-                                       audio_data_.back()[n] = static_cast<short>((static_cast<int>(audio_data_.back()[n]) + sample) & 0xFFFF);\r
+                                       audio_data_[n] = static_cast<int16_t>((static_cast<int32_t>(audio_data_[n]) + sample) & 0xFFFF);\r
                                }\r
                        }\r
                );\r
@@ -107,18 +104,11 @@ public:
                transform_stack_.pop();\r
        }\r
 \r
-       void begin_pass()\r
-       {\r
-               audio_data_.push_back(std::vector<short>());\r
-       }\r
 \r
-       std::vector<short>  end_pass()\r
+       std::vector<short> mix()\r
        {\r
-               prev_audio_transforms_ = std::move(next_audio_transforms_);\r
-\r
-               auto result = std::move(audio_data_.front());\r
-               audio_data_.pop_front();                \r
-               return result;\r
+               prev_audio_transforms_ = std::move(next_audio_transforms_);     \r
+               return std::move(audio_data_);\r
        }\r
 };\r
 \r
@@ -126,7 +116,6 @@ audio_mixer::audio_mixer() : impl_(new implementation()){}
 void audio_mixer::begin(const core::basic_frame& frame){impl_->begin(frame);}\r
 void audio_mixer::visit(core::write_frame& frame){impl_->visit(frame);}\r
 void audio_mixer::end(){impl_->end();}\r
-void audio_mixer::begin_pass(){ impl_->begin_pass();}  \r
-std::vector<short> audio_mixer::end_pass(){return impl_->end_pass();}\r
+std::vector<short> audio_mixer::mix(){return impl_->mix();}\r
 \r
 }}
\ No newline at end of file
index e855aaacee8c77c3af495cbf00bfeb2b6f85c2e2..9f524420b151f24b700f94a3f3b569a1ea2dfc80 100644 (file)
@@ -35,8 +35,7 @@ public:
        virtual void visit(core::write_frame& frame);\r
        virtual void end();\r
 \r
-       void begin_pass();\r
-       std::vector<short> end_pass();\r
+       std::vector<short> mix();\r
 \r
 private:\r
        struct implementation;\r
index ac36055dbceb7560c3da56a98d99bef1f360def4..2b07746d83a3c1f3fa2897d71b4009286857a980 100644 (file)
@@ -167,16 +167,16 @@ public:
                auto& root_audio_transform = boost::fusion::at_key<core::audio_transform>(root_transforms_);\r
                auto& audio_transforms = boost::fusion::at_key<core::audio_transform>(transforms_);\r
 \r
-               audio_mixer_.begin_pass();\r
                BOOST_FOREACH(auto& frame, frames)\r
                {\r
-                       int num = format_desc_.mode == core::video_mode::progressive ? 1 : 2;\r
+                       const unsigned int num = format_desc_.mode == core::video_mode::progressive ? 1 : 2;\r
 \r
                        auto frame1 = make_safe<core::basic_frame>(frame.second);\r
                        frame1->get_audio_transform() = root_audio_transform.fetch_and_tick(num)*audio_transforms[frame.first].fetch_and_tick(num);\r
                        frame1->accept(audio_mixer_);\r
                }\r
-               return audio_mixer_.end_pass();\r
+\r
+               return audio_mixer_.mix();\r
        }\r
                \r
        void send(const std::map<int, safe_ptr<core::basic_frame>>& frames)\r
@@ -205,7 +205,7 @@ public:
        }\r
                        \r
        template<typename T>    \r
-       void set_transform(const T& transform, int mix_duration, const std::wstring& tween)\r
+       void set_transform(const T& transform, unsigned int mix_duration, const std::wstring& tween)\r
        {\r
                executor_.invoke([&]\r
                {\r
@@ -218,7 +218,7 @@ public:
        }\r
                \r
        template<typename T>\r
-       void set_transform(int index, const T& transform, int mix_duration, const std::wstring& tween)\r
+       void set_transform(int index, const T& transform, unsigned int mix_duration, const std::wstring& tween)\r
        {\r
                executor_.invoke([&]\r
                {\r
@@ -231,7 +231,7 @@ public:
        }\r
                \r
        template<typename T>\r
-       void apply_transform(const std::function<T(const T&)>& transform, int mix_duration, const std::wstring& tween)\r
+       void apply_transform(const std::function<T(const T&)>& transform, unsigned int mix_duration, const std::wstring& tween)\r
        {\r
                return executor_.invoke([&]\r
                {\r
@@ -244,7 +244,7 @@ public:
        }\r
                \r
        template<typename T>\r
-       void apply_transform(int index, const std::function<T(T)>& transform, int mix_duration, const std::wstring& tween)\r
+       void apply_transform(int index, const std::function<T(T)>& transform, unsigned int mix_duration, const std::wstring& tween)\r
        {\r
                executor_.invoke([&]\r
                {\r
@@ -257,7 +257,7 @@ public:
        }\r
 \r
        template<typename T>\r
-       void reset_transform(int mix_duration, const std::wstring& tween)\r
+       void reset_transform(unsigned int mix_duration, const std::wstring& tween)\r
        {\r
                executor_.invoke([&]\r
                {\r
@@ -270,7 +270,7 @@ public:
        }\r
 \r
        template<typename T>\r
-       void reset_transform(int index, int mix_duration, const std::wstring& tween)\r
+       void reset_transform(int index, unsigned int mix_duration, const std::wstring& tween)\r
        {\r
                executor_.invoke([&]\r
                {               \r
@@ -306,17 +306,17 @@ safe_ptr<core::write_frame> frame_mixer_device::create_frame(void* tag, core::pi
        desc.planes.push_back( core::pixel_format_desc::plane(get_video_format_desc().width, get_video_format_desc().height, 4));\r
        return create_frame(tag, desc);\r
 }\r
-void frame_mixer_device::set_image_transform(const core::image_transform& transform, int mix_duration, const std::wstring& tween){impl_->set_transform<core::image_transform>(transform, mix_duration, tween);}\r
-void frame_mixer_device::set_image_transform(int index, const core::image_transform& transform, int mix_duration, const std::wstring& tween){impl_->set_transform<core::image_transform>(index, transform, mix_duration, tween);}\r
-void frame_mixer_device::set_audio_transform(const core::audio_transform& transform, int mix_duration, const std::wstring& tween){impl_->set_transform<core::audio_transform>(transform, mix_duration, tween);}\r
-void frame_mixer_device::set_audio_transform(int index, const core::audio_transform& transform, int mix_duration, const std::wstring& tween){impl_->set_transform<core::audio_transform>(index, transform, mix_duration, tween);}\r
-void frame_mixer_device::apply_image_transform(const std::function<core::image_transform(core::image_transform)>& transform, int mix_duration, const std::wstring& tween){impl_->apply_transform<core::image_transform>(transform, mix_duration, tween);}\r
-void frame_mixer_device::apply_image_transform(int index, const std::function<core::image_transform(core::image_transform)>& transform, int mix_duration, const std::wstring& tween){impl_->apply_transform<core::image_transform>(index, transform, mix_duration, tween);}\r
-void frame_mixer_device::apply_audio_transform(const std::function<core::audio_transform(core::audio_transform)>& transform, int mix_duration, const std::wstring& tween){impl_->apply_transform<core::audio_transform>(transform, mix_duration, tween);}\r
-void frame_mixer_device::apply_audio_transform(int index, const std::function<core::audio_transform(core::audio_transform)>& transform, int mix_duration, const std::wstring& tween){impl_->apply_transform<core::audio_transform>(index, transform, mix_duration, tween);}\r
-void frame_mixer_device::reset_image_transform(int mix_duration, const std::wstring& tween){impl_->reset_transform<core::image_transform>(mix_duration, tween);}\r
-void frame_mixer_device::reset_image_transform(int index, int mix_duration, const std::wstring& tween){impl_->reset_transform<core::image_transform>(index, mix_duration, tween);}\r
-void frame_mixer_device::reset_audio_transform(int mix_duration, const std::wstring& tween){impl_->reset_transform<core::audio_transform>(mix_duration, tween);}\r
-void frame_mixer_device::reset_audio_transform(int index, int mix_duration, const std::wstring& tween){impl_->reset_transform<core::audio_transform>(index, mix_duration, tween);}\r
+void frame_mixer_device::set_image_transform(const core::image_transform& transform, unsigned int mix_duration, const std::wstring& tween){impl_->set_transform<core::image_transform>(transform, mix_duration, tween);}\r
+void frame_mixer_device::set_image_transform(int index, const core::image_transform& transform, unsigned int mix_duration, const std::wstring& tween){impl_->set_transform<core::image_transform>(index, transform, mix_duration, tween);}\r
+void frame_mixer_device::set_audio_transform(const core::audio_transform& transform, unsigned int mix_duration, const std::wstring& tween){impl_->set_transform<core::audio_transform>(transform, mix_duration, tween);}\r
+void frame_mixer_device::set_audio_transform(int index, const core::audio_transform& transform, unsigned int mix_duration, const std::wstring& tween){impl_->set_transform<core::audio_transform>(index, transform, mix_duration, tween);}\r
+void frame_mixer_device::apply_image_transform(const std::function<core::image_transform(core::image_transform)>& transform, unsigned int mix_duration, const std::wstring& tween){impl_->apply_transform<core::image_transform>(transform, mix_duration, tween);}\r
+void frame_mixer_device::apply_image_transform(int index, const std::function<core::image_transform(core::image_transform)>& transform, unsigned int mix_duration, const std::wstring& tween){impl_->apply_transform<core::image_transform>(index, transform, mix_duration, tween);}\r
+void frame_mixer_device::apply_audio_transform(const std::function<core::audio_transform(core::audio_transform)>& transform, unsigned int mix_duration, const std::wstring& tween){impl_->apply_transform<core::audio_transform>(transform, mix_duration, tween);}\r
+void frame_mixer_device::apply_audio_transform(int index, const std::function<core::audio_transform(core::audio_transform)>& transform, unsigned int mix_duration, const std::wstring& tween){impl_->apply_transform<core::audio_transform>(index, transform, mix_duration, tween);}\r
+void frame_mixer_device::reset_image_transform(unsigned int mix_duration, const std::wstring& tween){impl_->reset_transform<core::image_transform>(mix_duration, tween);}\r
+void frame_mixer_device::reset_image_transform(int index, unsigned int mix_duration, const std::wstring& tween){impl_->reset_transform<core::image_transform>(index, mix_duration, tween);}\r
+void frame_mixer_device::reset_audio_transform(unsigned int mix_duration, const std::wstring& tween){impl_->reset_transform<core::audio_transform>(mix_duration, tween);}\r
+void frame_mixer_device::reset_audio_transform(int index, unsigned int mix_duration, const std::wstring& tween){impl_->reset_transform<core::audio_transform>(index, mix_duration, tween);}\r
 \r
 }}
\ No newline at end of file
index f3835663cc7d6e947a3252624c0c8fa9d6e5ed53..7bb9169618a8b8763255c772bd8fd17e83126e33 100644 (file)
@@ -55,22 +55,22 @@ public:
        \r
        const core::video_format_desc& get_video_format_desc() const; // nothrow\r
 \r
-       void set_image_transform(const core::image_transform& transform, int mix_duration = 0, const std::wstring& tween = L"linear");\r
-       void set_image_transform(int index, const core::image_transform& transform, int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void set_image_transform(const core::image_transform& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void set_image_transform(int index, const core::image_transform& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
 \r
-       void set_audio_transform(const core::audio_transform& transform, int mix_duration = 0, const std::wstring& tween = L"linear");\r
-       void set_audio_transform(int index, const core::audio_transform& transform, int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void set_audio_transform(const core::audio_transform& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void set_audio_transform(int index, const core::audio_transform& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
        \r
-       void apply_image_transform(const std::function<core::image_transform(core::image_transform)>& transform, int mix_duration = 0, const std::wstring& tween = L"linear");\r
-       void apply_image_transform(int index, const std::function<core::image_transform(core::image_transform)>& transform, int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void apply_image_transform(const std::function<core::image_transform(core::image_transform)>& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void apply_image_transform(int index, const std::function<core::image_transform(core::image_transform)>& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
 \r
-       void apply_audio_transform(const std::function<core::audio_transform(core::audio_transform)>& transform, int mix_duration = 0, const std::wstring& tween = L"linear");\r
-       void apply_audio_transform(int index, const std::function<core::audio_transform(core::audio_transform)>& transform, int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void apply_audio_transform(const std::function<core::audio_transform(core::audio_transform)>& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void apply_audio_transform(int index, const std::function<core::audio_transform(core::audio_transform)>& transform, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
 \r
-       void reset_image_transform(int mix_duration = 0, const std::wstring& tween = L"linear");\r
-       void reset_image_transform(int index, int mix_duration = 0, const std::wstring& tween = L"linear");\r
-       void reset_audio_transform(int mix_duration = 0, const std::wstring& tween = L"linear");\r
-       void reset_audio_transform(int index, int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void reset_image_transform(unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void reset_image_transform(int index, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void reset_audio_transform(unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
+       void reset_audio_transform(int index, unsigned int mix_duration = 0, const std::wstring& tween = L"linear");\r
 \r
 private:\r
        struct implementation;\r
index 9fb9b7bd2a2f50e17ffff0cf214388b231a33376..5c21b0601c73a5034731f6afa192ed476624d580 100644 (file)
@@ -28,41 +28,41 @@ namespace caspar { namespace core {
 struct read_frame::implementation : boost::noncopyable\r
 {\r
        boost::unique_future<safe_ptr<const host_buffer>> image_data_;\r
-       std::vector<short> audio_data_;\r
+       std::vector<int16_t> audio_data_;\r
 \r
 public:\r
-       implementation(boost::unique_future<safe_ptr<const host_buffer>>&& image_data, std::vector<short>&& audio_data) \r
+       implementation(boost::unique_future<safe_ptr<const host_buffer>>&& image_data, std::vector<int16_t>&& audio_data) \r
                : image_data_(std::move(image_data))\r
                , audio_data_(std::move(audio_data)){}  \r
 };\r
 \r
-read_frame::read_frame(boost::unique_future<safe_ptr<const host_buffer>>&& image_data, std::vector<short>&& audio_data) \r
+read_frame::read_frame(boost::unique_future<safe_ptr<const host_buffer>>&& image_data, std::vector<int16_t>&& audio_data) \r
        : impl_(new implementation(std::move(image_data), std::move(audio_data))){}\r
-read_frame::read_frame(safe_ptr<const host_buffer>&& image_data, std::vector<short>&& audio_data) \r
+read_frame::read_frame(safe_ptr<const host_buffer>&& image_data, std::vector<int16_t>&& audio_data) \r
 {\r
        boost::promise<safe_ptr<const host_buffer>> p;\r
        p.set_value(std::move(image_data));\r
        impl_.reset(new implementation(std::move(p.get_future()), std::move(audio_data)));\r
 }\r
 \r
-const boost::iterator_range<const unsigned char*> read_frame::image_data() const\r
+const boost::iterator_range<const uint8_t*> read_frame::image_data() const\r
 {\r
        try\r
        {\r
                if(!impl_->image_data_.get()->data())\r
-                       return boost::iterator_range<const unsigned char*>();\r
-               auto ptr = static_cast<const unsigned char*>(impl_->image_data_.get()->data());\r
-               return boost::iterator_range<const unsigned char*>(ptr, ptr + impl_->image_data_.get()->size());\r
+                       return boost::iterator_range<const uint8_t*>();\r
+               auto ptr = static_cast<const uint8_t*>(impl_->image_data_.get()->data());\r
+               return boost::iterator_range<const uint8_t*>(ptr, ptr + impl_->image_data_.get()->size());\r
        }\r
        catch(...) // image_data_ future might store exception.\r
        {\r
                CASPAR_LOG_CURRENT_EXCEPTION();\r
-               return boost::iterator_range<const unsigned char*>();\r
+               return boost::iterator_range<const uint8_t*>();\r
        }\r
 }\r
-const boost::iterator_range<const short*> read_frame::audio_data() const\r
+const boost::iterator_range<const int16_t*> read_frame::audio_data() const\r
 {\r
-       return boost::iterator_range<const short*>(impl_->audio_data_.data(), impl_->audio_data_.data() + impl_->audio_data_.size());\r
+       return boost::iterator_range<const int16_t*>(impl_->audio_data_.data(), impl_->audio_data_.data() + impl_->audio_data_.size());\r
 }\r
 \r
 }}
\ No newline at end of file
index 5bfbef5c69f92a6860b4193557fe2426db704298..ca7cba1194dc98b324bcf7b0c5f8b2a7744b8475 100644 (file)
@@ -36,18 +36,18 @@ class read_frame : boost::noncopyable
 {\r
        read_frame(){}\r
 public:\r
-       read_frame(boost::unique_future<safe_ptr<const host_buffer>>&& image_data, std::vector<short>&& audio_data);\r
-       read_frame(safe_ptr<const host_buffer>&& image_data, std::vector<short>&& audio_data);\r
+       read_frame(boost::unique_future<safe_ptr<const host_buffer>>&& image_data, std::vector<int16_t>&& audio_data);\r
+       read_frame(safe_ptr<const host_buffer>&& image_data, std::vector<int16_t>&& audio_data);\r
 \r
-       virtual const boost::iterator_range<const unsigned char*> image_data() const;\r
-       virtual const boost::iterator_range<const short*> audio_data() const;\r
+       virtual const boost::iterator_range<const uint8_t*> image_data() const;\r
+       virtual const boost::iterator_range<const int16_t*> audio_data() const;\r
        \r
        static safe_ptr<const read_frame> empty()\r
        {\r
                struct empty : public read_frame\r
                {                       \r
-                       virtual const boost::iterator_range<const unsigned char*> image_data() const {return boost::iterator_range<const unsigned char*>();}\r
-                       virtual const boost::iterator_range<const short*> audio_data() const {return boost::iterator_range<const short*>();}\r
+                       virtual const boost::iterator_range<const uint8_t*> image_data() const {return boost::iterator_range<const uint8_t*>();}\r
+                       virtual const boost::iterator_range<const int16_t*> audio_data() const {return boost::iterator_range<const int16_t*>();}\r
                };\r
                static safe_ptr<const empty> frame;\r
                return frame;\r
index 2933a7f51748bc33a70c06a9166eb6a487c15ba4..bf905b97cfaf850e2a22ebebd02556086b093792 100644 (file)
@@ -35,12 +35,12 @@ struct write_frame::implementation : boost::noncopyable
 {                              \r
        std::vector<safe_ptr<host_buffer>> buffers_;\r
        std::vector<safe_ptr<device_buffer>> textures_;\r
-       std::vector<short> audio_data_;\r
+       std::vector<int16_t> audio_data_;\r
        const core::pixel_format_desc desc_;\r
-       int tag_;\r
+       int32_t tag_;\r
 \r
 public:\r
-       implementation(int tag, const core::pixel_format_desc& desc, const std::vector<safe_ptr<host_buffer>>& buffers, const std::vector<safe_ptr<device_buffer>>& textures) \r
+       implementation(int32_t tag, const core::pixel_format_desc& desc, const std::vector<safe_ptr<host_buffer>>& buffers, const std::vector<safe_ptr<device_buffer>>& textures) \r
                : desc_(desc)\r
                , buffers_(buffers)\r
                , textures_(textures)\r
@@ -54,20 +54,20 @@ public:
                visitor.end();\r
        }\r
 \r
-       boost::iterator_range<unsigned char*> image_data(size_t index)\r
+       boost::iterator_range<uint8_t*> image_data(size_t index)\r
        {\r
                if(index >= buffers_.size() || !buffers_[index]->data())\r
-                       return boost::iterator_range<const unsigned char*>();\r
-               auto ptr = static_cast<unsigned char*>(buffers_[index]->data());\r
-               return boost::iterator_range<unsigned char*>(ptr, ptr+buffers_[index]->size());\r
+                       return boost::iterator_range<const uint8_t*>();\r
+               auto ptr = static_cast<uint8_t*>(buffers_[index]->data());\r
+               return boost::iterator_range<uint8_t*>(ptr, ptr+buffers_[index]->size());\r
        }\r
 \r
-       const boost::iterator_range<const unsigned char*> image_data(size_t index) const\r
+       const boost::iterator_range<const uint8_t*> image_data(size_t index) const\r
        {\r
                if(index >= buffers_.size() || !buffers_[index]->data())\r
-                       return boost::iterator_range<const unsigned char*>();\r
-               auto ptr = static_cast<const unsigned char*>(buffers_[index]->data());\r
-               return boost::iterator_range<const unsigned char*>(ptr, ptr+buffers_[index]->size());\r
+                       return boost::iterator_range<const uint8_t*>();\r
+               auto ptr = static_cast<const uint8_t*>(buffers_[index]->data());\r
+               return boost::iterator_range<const uint8_t*>(ptr, ptr+buffers_[index]->size());\r
        }\r
 \r
        void commit()\r
@@ -91,20 +91,20 @@ public:
        }\r
 };\r
        \r
-write_frame::write_frame(int tag, const core::pixel_format_desc& desc, const std::vector<safe_ptr<host_buffer>>& buffers, const std::vector<safe_ptr<device_buffer>>& textures) : impl_(new implementation(tag, desc, buffers, textures)){}\r
+write_frame::write_frame(int32_t tag, const core::pixel_format_desc& desc, const std::vector<safe_ptr<host_buffer>>& buffers, const std::vector<safe_ptr<device_buffer>>& textures) : impl_(new implementation(tag, desc, buffers, textures)){}\r
 void write_frame::accept(core::frame_visitor& visitor){impl_->accept(*this, visitor);}\r
 \r
-boost::iterator_range<unsigned char*> write_frame::image_data(size_t index){return impl_->image_data(index);}\r
-std::vector<short>& write_frame::audio_data() { return impl_->audio_data_; }\r
-const boost::iterator_range<const unsigned char*> write_frame::image_data(size_t index) const\r
+boost::iterator_range<uint8_t*> write_frame::image_data(size_t index){return impl_->image_data(index);}\r
+std::vector<int16_t>& write_frame::audio_data() { return impl_->audio_data_; }\r
+const boost::iterator_range<const uint8_t*> write_frame::image_data(size_t index) const\r
 {\r
-       return boost::iterator_range<const unsigned char*>(impl_->image_data(index).begin(), impl_->image_data(index).end());\r
+       return boost::iterator_range<const uint8_t*>(impl_->image_data(index).begin(), impl_->image_data(index).end());\r
 }\r
-const boost::iterator_range<const short*> write_frame::audio_data() const\r
+const boost::iterator_range<const int16_t*> write_frame::audio_data() const\r
 {\r
-       return boost::iterator_range<const short*>(impl_->audio_data_.data(), impl_->audio_data_.data() + impl_->audio_data_.size());\r
+       return boost::iterator_range<const int16_t*>(impl_->audio_data_.data(), impl_->audio_data_.data() + impl_->audio_data_.size());\r
 }\r
-int write_frame::tag() const {return impl_->tag_;}\r
+int32_t write_frame::tag() const {return impl_->tag_;}\r
 const core::pixel_format_desc& write_frame::get_pixel_format_desc() const{return impl_->desc_;}\r
 const std::vector<safe_ptr<device_buffer>>& write_frame::get_textures() const{return impl_->textures_;}\r
 const std::vector<safe_ptr<host_buffer>>& write_frame::get_buffers() const{return impl_->buffers_;}\r
index 9c48e29e4d8f04b14e2a79bf32895c0f194a87f3..44134d45a660120903ef6f4b7ed92decb8ce41ef 100644 (file)
@@ -41,13 +41,13 @@ public:
        explicit write_frame(int tag, const core::pixel_format_desc& desc, const std::vector<safe_ptr<host_buffer>>& buffers, const std::vector<safe_ptr<device_buffer>>& textures);\r
                        \r
        // core::write_frame\r
-       virtual boost::iterator_range<unsigned char*> image_data(size_t plane_index = 0);       \r
-       virtual std::vector<short>& audio_data();\r
+       virtual boost::iterator_range<uint8_t*> image_data(size_t plane_index = 0);     \r
+       virtual std::vector<int16_t>& audio_data();\r
        \r
-       virtual const boost::iterator_range<const unsigned char*> image_data(size_t plane_index = 0) const;\r
-       virtual const boost::iterator_range<const short*> audio_data() const;\r
+       virtual const boost::iterator_range<const uint8_t*> image_data(size_t plane_index = 0) const;\r
+       virtual const boost::iterator_range<const int16_t*> audio_data() const;\r
 \r
-       void commit(size_t plane_index);\r
+       void commit(uint32_t plane_index);\r
        void commit();\r
 \r
        virtual void accept(core::frame_visitor& visitor);\r
index b99dda3b057617fe5d6abf4fdeaaa80a449d8132..f9a3079bb409ea4f633b4397c09afa161288bf49 100644 (file)
@@ -44,7 +44,7 @@ public:
                auto frame = frame_factory->create_frame(this, 1, 1, pixel_format::bgra);\r
                \r
                // Read color from hex-string and write to frame pixel.\r
-               auto& value = *reinterpret_cast<unsigned long*>(frame->image_data().begin());\r
+               auto& value = *reinterpret_cast<uint32_t*>(frame->image_data().begin());\r
                std::wstringstream str(color_str_.substr(1));\r
                str >> std::hex >> value;\r
 \r
index 7f3c48b22533a072296a5b901b37687c394515e5..960fc7f078712057e9a6a4bae787877f66c0bf49 100644 (file)
@@ -44,7 +44,7 @@ const safe_ptr<frame_producer>& frame_producer::empty() // nothrow
        return producer;\r
 }      \r
 \r
-safe_ptr<basic_frame> frame_producer::receive_w_last()\r
+safe_ptr<basic_frame> frame_producer::receive_save_last()\r
 {\r
        auto frame = receive();\r
        if(frame != core::basic_frame::late())\r
@@ -57,7 +57,7 @@ safe_ptr<basic_frame> frame_producer::receive_w_last()
 \r
 safe_ptr<basic_frame> receive(const safe_ptr<frame_producer>& producer)\r
 {\r
-       return producer->receive_w_last();\r
+       return producer->receive_save_last();\r
 }\r
 \r
 safe_ptr<basic_frame> receive_and_follow(safe_ptr<frame_producer>& producer)\r
index 65c7a3e9e1ea1dd8ec4fe1e8194f3b4b4383d59e..67a4a3f6b42a46f86a3d3043b66c61b0e68932d4 100644 (file)
@@ -54,10 +54,11 @@ public:
        safe_ptr<core::basic_frame> last_frame() const {return last_frame_;}\r
        \r
 private:\r
-       virtual safe_ptr<basic_frame> receive() = 0;\r
        friend safe_ptr<basic_frame> receive(const safe_ptr<frame_producer>& producer);\r
 \r
-       safe_ptr<basic_frame> receive_w_last();\r
+       virtual safe_ptr<basic_frame> receive() = 0;\r
+\r
+       safe_ptr<basic_frame> receive_save_last();\r
 \r
        safe_ptr<core::basic_frame> last_frame_;\r
 };\r
index 2498370da820eeb3a74768278c317e80067896cf..d2004e579b8f1ce857521321fbf83921493e4d51 100644 (file)
@@ -37,7 +37,6 @@
 #include <boost/timer.hpp>\r
 \r
 #include <tbb/parallel_for.h>\r
-#include <tbb/mutex.h>\r
 \r
 #include <array>\r
 #include <memory>\r
@@ -47,21 +46,18 @@ namespace caspar { namespace core {
 \r
 struct frame_producer_device::implementation : boost::noncopyable\r
 {              \r
-       std::map<int, layer> layers_;           \r
-       \r
-       const video_format_desc format_desc_;\r
-       \r
+       std::map<int, layer>             layers_;               \r
+       const video_format_desc          format_desc_;  \r
        safe_ptr<diagnostics::graph> diag_;\r
+       const output_t                           output_;\r
 \r
-       const std::function<void(const std::map<int, safe_ptr<basic_frame>>&)> output_;\r
-\r
-       boost::timer frame_timer_;\r
-       boost::timer tick_timer_;\r
-       boost::timer output_timer_;\r
+       boost::timer                             frame_timer_;\r
+       boost::timer                             tick_timer_;\r
+       boost::timer                             output_timer_;\r
        \r
-       mutable executor executor_;\r
+       mutable executor                         executor_;\r
 public:\r
-       implementation(const video_format_desc& format_desc, const std::function<void(const std::map<int, safe_ptr<basic_frame>>&)>& output)  \r
+       implementation(const video_format_desc& format_desc, const output_t& output)  \r
                : format_desc_(format_desc)\r
                , diag_(diagnostics::create_graph(std::string("frame_producer_device")))\r
                , executor_(L"frame_producer_device")\r
@@ -198,7 +194,7 @@ public:
        }\r
 };\r
 \r
-frame_producer_device::frame_producer_device(const video_format_desc& format_desc, const std::function<void(const std::map<int, safe_ptr<basic_frame>>&)>& output) : impl_(new implementation(format_desc, output)){}\r
+frame_producer_device::frame_producer_device(const video_format_desc& format_desc, const output_t& output) : impl_(new implementation(format_desc, output)){}\r
 frame_producer_device::frame_producer_device(frame_producer_device&& other) : impl_(std::move(other.impl_)){}\r
 void frame_producer_device::swap(frame_producer_device& other){impl_->swap(other);}\r
 void frame_producer_device::load(int index, const safe_ptr<frame_producer>& producer, bool preview){impl_->load(index, producer, preview);}\r
index ced321e310c5c178acdcedea37341394ce4c421d..6ec495e362a1ee739b9e230b06ea94817281a1d2 100644 (file)
@@ -45,7 +45,9 @@ struct video_format_desc;
 class frame_producer_device : boost::noncopyable\r
 {\r
 public:\r
-       explicit frame_producer_device(const video_format_desc& format_desc, const std::function<void(const std::map<int, safe_ptr<basic_frame>>&)>& output);\r
+       typedef std::function<void(const std::map<int, safe_ptr<basic_frame>>&)> output_t;\r
+\r
+       explicit frame_producer_device(const video_format_desc& format_desc, const output_t& output);\r
        frame_producer_device(frame_producer_device&& other);\r
 \r
        void swap(frame_producer_device& other);\r
index d8eac2bb99b7ff51a1789ea8f5babae5d975b2b4..a9ef991d0d25af6ad325694759e221ad23745eca 100644 (file)
@@ -43,8 +43,7 @@ struct audio_decoder::implementation : boost::noncopyable
        input&                                                  input_;\r
        AVCodecContext&                                 codec_context_;         \r
        const core::video_format_desc   format_desc_;\r
-       std::vector<short>                              current_chunk_;\r
-       std::vector<std::vector<short>> chunks_;                \r
+       std::vector<int16_t>                    current_chunk_; \r
        size_t                                                  frame_number_;\r
        bool                                                    restarting_;\r
 public:\r
@@ -77,9 +76,9 @@ public:
                return result;\r
        }\r
 \r
-       std::deque<std::pair<int, std::vector<short>>> decode(const std::shared_ptr<AVPacket>& audio_packet)\r
+       std::deque<std::pair<int, std::vector<int16_t>>> decode(const std::shared_ptr<AVPacket>& audio_packet)\r
        {                       \r
-               std::deque<std::pair<int, std::vector<short>>> result;\r
+               std::deque<std::pair<int, std::vector<int16_t>>> result;\r
 \r
                if(!audio_packet)\r
                {       \r
@@ -111,7 +110,7 @@ public:
                const auto last = current_chunk_.end() - current_chunk_.size() % format_desc_.audio_samples_per_frame;\r
                \r
                for(auto it = current_chunk_.begin(); it != last; it += format_desc_.audio_samples_per_frame)           \r
-                       result.push_back(std::make_pair(frame_number_++, std::vector<short>(it, it + format_desc_.audio_samples_per_frame)));           \r
+                       result.push_back(std::make_pair(frame_number_++, std::vector<int16_t>(it, it + format_desc_.audio_samples_per_frame)));         \r
 \r
                current_chunk_.erase(current_chunk_.begin(), last);\r
 \r
@@ -125,6 +124,6 @@ public:
 };\r
 \r
 audio_decoder::audio_decoder(input& input, const core::video_format_desc& format_desc) : impl_(new implementation(input, format_desc)){}\r
-std::deque<std::pair<int, std::vector<short>>> audio_decoder::receive(){return impl_->receive();}\r
+std::deque<std::pair<int, std::vector<int16_t>>> audio_decoder::receive(){return impl_->receive();}\r
 void audio_decoder::restart(){impl_->restart();}\r
 }
\ No newline at end of file
index fe47799591bcd96dcc46c7fe7fb82f926bfcf9e4..0a0cc7a48027683d551a72c240d7812af6bb9cf9 100644 (file)
@@ -39,7 +39,7 @@ class audio_decoder : boost::noncopyable
 public:\r
        explicit audio_decoder(input& input, const core::video_format_desc& format_desc);\r
 \r
-       std::deque<std::pair<int, std::vector<short>>> receive();\r
+       std::deque<std::pair<int, std::vector<int16_t>>> receive();\r
 \r
        void restart();\r
 private:\r
index 1ef797f60a9f8d60cc59d3ae3e5a8c8fe3e63208..6f7d529d73f169eac1172f4300b3eb4cff029f7e 100644 (file)
@@ -47,6 +47,7 @@
 #include <crtdbg.h>\r
 #endif\r
 \r
+#include <cstdint>\r
 #include <winsock2.h>\r
 #include <tchar.h>\r
 #include <sstream>\r
index baeaef99e1e9fee6cca6b83a8d10b4d662f3cc76..c3e86a9e1a0fd09f080c5e7901e9d555b999c472 100644 (file)
         </bluefish>-->\r
       </consumers>\r
     </channel>\r
-    <channel>\r
-      <videomode>1080i5000</videomode>\r
-      <consumers>\r
-        <audio/>\r
-        <ogl>\r
-          <device>1</device>\r
-          <stretch>uniform</stretch>\r
-          <windowed>true</windowed>\r
-          <output>key_only</output>\r
-        </ogl>\r
-      </consumers>\r
-    </channel>\r
 </channels>\r
   <controllers>\r
     <tcp>\r
index 48bf5e2263bbb21269d88616459229ef0a214703..aa8edf040b6eec3652c2d6f508b599ea87689c35 100644 (file)
@@ -87,6 +87,15 @@ void setup_console_window()
        // Set console title.\r
        std::wstringstream str;\r
        str << "CasparCG Server " << caspar::env::version();\r
+#ifdef COMPILE_RELEASE\r
+       str << " Release";\r
+#elif  COMPILE_PROFILE\r
+       str << " Profile";\r
+#elif  COMPILE_DEVELOP\r
+       str << " Develop";\r
+#elif  COMPILE_DEBUG\r
+       str << " Debug";\r
+#endif\r
        SetConsoleTitle(str.str().c_str());\r
 }\r
 \r
index c19781e1437a536af8a9d14e69313cbda04a9fdd..4ff86fe99a32305b22cc5e237ce6ccefd6061ae7 100644 (file)
       <BrowseInformation>true</BrowseInformation>\r
       <WarningLevel>Level4</WarningLevel>\r
       <DebugInformationFormat>EditAndContinue</DebugInformationFormat>\r
-      <PreprocessorDefinitions>TBB_USE_CAPTURED_EXCEPTION=0;TBB_USE_ASSERT=1;TBB_USE_DEBUG;_DEBUG;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <PreprocessorDefinitions>TBB_USE_CAPTURED_EXCEPTION=0;TBB_USE_ASSERT=1;TBB_USE_DEBUG;_DEBUG;_CRT_SECURE_NO_WARNINGS;COMPILE_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <TreatWarningAsError>true</TreatWarningAsError>\r
       <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
       <FloatingPointModel>Fast</FloatingPointModel>\r
@@ -223,7 +223,7 @@ copy "$(ProjectDir)caspar.config" "$(OutDir)"</Command>
       <WarningLevel>Level4</WarningLevel>\r
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
       <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
-      <PreprocessorDefinitions>TBB_USE_CAPTURED_EXCEPTION=0;NDEBUG;_VC80_UPGRADE=0x0710;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <PreprocessorDefinitions>TBB_USE_CAPTURED_EXCEPTION=0;NDEBUG;_VC80_UPGRADE=0x0710;COMPILE_RELEASE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <WholeProgramOptimization>true</WholeProgramOptimization>\r
       <TreatWarningAsError>true</TreatWarningAsError>\r
       <FloatingPointModel>Fast</FloatingPointModel>\r
@@ -278,7 +278,7 @@ copy "$(ProjectDir)caspar.config" "$(OutDir)"</Command>
       <WarningLevel>Level4</WarningLevel>\r
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
       <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
-      <PreprocessorDefinitions>TBB_USE_CAPTURED_EXCEPTION=0;TBB_USE_THREADING_TOOLS=1;NDEBUG;_VC80_UPGRADE=0x0710;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <PreprocessorDefinitions>TBB_USE_CAPTURED_EXCEPTION=0;TBB_USE_THREADING_TOOLS=1;NDEBUG;_VC80_UPGRADE=0x0710;COMPILE_PROFILE;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <WholeProgramOptimization>false</WholeProgramOptimization>\r
       <TreatWarningAsError>true</TreatWarningAsError>\r
       <FloatingPointModel>Fast</FloatingPointModel>\r
@@ -333,7 +333,7 @@ copy "$(ProjectDir)caspar.config" "$(OutDir)"</Command>
       <WarningLevel>Level4</WarningLevel>\r
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>\r
       <MultiProcessorCompilation>true</MultiProcessorCompilation>\r
-      <PreprocessorDefinitions>TBB_USE_CAPTURED_EXCEPTION=0;TBB_USE_ASSERT=1;TBB_USE_PERFORMANCE_WARNINGS=1;NDEBUG;_VC80_UPGRADE=0x0710;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
+      <PreprocessorDefinitions>TBB_USE_CAPTURED_EXCEPTION=0;TBB_USE_ASSERT=1;TBB_USE_PERFORMANCE_WARNINGS=1;NDEBUG;_VC80_UPGRADE=0x0710;COMPILE_DEVELOP;%(PreprocessorDefinitions)</PreprocessorDefinitions>\r
       <WholeProgramOptimization>false</WholeProgramOptimization>\r
       <TreatWarningAsError>true</TreatWarningAsError>\r
       <FloatingPointModel>Fast</FloatingPointModel>\r