]> git.sesse.net Git - casparcg/blobdiff - modules/ffmpeg/producer/ffmpeg_producer.cpp
* Working server startup in Linux
[casparcg] / modules / ffmpeg / producer / ffmpeg_producer.cpp
index 64be5c78efb95755aa67fadddc295ad0363b7a99..faa9bf847f5c686413cc19e2ed391e6c753aaa03 100644 (file)
@@ -19,7 +19,7 @@
 * Author: Robert Nagy, ronag89@gmail.com
 */
 
-#include "../stdafx.h"
+#include "../StdAfx.h"
 
 #include "ffmpeg_producer.h"
 
 
 #include <boost/algorithm/string.hpp>
 #include <common/assert.h>
-#include <boost/assign.hpp>
 #include <boost/timer.hpp>
-#include <boost/foreach.hpp>
 #include <boost/filesystem.hpp>
-#include <boost/range/algorithm/find_if.hpp>
-#include <boost/range/algorithm/find.hpp>
 #include <boost/property_tree/ptree.hpp>
 #include <boost/regex.hpp>
 #include <boost/thread/future.hpp>
@@ -93,7 +89,7 @@ struct ffmpeg_producer : public core::frame_producer_base
 {
        spl::shared_ptr<core::monitor::subject>                 monitor_subject_;
        const std::wstring                                                              filename_;
-       const std::wstring                                                              path_relative_to_media_;
+       const std::wstring                                                              path_relative_to_media_ = get_relative_or_original(filename_, env::media_folder());
        
        const spl::shared_ptr<diagnostics::graph>               graph_;
                                        
@@ -102,7 +98,7 @@ struct ffmpeg_producer : public core::frame_producer_base
 
        input                                                                                   input_; 
 
-       const double                                                                    fps_;
+       const double                                                                    fps_                                    = read_fps(input_.context(), format_desc_.fps);
        const uint32_t                                                                  start_;
                
        std::unique_ptr<video_decoder>                                  video_decoder_;
@@ -110,7 +106,7 @@ struct ffmpeg_producer : public core::frame_producer_base
        frame_muxer                                                                             muxer_;
        core::constraints                                                               constraints_;
        
-       core::draw_frame                                                                last_frame_;
+       core::draw_frame                                                                last_frame_                             = core::draw_frame::empty();
 
        boost::optional<uint32_t>                                               seek_target_;
        
@@ -123,14 +119,12 @@ public:
                                                         uint32_t start, 
                                                         uint32_t length) 
                : filename_(filename)
-               , path_relative_to_media_(get_relative_or_original(filename, env::media_folder()))
                , frame_factory_(frame_factory)         
                , format_desc_(format_desc)
                , input_(graph_, filename_, loop, start, length)
                , fps_(read_fps(input_.context(), format_desc_.fps))
                , muxer_(fps_, frame_factory, format_desc_, filter)
                , start_(start)
-               , last_frame_(core::draw_frame::empty())
        {
                graph_->set_color("frame-time", diagnostics::color(0.1f, 1.0f, 0.1f));
                graph_->set_color("underflow", diagnostics::color(0.6f, 0.3f, 0.9f));   
@@ -252,10 +246,10 @@ public:
                
        std::future<std::wstring> call(const std::vector<std::wstring>& params) override
        {
-               static const boost::wregex loop_exp(L"LOOP\\s*(?<VALUE>\\d?)?", boost::regex::icase);
-               static const boost::wregex seek_exp(L"SEEK\\s+(?<VALUE>\\d+)", boost::regex::icase);
-               static const boost::wregex length_exp(L"LENGTH\\s+(?<VALUE>\\d+)?", boost::regex::icase);
-               static const boost::wregex start_exp(L"START\\s+(?<VALUE>\\d+)?", boost::regex::icase);
+               static const boost::wregex loop_exp(LR"(LOOP\s*(?<VALUE>\d?)?)", boost::regex::icase);
+               static const boost::wregex seek_exp(LR"(SEEK\s+(?<VALUE>\d+))", boost::regex::icase);
+               static const boost::wregex length_exp(LR"(LENGTH\s+(?<VALUE>\d+)?)", boost::regex::icase);
+               static const boost::wregex start_exp(LR"(START\\s+(?<VALUE>\\d+)?)", boost::regex::icase);
 
                auto param = boost::algorithm::join(params, L" ");
                
@@ -405,7 +399,7 @@ public:
 
 spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core::frame_factory>& frame_factory, const core::video_format_desc& format_desc, const std::vector<std::wstring>& params)
 {              
-       auto filename = probe_stem(env::media_folder() + L"\\" + params.at(0));
+       auto filename = probe_stem(env::media_folder() + L"/" + params.at(0));
 
        if(filename.empty())
                return core::frame_producer::empty();
@@ -418,4 +412,4 @@ spl::shared_ptr<core::frame_producer> create_producer(const spl::shared_ptr<core
        return create_destroy_proxy(spl::make_shared_ptr(std::make_shared<ffmpeg_producer>(frame_factory, format_desc, filename, filter_str, loop, start, length)));
 }
 
-}}
\ No newline at end of file
+}}