]> git.sesse.net Git - casparcg/commitdiff
2.0. More header optimizations.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 8 Aug 2011 13:46:14 +0000 (13:46 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Mon, 8 Aug 2011 13:46:14 +0000 (13:46 +0000)
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@1091 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

24 files changed:
common/concurrency/executor.h
common/log/log.cpp
common/log/log.h
common/memory/safe_ptr.h
core/producer/frame_producer.h
modules/bluefish/bluefish.cpp
modules/bluefish/consumer/bluefish_consumer.cpp
modules/bluefish/consumer/bluefish_consumer.h
modules/decklink/consumer/decklink_consumer.cpp
modules/decklink/consumer/decklink_consumer.h
modules/decklink/producer/decklink_producer.cpp
modules/ffmpeg/consumer/ffmpeg_consumer.h
modules/ffmpeg/ffmpeg.h
modules/image/producer/image_scroll_producer.cpp
modules/image/util/image_loader.cpp
modules/oal/consumer/oal_consumer.cpp
modules/oal/consumer/oal_consumer.h
modules/oal/oal.cpp
modules/ogl/consumer/ogl_consumer.cpp
modules/ogl/consumer/ogl_consumer.h
shell/main.cpp
shell/server.cpp
shell/server.h
shell/shell.vcxproj

index 87fd167bce85d4fb129cefbcc90dffa500b73417..c4ba4008f95af44af38d5601afed9a238813af0c 100644 (file)
@@ -20,7 +20,7 @@
 #pragma once\r
 \r
 #include "../exception/win32_exception.h"\r
-#include "../utility/assert.h"\r
+#include "../utility/string.h"\r
 #include "../log/log.h"\r
 \r
 #include <tbb/atomic.h>\r
index 4675ba4de74cbbd20eb5d6c2115cd599f4c84268..ebb25cbb483d88e7b446f418bbd773825b2ed279 100644 (file)
@@ -27,7 +27,7 @@
 #include "log.h"\r
 \r
 #include "../exception/exceptions.h"\r
-\r
+#include "../utility/string.h"\r
 #include <ios>\r
 #include <string>\r
 #include <ostream>\r
index b0d7fdca0256cf210db6fcb81568248a19cfed04..1e81522a7796e5665aea698fe99e7f010cbbbdc3 100644 (file)
@@ -34,8 +34,6 @@
 #include <boost/log/sources/severity_logger.hpp>\r
 #include <boost/log/sources/record_ostream.hpp>\r
 \r
-#include "../utility/string.h"\r
-\r
 namespace caspar { namespace log {\r
        \r
 namespace internal{\r
@@ -90,7 +88,7 @@ BOOST_LOG_DECLARE_GLOBAL_LOGGER_INIT(logger, caspar_logger)
 \r
 #define CASPAR_LOG_CURRENT_EXCEPTION() \\r
        try\\r
-       {CASPAR_LOG(error) << caspar::widen(boost::current_exception_diagnostic_information());}\\r
+       {CASPAR_LOG(error) << boost::current_exception_diagnostic_information().c_str();}\\r
        catch(...){}\r
 \r
 }}\r
index 5b371808c22ace5fc4a0b23b747b94ddf8798c40..f649f0e06c7f5efe82fef3c86d239bd350491f8b 100644 (file)
@@ -23,8 +23,6 @@
 #include <type_traits>\r
 #include <exception>\r
 \r
-#include "../utility/assert.h"\r
-\r
 namespace caspar {\r
        \r
 template<typename T>\r
@@ -107,19 +105,16 @@ public:
 \r
        T& operator*() const // noexcept\r
        {\r
-               CASPAR_ASSERT(impl_);\r
                return *impl_.get();\r
        } \r
 \r
        T* operator->() const // noexcept\r
        {\r
-               CASPAR_ASSERT(impl_);\r
                return impl_.get();\r
        } \r
 \r
        T* get() const // noexcept\r
        {\r
-               CASPAR_ASSERT(impl_);\r
                return impl_.get();\r
        }  \r
 \r
index aa51269df41d5c397da4ca86279d6bab21f4a085..3202d93e89a5ae97923d3e972604b8bf945b8994 100644 (file)
@@ -26,6 +26,7 @@
 #include <functional>\r
 #include <string>\r
 #include <vector>\r
+#include <stdint.h>\r
 \r
 namespace caspar { namespace core {\r
 \r
index 8cd7bf9a991e4422cbea8d230108fa0202a48b50..a658786c5696f912d41d5f0dc49b8dc73c470b0c 100644 (file)
 */\r
 #include "bluefish.h"\r
 \r
+#include "consumer/bluefish_consumer.h"\r
+\r
 #include "util/blue_velvet.h"\r
 \r
+#include <common/log/log.h>\r
+#include <common/utility/string.h>\r
+\r
 #include <core/consumer/frame_consumer.h>\r
 \r
-#include "consumer/bluefish_consumer.h"\r
+#include <boost/lexical_cast.hpp>\r
 \r
 namespace caspar {\r
 \r
index 648cd8f64bd59bc4060e33ae0dba05b85a4ba7cb..64307aa47bac7386a41f2070468fb5e0756c68ed 100644 (file)
@@ -32,6 +32,8 @@
 #include <common/memory/memclr.h>\r
 #include <common/utility/timer.h>\r
 \r
+#include <core/consumer/frame_consumer.h>\r
+\r
 #include <tbb/concurrent_queue.h>\r
 \r
 #include <boost/timer.hpp>\r
index b53addd35ebc98706dcc39152e9a528608eb64a9..90249d4716fe6b185f22af751e652a6c97c71312 100644 (file)
@@ -19,7 +19,6 @@
 */\r
 #pragma once\r
 \r
-#include <core/consumer/frame_consumer.h>\r
 #include <common/memory/safe_ptr.h>\r
 \r
 #include <boost/property_tree/ptree.hpp>\r
 #include <string>\r
 \r
 namespace caspar { \r
+\r
+namespace core {\r
+       struct frame_consumer;\r
+}\r
                        \r
 safe_ptr<core::frame_consumer> create_bluefish_consumer(const std::vector<std::wstring>& params);\r
 safe_ptr<core::frame_consumer> create_bluefish_consumer(const boost::property_tree::ptree& ptree);\r
index fc888b42611e0fbb3dcb8dbe71e8f7b27029b00b..78bf816c6cf05b3ad88af55b9d6173111d4d2a5e 100644 (file)
@@ -35,6 +35,8 @@
 #include <common/memory/memclr.h>\r
 #include <common/memory/memshfl.h>\r
 \r
+#include <core/consumer/frame_consumer.h>\r
+\r
 #include <tbb/concurrent_queue.h>\r
 \r
 #include <boost/circular_buffer.hpp>\r
index 41d49bb7669e715bcb99803a7d217ca08fd04156..3d8a9f3a19bbc8e1e48a946280cc3bf41b30dfa1 100644 (file)
@@ -19,7 +19,8 @@
 */\r
 #pragma once\r
 \r
-#include <core/consumer/frame_consumer.h>\r
+#include <common/memory/safe_ptr.h>\r
+\r
 #include <core/video_format.h>\r
 \r
 #include <boost/property_tree/ptree.hpp>\r
 #include <vector>\r
 \r
 namespace caspar { \r
+\r
+namespace core {\r
+       struct frame_consumer;\r
+}\r
        \r
 safe_ptr<core::frame_consumer> create_decklink_consumer(const std::vector<std::wstring>& params);\r
 safe_ptr<core::frame_consumer> create_decklink_consumer(const boost::property_tree::ptree& ptree);\r
index 3ebd322543313a5533ff528033d510b602a84693..f5e152efffa4fd814c1f6e8c9ba433788f19e8d9 100644 (file)
@@ -39,7 +39,6 @@
 #include <core/producer/frame/frame_factory.h>\r
 \r
 #include <tbb/concurrent_queue.h>\r
-#include <tbb/atomic.h>\r
 \r
 #include <boost/algorithm/string.hpp>\r
 #include <boost/timer.hpp>\r
index 644e1fea623286bcc71bd10c0372f63c08f59196..979c598744a37fcac275a3f9694d5c701ef9d310 100644 (file)
 */\r
 #pragma once\r
 \r
-#include <boost/property_tree/ptree.hpp>\r
-\r
-#include <string>\r
-#include <vector>\r
+//#include <boost/property_tree/ptree.hpp>\r
+//\r
+//#include <string>\r
+//#include <vector>\r
 \r
 namespace caspar { \r
        \r
index 1147dafd510997a1d576be409d48f5c5d4ec572c..679182ab36e60550816ce3521753b41c9b8b835d 100644 (file)
@@ -19,6 +19,8 @@
 */\r
 #pragma once\r
 \r
+#include <string>\r
+\r
 namespace caspar {\r
 \r
 void init_ffmpeg();\r
index ccf55b3657733d3d6bc9cd3ad393e9cdbe08e7ae..900a7ab7da9135435edbe723e5c348797245f8df 100644 (file)
@@ -35,6 +35,7 @@
 #include <boost/assign.hpp>\r
 #include <boost/filesystem.hpp>\r
 #include <boost/foreach.hpp>\r
+#include <boost/lexical_cast.hpp>\r
 \r
 #include <algorithm>\r
 \r
index e1b29ca9894dd3cf46611313a69c2fa575eb8442..30f89831bd443aac03a94314d9e404923e9f3a56 100644 (file)
@@ -28,7 +28,6 @@
 \r
 #include <boost/exception/errinfo_file_name.hpp>\r
 #include <boost/filesystem.hpp>\r
-#include <boost/thread/once.hpp>\r
 \r
 namespace caspar { \r
 \r
index 645a87cb5a7c600867221d89f3cbdaded7d9a40d..6341273ad375cebc06f5e76f0ea84371c5794080 100644 (file)
@@ -23,7 +23,9 @@
 #include <common/diagnostics/graph.h>\r
 #include <common/log/log.h>\r
 #include <common/utility/timer.h>\r
+#include <common/utility/string.h>\r
 \r
+#include <core/consumer/frame_consumer.h>\r
 #include <core/video_format.h>\r
 \r
 #include <core/mixer/read_frame.h>\r
 \r
 namespace caspar {\r
 \r
-struct oal_consumer::implementation : public sf::SoundStream, boost::noncopyable\r
+struct oal_consumer : public core::frame_consumer,  public sf::SoundStream\r
 {\r
-       safe_ptr<diagnostics::graph> graph_;\r
-       boost::timer perf_timer_;\r
+       safe_ptr<diagnostics::graph>                                            graph_;\r
+       boost::timer                                                                            perf_timer_;\r
 \r
-       tbb::concurrent_bounded_queue<std::vector<short>> input_;\r
-       boost::circular_buffer<std::vector<short>> container_;\r
-       tbb::atomic<bool> is_running_;\r
+       tbb::concurrent_bounded_queue<std::vector<short>>       input_;\r
+       boost::circular_buffer<std::vector<short>>                      container_;\r
+       tbb::atomic<bool>                                                                       is_running_;\r
 \r
-       core::video_format_desc format_desc_;\r
-       int preroll_count_;\r
+       core::video_format_desc                                                         format_desc_;\r
+       int                                                                                                     preroll_count_;\r
 public:\r
-       implementation(const core::video_format_desc& format_desc\r
+       oal_consumer(\r
                : graph_(diagnostics::create_graph(narrow(print())))\r
                , container_(5)\r
-               , format_desc_(format_desc)\r
                , preroll_count_(0)\r
        {\r
                graph_->add_guide("tick-time", 0.5);\r
                graph_->set_color("tick-time", diagnostics::color(0.1f, 0.7f, 0.8f));\r
                is_running_ = true;\r
                input_.set_capacity(core::consumer_buffer_depth()-2);\r
-               \r
-               sf::SoundStream::Initialize(2, 48000);\r
-               Play();         \r
-               CASPAR_LOG(info) << print() << " Sucessfully initialized.";\r
        }\r
 \r
-       ~implementation()\r
+       ~oal_consumer()\r
        {\r
                is_running_ = false;\r
                input_.try_push(std::vector<short>());\r
@@ -73,8 +70,16 @@ public:
                Stop();\r
                CASPAR_LOG(info) << print() << L" Shutting down.";      \r
        }\r
+\r
+       virtual void initialize(const core::video_format_desc& format_desc)\r
+       {\r
+               format_desc_ = format_desc;             \r
+               sf::SoundStream::Initialize(2, 48000);\r
+               Play();         \r
+               CASPAR_LOG(info) << print() << " Sucessfully initialized.";\r
+       }\r
        \r
-       void send(const safe_ptr<core::read_frame>& frame)\r
+       virtual void send(const safe_ptr<core::read_frame>& frame)\r
        {                       \r
                if(preroll_count_ < input_.capacity())\r
                {\r
@@ -85,7 +90,7 @@ public:
                input_.push(std::vector<int16_t>(frame->audio_data().begin(), frame->audio_data().end()));      \r
        }\r
 \r
-       size_t buffer_depth() const{return 3;}\r
+       virtual size_t buffer_depth() const{return 3;}\r
 \r
        virtual bool OnGetData(sf::SoundStream::Chunk& data)\r
        {               \r
@@ -102,19 +107,16 @@ public:
                return is_running_;\r
        }\r
 \r
-       std::wstring print() const\r
+       virtual std::wstring print() const\r
        {\r
                return L"oal[" + format_desc_.name + L"]";\r
        }\r
-};\r
 \r
-oal_consumer::oal_consumer(){}\r
-oal_consumer::oal_consumer(oal_consumer&& other) : impl_(std::move(other.impl_)){}\r
-void oal_consumer::send(const safe_ptr<core::read_frame>& frame){impl_->send(frame);}\r
-size_t oal_consumer::buffer_depth() const{return impl_->buffer_depth();}\r
-void oal_consumer::initialize(const core::video_format_desc& format_desc){impl_.reset(new implementation(format_desc));}\r
-std::wstring oal_consumer::print() const { return impl_->print(); }\r
-const core::video_format_desc& oal_consumer::get_video_format_desc() const{return impl_->format_desc_;}\r
+       virtual const core::video_format_desc& get_video_format_desc() const\r
+       {\r
+               return format_desc_;\r
+       }\r
+};\r
 \r
 safe_ptr<core::frame_consumer> create_oal_consumer(const std::vector<std::wstring>& params)\r
 {\r
@@ -123,4 +125,10 @@ safe_ptr<core::frame_consumer> create_oal_consumer(const std::vector<std::wstrin
 \r
        return make_safe<oal_consumer>();\r
 }\r
+\r
+safe_ptr<core::frame_consumer> create_oal_consumer()\r
+{\r
+       return make_safe<oal_consumer>();\r
+}\r
+\r
 }\r
index efa6f38a6e7f919a9763c690fb07207c7407fed0..64e87eb0f85d921b51aef1da169266916fe0b4c1 100644 (file)
 */\r
 #pragma once\r
 \r
+#include <common/memory/safe_ptr.h>\r
+\r
 #include <core/video_format.h>\r
-#include <core/consumer/frame_consumer.h>\r
 \r
 #include <vector>\r
 \r
 namespace caspar {\r
-       \r
-class oal_consumer : public core::frame_consumer\r
-{\r
-public:        \r
-       explicit oal_consumer();\r
-       oal_consumer(oal_consumer&& other);\r
-\r
-       // frame_consumer\r
-       virtual void initialize(const core::video_format_desc& format_desc);    \r
-       virtual void send(const safe_ptr<core::read_frame>&);\r
-       virtual size_t buffer_depth() const;\r
-       virtual std::wstring print() const;\r
-       virtual const core::video_format_desc& get_video_format_desc() const;\r
-private:\r
-       struct implementation;\r
-       std::shared_ptr<implementation> impl_;\r
-};\r
+\r
+namespace core {\r
+       struct frame_consumer;\r
+}      \r
 \r
 safe_ptr<core::frame_consumer> create_oal_consumer(const std::vector<std::wstring>& params);\r
+safe_ptr<core::frame_consumer> create_oal_consumer();\r
 \r
 }
\ No newline at end of file
index cfe107beffb5a79e3ddc6697c04b51ea65109e8c..8c27fd2510f2be6d6cbb3d5483507555fbabeff6 100644 (file)
@@ -28,7 +28,7 @@ namespace caspar
 \r
 void init_oal()\r
 {\r
-       core::register_consumer_factory(create_oal_consumer);\r
+       core::register_consumer_factory([](const std::vector<std::wstring>& params){return create_oal_consumer(params);});\r
 }\r
 \r
 }
\ No newline at end of file
index 35178486a12ac47a8b687cd4eac3b587aa9f954f..e8d04cdec0c3d353bd9156cd1abf3f96ea422a9a 100644 (file)
@@ -26,9 +26,6 @@
 \r
 #include "ogl_consumer.h"\r
 \r
-#include <core/video_format.h>\r
-#include <core/mixer/read_frame.h>\r
-\r
 #include <common/gl/gl_check.h>\r
 #include <common/concurrency/executor.h>\r
 #include <common/memory/safe_ptr.h>\r
 #include <common/diagnostics/graph.h>\r
 #include <common/utility/timer.h>\r
 \r
+#include <core/video_format.h>\r
+#include <core/mixer/read_frame.h>\r
+#include <core/consumer/frame_consumer.h>\r
+\r
 #include <boost/timer.hpp>\r
 #include <boost/circular_buffer.hpp>\r
 \r
index 6b5ca3a48c0033c131b39f2fc8aa012c06fb5c78..382aae89caf0a74273837524b1b7fdf74f99537a 100644 (file)
 */\r
 #pragma once\r
 \r
-#include <core/consumer/frame_consumer.h>\r
-#include <core/video_format.h>\r
+#include <common/memory/safe_ptr.h>\r
 \r
 #include <vector>\r
 #include <boost/property_tree/ptree.hpp>\r
 \r
 namespace caspar {\r
 \r
+namespace core {\r
+       struct frame_consumer;\r
+}\r
+\r
 safe_ptr<core::frame_consumer> create_ogl_consumer(const std::vector<std::wstring>& params);\r
 safe_ptr<core::frame_consumer> create_ogl_consumer(const boost::property_tree::ptree& ptree);\r
 \r
index 322877da3cdbd38781ed6bca0d047c161d5f463c..2b016d0da6a8bd2f7ba85485e85775a07a13eb76 100644 (file)
 #include <windows.h>\r
 #include <atlbase.h>\r
 \r
-#include <GL/glew.h>\r
-\r
-#include <core/mixer/gpu/ogl_device.h>\r
-\r
 #include <protocol/amcp/AMCPProtocolStrategy.h>\r
 \r
 #include <modules/bluefish/bluefish.h>\r
 #include <common/gl/gl_check.h>\r
 #include <common/os/windows/current_version.h>\r
 #include <common/os/windows/system_info.h>\r
-#include <common/utility/assert.h>\r
+\r
+#include <core/mixer/gpu/ogl_device.h>\r
 \r
 #include <tbb/task_scheduler_observer.h>\r
-#include <tbb/task_scheduler_init.h>\r
 \r
-#include <boost/foreach.hpp>\r
 #include <boost/property_tree/detail/file_parser_error.hpp>\r
 \r
+#include <algorithm>\r
+\r
 // NOTE: This is needed in order to make CComObject work since this is not a real ATL project.\r
 CComModule _AtlModule;\r
 extern __declspec(selectany) CAtlModule* _pAtlModule = &_AtlModule;\r
@@ -125,13 +122,18 @@ void print_info()
        CASPAR_LOG(info) << L"FreeImage " << caspar::get_image_version();\r
        \r
        CASPAR_LOG(info) << L"Decklink " << caspar::get_decklink_version();\r
-       BOOST_FOREACH(auto& device, caspar::get_decklink_device_list())\r
+       auto deck = caspar::get_decklink_device_list();\r
+       std::for_each(deck.begin(), deck.end(), [](const std::wstring& device)\r
+       {\r
                CASPAR_LOG(info) << device;\r
+       });\r
                \r
-       CASPAR_LOG(info) << L"Bluefish " << caspar::get_bluefish_version();\r
-       BOOST_FOREACH(auto& device, caspar::get_bluefish_device_list())\r
+       auto blue = caspar::get_bluefish_device_list();\r
+       std::for_each(blue.begin(), blue.end(), [](const std::wstring& device)\r
+       {\r
                CASPAR_LOG(info) << device;\r
-\r
+       });\r
+       \r
        CASPAR_LOG(info) << L"FFMPEG-avcodec "  << caspar::get_avcodec_version();\r
        CASPAR_LOG(info) << L"FFMPEG-avformat " << caspar::get_avformat_version();\r
        CASPAR_LOG(info) << L"FFMPEG-avfilter " << caspar::get_avfilter_version();\r
index e3c33749f3ee6dd575ec1f6a789793d7966f21dc..b121b809819c43776d951fd00d19f20f75717842 100644 (file)
@@ -51,7 +51,6 @@
 \r
 #include <boost/algorithm/string.hpp>\r
 #include <boost/lexical_cast.hpp>\r
-#include <boost/filesystem.hpp>\r
 #include <boost/foreach.hpp>\r
 #include <boost/property_tree/ptree.hpp>\r
 #include <boost/property_tree/xml_parser.hpp>\r
@@ -61,11 +60,10 @@ namespace caspar {
 using namespace core;\r
 using namespace protocol;\r
 \r
-\r
 struct server::implementation : boost::noncopyable\r
 {\r
        std::vector<safe_ptr<IO::AsyncEventServer>> async_servers_;     \r
-       std::vector<safe_ptr<video_channel>>                            channels_;\r
+       std::vector<safe_ptr<video_channel>>            channels_;\r
        ogl_device                                                                      ogl_;\r
 \r
        implementation()                                                                                                \r
@@ -117,7 +115,7 @@ struct server::implementation : boost::noncopyable
                                        //else if(name == "file")                                       \r
                                        //      channels_.back()->output()->add(index++, create_ffmpeg_consumer(xml_consumer.second));                                          \r
                                        else if(name == "audio")\r
-                                               channels_.back()->output()->add(index++, make_safe<oal_consumer>());            \r
+                                               channels_.back()->output()->add(index++, create_oal_consumer());                \r
                                        else if(name != "<xmlcomment>")\r
                                                CASPAR_LOG(warning) << "Invalid consumer: " << widen(name);     \r
                                }\r
index 579a1e7d1182196609d69a5ee4dd1da0024fe882..53b2c66c53a8bb676c70ae0c515a9d3e3ea09ac9 100644 (file)
 \r
 #pragma once\r
 \r
-#include <core/video_channel.h>\r
-\r
-#include <common/exception/exceptions.h>\r
+#include <common/memory/safe_ptr.h>\r
 \r
 #include <boost/noncopyable.hpp>\r
 \r
 #include <vector>\r
 \r
 namespace caspar {\r
-               \r
+\r
+namespace core {\r
+       class video_channel;\r
+}\r
+\r
 class server : boost::noncopyable\r
 {\r
 public:\r
        server();\r
-\r
        const std::vector<safe_ptr<core::video_channel>> get_channels() const;\r
-\r
 private:\r
        struct implementation;\r
-       std::shared_ptr<implementation> impl_;\r
+       safe_ptr<implementation> impl_;\r
 };\r
 \r
 }
\ No newline at end of file
index 4b1a152a5473da786ba86caa90f7609914edf1e0..244b58fdb95d265b924cb4a8ca5ef5d47f1adc10 100644 (file)
@@ -25,6 +25,7 @@
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">NotUsing</PrecompiledHeader>\r
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Develop|Win32'">NotUsing</PrecompiledHeader>\r
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">NotUsing</PrecompiledHeader>\r
+      <ShowIncludes Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ShowIncludes>\r
     </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r