]> git.sesse.net Git - casparcg/commitdiff
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sun, 9 Jan 2011 21:15:11 +0000 (21:15 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sun, 9 Jan 2011 21:15:11 +0000 (21:15 +0000)
22 files changed:
core/configuration.cpp [moved from core/server.cpp with 76% similarity]
core/configuration.h [moved from core/server.h with 86% similarity]
core/consumer/bluefish/util.h
core/consumer/decklink/DeckLinkAPI_i.c
core/consumer/decklink/util.h
core/consumer/frame_consumer_device.cpp
core/consumer/oal/oal_consumer.cpp
core/core.vcxproj
core/core.vcxproj.filters
core/format/video_format.cpp
core/format/video_format.h
core/producer/ffmpeg/audio/audio_decoder.cpp
core/producer/ffmpeg/audio/audio_decoder.h
core/producer/ffmpeg/ffmpeg_producer.cpp
core/producer/ffmpeg/input.cpp
core/producer/ffmpeg/input.h
core/producer/ffmpeg/video/video_decoder.cpp
core/producer/flash/cg_producer.cpp
core/producer/image/image_scroll_producer.cpp
core/protocol/amcp/AMCPCommandsImpl.cpp
core/protocol/cii/CIIProtocolStrategy.cpp
shell/main.cpp

similarity index 76%
rename from core/server.cpp
rename to core/configuration.cpp
index 66b42498debc3aabc312003c1cbe06e36c88ec72..814a34f7a5b08f03a1e628a1de77b5898386e958 100644 (file)
@@ -1,6 +1,6 @@
 #include "StdAfx.h"\r
 \r
-#include "server.h"\r
+#include "configuration.h"\r
 #include "channel.h"\r
 \r
 #include "consumer/oal/oal_consumer.h"\r
@@ -31,7 +31,7 @@
 \r
 namespace caspar { namespace core {\r
 \r
-struct server::implementation : boost::noncopyable\r
+struct configuration::implementation : boost::noncopyable\r
 {\r
        implementation()                                                                                                \r
        {                       \r
@@ -48,7 +48,7 @@ struct server::implementation : boost::noncopyable
 \r
        ~implementation()\r
        {                               \r
-               async_servers_.clear();\r
+               async_configurations_.clear();\r
                channels_.clear();\r
        }\r
 \r
@@ -132,9 +132,9 @@ struct server::implementation : boost::noncopyable
                                {                                       \r
                                        unsigned int port = xml_controller.second.get<unsigned int>("port");\r
                                        port = port != 0 ? port : 5250;\r
-                                       auto asyncserver = make_safe<IO::AsyncEventServer>(create_protocol(protocol), port);\r
-                                       asyncserver->Start();\r
-                                       async_servers_.push_back(asyncserver);\r
+                                       auto asyncconfiguration = make_safe<IO::AsyncEventServer>(create_protocol(protocol), port);\r
+                                       asyncconfiguration->Start();\r
+                                       async_configurations_.push_back(asyncconfiguration);\r
                                }\r
                                else\r
                                        BOOST_THROW_EXCEPTION(invalid_configuration() << arg_name_info(name) << msg_info("Invalid controller"));\r
@@ -158,7 +158,7 @@ struct server::implementation : boost::noncopyable
                BOOST_THROW_EXCEPTION(invalid_configuration() << arg_name_info("name") << arg_value_info(name) << msg_info("Invalid protocol"));\r
        }\r
 \r
-       std::vector<safe_ptr<IO::AsyncEventServer>> async_servers_;\r
+       std::vector<safe_ptr<IO::AsyncEventServer>> async_configurations_;\r
        \r
        std::vector<safe_ptr<channel>> channels_;\r
 \r
@@ -170,38 +170,38 @@ struct server::implementation : boost::noncopyable
        static std::wstring data_folder_;\r
 };\r
 \r
-std::wstring server::implementation::media_folder_ = L"";\r
-std::wstring server::implementation::log_folder_ = L"";\r
-std::wstring server::implementation::template_folder_ = L"";\r
-std::wstring server::implementation::data_folder_ = L"";\r
+std::wstring configuration::implementation::media_folder_ = L"";\r
+std::wstring configuration::implementation::log_folder_ = L"";\r
+std::wstring configuration::implementation::template_folder_ = L"";\r
+std::wstring configuration::implementation::data_folder_ = L"";\r
 \r
-server::server() : impl_(new implementation()){}\r
+configuration::configuration() : impl_(new implementation()){}\r
 \r
-const std::wstring& server::media_folder()\r
+const std::wstring& configuration::media_folder()\r
 {\r
-       server::implementation::setup_paths();\r
-       return server::implementation::media_folder_;\r
+       configuration::implementation::setup_paths();\r
+       return configuration::implementation::media_folder_;\r
 }\r
 \r
-const std::wstring& server::log_folder()\r
+const std::wstring& configuration::log_folder()\r
 {\r
-       server::implementation::setup_paths();\r
-       return server::implementation::log_folder_;\r
+       configuration::implementation::setup_paths();\r
+       return configuration::implementation::log_folder_;\r
 }\r
 \r
-const std::wstring& server::template_folder()\r
+const std::wstring& configuration::template_folder()\r
 {\r
-       server::implementation::setup_paths();\r
-       return server::implementation::template_folder_;\r
+       configuration::implementation::setup_paths();\r
+       return configuration::implementation::template_folder_;\r
 }\r
 \r
-const std::wstring& server::data_folder()\r
+const std::wstring& configuration::data_folder()\r
 {\r
-       server::implementation::setup_paths();\r
-       return server::implementation::data_folder_;\r
+       configuration::implementation::setup_paths();\r
+       return configuration::implementation::data_folder_;\r
 }\r
 \r
-const std::vector<safe_ptr<channel>> server::get_channels() const\r
+const std::vector<safe_ptr<channel>> configuration::get_channels() const\r
 {\r
        return impl_->channels_;\r
 }\r
similarity index 86%
rename from core/server.h
rename to core/configuration.h
index fa46ec2ab9f216edf02a008b2fabe4cf371f359f..803d67f958444ff4f3b1d41e955b04f960bfbf44 100644 (file)
@@ -12,10 +12,10 @@ namespace caspar { namespace core {
        \r
 struct invalid_configuration : virtual boost::exception, virtual std::exception {};\r
 \r
-class server : boost::noncopyable\r
+class configuration : boost::noncopyable\r
 {\r
 public:\r
-       server();\r
+       configuration();\r
 \r
        static const std::wstring& media_folder();\r
        static const std::wstring& log_folder();\r
index eb13e614939f41aace15b2d2b888076d020dd776..e5b51658eb9e1e6560ec5e7e615b3845d95d9f41 100644 (file)
@@ -3,8 +3,6 @@
 #include <BlueVelvet4.h>\r
 #include "../../format/video_format.h"\r
 \r
-#include <memory>\r
-\r
 namespace caspar { namespace core { namespace bluefish {\r
        \r
 inline bool is_epoch_card(int card_type)\r
@@ -25,7 +23,7 @@ inline EVideoMode vid_fmt_from_video_format(const video_format::type& fmt)
        //case video_format::ntsc:              return VID_FMT_NTSC;\r
        //case video_format::x576p2500: return VID_FMT_INVALID; //not supported\r
        case video_format::x720p2500:   return VID_FMT_720P_2500;\r
-       //case video_format::x720p5000: return VID_FMT_720P_5000;\r
+       case video_format::x720p5000:   return VID_FMT_720P_5000;\r
        //case video_format::x720p5994: return VID_FMT_720P_5994;\r
        //case video_format::x720p6000: return VID_FMT_720P_6000;\r
        //case video_format::x1080p2397:        return VID_FMT_1080P_2397;\r
index b2e87a93f9887ff0866e75dbcd9eece66e6d0782..845c7aaa543e3db1369b6469e7016630246b4de8 100644 (file)
@@ -2,7 +2,7 @@
 \r
 /* this ALWAYS GENERATED file contains the IIDs and CLSIDs */\r
 \r
-/* link this file in with the server and any clients */\r
+/* link this file in with the configuration and any clients */\r
 \r
 \r
  /* File created by MIDL compiler version 7.00.0500 */\r
index 1c8a264f7235859ad727eb130db77ad3a3e59711..a2b142bcd0e57b69d6aa76e4dd969cb3294cf87a 100644 (file)
@@ -14,7 +14,7 @@ namespace caspar { namespace core { namespace decklink {
                //case video_format::ntsc:              return bmdModeNTSC;\r
                //case video_format::x576p2500: return ULONG_MAX;\r
                case video_format::x720p2500:   return ULONG_MAX;\r
-               //case video_format::x720p5000: return bmdModeHD720p50;\r
+               case video_format::x720p5000:   return bmdModeHD720p50;\r
                //case video_format::x720p5994: return bmdModeHD720p5994;\r
                //case video_format::x720p6000: return bmdModeHD720p60;\r
                //case video_format::x1080p2397:        return bmdModeHD1080p2398;\r
index 4fa38518276840db531279961cb62aace4802625..b7d194e19f29039c288fa37798edb6f106c3050c 100644 (file)
@@ -47,10 +47,7 @@ public:
                                try\r
                                {\r
                                        size_t offset = max_depth_ - consumer->buffer_depth();\r
-                                       if(offset >= buffer_.size())\r
-                                               return;\r
-\r
-                                       if(consumer->synchronize() == frame_consumer::clock)\r
+                                       if(offset < buffer_.size() && consumer->synchronize() == frame_consumer::clock)\r
                                                sync = frame_consumer::clock;\r
                                }\r
                                catch(...)\r
index 0e48dae961aea39e57ed2bb1918157a4eefd3a81..f59a0859d5f8e498f91afb865d9b165f91a236fd 100644 (file)
@@ -37,19 +37,15 @@ struct consumer::implementation : public sf::SoundStream, boost::noncopyable
        implementation() : container_(5)\r
        {\r
                sf::SoundStream::Initialize(2, 48000);\r
-       }\r
-\r
-       ~implementation()\r
-       {\r
-               Stop();\r
+               Play();         \r
        }\r
        \r
        void send(const safe_ptr<const read_frame>& frame)\r
        {                               \r
-               input_.push(std::vector<short>(frame->audio_data().begin(), frame->audio_data().end())); \r
+               if(frame->audio_data().empty())\r
+                       return;\r
 \r
-               if(GetStatus() != Playing && input_.size() > 2)         \r
-                       Play();         \r
+               input_.push(std::vector<short>(frame->audio_data().begin(), frame->audio_data().end()));        \r
        }\r
 \r
        frame_consumer::sync_mode synchronize()\r
@@ -69,23 +65,13 @@ struct consumer::implementation : public sf::SoundStream, boost::noncopyable
        }\r
 \r
        bool OnGetData(sf::SoundStream::Chunk& data)\r
-       {\r
-               static std::vector<short> silence(1920*2, 0);\r
-               \r
+       {               \r
                std::vector<short> audio_data;          \r
                input_.pop(audio_data);\r
-                       \r
-               if(audio_data.empty())\r
-               {       \r
-                       data.Samples = silence.data();\r
-                       data.NbSamples = silence.size();\r
-               }\r
-               else\r
-               {\r
-                       container_.push_back(std::move(audio_data));\r
-                       data.Samples = container_.back().data();\r
-                       data.NbSamples = container_.back().size();\r
-               }\r
+                               \r
+               container_.push_back(std::move(audio_data));\r
+               data.Samples = container_.back().data();\r
+               data.NbSamples = container_.back().size();              \r
 \r
                return true;\r
        }\r
index e9b5cbd50652e3001be9068385fe1fee18be1020..44c90f0899eb2e2ec27885243b85f595834a02bc 100644 (file)
     <ClInclude Include="protocol\clk\CLKCommand.h" />\r
     <ClInclude Include="protocol\clk\CLKProtocolStrategy.h" />\r
     <ClInclude Include="protocol\media.h" />\r
-    <ClInclude Include="server.h" />\r
+    <ClInclude Include="configuration.h" />\r
     <CustomBuildStep Include="consumers\bluefish\BluefishException.h" />\r
     <CustomBuildStep Include="consumers\bluefish\BluefishFrameManager.h" />\r
     <CustomBuildStep Include="consumers\bluefish\BluefishPlaybackStrategy.h" />\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
       <PrecompiledHeaderFile Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">../StdAfx.h</PrecompiledHeaderFile>\r
     </ClCompile>\r
-    <ClCompile Include="server.cpp" />\r
+    <ClCompile Include="configuration.cpp" />\r
     <ClCompile Include="StdAfx.cpp">\r
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>\r
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>\r
index 483ffca61e52ed276a7e7390987e970900ca8720..698faa56016410f6fde50c39a2eda8ed00878176 100644 (file)
     <ClInclude Include="producer\layer.h">\r
       <Filter>Source\channel</Filter>\r
     </ClInclude>\r
-    <ClInclude Include="server.h">\r
-      <Filter>Source</Filter>\r
-    </ClInclude>\r
     <ClInclude Include="processor\write_frame.h">\r
       <Filter>Source\channel\processor\frame</Filter>\r
     </ClInclude>\r
     <ClInclude Include="producer\flash\TimerHelper.h">\r
       <Filter>Source\channel\producer\flash\interop</Filter>\r
     </ClInclude>\r
+    <ClInclude Include="configuration.h">\r
+      <Filter>Source</Filter>\r
+    </ClInclude>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <ClCompile Include="protocol\amcp\AMCPCommandQueue.cpp">\r
     <ClCompile Include="consumer\frame_consumer_device.cpp">\r
       <Filter>Source\channel\consumer</Filter>\r
     </ClCompile>\r
-    <ClCompile Include="server.cpp">\r
-      <Filter>Source</Filter>\r
-    </ClCompile>\r
     <ClCompile Include="processor\frame_processor_device.cpp">\r
       <Filter>Source\channel\processor</Filter>\r
     </ClCompile>\r
     <ClCompile Include="producer\flash\Flash9e_i.c">\r
       <Filter>Source\channel\producer\flash\interop</Filter>\r
     </ClCompile>\r
+    <ClCompile Include="configuration.cpp">\r
+      <Filter>Source</Filter>\r
+    </ClCompile>\r
   </ItemGroup>\r
   <ItemGroup>\r
     <Midl Include="consumer\decklink\DeckLinkAPI_v7_3.idl">\r
index 65c787071159bd27fbd7ab2ff9718cf4f33517b0..3c058f1387e405c4c8f8d4fe8d1f70f2a455b094 100644 (file)
@@ -36,7 +36,7 @@ const video_format_desc format_descs[video_format::invalid] =
        //DEFINE_VIDEOFORMATDESC(720,  486,  video_mode::lower,                 60/1.001,       TEXT("NTSC"),           video_format::ntsc              ), \r
        //DEFINE_VIDEOFORMATDESC(720,  576,  video_mode::progressive,           25,                     TEXT("576p2500"),       video_format::x576p2500 ),\r
        DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,             25,                     TEXT("720p2500"),       video_format::x720p2500 ), \r
-       //DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,   50,                     TEXT("720p5000"),       video_format::x720p5000 ), \r
+       DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,             50,                     TEXT("720p5000"),       video_format::x720p5000 ), \r
        //DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,   60/1.001,       TEXT("720p5994"),       video_format::x720p5994 ),\r
        //DEFINE_VIDEOFORMATDESC(1280, 720,  video_mode::progressive,   60,                     TEXT("720p6000"),       video_format::x720p6000 ),\r
        //DEFINE_VIDEOFORMATDESC(1920, 1080, video_mode::progressive,   24/1.001,       TEXT("1080p2397"),      video_format::x1080p2397),\r
index 7e3545e57a37f8b9cdc1f3ee15606dae06a671fc..81ce8174fc6137a3ebfd0113fa61b9597b8b43ea 100644 (file)
@@ -14,7 +14,7 @@ struct video_format
                //ntsc,\r
                //x576p2500,\r
                x720p2500,\r
-               //x720p5000,\r
+               x720p5000,\r
                //x720p5994,\r
                //x720p6000,\r
                //x1080p2397,\r
index d5b79e1b7f48e91d95c0409ced063f9fd58f3ef0..eff989f24986a39e9c4c675a761fdce98017f0c0 100644 (file)
@@ -21,35 +21,43 @@ namespace caspar { namespace core { namespace ffmpeg{
 \r
 struct audio_decoder::implementation : boost::noncopyable\r
 {\r
-       static const int FRAME_AUDIO_SAMPLES = 1920*2;\r
-       static const int SAMPLE_RATE = 48000;\r
+       static const size_t SAMPLE_RATE = 48000;\r
+       static const size_t N_CHANNELS = 2;\r
 \r
-       implementation(AVCodecContext* codec_context) : current_chunk_(), codec_context_(codec_context), audio_buffer_(4*SAMPLE_RATE*2+FF_INPUT_BUFFER_PADDING_SIZE/2){}\r
+       implementation(AVCodecContext* codec_context, double fps) : current_chunk_(), codec_context_(codec_context), audio_buffer_(4*SAMPLE_RATE*2+FF_INPUT_BUFFER_PADDING_SIZE/2)\r
+       {\r
+               if(codec_context_->sample_rate != SAMPLE_RATE)\r
+                       BOOST_THROW_EXCEPTION(file_read_error() << msg_info("Invalid sample rate. Expected 48000."));\r
+\r
+               if(codec_context_->channels != 2)\r
+                       BOOST_THROW_EXCEPTION(file_read_error() << msg_info("Invalid channel count. Expected 2."));\r
+               audio_frame_size_ = static_cast<size_t>(static_cast<double>(SAMPLE_RATE) / fps) * N_CHANNELS;\r
+       }\r
                \r
        std::vector<std::vector<short>> execute(const aligned_buffer& audio_packet)\r
        {                       \r
-               static const std::vector<std::vector<short>> silence(1920*2, 0);\r
-               \r
                int written_bytes = audio_buffer_.size()*2 - FF_INPUT_BUFFER_PADDING_SIZE;\r
                const int result = avcodec_decode_audio2(codec_context_, audio_buffer_.data(), &written_bytes, audio_packet.data(), audio_packet.size());\r
 \r
-               if(result <= 0 || codec_context_->sample_rate != SAMPLE_RATE)\r
-                       return silence;\r
+               if(result <= 0)\r
+                       return std::vector<std::vector<short>>();\r
                                                \r
                current_chunk_.insert(current_chunk_.end(), audio_buffer_.data(), audio_buffer_.data() + written_bytes/2);\r
 \r
                std::vector<std::vector<short>> chunks_;\r
                                \r
-               const auto last = current_chunk_.end() - current_chunk_.size() % FRAME_AUDIO_SAMPLES;\r
+               const auto last = current_chunk_.end() - current_chunk_.size() % audio_frame_size_;\r
 \r
-               for(auto it = current_chunk_.begin(); it != last; it += FRAME_AUDIO_SAMPLES)            \r
-                       chunks_.push_back(std::vector<short>(it, it + FRAME_AUDIO_SAMPLES));            \r
+               for(auto it = current_chunk_.begin(); it != last; it += audio_frame_size_)              \r
+                       chunks_.push_back(std::vector<short>(it, it + audio_frame_size_));              \r
 \r
                current_chunk_.erase(current_chunk_.begin(), last);\r
                \r
                return chunks_;\r
        }\r
 \r
+       size_t audio_frame_size_;\r
+\r
        typedef std::vector<short, tbb::cache_aligned_allocator<short>> buffer;\r
 \r
        buffer audio_buffer_;   \r
@@ -59,6 +67,6 @@ struct audio_decoder::implementation : boost::noncopyable
        AVCodecContext* codec_context_;\r
 };\r
 \r
-audio_decoder::audio_decoder(AVCodecContext* codec_context) : impl_(new implementation(codec_context)){}\r
+audio_decoder::audio_decoder(AVCodecContext* codec_context, double fps) : impl_(new implementation(codec_context, fps)){}\r
 std::vector<std::vector<short>> audio_decoder::execute(const aligned_buffer& audio_packet){return impl_->execute(audio_packet);}\r
 }}}
\ No newline at end of file
index 630ea235ad5672976b892aa42fa65e54c60ee912..66b57b6be281fe6ceb3f3504b92bce0dfb389a5d 100644 (file)
@@ -16,7 +16,7 @@ typedef std::vector<unsigned char, tbb::cache_aligned_allocator<unsigned char>>
 class audio_decoder : boost::noncopyable\r
 {\r
 public:\r
-       audio_decoder(AVCodecContext* codec_context);\r
+       audio_decoder(AVCodecContext* codec_context, double fps);\r
        std::vector<std::vector<short>> execute(const aligned_buffer& audio_packet);\r
 private:\r
        struct implementation;\r
index 687067d1429ac788422e00d5ab5f786cfa1d897a..08227867e741efa7b3e6e2332067b38233474f58 100644 (file)
@@ -21,7 +21,7 @@ struct ffmpeg_producer : public frame_producer
 {\r
 public:\r
        ffmpeg_producer(const std::wstring& filename, const  std::vector<std::wstring>& params) : filename_(filename), last_frame_(draw_frame(draw_frame::empty())),\r
-               input_(filename), video_decoder_(input_.get_video_codec_context().get()), audio_decoder_(input_.get_audio_codec_context().get())\r
+               input_(filename), video_decoder_(input_.get_video_codec_context().get()), audio_decoder_(input_.get_audio_codec_context().get(), input_.fps())\r
        {                               \r
                input_.set_loop(std::find(params.begin(), params.end(), L"LOOP") != params.end());\r
 \r
index 9f59a17a5d1f488e824e59b02a8d28664bc8e997..25725288f6e6359523bde1a942d6b5214caa6bbd 100644 (file)
@@ -169,6 +169,11 @@ struct input::implementation : boost::noncopyable
                return true;\r
        }\r
 \r
+       double fps() const\r
+       {\r
+               return static_cast<double>(video_codec_context_->time_base.den) / static_cast<double>(video_codec_context_->time_base.num);\r
+       }\r
+\r
        std::wstring print() const\r
        {\r
                return L"ffmpeg[" + boost::filesystem::wpath(filename_).filename() + L"] Buffer thread";\r
@@ -204,4 +209,5 @@ bool input::is_eof() const{return impl_->is_eof();}
 aligned_buffer input::get_video_packet(){return impl_->get_video_packet();}\r
 aligned_buffer input::get_audio_packet(){return impl_->get_audio_packet();}\r
 bool input::seek(unsigned long long frame){return impl_->seek(frame);}\r
+double input::fps() const { return impl_->fps(); }\r
 }}}
\ No newline at end of file
index 24a5b0cd5e113238621d83a374a2ba64e463ae65..4f39be633ce9f2e87602deba312eb9726bae6795 100644 (file)
@@ -25,6 +25,8 @@ public:
 \r
        bool is_eof() const;\r
        void set_loop(bool value);\r
+\r
+       double fps() const;\r
 private:\r
        struct implementation;\r
        std::shared_ptr<implementation> impl_;\r
index 7ba5af2180b0eaecdff62bf0b081a62742c3c0ed..6ca4edf57a3e9a9d9b6c673286d5417ed7521c57 100644 (file)
@@ -132,8 +132,7 @@ struct video_decoder::implementation : boost::noncopyable
                                });\r
                        });\r
 \r
-                       // TODO: Make generic for all formats and modes.\r
-                       if(codec_context_->codec_id == CODEC_ID_DVVIDEO) // Move up one field           \r
+                       if(frame_processor_->get_video_format_desc().mode == video_mode::upper && codec_context_->codec_id == CODEC_ID_DVVIDEO) // Move up one field            \r
                                write->translate(0.0f, 1.0/static_cast<double>(height_));\r
 \r
                        return write;\r
@@ -148,8 +147,7 @@ struct video_decoder::implementation : boost::noncopyable
                 \r
                        sws_scale(sws_context_.get(), decoded_frame->data, decoded_frame->linesize, 0, height_, av_frame.data, av_frame.linesize);      \r
                                                \r
-                       // TODO: Make generic for all formats and modes.\r
-                       if(codec_context_->codec_id == CODEC_ID_DVVIDEO) // Move up one field           \r
+                       if(frame_processor_->get_video_format_desc().mode == video_mode::upper && codec_context_->codec_id == CODEC_ID_DVVIDEO) // Move up one field            \r
                                write->translate(0.0f, 1.0/static_cast<double>(height_));\r
 \r
                        return write;\r
@@ -158,7 +156,10 @@ struct video_decoder::implementation : boost::noncopyable
 \r
        void initialize(const safe_ptr<frame_processor_device>& frame_processor)\r
        {\r
-               frame_processor_ = frame_processor;\r
+               frame_processor_ = frame_processor;             \r
+               double frame_rate = static_cast<double>(codec_context_->time_base.den) / static_cast<double>(codec_context_->time_base.num);\r
+               if(abs(frame_rate - frame_processor->get_video_format_desc().actual_fps) > std::numeric_limits<double>::min())\r
+                       BOOST_THROW_EXCEPTION(file_read_error() << msg_info("Invalid video framerate."));\r
        }\r
        \r
        std::shared_ptr<frame_processor_device> frame_processor_;\r
index 89ebbbe0b37c9c76c976a0ec5349ae013c42eb7f..dbe2156b7bdae03b82fa76885857b878a541a518 100644 (file)
@@ -4,7 +4,7 @@
 \r
 #include "flash_producer.h"\r
 \r
-#include "../../Server.h"\r
+#include "../../configuration.h"\r
 \r
 #include <boost/filesystem.hpp>\r
 #include <boost/format.hpp>\r
@@ -17,11 +17,11 @@ namespace caspar { namespace core { namespace flash {
 struct cg_producer::implementation : boost::noncopyable\r
 {\r
 public:\r
-       implementation() : flash_producer_(flash_producer(server::template_folder()+TEXT("cg.fth.18"))){}\r
+       implementation() : flash_producer_(flash_producer(configuration::template_folder()+TEXT("cg.fth.18"))){}\r
 \r
        void clear()\r
        {\r
-               flash_producer_ = flash_producer(server::template_folder()+TEXT("cg.fth.18"));\r
+               flash_producer_ = flash_producer(configuration::template_folder()+TEXT("cg.fth.18"));\r
        }\r
 \r
        void add(int layer, const std::wstring& filename,  bool play_on_load, const std::wstring& label, const std::wstring& data)\r
index d3a391097c08138939b39ec43090222a207cfef7..7d25b8ce7b7c38f3639d9aa832d0cd0038827db8 100644 (file)
@@ -8,7 +8,7 @@
 //#include "../../processor/draw_frame.h"\r
 //#include "../../format/video_format.h"\r
 //#include "../../processor/frame_processor_device.h"\r
-//#include "../../server.h"\r
+//#include "../../configuration.h"\r
 //\r
 //#include <tbb/parallel_for.h>\r
 //#include <tbb/parallel_invoke.h>\r
 //safe_ptr<frame_producer> create_image_scroll_producer(const std::vector<std::wstring>& params)\r
 //{\r
 //     static const std::vector<std::wstring> extensions = list_of(L"spng")(L"stga")(L"sbmp")(L"sjpg")(L"sjpeg");\r
-//     std::wstring filename = server::media_folder() + L"\\" + params[0];\r
+//     std::wstring filename = configuration::media_folder() + L"\\" + params[0];\r
 //     \r
 //     auto ext = std::find_if(extensions.begin(), extensions.end(), [&](const std::wstring& ex) -> bool\r
 //             {                                       \r
index a7321d91061844c73601e9e42a27b67b2b37fa6d..b0878f3f3be43761c0f3d6e399cc1b5f994a4941 100644 (file)
@@ -29,7 +29,7 @@
 #include <boost/lexical_cast.hpp>\r
 #include "../../producer/flash/cg_producer.h"\r
 #include "../media.h"\r
-#include "../../Server.h"\r
+#include "../../configuration.h"\r
 \r
 #include <algorithm>\r
 #include <locale>\r
@@ -61,8 +61,8 @@
 403 [kommando] ERROR   Ogiltig parameter  \r
 404 [kommando] ERROR   Mediafilen hittades inte  \r
 \r
-500 FAILED                             Internt serverfel  \r
-501 [kommando] FAILED  Internt serverfel  \r
+500 FAILED                             Internt configurationfel  \r
+501 [kommando] FAILED  Internt configurationfel  \r
 502 [kommando] FAILED  Oläslig mediafil  \r
 \r
 600 [kommando] FAILED  funktion ej implementerad\r
@@ -73,7 +73,7 @@ namespace caspar { namespace core {
 std::wstring ListMedia()\r
 {      \r
        std::wstringstream replyString;\r
-       for (boost::filesystem::wrecursive_directory_iterator itr(server::media_folder()), end; itr != end; ++itr)\r
+       for (boost::filesystem::wrecursive_directory_iterator itr(configuration::media_folder()), end; itr != end; ++itr)\r
        {                       \r
                if(boost::filesystem::is_regular_file(itr->path()))\r
                {\r
@@ -91,7 +91,7 @@ std::wstring ListMedia()
                        {               \r
                                auto is_not_digit = [](char c){ return std::isdigit(c) == 0; };\r
 \r
-                               auto relativePath = boost::filesystem::wpath(itr->path().file_string().substr(server::media_folder().size()-1, itr->path().file_string().size()));\r
+                               auto relativePath = boost::filesystem::wpath(itr->path().file_string().substr(configuration::media_folder().size()-1, itr->path().file_string().size()));\r
 \r
                                auto writeTimeStr = boost::posix_time::to_iso_string(boost::posix_time::from_time_t(boost::filesystem::last_write_time(itr->path())));\r
                                writeTimeStr.erase(std::remove_if(writeTimeStr.begin(), writeTimeStr.end(), is_not_digit), writeTimeStr.end());\r
@@ -116,11 +116,11 @@ std::wstring ListTemplates()
 {\r
        std::wstringstream replyString;\r
 \r
-       for (boost::filesystem::wrecursive_directory_iterator itr(server::template_folder()), end; itr != end; ++itr)\r
+       for (boost::filesystem::wrecursive_directory_iterator itr(configuration::template_folder()), end; itr != end; ++itr)\r
        {               \r
                if(boost::filesystem::is_regular_file(itr->path()) && itr->path().extension() == L".ft")\r
                {\r
-                       auto relativePath = boost::filesystem::wpath(itr->path().file_string().substr(server::template_folder().size()-1, itr->path().file_string().size()));\r
+                       auto relativePath = boost::filesystem::wpath(itr->path().file_string().substr(configuration::template_folder().size()-1, itr->path().file_string().size()));\r
 \r
                        auto writeTimeStr = boost::posix_time::to_iso_string(boost::posix_time::from_time_t(boost::filesystem::last_write_time(itr->path())));\r
                        writeTimeStr.erase(std::remove_if(writeTimeStr.begin(), writeTimeStr.end(), [](char c){ return std::isdigit(c) == 0;}), writeTimeStr.end());\r
@@ -168,7 +168,7 @@ bool LoadCommand::DoExecute()
        //Perform loading of the clip\r
        try\r
        {\r
-               _parameters[0] = server::media_folder() + L"\\" + _parameters[0];\r
+               _parameters[0] = configuration::media_folder() + L"\\" + _parameters[0];\r
                auto pFP = load_media(_parameters);             \r
                GetChannel()->preview(GetLayerIndex(), pFP);\r
        \r
@@ -243,7 +243,7 @@ bool LoadbgCommand::DoExecute()
        //Perform loading of the clip\r
        try\r
        {\r
-               _parameters[0] = server::media_folder() + L"\\" + _parameters[0];\r
+               _parameters[0] = configuration::media_folder() + L"\\" + _parameters[0];\r
                auto pFP = load_media(_parameters);\r
                if(pFP == frame_producer::empty())\r
                        BOOST_THROW_EXCEPTION(file_not_found() << msg_info(_parameters.size() > 0 ? narrow(_parameters[0]) : ""));\r
@@ -422,7 +422,7 @@ bool CGCommand::DoExecuteAdd() {
                else \r
                {\r
                        //The data is not an XML-string, it must be a filename\r
-                       std::wstring filename = server::data_folder();\r
+                       std::wstring filename = configuration::data_folder();\r
                        filename.append(dataString);\r
                        filename.append(TEXT(".ftd"));\r
 \r
@@ -441,7 +441,7 @@ bool CGCommand::DoExecuteAdd() {
                }\r
        }\r
 \r
-       std::wstring fullFilename = flash::flash_producer::find_template(server::template_folder() + _parameters[2]);\r
+       std::wstring fullFilename = flash::flash_producer::find_template(configuration::template_folder() + _parameters[2]);\r
        if(!fullFilename.empty())\r
        {\r
                std::wstring extension = boost::filesystem::wpath(fullFilename).extension();\r
@@ -629,7 +629,7 @@ bool DataCommand::DoExecuteStore()
                return false;\r
        }\r
 \r
-       std::wstring filename = server::data_folder();\r
+       std::wstring filename = configuration::data_folder();\r
        filename.append(_parameters[1]);\r
        filename.append(TEXT(".ftd"));\r
 \r
@@ -656,7 +656,7 @@ bool DataCommand::DoExecuteRetrieve()
                return false;\r
        }\r
 \r
-       std::wstring filename = server::data_folder();\r
+       std::wstring filename = configuration::data_folder();\r
        filename.append(_parameters[1]);\r
        filename.append(TEXT(".ftd"));\r
 \r
@@ -701,7 +701,7 @@ bool CinfCommand::DoExecute()
 {\r
        std::wstringstream replyString;\r
 \r
-       std::wstring filename = server::media_folder()+_parameters[0];\r
+       std::wstring filename = configuration::media_folder()+_parameters[0];\r
 \r
        // TODO:\r
 \r
index 9cd364b0634dd957d4250f34ff492221ac44feb1..bcd448ca27bea0d9c6ff36ef6543c27de753e42e 100644 (file)
@@ -28,7 +28,7 @@
 #include "CIICommandsimpl.h"\r
 #include "../../producer/flash/flash_producer.h"\r
 #include "../../producer/transition/transition_producer.h"\r
-#include "../../Server.h"\r
+#include "../../configuration.h"\r
 #include "../../producer/frame_producer.h"\r
 \r
 #if defined(_MSC_VER)\r
@@ -166,7 +166,7 @@ CIICommandPtr CIIProtocolStrategy::Create(const std::wstring& name)
 \r
 void CIIProtocolStrategy::WriteTemplateData(const std::wstring& templateName, const std::wstring& titleName, const std::wstring& xmlData) \r
 {\r
-       std::wstring fullTemplateFilename = server::template_folder();\r
+       std::wstring fullTemplateFilename = configuration::template_folder();\r
        if(currentProfile_.size() > 0)\r
        {\r
                fullTemplateFilename += currentProfile_;\r
@@ -180,7 +180,7 @@ void CIIProtocolStrategy::WriteTemplateData(const std::wstring& templateName, co
                return;\r
        }\r
        \r
-       auto producer = flash::flash_producer(server::template_folder()+TEXT("CG.fth"));\r
+       auto producer = flash::flash_producer(configuration::template_folder()+TEXT("CG.fth"));\r
 \r
        std::wstringstream flashParam;\r
        flashParam << TEXT("<invoke name=\"Add\" returntype=\"xml\"><arguments><number>1</number><string>") << currentProfile_ << '/' <<  templateName << TEXT("</string><number>0</number><true/><string> </string><string><![CDATA[ ") << xmlData << TEXT(" ]]></string></arguments></invoke>");\r
index 94de844998118f4a32e76eca200459b363df3fc2..1df668cb8bfb3b9771b845f2f8128bfdac636481 100644 (file)
@@ -32,7 +32,7 @@
 #include <conio.h>\r
 \r
 #include <core/config.h>\r
-#include <core/server.h>\r
+#include <core/configuration.h>\r
 #include <core/protocol/amcp/AMCPProtocolStrategy.h>\r
 #include <common/exception/win32_exception.h>\r
 #include <common/exception/exceptions.h>\r
@@ -76,7 +76,7 @@ int main(int argc, wchar_t* argv[])
        MessageBox(nullptr, TEXT("Now is the time to connect for remote debugging..."), TEXT("Debug"), MB_OK | MB_TOPMOST);\r
 #endif\r
 \r
-       log::add_file_sink(server::log_folder());\r
+       log::add_file_sink(configuration::log_folder());\r
        \r
        CASPAR_LOG(debug) << "Started Main Thread";\r
 \r
@@ -85,7 +85,7 @@ int main(int argc, wchar_t* argv[])
                                \r
        try \r
        {\r
-               server caspar_device;\r
+               configuration caspar_device;\r
                                \r
                auto dummy = std::make_shared<IO::DummyClientInfo>();\r
                amcp::AMCPProtocolStrategy amcp(caspar_device.get_channels());\r