diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c653d038..101d68ec 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,40 +6,24 @@ jobs: windows: strategy: matrix: - os: [windows-2016, windows-2019] + os: windows-2019 include: - - os: windows-2016 - generator_32: "Visual Studio 15 2017" - generator_64: "Visual Studio 15 2017" - sysversion: "10.0.17763.0" - os: windows-2019 - generator_32: "Visual Studio 16 2019" - generator_64: "Visual Studio 16 2019" sysversion: "10.0.18362.0" runs-on: ${{ matrix.os }} steps: - name: "Clone Repository" uses: actions/checkout@v1 - - name: Install Node.JS 10.x - uses: actions/setup-node@v1 - with: - node-version: 10 - - name: Configure & Compile - shell: bash - env: - CMAKE_GENERATOR_32: ${{ matrix.generator_32 }} - CMAKE_GENERATOR_64: ${{ matrix.generator_64 }} - CMAKE_SYSTEM_VERSION: ${{ matrix.sysversion }} - run: node ./ci/builder.js - - name: Package - shell: bash - env: - CMAKE_GENERATOR_32: ${{ matrix.generator_32 }} - CMAKE_GENERATOR_64: ${{ matrix.generator_64 }} + - name: "Configure Project" run: | - mkdir build/package - ls build/ - node ./ci/packager.js + cmake -H"." -B"build/temp" -G"Visual Studio 16 2019" -A"x64" -T"host=x64" -DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_PACKAGE_NAME=StreamFX -DCMAKE_INSTALL_PREFIX="build/distrib" -DCMAKE_PACKAGE_PREFIX="build/package" -DOBS_DOWNLOAD=true + - name: "Build Project" + run: | + cmake -H. -B"build/temp" --config RelWithDebInfo + - name: "Package Project" + run: | + cmake -H. -B"build/temp" --config RelWithDebInfo --target PACKAGE_7Z + cmake -H. -B"build/temp" --config RelWithDebInfo --target PACKAGE_ZIP - name: "Package Installer (Prereqs)" run: | curl "-kL" "https://cdn.xaymar.com/ci/innosetup-6.0.3.exe" "-f" "--retry" "5" "-o" "inno.exe" diff --git a/ci/builder.js b/ci/builder.js deleted file mode 100644 index e37c9ec7..00000000 --- a/ci/builder.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; - -const process = require('process'); -const runner = require('./runner.js'); -let env = process.env; - -let x32_steps = []; -let x64_steps = []; - -if ((process.platform == "win32") || (process.platform == "win64")) { - // Windows - let extra_conf = [ - `-DCMAKE_SYSTEM_VERSION=${process.env.CMAKE_SYSTEM_VERSION}`, - `-DCMAKE_PACKAGE_NAME=StreamFX`, - '-DCMAKE_INSTALL_PREFIX="build/distrib"', - '-DCMAKE_PACKAGE_PREFIX="build/package"', - '-DOBS_DOWNLOAD=true', - ]; - let extra_build = [ - - ]; - - if(process.env.APPVEYOR) { - extra_build.concat(['--', '/logger:"C:\\Program Files\\AppVeyor\\BuildAgent\\Appveyor.MSBuildLogger.dll"']); - } - - if ((process.env.CMAKE_GENERATOR_32 !== undefined) && (process.env.CMAKE_GENERATOR_32 !== "")) { - x32_steps.push( - [ 'cmake', [ - '-H.', '-Bbuild/32', - `-G"${process.env.CMAKE_GENERATOR_32}"`, '-AWin32', '-T"host=x64"', - ].concat(extra_conf), env ] - ); - x32_steps.push( - [ 'cmake', [ - '--build', 'build/32', - '--config', 'RelWithDebInfo', - '--target', 'INSTALL' - ].concat(extra_build), env ] - ); - } - if ((process.env.CMAKE_GENERATOR_64 !== undefined) && (process.env.CMAKE_GENERATOR_64 !== "")) { - x64_steps.push( - [ 'cmake', [ - '-H.', '-Bbuild/64', - `-G"${process.env.CMAKE_GENERATOR_64}"`, '-Ax64', '-T"host=x64"', - ].concat(extra_conf), env ] - ); - x64_steps.push( - [ 'cmake', [ - '--build', 'build/64', - '--config', 'RelWithDebInfo', - '--target', 'INSTALL' - ].concat(extra_build), env ] - ); - } -} else { - // Unix - -} - -function runRunners(runnerArray, name) { - return new Promise(async (resolve, reject) => { - let local = runnerArray.reverse(); - while (local.length > 0) { - try { - let task = local.pop(); - let work = new runner(name, task[0], task[1], task[2]); - await work.run(); - } catch (e) { - reject(e); - return; - } - } - resolve(0); - }); -} - -let promises = []; -promises.push(runRunners(x32_steps, "32-Bit")); -promises.push(runRunners(x64_steps, "64-Bit")); -Promise.all(promises).then( - res => { - process.exit(0); - }, - err => { - console.log(err); - process.exit(1); - } -).catch(err => { - console.log(err); - process.exit(1); -}) diff --git a/ci/packager.js b/ci/packager.js deleted file mode 100644 index e73becb5..00000000 --- a/ci/packager.js +++ /dev/null @@ -1,69 +0,0 @@ -"use strict"; - -const process = require('process'); -const runner = require('./runner.js'); -let env = process.env; - -let steps = []; - -if ((process.env.CMAKE_GENERATOR_64 !== undefined) && (process.env.CMAKE_GENERATOR_64 !== "")) { - steps.push( - [ 'cmake', [ - '--build', 'build/64', - '--config', 'RelWithDebInfo', - '--target', 'PACKAGE_7Z' - ], env ] - ); - steps.push( - [ 'cmake', [ - '--build', 'build/64', - '--config', 'RelWithDebInfo', - '--target', 'PACKAGE_ZIP' - ], env ] - ); -} else if ((process.env.CMAKE_GENERATOR_32 !== undefined) && (process.env.CMAKE_GENERATOR_32 !== "")) { - steps.push( - [ 'cmake', [ - '--build', 'build/32', - '--config', 'RelWithDebInfo', - '--target', 'PACKAGE_7Z' - ], env ] - ); - steps.push( - [ 'cmake', [ - '--build', 'build/32', - '--config', 'RelWithDebInfo', - '--target', 'PACKAGE_ZIP' - ], env ] - ); -} - -function runRunners(runnerArray, name) { - return new Promise(async (resolve, reject) => { - let local = runnerArray.reverse(); - while (local.length > 0) { - try { - let task = local.pop(); - let work = new runner(name, task[0], task[1], task[2]); - await work.run(); - } catch (e) { - reject(e); - return; - } - } - resolve(0); - }); -} - - -let promises = []; -promises.push(runRunners(steps, "32-Bit")); -Promise.all(promises).then( - res => { - process.exit(0); - }, - err => { - console.log(err); - process.exit(1); - } -) diff --git a/ci/runner.js b/ci/runner.js deleted file mode 100644 index 66bccf40..00000000 --- a/ci/runner.js +++ /dev/null @@ -1,50 +0,0 @@ -"use strict"; - -const process = require('process'); -const cp = require('child_process'); - -class Runner { - constructor(name, cmd, args, env) { - this.name = name; - this.cmd = cmd; - if (args == undefined) - args = []; - this.args = args; - if (env == undefined) - env = process.env; - this.env = env; - } - - run() { - let self = this; - return new Promise(function(resolve, reject) { - self.proc = cp.spawn( - self.cmd, self.args, { - windowsVerbatimArguments: true, - windowsHide: true, - env: self.env, - } - ); - self.proc.stdout.on('data', (data) => { - process.stdout.write(`[${self.name}:Out] ${data}`); - }); - self.proc.stderr.on('data', (data) => { - process.stderr.write(`[${self.name}:Err] ${data}`); - }); - self.proc.on('exit', (code, signal) => { - if (code != 0) { - reject(code); - return; - } - resolve(code); - return; - }); - }); - } - - execute() { - return this.run(); - } -} - -module.exports = Runner; \ No newline at end of file diff --git a/source/encoders/ffmpeg-encoder.cpp b/source/encoders/ffmpeg-encoder.cpp index 5c0509e6..d6241c87 100644 --- a/source/encoders/ffmpeg-encoder.cpp +++ b/source/encoders/ffmpeg-encoder.cpp @@ -63,7 +63,7 @@ enum class keyframe_type { SECONDS, FRAMES }; std::shared_ptr encoder::ffmpeg::ffmpeg_manager::_instance; -ffmpeg_manager::ffmpeg_manager() +ffmpeg_manager::ffmpeg_manager() : _factories(), _handlers(), _debug_handler() { // Handlers _debug_handler = ::std::make_shared(); @@ -71,6 +71,8 @@ ffmpeg_manager::ffmpeg_manager() register_handler("h264_nvenc", ::std::make_shared()); register_handler("hevc_nvenc", ::std::make_shared()); + // Encoders + /* void* iterator = nullptr; const AVCodec* codec = nullptr; for (codec = av_codec_iterate(&iterator); codec != nullptr; codec = av_codec_iterate(&iterator)) { @@ -85,6 +87,7 @@ ffmpeg_manager::ffmpeg_manager() } } } + */ } ffmpeg_manager::~ffmpeg_manager() @@ -92,9 +95,12 @@ ffmpeg_manager::~ffmpeg_manager() _factories.clear(); } -void ffmpeg_manager::register_handler(std::string const codec, std::shared_ptr const handler) {} +void ffmpeg_manager::register_handler(std::string codec, std::shared_ptr handler) +{ + _handlers.try_emplace(codec, handler); +} -std::shared_ptr const ffmpeg_manager::get_handler(std::string const codec) +std::shared_ptr ffmpeg_manager::get_handler(std::string codec) { auto fnd = _handlers.find(codec); if (fnd != _handlers.end()) @@ -106,7 +112,7 @@ std::shared_ptr const ffmpeg_manager::get_handler(std::string #endif } -bool ffmpeg_manager::has_handler(std::string const codec) +bool ffmpeg_manager::has_handler(std::string codec) { return (_handlers.find(codec) != _handlers.end()); } diff --git a/source/encoders/ffmpeg-encoder.hpp b/source/encoders/ffmpeg-encoder.hpp index 09ad60b4..be0cb159 100644 --- a/source/encoders/ffmpeg-encoder.hpp +++ b/source/encoders/ffmpeg-encoder.hpp @@ -99,11 +99,11 @@ namespace encoder::ffmpeg { ffmpeg_manager(); ~ffmpeg_manager(); - void register_handler(std::string const codec, std::shared_ptr const handler); + void register_handler(std::string codec, std::shared_ptr handler); - std::shared_ptr const get_handler(std::string const codec); + std::shared_ptr get_handler(std::string codec); - bool has_handler(std::string const codec); + bool has_handler(std::string codec); }; struct ffmpeg_info {