Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 18024aaf12 | |||
| b2b5cd8fad | |||
| b6e881b90f | |||
| bd60958b2f | |||
| f9ad87a56d | |||
| b07365cdc4 | |||
| f21cbe9aba | |||
| 403b43e77b | |||
| 58d8713369 |
@@ -3,32 +3,49 @@ name: CI
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
windows:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [windows-2016, windows-2019]
|
||||
include:
|
||||
- os: windows-2016
|
||||
generator_32: "Visual Studio 15 2017"
|
||||
generator_64: "Visual Studio 15 2017 Win64"
|
||||
generator_64: "Visual Studio 15 2017"
|
||||
sysversion: "10.0.17763.0"
|
||||
- os: windows-2019
|
||||
generator_32:
|
||||
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
|
||||
- name: "Clone Repository"
|
||||
uses: actions/checkout@v1
|
||||
- name: Update Submodules
|
||||
run: git submodule update --init --force --recursive
|
||||
- name: Install Node.JS 10.x
|
||||
uses: actions/setup-node@v1
|
||||
with:
|
||||
node-version: 10
|
||||
- name: Build
|
||||
- name: Configure & Compile
|
||||
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
|
||||
env:
|
||||
CMAKE_GENERATOR_32: ${{ matrix.generator_32 }}
|
||||
CMAKE_GENERATOR_64: ${{ matrix.generator_64 }}
|
||||
run: |
|
||||
mkdir build/package
|
||||
node ./ci/packager.js
|
||||
- name: "Package Installer (Prereqs)"
|
||||
run: |
|
||||
curl "-kL" "https://cdn.xaymar.com/ci/innosetup-6.0.3.exe" "-f" "--retry" "5" "-o" "inno.exe"
|
||||
.\inno.exe /VERYSILENT /SP- /SUPPRESSMSGBOXES /NORESTART
|
||||
- name: "Package Installer (Compile)"
|
||||
run: |
|
||||
& 'C:\Program Files (x86)\Inno Setup 6\ISCC.exe' /Qp ".\build\64\installer.iss"
|
||||
- name: "Upload Artifacts"
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: ${{ matrix.os }}
|
||||
path: build/package
|
||||
+12
-2
@@ -25,8 +25,8 @@ Include("cmake/util.cmake")
|
||||
|
||||
# Automatic Versioning
|
||||
set(VERSION_MAJOR 0)
|
||||
set(VERSION_MINOR 2)
|
||||
set(VERSION_PATCH 0)
|
||||
set(VERSION_MINOR 3)
|
||||
set(VERSION_PATCH 1)
|
||||
set(VERSION_TWEAK 0)
|
||||
set(PROJECT_COMMIT "N/A")
|
||||
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git")
|
||||
@@ -116,18 +116,27 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/cmake/version.hpp.in"
|
||||
"${PROJECT_BINARY_DIR}/source/version.hpp"
|
||||
@ONLY
|
||||
)
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/cmake/module.cpp.in"
|
||||
"${PROJECT_BINARY_DIR}/source/module.cpp"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
# Windows
|
||||
if (WIN32)
|
||||
## Installer (InnoSetup)
|
||||
get_filename_component(ISS_FILES_DIR "${CMAKE_INSTALL_PREFIX}" ABSOLUTE)
|
||||
file(TO_NATIVE_PATH "${ISS_FILES_DIR}" ISS_FILES_DIR)
|
||||
get_filename_component(ISS_PACKAGE_DIR "${CMAKE_PACKAGE_PREFIX}" ABSOLUTE)
|
||||
file(TO_NATIVE_PATH "${ISS_PACKAGE_DIR}" ISS_PACKAGE_DIR)
|
||||
get_filename_component(ISS_SOURCE_DIR "${PROJECT_SOURCE_DIR}" ABSOLUTE)
|
||||
file(TO_NATIVE_PATH "${ISS_SOURCE_DIR}" ISS_SOURCE_DIR)
|
||||
configure_file(
|
||||
"${PROJECT_SOURCE_DIR}/cmake/installer.iss.in"
|
||||
"${PROJECT_BINARY_DIR}/installer.iss"
|
||||
@ONLY
|
||||
)
|
||||
|
||||
# Windows Specific Resource Definition
|
||||
@@ -325,6 +334,7 @@ add_library(${PROJECT_NAME} MODULE
|
||||
${PROJECT_GENERATED}
|
||||
${PROJECT_PRIVATE}
|
||||
${PROJECT_DATA}
|
||||
${PROJECT_TEMPLATES}
|
||||
)
|
||||
|
||||
# Include Directories
|
||||
|
||||
@@ -1,74 +0,0 @@
|
||||
# Generic Settings
|
||||
version: '{build}-{branch}'
|
||||
|
||||
matrix:
|
||||
fast_finish: true
|
||||
|
||||
# Build Image & Environment
|
||||
platform: x64
|
||||
|
||||
# Build Tags only
|
||||
skip_non_tags: true
|
||||
|
||||
image:
|
||||
- Visual Studio 2017
|
||||
|
||||
environment:
|
||||
CMAKE_SYSTEM_VERSION: 10.0.17134.0
|
||||
CMAKE_GENERATOR_32: "Visual Studio 15 2017"
|
||||
CMAKE_GENERATOR_64: "Visual Studio 15 2017 Win64"
|
||||
PACKAGE_PREFIX: obs-ffmpeg-encoder
|
||||
INNOSETUP_URL: http://www.jrsoftware.org/download.php/is.exe
|
||||
CURL_VERSION: 7.39.0
|
||||
|
||||
# Resource Cache
|
||||
cache:
|
||||
- inno.exe
|
||||
- build/32/libobs-download
|
||||
- build/32/libobs-src
|
||||
- build/64/libobs-download
|
||||
- build/64/libobs-src
|
||||
|
||||
# Building
|
||||
install:
|
||||
- cmd: ci/appveyor-install.bat
|
||||
|
||||
build_script:
|
||||
- cmd: node ci/builder.js
|
||||
|
||||
after_build:
|
||||
- cmd: node ci/packager.js
|
||||
- cmd: ci/appveyor-package.bat
|
||||
|
||||
# Testing
|
||||
test: off
|
||||
|
||||
# Artifacts
|
||||
artifacts:
|
||||
- path: build/obs-ffmpeg-encoder-*.zip
|
||||
- path: build/obs-ffmpeg-encoder-*.7z
|
||||
- path: build/obs-ffmpeg-encoder-*.exe
|
||||
|
||||
# Deploying
|
||||
deploy:
|
||||
- provider: GitHub
|
||||
auth_token:
|
||||
secure: diGN1FzupARljI1iJsiAdZHut8aXODkUC6YDDi2oDRikEp5Ic8kQd8SSRDyA4pAJ
|
||||
draft: true
|
||||
prerelease: false
|
||||
force_update: true
|
||||
on:
|
||||
appveyor_repo_tag: true
|
||||
|
||||
# Notifications
|
||||
notifications:
|
||||
- provider: Webhook
|
||||
url:
|
||||
secure: PTtt5ALhmK0q42jYyx4/Qa1Uf18+gLMXKGdzJjDISJt8IE/K0Zyp58UYmDDbbyLp4pBRf/Ylj8rn/zYL/mqBoDVRIH5zasPqIvBD0ZhtvNjTOxQ3QoRkAmxgpWeMowm3A3I1rLizA2H4EctPpoAJGrvQ1G2HEYn9tVsGYeetFTo=
|
||||
on_build_success: false
|
||||
on_build_failure: false
|
||||
on_build_status_changed: true
|
||||
body: >-
|
||||
{
|
||||
"content": "**Build {{status}}**: [{{commitId}}] {{commitMessage}}\nBy {{commitAuthor}} on {{commitDate}}\n{{buildUrl}}"
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
@ECHO OFF
|
||||
git submodule update --init --force --recursive
|
||||
|
||||
IF EXIST inno.exe (
|
||||
curl -kL "%INNOSETUP_URL%" -f --retry 5 -o inno.exe -z inno.exe
|
||||
) else (
|
||||
curl -kL "%INNOSETUP_URL%" -f --retry 5 -o inno.exe
|
||||
)
|
||||
inno.exe /VERYSILENT /NORETART /SP- /SUPPRESSMSGBOXES
|
||||
@@ -1,3 +0,0 @@
|
||||
@ECHO OFF
|
||||
ECHO -- Building Installer --
|
||||
"C:\Program Files (x86)\Inno Setup 5\ISCC.exe" /Qp ".\build\64\installer.iss" > nul
|
||||
+5
-8
@@ -13,7 +13,7 @@ if ((process.platform == "win32") || (process.platform == "win64")) {
|
||||
`-DCMAKE_SYSTEM_VERSION=${process.env.CMAKE_SYSTEM_VERSION}`,
|
||||
`-DCMAKE_PACKAGE_NAME=obs-ffmpeg-encoder`,
|
||||
'-DCMAKE_INSTALL_PREFIX="build/distrib/"',
|
||||
'-DCMAKE_PACKAGE_PREFIX="build/"',
|
||||
'-DCMAKE_PACKAGE_PREFIX="build/package/"',
|
||||
];
|
||||
let extra_build = [
|
||||
|
||||
@@ -26,9 +26,8 @@ if ((process.platform == "win32") || (process.platform == "win64")) {
|
||||
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}"`,
|
||||
'-H.', '-Bbuild/32',
|
||||
`-G"${process.env.CMAKE_GENERATOR_32}"`, '-AWin32', '-T"host=x64"',
|
||||
].concat(extra_conf), env ]
|
||||
);
|
||||
x32_steps.push(
|
||||
@@ -42,10 +41,8 @@ if ((process.platform == "win32") || (process.platform == "win64")) {
|
||||
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}"`,
|
||||
'-T"host=x64"'
|
||||
'-H.', '-Bbuild/64',
|
||||
`-G"${process.env.CMAKE_GENERATOR_64}"`, '-Ax64', '-T"host=x64"',
|
||||
].concat(extra_conf), env ]
|
||||
);
|
||||
x64_steps.push(
|
||||
|
||||
+19
-13
@@ -2,20 +2,8 @@
|
||||
|
||||
const process = require('process');
|
||||
const runner = require('./runner.js');
|
||||
|
||||
function runRunners(runnerArray, name) {
|
||||
return new Promise(async (resolve, reject) => {
|
||||
let local = runnerArray.reverse();
|
||||
while (local.length > 0) {
|
||||
let task = local.pop();
|
||||
let work = new runner(name, task[0], task[1], task[2]);
|
||||
await work.run();
|
||||
}
|
||||
resolve(0);
|
||||
});
|
||||
}
|
||||
|
||||
let env = process.env;
|
||||
|
||||
let steps = [];
|
||||
|
||||
if ((process.env.CMAKE_GENERATOR_64 !== undefined) && (process.env.CMAKE_GENERATOR_64 !== "")) {
|
||||
@@ -50,6 +38,24 @@ if ((process.env.CMAKE_GENERATOR_64 !== undefined) && (process.env.CMAKE_GENERAT
|
||||
);
|
||||
}
|
||||
|
||||
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(
|
||||
|
||||
@@ -21,8 +21,8 @@ AppUpdatesURL={#MyAppURL}
|
||||
DefaultDirName={code:GetDirName}
|
||||
DefaultGroupName={#MyAppName}
|
||||
AllowNoIcons=yes
|
||||
LicenseFile="@PROJECT_SOURCE_DIR@/LICENSE"
|
||||
OutputDir="@CMAKE_INSTALL_PREFIX@/../"
|
||||
LicenseFile="@ISS_SOURCE_DIR@/LICENSE"
|
||||
OutputDir="@ISS_PACKAGE_DIR@"
|
||||
OutputBaseFilename=obs-ffmpeg-encoder-{#MyAppVersion}
|
||||
Compression=lzma
|
||||
SolidCompression=yes
|
||||
@@ -34,7 +34,7 @@ VersionInfoDescription={#MyAppName} Setup
|
||||
Name: "english"; MessagesFile: "compiler:Default.isl"
|
||||
|
||||
[Files]
|
||||
Source: "@CMAKE_INSTALL_PREFIX@/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
Source: "@ISS_FILES_DIR@/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
|
||||
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
|
||||
|
||||
[Icons]
|
||||
|
||||
+3
-4
@@ -600,8 +600,7 @@ void obsffmpeg::encoder::initialize_sw(obs_data_t* settings)
|
||||
static_cast<AVPixelFormat>(obs_data_get_int(settings, ST_FFMPEG_COLORFORMAT));
|
||||
if (_pixfmt_target == AV_PIX_FMT_NONE) {
|
||||
// Find the best conversion format.
|
||||
std::vector<AVPixelFormat> fmts = ffmpeg::tools::get_software_formats(_codec->pix_fmts);
|
||||
_pixfmt_target = ffmpeg::tools::get_best_compatible_format(fmts.data(), _pixfmt_source);
|
||||
_pixfmt_target = ffmpeg::tools::get_least_lossy_format(_codec->pix_fmts, _pixfmt_source);
|
||||
|
||||
if (_handler) // Allow Handler to override the automatic color format for sanity reasons.
|
||||
_handler->override_colorformat(_pixfmt_target, settings, _codec, _context);
|
||||
@@ -622,8 +621,8 @@ void obsffmpeg::encoder::initialize_sw(obs_data_t* settings)
|
||||
}
|
||||
}
|
||||
|
||||
_context->width = voi->width;
|
||||
_context->height = voi->height;
|
||||
_context->width = static_cast<int>(obs_encoder_get_width(_self));
|
||||
_context->height = static_cast<int>(obs_encoder_get_height(_self));
|
||||
ffmpeg::tools::setup_obs_color(voi->colorspace, voi->range, _context);
|
||||
|
||||
_context->pix_fmt = _pixfmt_target;
|
||||
|
||||
@@ -279,106 +279,6 @@ std::vector<AVPixelFormat> ffmpeg::tools::get_software_formats(const AVPixelForm
|
||||
return std::move(fmts);
|
||||
}
|
||||
|
||||
static std::map<std::pair<AVPixelFormat, AVPixelFormat>, double_t> format_compatibility = {
|
||||
{{AV_PIX_FMT_NV12, AV_PIX_FMT_NV12}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_NV12, AV_PIX_FMT_NV21}, 65535.0},
|
||||
|
||||
{{AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUVA420P}, 65535.0},
|
||||
{{AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P9}, 58981.5},
|
||||
{{AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P10}, 53083.35},
|
||||
{{AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P12}, 47775.015},
|
||||
{{AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P14}, 42997.5135},
|
||||
{{AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUV420P16}, 38697.76215},
|
||||
|
||||
{{AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA420P}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA420P9}, 65535.0},
|
||||
{{AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA420P10}, 58981.5},
|
||||
{{AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUVA420P16}, 53083.35},
|
||||
{{AV_PIX_FMT_YUVA420P, AV_PIX_FMT_YUV420P}, 32767.0},
|
||||
|
||||
{{AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUVA422P}, 65535.0},
|
||||
{{AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P9}, 58981.5},
|
||||
{{AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P10}, 53083.35},
|
||||
{{AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P12}, 47775.015},
|
||||
{{AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P14}, 42997.5135},
|
||||
{{AV_PIX_FMT_YUV422P, AV_PIX_FMT_YUV422P16}, 38697.76215},
|
||||
|
||||
{{AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUVA422P}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P9}, 65535.0},
|
||||
{{AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P10}, 58981.5},
|
||||
{{AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA422P16}, 53083.35},
|
||||
{{AV_PIX_FMT_YUVA422P, AV_PIX_FMT_YUV422P}, 32767.0},
|
||||
|
||||
{{AV_PIX_FMT_YVYU422, AV_PIX_FMT_YVYU422}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_YVYU422, AV_PIX_FMT_YUYV422}, 65535.0},
|
||||
|
||||
{{AV_PIX_FMT_UYVY422, AV_PIX_FMT_UYVY422}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_UYVY422, AV_PIX_FMT_YVYU422}, 65535.0},
|
||||
|
||||
{{AV_PIX_FMT_YUYV422, AV_PIX_FMT_YUYV422}, std::numeric_limits<double_t>::max()},
|
||||
|
||||
{{AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUVA444P}, 65535.0},
|
||||
{{AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P9}, 58981.5},
|
||||
{{AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P10}, 53083.35},
|
||||
{{AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P12}, 47775.015},
|
||||
{{AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P14}, 42997.5135},
|
||||
{{AV_PIX_FMT_YUV444P, AV_PIX_FMT_YUV444P16}, 38697.76215},
|
||||
|
||||
{{AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA444P}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA444P9}, 65535.0},
|
||||
{{AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA444P10}, 58981.5},
|
||||
{{AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUVA444P16}, 53083.35},
|
||||
{{AV_PIX_FMT_YUVA444P, AV_PIX_FMT_YUV444P}, 32767.0},
|
||||
|
||||
{{AV_PIX_FMT_RGBA, AV_PIX_FMT_RGBA}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB0}, 65535.0},
|
||||
{{AV_PIX_FMT_RGBA, AV_PIX_FMT_0RGB}, 32767.0},
|
||||
{{AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB24}, 16384.0},
|
||||
|
||||
{{AV_PIX_FMT_BGRA, AV_PIX_FMT_BGRA}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_BGRA, AV_PIX_FMT_BGR0}, 65535.0},
|
||||
{{AV_PIX_FMT_BGRA, AV_PIX_FMT_0BGR}, 32767.0},
|
||||
{{AV_PIX_FMT_BGRA, AV_PIX_FMT_BGR24}, 16384.0},
|
||||
|
||||
{{AV_PIX_FMT_BGR0, AV_PIX_FMT_BGR0}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_BGR0, AV_PIX_FMT_BGRA}, 65535.0},
|
||||
{{AV_PIX_FMT_BGR0, AV_PIX_FMT_BGR24}, 32767.0},
|
||||
|
||||
{{AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY8}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY9}, 65535.0},
|
||||
{{AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY10}, 58981.5},
|
||||
{{AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY12}, 53083.35},
|
||||
{{AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY14}, 47775.015},
|
||||
{{AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY16}, 42997.5135},
|
||||
|
||||
{{AV_PIX_FMT_BGR24, AV_PIX_FMT_BGR24}, std::numeric_limits<double_t>::max()},
|
||||
{{AV_PIX_FMT_BGR24, AV_PIX_FMT_RGB24}, 32767.0},
|
||||
};
|
||||
|
||||
AVPixelFormat ffmpeg::tools::get_best_compatible_format(const AVPixelFormat* list, AVPixelFormat source)
|
||||
{
|
||||
double_t score = std::numeric_limits<double_t>::min();
|
||||
AVPixelFormat best = source;
|
||||
|
||||
for (auto fmt = list; fmt && (*fmt != AV_PIX_FMT_NONE); fmt++) {
|
||||
auto found = format_compatibility.find(std::pair{source, *fmt});
|
||||
if (found != format_compatibility.end() && (score < found->second)) {
|
||||
score = found->second;
|
||||
best = *fmt;
|
||||
}
|
||||
}
|
||||
|
||||
if (score <= 0) {
|
||||
int data_loss = 0;
|
||||
return avcodec_find_best_pix_fmt_of_list(list, source, 0, &data_loss);
|
||||
}
|
||||
|
||||
return best;
|
||||
}
|
||||
|
||||
void ffmpeg::tools::setup_obs_color(video_colorspace colorspace, video_range_type range, AVCodecContext* context)
|
||||
{
|
||||
std::map<video_colorspace, std::tuple<AVColorSpace, AVColorPrimaries, AVColorTransferCharacteristic>>
|
||||
|
||||
@@ -56,8 +56,6 @@ namespace ffmpeg {
|
||||
|
||||
std::vector<AVPixelFormat> get_software_formats(const AVPixelFormat* list);
|
||||
|
||||
AVPixelFormat get_best_compatible_format(const AVPixelFormat* list, AVPixelFormat source);
|
||||
|
||||
void setup_obs_color(video_colorspace colorspace, video_range_type range, AVCodecContext* context);
|
||||
} // namespace tools
|
||||
} // namespace ffmpeg
|
||||
|
||||
@@ -20,6 +20,7 @@
|
||||
// SOFTWARE.
|
||||
|
||||
#include "nvenc_shared.hpp"
|
||||
#include <algorithm>
|
||||
#include "codecs/hevc.hpp"
|
||||
#include "plugin.hpp"
|
||||
#include "strings.hpp"
|
||||
@@ -131,15 +132,17 @@ std::map<b_ref_mode, std::string> obsffmpeg::nvenc::b_ref_mode_to_opt{
|
||||
{b_ref_mode::MIDDLE, "middle"},
|
||||
};
|
||||
|
||||
void obsffmpeg::nvenc::override_lag_in_frames(size_t& lag, obs_data_t*, const AVCodec*,
|
||||
AVCodecContext* context)
|
||||
void obsffmpeg::nvenc::override_lag_in_frames(size_t& lag, obs_data_t*, const AVCodec*, AVCodecContext* context)
|
||||
{
|
||||
// With NVENC, the number of frames lagged before we get our first
|
||||
// packet is determined by the number of b-frames. Threads, lookahead
|
||||
// frames and various other settings are ignored.
|
||||
// The minimum number of lagged frames is 1.
|
||||
|
||||
lag = 1ull + static_cast<size_t>(context->max_b_frames);
|
||||
int64_t rcla = 0;
|
||||
av_opt_get_int(context, "rc-lookahead", AV_OPT_SEARCH_CHILDREN, &rcla);
|
||||
|
||||
lag = static_cast<size_t>(std::max(1ll + static_cast<int64_t>(context->max_b_frames), rcla));
|
||||
}
|
||||
|
||||
void obsffmpeg::nvenc::get_defaults(obs_data_t* settings, const AVCodec*, AVCodecContext*)
|
||||
|
||||
Reference in New Issue
Block a user