ffmpeg-encoder: Various warning fixes and cleanup

Also don't include it from plugin.cpp if it's not enabled.
This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2020-03-27 20:06:27 +01:00
parent ff3c2e8c66
commit 4f7c1cb35e
12 changed files with 56 additions and 20 deletions

View file

@ -35,13 +35,17 @@
#include "handlers/handler.hpp"
extern "C" {
#include <obs-properties.h>
#include <obs.h>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4244)
#pragma warning(disable : 4242 4244 4365)
#endif
#include <libavcodec/avcodec.h>
#include <libavutil/frame.h>
#include <obs-properties.h>
#include <obs.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}
namespace encoder::ffmpeg {

View file

@ -31,7 +31,7 @@ extern "C" {
#include <obs-encoder.h>
#include <obs-properties.h>
#pragma warning(push)
#pragma warning(disable : 4244)
#pragma warning(disable : 4242 4244 4365)
#include <libavcodec/avcodec.h>
#pragma warning(pop)
}

View file

@ -29,11 +29,15 @@
#include "utility.hpp"
extern "C" {
#include <obs-module.h>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4244)
#pragma warning(disable : 4242 4244 4365)
#endif
#include <libavutil/opt.h>
#include <obs-module.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}
#define KEY_PROFILE "H264.Profile"

View file

@ -31,7 +31,7 @@
extern "C" {
#include <obs-module.h>
#pragma warning(push)
#pragma warning(disable : 4244)
#pragma warning(disable : 4242 4244 4365)
#include <libavutil/opt.h>
#pragma warning(pop)
}

View file

@ -367,7 +367,7 @@ void nvenc::get_properties_post(obs_properties_t* props, const AVCodec* codec)
obs_properties_t* grp = props;
if (!util::are_property_groups_broken()) {
grp = obs_properties_create();
auto p = obs_properties_add_group(props, ST_RATECONTROL_QUALITY, D_TRANSLATE(ST_RATECONTROL_QUALITY),
obs_properties_add_group(props, ST_RATECONTROL_QUALITY, D_TRANSLATE(ST_RATECONTROL_QUALITY),
OBS_GROUP_NORMAL, grp);
}
@ -393,8 +393,7 @@ void nvenc::get_properties_post(obs_properties_t* props, const AVCodec* codec)
obs_properties_t* grp = props;
if (!util::are_property_groups_broken()) {
grp = obs_properties_create();
auto p = obs_properties_add_group(props, ST_RATECONTROL_QP, D_TRANSLATE(ST_RATECONTROL_QP),
OBS_GROUP_NORMAL, grp);
obs_properties_add_group(props, ST_RATECONTROL_QP, D_TRANSLATE(ST_RATECONTROL_QP), OBS_GROUP_NORMAL, grp);
}
{

View file

@ -26,11 +26,15 @@
#include "utility.hpp"
extern "C" {
#include <obs-properties.h>
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4244)
#pragma warning(disable : 4242 4244 4365)
#endif
#include <libavcodec/avcodec.h>
#include <obs-properties.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}
/* NVENC has multiple compression modes:

View file

@ -24,10 +24,14 @@
#include <mutex>
extern "C" {
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4244)
#pragma warning(disable : 4242 4244 4365)
#endif
#include <libavutil/frame.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}
namespace ffmpeg {

View file

@ -28,11 +28,15 @@
#include <utility>
extern "C" {
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4244)
#pragma warning(disable : 4242 4244 4365)
#endif
#include <libavutil/frame.h>
#include <libavutil/hwcontext.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}
namespace ffmpeg::hwapi {

View file

@ -24,11 +24,15 @@
#include <utility>
extern "C" {
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4244)
#pragma warning(disable : 4242 4244 4365)
#endif
#include <libavutil/pixfmt.h>
#include <libswscale/swscale.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}
namespace ffmpeg {

View file

@ -177,6 +177,8 @@ AVColorSpace tools::obs_videocolorspace_to_avcolorspace(video_colorspace v)
return AVCOL_SPC_BT709;
case VIDEO_CS_601:
return AVCOL_SPC_BT470BG;
case VIDEO_CS_SRGB:
return AVCOL_SPC_RGB;
}
throw std::invalid_argument("unknown color space");
}
@ -251,6 +253,7 @@ void tools::setup_obs_color(video_colorspace colorspace, video_range_type range,
{VIDEO_CS_DEFAULT, {AVCOL_SPC_BT470BG, AVCOL_PRI_BT470BG, AVCOL_TRC_SMPTE170M}},
{VIDEO_CS_601, {AVCOL_SPC_BT470BG, AVCOL_PRI_BT470BG, AVCOL_TRC_SMPTE170M}},
{VIDEO_CS_709, {AVCOL_SPC_BT709, AVCOL_PRI_BT709, AVCOL_TRC_BT709}},
{VIDEO_CS_SRGB, {AVCOL_SPC_RGB, AVCOL_PRI_BT709, AVCOL_TRC_BT709}},
};
std::map<video_range_type, AVColorRange> colorranges = {
{VIDEO_RANGE_DEFAULT, AVCOL_RANGE_MPEG},

View file

@ -26,8 +26,15 @@
#include <vector>
extern "C" {
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4242 4244 4365)
#endif
#include <libavcodec/avcodec.h>
#include <libavutil/pixfmt.h>
#ifdef _MSC_VER
#pragma warning(pop)
#endif
}
namespace ffmpeg::tools {

View file

@ -19,10 +19,11 @@
#include "plugin.hpp"
#include <stdexcept>
#include "obs/obs-source-tracker.hpp"
#ifdef ENABLE_ENCODER_FFMPEG
#include "encoders/ffmpeg-encoder.hpp"
#endif
#ifdef ENABLE_FILTER_BLUR
#include "filters/filter-blur.hpp"
@ -45,12 +46,14 @@
#ifdef ENABLE_FILTER_TRANSFORM
#include "filters/filter-transform.hpp"
#endif
#ifdef ENABLE_SOURCE_MIRROR
#include "sources/source-mirror.hpp"
#endif
#ifdef ENABLE_SOURCE_SHADER
#include "sources/source-shader.hpp"
#endif
#ifdef ENABLE_TRANSITION_SHADER
//#include "transitions/source-shader.hpp"
#endif
@ -169,7 +172,7 @@ try {
#ifdef _WIN32
// Windows Only
extern "C" {
#include <windows.h>
#include <Windows.h>
}
BOOL WINAPI DllMain(HINSTANCE, DWORD, LPVOID)