From 17f88ac080bc2ee12cea24e865a2edd41e89c3db Mon Sep 17 00:00:00 2001 From: Ilari Liusvaara Date: Wed, 2 Mar 2011 04:03:27 +0200 Subject: [PATCH] streamtools: Backport newer x264 driver The newer driver is needed to support new x264 versions so backport it. --- Changelog.utf8 | 3 ++- streamtools/outputs/x264.cpp | 28 ++++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/Changelog.utf8 b/Changelog.utf8 index d3adbb9..d542544 100644 --- a/Changelog.utf8 +++ b/Changelog.utf8 @@ -1,6 +1,7 @@ Changes from JPC-RR Release 11.4 onwards: ========================================= -- Don't try to stuff CDs into fdb +- Don't try to stuff CDs into fdb. +- streamtools: Backport newer x264 driver. Changes from JPC-RR Release 11.3 to JPC-RR Release 11.4: ======================================================== diff --git a/streamtools/outputs/x264.cpp b/streamtools/outputs/x264.cpp index df54f31..d85f614 100644 --- a/streamtools/outputs/x264.cpp +++ b/streamtools/outputs/x264.cpp @@ -22,11 +22,12 @@ namespace class output_driver_x264 : public output_driver { public: - output_driver_x264(const std::string& _filename, const std::string& _options) + output_driver_x264(const std::string& _filename, const std::string& _options, bool _newres) { filename = _filename; options = _options; set_video_callback(make_bound_method(*this, &output_driver_x264::video_callback)); + newres = _newres; } ~output_driver_x264() @@ -44,8 +45,12 @@ namespace std::stringstream commandline; commandline << "x264 "; commandline << expand_options(options, v.get_rate_num(), v.get_rate_denum()); - commandline << " - -o " << filename << " " << v.get_width() << "x" << v.get_height(); + commandline << " -o " << filename << " - "; + if(newres) + commandline << "--input-res "; + commandline << v.get_width() << "x" << v.get_height(); std::string s = commandline.str(); + std::cerr << s << std::endl; out = popen(s.c_str(), "w"); if(!out) { std::stringstream str; @@ -65,6 +70,7 @@ namespace size_t framesize; uint32_t width; uint32_t height; + bool newres; }; class output_driver_x264_factory : output_driver_factory @@ -77,7 +83,21 @@ namespace output_driver& make(const std::string& type, const std::string& name, const std::string& parameters) { - return *new output_driver_x264(name, parameters); + return *new output_driver_x264(name, parameters, false); } - } factory; + } factory1; + + class output_driver_x264n_factory : output_driver_factory + { + public: + output_driver_x264n_factory() + : output_driver_factory("x264n") + { + } + + output_driver& make(const std::string& type, const std::string& name, const std::string& parameters) + { + return *new output_driver_x264(name, parameters, true); + } + } factory2; } -- 2.11.4.GIT