]> git.sesse.net Git - casparcg/commitdiff
2.0.0.2: amcp: Enabled PARAM command.
authorronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sat, 14 May 2011 20:20:20 +0000 (20:20 +0000)
committerronag <ronag@362d55ac-95cf-4e76-9f9a-cbaa9c17b72d>
Sat, 14 May 2011 20:20:20 +0000 (20:20 +0000)
         ffmpeg_producer: Formatting.

git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches/2.0.0.2@747 362d55ac-95cf-4e76-9f9a-cbaa9c17b72d

modules/ffmpeg/producer/ffmpeg_producer.cpp
modules/ffmpeg/producer/input.cpp
protocol/amcp/AMCPProtocolStrategy.cpp

index fc884aadf198a8950fbf9f80a20f98ecf900cbf1..752e12a9862b7473a02b7bc36379ca8cbff3ee9f 100644 (file)
@@ -48,13 +48,13 @@ struct ffmpeg_producer : public core::frame_producer
        const std::wstring                                              filename_;\r
        const bool                                                              loop_;\r
        \r
-       std::shared_ptr<diagnostics::graph>             graph_;\r
+       const safe_ptr<diagnostics::graph>              graph_;\r
        boost::timer                                                    frame_timer_;\r
                \r
        std::deque<safe_ptr<core::write_frame>> video_frame_buffer_;    \r
        std::deque<std::vector<short>>                  audio_chunk_buffer_;\r
                        \r
-       std::shared_ptr<core::frame_factory>    frame_factory_;\r
+       const safe_ptr<core::frame_factory>             frame_factory_;\r
 \r
        input                                                                   input_; \r
        std::unique_ptr<video_decoder>                  video_decoder_;\r
@@ -226,16 +226,16 @@ safe_ptr<core::frame_producer> create_ffmpeg_producer(const safe_ptr<core::frame
                (L"mpg")(L"mpeg")(L"avi")(L"mov")(L"qt")(L"webm")(L"dv")(L"mp4")(L"f4v")(L"flv")(L"mkv")(L"mka")(L"wmv")(L"wma")(L"ogg")(L"divx")(L"xvid")(L"wav")(L"mp3")(L"m2v");\r
        std::wstring filename = env::media_folder() + L"\\" + params[0];\r
        \r
-       auto ext = std::find_if(extensions.begin(), extensions.end(), [&](const std::wstring& ex) -> bool\r
-               {                                       \r
-                       return boost::filesystem::is_regular_file(boost::filesystem::wpath(filename).replace_extension(ex));\r
-               });\r
+       auto ext = boost::find_if(extensions, [&](const std::wstring& ex)\r
+       {                                       \r
+               return boost::filesystem::is_regular_file(boost::filesystem::wpath(filename).replace_extension(ex));\r
+       });\r
 \r
        if(ext == extensions.end())\r
                return core::frame_producer::empty();\r
 \r
        std::wstring path = filename + L"." + *ext;\r
-       bool loop = std::find(params.begin(), params.end(), L"LOOP") != params.end();\r
+       bool loop = boost::find(params, L"LOOP") != params.end();\r
 \r
        static const boost::wregex expr(L"\\((?<START>\\d+)(,(?<LENGTH>\\d+)?)?\\)");//(,(?<END>\\d+))?\\]"); // boost::regex has no repeated captures?\r
        boost::wsmatch what;\r
index 4116034a58058c2db113e665b1fcea3796e274ea..8bdda005a61ea984f68af40965ab0cf743c51aad 100644 (file)
@@ -30,6 +30,9 @@
 #include <tbb/concurrent_queue.h>\r
 #include <tbb/mutex.h>\r
 \r
+#include <boost/range/iterator_range.hpp>\r
+#include <boost/range/algorithm.hpp>\r
+\r
 #if defined(_MSC_VER)\r
 #pragma warning (disable : 4244)\r
 #endif\r
@@ -180,13 +183,13 @@ private:
 \r
        std::shared_ptr<AVCodecContext> open_stream(int codec_type, int& s_index) const\r
        {               \r
-               AVStream** streams_end = format_context_->streams+format_context_->nb_streams;\r
-               AVStream** stream = std::find_if(format_context_->streams, streams_end, [&](AVStream* stream) \r
+               const auto streams = boost::iterator_range<AVStream**>(format_context_->streams, format_context_->streams+format_context_->nb_streams);\r
+               const auto stream = boost::find_if(streams, [&](AVStream* stream) \r
                {\r
                        return stream != nullptr && stream->codec->codec_type == codec_type;\r
                });\r
                \r
-               if(stream == streams_end\r
+               if(stream == streams.end()\r
                        return nullptr;\r
                \r
                auto codec = avcodec_find_decoder((*stream)->codec->codec_id);                  \r
@@ -261,7 +264,7 @@ private:
        void seek_frame(int64_t frame, int flags = 0)\r
        {       \r
                // Convert from frames into seconds.\r
-               auto ts = frame*static_cast<int64_t>((AV_TIME_BASE*get_default_context()->time_base.num) / get_default_context()->time_base.den);\r
+               const auto ts = frame*static_cast<int64_t>((AV_TIME_BASE*get_default_context()->time_base.num) / get_default_context()->time_base.den);\r
 \r
                const int errn = av_seek_frame(format_context_.get(), -1, ts, flags | AVSEEK_FLAG_FRAME);\r
 \r
index 478f4642a701c13fed99d809fb6551a814df4724..31f892ec55fb95ce6290647db02701973aec370e 100644 (file)
@@ -311,6 +311,7 @@ AMCPCommandPtr AMCPProtocolStrategy::CommandFactory(const std::wstring& str)
        transform(s.begin(), s.end(), s.begin(), toupper);\r
        \r
        if         (s == TEXT("MIXER"))         return std::make_shared<MixerCommand>();\r
+       else if(s == TEXT("PARAM"))             return std::make_shared<ParamCommand>();\r
        else if(s == TEXT("SWAP"))              return std::make_shared<SwapCommand>();\r
        else if(s == TEXT("LOAD"))              return std::make_shared<LoadCommand>();\r
        else if(s == TEXT("LOADBG"))    return std::make_shared<LoadbgCommand>();\r