]> git.sesse.net Git - casparcg/commitdiff
-Fixed bug where ffmpeg parameter values with : in them did not work like -vf scale...
authorHelge Norberg <helge.norberg@gmail.com>
Wed, 18 Jun 2014 18:13:16 +0000 (20:13 +0200)
committerHelge Norberg <helge.norberg@gmail.com>
Wed, 18 Jun 2014 18:13:16 +0000 (20:13 +0200)
-Fixed related bug where ffmpeg parameter values with - in them did not work like -vf yadif=3:-1

core/parameters/parameters.cpp
core/parameters/parameters.h
modules/ffmpeg/consumer/streaming_consumer.cpp

index c63c68b6a44c6bbb7e096db720368a36053df72b..5002acc330c6bd00e1d7c34be696bbb002b72801 100644 (file)
@@ -94,19 +94,21 @@ std::wstring parameters::get(std::wstring const& key, std::wstring const& defaul
        return *it;
 }
 
-std::wstring parameters::get_original_string() const
+std::wstring parameters::get_original_string(int num_skip) const
 {
+       int left_to_skip = num_skip;
        std::wstring str;
        BOOST_FOREACH(auto& param, params_original_)
        {
-               str += param + L" ";
+               if (left_to_skip-- <= 0)
+                       str += param + L" ";
        }
        return str;
 }
 
 const std::wstring& parameters::at_original(size_t i) const
 {
-       return params_original_[i];
+       return params_original_.at(i);
 }
 
 void parameters::set(size_t index, std::wstring const& value)
index ce0a3c36d945646afcb96fd44f3c838b2cbcb34d..f8c271fe186b6e6d9ef0d92e88cb4fe9209e1723 100644 (file)
@@ -67,7 +67,7 @@ public:
 
        std::wstring get(std::wstring const& key, std::wstring const& default_value = L"") const;
 
-       std::wstring get_original_string() const;
+       std::wstring get_original_string(int num_skip = 0) const;
 
        const std::wstring& at_original(size_t i) const;
 
index d7bd4b23e8de129d2d7598852d2c2af73f18ea95..33ca9698394c9e3e3e5677b8dd12be62f00e8c69 100644 (file)
@@ -91,9 +91,6 @@ private:
        
        executor                                                                        executor_;
 
-       executor                                                                        video_filter_executor_;
-       executor                                                                        audio_filter_executor_;
-
        executor                                                                        video_encoder_executor_;
        executor                                                                        audio_encoder_executor_;
 
@@ -115,8 +112,6 @@ public:
                , audio_encoder_executor_(print() + L" video_encoder")
                , video_encoder_executor_(print() + L" audio_encoder")
                , write_executor_(print() + L" io")
-               , video_filter_executor_(print() + L" video_filter")
-               , audio_filter_executor_(print() + L" audio_filter")
        {               
                abort_request_ = false; 
 
@@ -124,7 +119,7 @@ public:
                                boost::sregex_iterator(
                                        options.begin(), 
                                        options.end(), 
-                                       boost::regex("-(?<NAME>[^-\\s]+)(\\s+(?<VALUE>[^-\\s]+))?")); 
+                                       boost::regex("-(?<NAME>[^-\\s]+)(\\s+(?<VALUE>[^\\s]+))?")); 
                        it != boost::sregex_iterator(); 
                        ++it)
                {                               
@@ -149,9 +144,6 @@ public:
                        encode_video(nullptr, nullptr);
                        encode_audio(nullptr, nullptr);                 
 
-                       video_filter_executor_.wait();
-                       audio_filter_executor_.wait();
-
                        video_graph_.reset();
                        audio_graph_.reset();
                        
@@ -1234,17 +1226,13 @@ private:
        
 safe_ptr<core::frame_consumer> create_streaming_consumer(const core::parameters& params)
 {       
-    static boost::wregex path_exp(L"\\s*(STREAM\\s)?(?<PATH>.+\\.[^\\s]+|.+:[^\\s]*)\\s*(?<ARGS>.*)" , boost::regex::icase);
+       if (params.size() < 1 || params[0] != L"STREAM")
+               return core::frame_consumer::empty();
 
-       auto str = params.get_original_string();
+       auto path = narrow(params.at_original(1));
+       auto args = narrow(params.get_original_string(2));
 
-    boost::wsmatch what;
-       if(!boost::regex_match(str, what, path_exp))
-         return core::frame_consumer::empty();
-                                  
-    return make_safe<streaming_consumer>(
-               narrow(what["PATH"].str()),
-               narrow(what["ARGS"].str()));
+       return make_safe<streaming_consumer>(path, args);
 }
 
 safe_ptr<core::frame_consumer> create_streaming_consumer(const boost::property_tree::wptree& ptree)