mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-05-27 22:36:36 +00:00
VideoConfig: Eliminate frame dumping members.
This commit is contained in:
parent
f4c37aeb14
commit
48b2f7d200
5 changed files with 15 additions and 35 deletions
|
@ -8,7 +8,6 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include <fmt/chrono.h>
|
#include <fmt/chrono.h>
|
||||||
|
@ -32,15 +31,14 @@ extern "C" {
|
||||||
#include "Common/MsgHandler.h"
|
#include "Common/MsgHandler.h"
|
||||||
#include "Common/StringUtil.h"
|
#include "Common/StringUtil.h"
|
||||||
|
|
||||||
|
#include "Core/Config/GraphicsSettings.h"
|
||||||
#include "Core/Config/MainSettings.h"
|
#include "Core/Config/MainSettings.h"
|
||||||
#include "Core/ConfigManager.h"
|
#include "Core/ConfigManager.h"
|
||||||
#include "Core/HW/SystemTimers.h"
|
#include "Core/HW/SystemTimers.h"
|
||||||
#include "Core/HW/VideoInterface.h"
|
#include "Core/HW/VideoInterface.h"
|
||||||
#include "Core/System.h"
|
#include "Core/System.h"
|
||||||
|
|
||||||
#include "VideoCommon/FrameDumper.h"
|
|
||||||
#include "VideoCommon/OnScreenDisplay.h"
|
#include "VideoCommon/OnScreenDisplay.h"
|
||||||
#include "VideoCommon/VideoConfig.h"
|
|
||||||
|
|
||||||
struct FrameDumpContext
|
struct FrameDumpContext
|
||||||
{
|
{
|
||||||
|
@ -122,8 +120,9 @@ void InitAVCodec()
|
||||||
|
|
||||||
std::string GetDumpPath(const std::string& extension, std::time_t time, u32 index)
|
std::string GetDumpPath(const std::string& extension, std::time_t time, u32 index)
|
||||||
{
|
{
|
||||||
if (!g_Config.sDumpPath.empty())
|
const std::string dump_path = Config::Get(Config::GFX_DUMP_PATH);
|
||||||
return g_Config.sDumpPath;
|
if (!dump_path.empty())
|
||||||
|
return dump_path;
|
||||||
|
|
||||||
const std::string path_prefix =
|
const std::string path_prefix =
|
||||||
File::GetUserPath(D_DUMPFRAMES_IDX) + SConfig::GetInstance().GetGameID();
|
File::GetUserPath(D_DUMPFRAMES_IDX) + SConfig::GetInstance().GetGameID();
|
||||||
|
@ -194,7 +193,7 @@ bool FFMpegFrameDump::PrepareEncoding(int w, int h, u64 start_ticks, u32 savesta
|
||||||
|
|
||||||
bool FFMpegFrameDump::CreateVideoFile()
|
bool FFMpegFrameDump::CreateVideoFile()
|
||||||
{
|
{
|
||||||
const std::string& format = g_Config.sDumpFormat;
|
const std::string format = Config::Get(Config::GFX_DUMP_FORMAT);
|
||||||
|
|
||||||
const std::string dump_path = GetDumpPath(format, m_start_time, m_file_index);
|
const std::string dump_path = GetDumpPath(format, m_start_time, m_file_index);
|
||||||
|
|
||||||
|
@ -217,7 +216,8 @@ bool FFMpegFrameDump::CreateVideoFile()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string& codec_name = g_Config.bUseLossless ? "utvideo" : g_Config.sDumpCodec;
|
const std::string codec_name =
|
||||||
|
Config::Get(Config::GFX_USE_LOSSLESS) ? "utvideo" : Config::Get(Config::GFX_DUMP_CODEC);
|
||||||
|
|
||||||
AVCodecID codec_id = output_format->video_codec;
|
AVCodecID codec_id = output_format->video_codec;
|
||||||
|
|
||||||
|
@ -231,12 +231,12 @@ bool FFMpegFrameDump::CreateVideoFile()
|
||||||
}
|
}
|
||||||
|
|
||||||
const AVCodec* codec = nullptr;
|
const AVCodec* codec = nullptr;
|
||||||
|
const std::string dump_encoder = Config::Get(Config::GFX_DUMP_ENCODER);
|
||||||
if (!g_Config.sDumpEncoder.empty())
|
if (!dump_encoder.empty())
|
||||||
{
|
{
|
||||||
codec = avcodec_find_encoder_by_name(g_Config.sDumpEncoder.c_str());
|
codec = avcodec_find_encoder_by_name(dump_encoder.c_str());
|
||||||
if (!codec)
|
if (!codec)
|
||||||
WARN_LOG_FMT(FRAMEDUMP, "Invalid encoder {}", g_Config.sDumpEncoder);
|
WARN_LOG_FMT(FRAMEDUMP, "Invalid encoder {}", dump_encoder);
|
||||||
}
|
}
|
||||||
if (!codec)
|
if (!codec)
|
||||||
codec = avcodec_find_encoder(codec_id);
|
codec = avcodec_find_encoder(codec_id);
|
||||||
|
@ -258,7 +258,7 @@ bool FFMpegFrameDump::CreateVideoFile()
|
||||||
m_context->height, time_base.den, time_base.num);
|
m_context->height, time_base.den, time_base.num);
|
||||||
|
|
||||||
m_context->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
m_context->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||||
m_context->codec->bit_rate = static_cast<int64_t>(g_Config.iBitrateKbps) * 1000;
|
m_context->codec->bit_rate = static_cast<int64_t>(Config::Get(Config::GFX_BITRATE_KBPS)) * 1000;
|
||||||
m_context->codec->width = m_context->width;
|
m_context->codec->width = m_context->width;
|
||||||
m_context->codec->height = m_context->height;
|
m_context->codec->height = m_context->height;
|
||||||
m_context->codec->time_base = time_base;
|
m_context->codec->time_base = time_base;
|
||||||
|
@ -267,7 +267,7 @@ bool FFMpegFrameDump::CreateVideoFile()
|
||||||
|
|
||||||
AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
|
AVPixelFormat pix_fmt = AV_PIX_FMT_NONE;
|
||||||
|
|
||||||
const std::string& pixel_format_string = g_Config.sDumpPixelFormat;
|
const std::string pixel_format_string = Config::Get(Config::GFX_DUMP_PIXEL_FORMAT);
|
||||||
if (!pixel_format_string.empty())
|
if (!pixel_format_string.empty())
|
||||||
{
|
{
|
||||||
pix_fmt = av_get_pix_fmt(pixel_format_string.c_str());
|
pix_fmt = av_get_pix_fmt(pixel_format_string.c_str());
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
#include "VideoCommon/AbstractTexture.h"
|
#include "VideoCommon/AbstractTexture.h"
|
||||||
#include "VideoCommon/OnScreenDisplay.h"
|
#include "VideoCommon/OnScreenDisplay.h"
|
||||||
#include "VideoCommon/Present.h"
|
#include "VideoCommon/Present.h"
|
||||||
#include "VideoCommon/VideoConfig.h"
|
|
||||||
|
|
||||||
// The video encoder needs the image to be a multiple of x samples.
|
// The video encoder needs the image to be a multiple of x samples.
|
||||||
static constexpr int VIDEO_ENCODER_LCM = 4;
|
static constexpr int VIDEO_ENCODER_LCM = 4;
|
||||||
|
@ -201,7 +200,7 @@ void FrameDumper::FrameDumpThreadFunc()
|
||||||
{
|
{
|
||||||
Common::SetCurrentThreadName("FrameDumping");
|
Common::SetCurrentThreadName("FrameDumping");
|
||||||
|
|
||||||
bool dump_to_ffmpeg = !g_ActiveConfig.bDumpFramesAsImages;
|
bool dump_to_ffmpeg = !Config::Get(Config::GFX_DUMP_FRAMES_AS_IMAGES);
|
||||||
bool frame_dump_started = false;
|
bool frame_dump_started = false;
|
||||||
|
|
||||||
// If Dolphin was compiled without ffmpeg, we only support dumping to images.
|
// If Dolphin was compiled without ffmpeg, we only support dumping to images.
|
||||||
|
|
|
@ -229,7 +229,7 @@ void Presenter::ProcessFrameDumping(u64 ticks) const
|
||||||
if (g_frame_dumper->IsFrameDumping() && m_xfb_entry)
|
if (g_frame_dumper->IsFrameDumping() && m_xfb_entry)
|
||||||
{
|
{
|
||||||
MathUtil::Rectangle<int> target_rect;
|
MathUtil::Rectangle<int> target_rect;
|
||||||
switch (g_ActiveConfig.frame_dumps_resolution_type)
|
switch (Config::Get(Config::GFX_FRAME_DUMPS_RESOLUTION_TYPE))
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case FrameDumpResolutionType::WindowResolution:
|
case FrameDumpResolutionType::WindowResolution:
|
||||||
|
|
|
@ -112,15 +112,6 @@ void VideoConfig::Refresh()
|
||||||
bCacheHiresTextures = Config::Get(Config::GFX_CACHE_HIRES_TEXTURES);
|
bCacheHiresTextures = Config::Get(Config::GFX_CACHE_HIRES_TEXTURES);
|
||||||
bDumpEFBTarget = Config::Get(Config::GFX_DUMP_EFB_TARGET);
|
bDumpEFBTarget = Config::Get(Config::GFX_DUMP_EFB_TARGET);
|
||||||
bDumpXFBTarget = Config::Get(Config::GFX_DUMP_XFB_TARGET);
|
bDumpXFBTarget = Config::Get(Config::GFX_DUMP_XFB_TARGET);
|
||||||
bDumpFramesAsImages = Config::Get(Config::GFX_DUMP_FRAMES_AS_IMAGES);
|
|
||||||
bUseLossless = Config::Get(Config::GFX_USE_LOSSLESS);
|
|
||||||
sDumpFormat = Config::Get(Config::GFX_DUMP_FORMAT);
|
|
||||||
sDumpCodec = Config::Get(Config::GFX_DUMP_CODEC);
|
|
||||||
sDumpPixelFormat = Config::Get(Config::GFX_DUMP_PIXEL_FORMAT);
|
|
||||||
sDumpEncoder = Config::Get(Config::GFX_DUMP_ENCODER);
|
|
||||||
sDumpPath = Config::Get(Config::GFX_DUMP_PATH);
|
|
||||||
iBitrateKbps = Config::Get(Config::GFX_BITRATE_KBPS);
|
|
||||||
frame_dumps_resolution_type = Config::Get(Config::GFX_FRAME_DUMPS_RESOLUTION_TYPE);
|
|
||||||
bEnableGPUTextureDecoding = Config::Get(Config::GFX_ENABLE_GPU_TEXTURE_DECODING);
|
bEnableGPUTextureDecoding = Config::Get(Config::GFX_ENABLE_GPU_TEXTURE_DECODING);
|
||||||
bPreferVSForLinePointExpansion = Config::Get(Config::GFX_PREFER_VS_FOR_LINE_POINT_EXPANSION);
|
bPreferVSForLinePointExpansion = Config::Get(Config::GFX_PREFER_VS_FOR_LINE_POINT_EXPANSION);
|
||||||
bEnablePixelLighting = Config::Get(Config::GFX_ENABLE_PIXEL_LIGHTING);
|
bEnablePixelLighting = Config::Get(Config::GFX_ENABLE_PIXEL_LIGHTING);
|
||||||
|
|
|
@ -258,19 +258,9 @@ struct VideoConfig final
|
||||||
bool bCacheHiresTextures = false;
|
bool bCacheHiresTextures = false;
|
||||||
bool bDumpEFBTarget = false;
|
bool bDumpEFBTarget = false;
|
||||||
bool bDumpXFBTarget = false;
|
bool bDumpXFBTarget = false;
|
||||||
bool bDumpFramesAsImages = false;
|
|
||||||
bool bUseLossless = false;
|
|
||||||
std::string sDumpCodec;
|
|
||||||
std::string sDumpPixelFormat;
|
|
||||||
std::string sDumpEncoder;
|
|
||||||
std::string sDumpFormat;
|
|
||||||
std::string sDumpPath;
|
|
||||||
FrameDumpResolutionType frame_dumps_resolution_type =
|
|
||||||
FrameDumpResolutionType::XFBAspectRatioCorrectedResolution;
|
|
||||||
bool bBorderlessFullscreen = false;
|
bool bBorderlessFullscreen = false;
|
||||||
bool bEnableGPUTextureDecoding = false;
|
bool bEnableGPUTextureDecoding = false;
|
||||||
bool bPreferVSForLinePointExpansion = false;
|
bool bPreferVSForLinePointExpansion = false;
|
||||||
int iBitrateKbps = 0;
|
|
||||||
bool bGraphicMods = false;
|
bool bGraphicMods = false;
|
||||||
std::optional<GraphicsModGroupConfig> graphics_mod_config;
|
std::optional<GraphicsModGroupConfig> graphics_mod_config;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue