summaryrefslogtreecommitdiff
path: root/Source
diff options
context:
space:
mode:
authorsmelenchuk <smelenchuk@gmail.com>2011-02-11 22:09:20 +0000
committersmelenchuk <smelenchuk@gmail.com>2011-02-11 22:09:20 +0000
commitcecef62c8cd2a1f43447665012e2b8d900478fd3 (patch)
treefb7e2fb1d4e9a0ebb21186133d6ea8f442fba7ab /Source
parentc45a4306494da14cfeedab8d010874883a337c50 (diff)
For non-win32 and with-libav conditions, add an option to frame dumping to use FFV1 codec for lossless video dumping.
git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7139 8ced0084-cf51-0410-be5f-012b33b47a6e
Diffstat (limited to 'Source')
-rw-r--r--Source/Core/DolphinWX/Src/VideoConfigDiag.cpp6
-rw-r--r--Source/Core/VideoCommon/Src/AVIDump.cpp14
-rw-r--r--Source/Core/VideoCommon/Src/VideoConfig.cpp2
-rw-r--r--Source/Core/VideoCommon/Src/VideoConfig.h1
4 files changed, 19 insertions, 4 deletions
diff --git a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp
index 7a079d3e5b..840afa4a13 100644
--- a/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp
+++ b/Source/Core/DolphinWX/Src/VideoConfigDiag.cpp
@@ -99,6 +99,9 @@ wxString dump_textures_tooltip = wxTRANSLATE("Dump game textures to User/Dump/Te
wxString load_hires_textures_tooltip = wxTRANSLATE("Load high-resolution textures from User/Load/Textures/<game id>/");
wxString dump_efb_tooltip = wxT("");
wxString dump_frames_tooltip = wxT("");
+#if !defined WIN32 && defined HAVE_LIBAV
+wxString use_ffv1_tooltip = wxT("");
+#endif
wxString free_look_tooltip = wxT("");
wxString crop_tooltip = wxT("");
wxString opencl_tooltip = wxT("");
@@ -402,6 +405,9 @@ VideoConfigDiag::VideoConfigDiag(wxWindow* parent, const std::string &title, con
szr_utility->Add(new SettingCheckBox(page_advanced, _("Dump EFB Target"), dump_efb_tooltip, vconfig.bDumpEFBTarget));
szr_utility->Add(new SettingCheckBox(page_advanced, _("Dump Frames"), dump_frames_tooltip, vconfig.bDumpFrames));
szr_utility->Add(new SettingCheckBox(page_advanced, _("Free Look"), free_look_tooltip, vconfig.bFreeLook));
+#if !defined WIN32 && defined HAVE_LIBAV
+ szr_utility->Add(new SettingCheckBox(page_advanced, _("Frame dumps use FFV1"), use_ffv1_tooltip, vconfig.bUseFFV1));
+#endif
wxStaticBoxSizer* const group_utility = new wxStaticBoxSizer(wxVERTICAL, page_advanced, _("Utility"));
szr_advanced->Add(group_utility, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 5);
diff --git a/Source/Core/VideoCommon/Src/AVIDump.cpp b/Source/Core/VideoCommon/Src/AVIDump.cpp
index f276fb3483..75de09fee9 100644
--- a/Source/Core/VideoCommon/Src/AVIDump.cpp
+++ b/Source/Core/VideoCommon/Src/AVIDump.cpp
@@ -17,6 +17,7 @@
#include "AVIDump.h"
#include "HW/VideoInterface.h" //for TargetRefreshRate
+#include "VideoConfig.h"
#ifdef _WIN32
@@ -253,6 +254,11 @@ bool AVIDump::CreateFile()
return false;
}
+ if (g_Config.bUseFFV1)
+ {
+ s_FormatContext->oformat->video_codec = CODEC_ID_FFV1;
+ }
+
s_Stream->codec->codec_id = s_FormatContext->oformat->video_codec;
s_Stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
s_Stream->codec->bit_rate = 400000;
@@ -260,7 +266,7 @@ bool AVIDump::CreateFile()
s_Stream->codec->height = s_height;
s_Stream->codec->time_base = (AVRational){1, VideoInterface::TargetRefreshRate};
s_Stream->codec->gop_size = 12;
- s_Stream->codec->pix_fmt = PIX_FMT_YUV420P;
+ s_Stream->codec->pix_fmt = (g_Config.bUseFFV1) ? PIX_FMT_BGRA : PIX_FMT_YUV420P;
av_set_parameters(s_FormatContext, NULL);
@@ -272,7 +278,7 @@ bool AVIDump::CreateFile()
}
if(!(s_SwsContext = sws_getContext(s_width, s_height, PIX_FMT_BGR24, s_width, s_height,
- PIX_FMT_YUV420P, SWS_BICUBIC, NULL, NULL, NULL)))
+ s_Stream->codec->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL)))
{
CloseFile();
return false;
@@ -281,10 +287,10 @@ bool AVIDump::CreateFile()
s_BGRFrame = avcodec_alloc_frame();
s_YUVFrame = avcodec_alloc_frame();
- s_size = avpicture_get_size(PIX_FMT_YUV420P, s_width, s_height);
+ s_size = avpicture_get_size(s_Stream->codec->pix_fmt, s_width, s_height);
s_YUVBuffer = new uint8_t[s_size];
- avpicture_fill((AVPicture *)s_YUVFrame, s_YUVBuffer, PIX_FMT_YUV420P, s_width, s_height);
+ avpicture_fill((AVPicture *)s_YUVFrame, s_YUVBuffer, s_Stream->codec->pix_fmt, s_width, s_height);
s_OutBuffer = new uint8_t[s_size];
diff --git a/Source/Core/VideoCommon/Src/VideoConfig.cpp b/Source/Core/VideoCommon/Src/VideoConfig.cpp
index 2bad82836e..11fa943e23 100644
--- a/Source/Core/VideoCommon/Src/VideoConfig.cpp
+++ b/Source/Core/VideoCommon/Src/VideoConfig.cpp
@@ -76,6 +76,7 @@ void VideoConfig::Load(const char *ini_file)
iniFile.Get("Settings", "DumpEFBTarget", &bDumpEFBTarget, 0);
iniFile.Get("Settings", "DumpFrames", &bDumpFrames, 0);
iniFile.Get("Settings", "FreeLook", &bFreeLook, 0);
+ iniFile.Get("Settings", "UseFFV1", &bUseFFV1, 0);
iniFile.Get("Settings", "AnaglyphStereo", &bAnaglyphStereo, false);
iniFile.Get("Settings", "AnaglyphStereoSeparation", &iAnaglyphStereoSeparation, 200);
iniFile.Get("Settings", "AnaglyphFocalAngle", &iAnaglyphFocalAngle, 0);
@@ -203,6 +204,7 @@ void VideoConfig::Save(const char *ini_file)
iniFile.Set("Settings", "DumpEFBTarget", bDumpEFBTarget);
iniFile.Set("Settings", "DumpFrames", bDumpFrames);
iniFile.Set("Settings", "FreeLook", bFreeLook);
+ iniFile.Set("Settings", "UseFFV1", bUseFFV1);
iniFile.Set("Settings", "AnaglyphStereo", bAnaglyphStereo);
iniFile.Set("Settings", "AnaglyphStereoSeparation", iAnaglyphStereoSeparation);
iniFile.Set("Settings", "AnaglyphFocalAngle", iAnaglyphFocalAngle);
diff --git a/Source/Core/VideoCommon/Src/VideoConfig.h b/Source/Core/VideoCommon/Src/VideoConfig.h
index 78aac9f025..2f43efe1ef 100644
--- a/Source/Core/VideoCommon/Src/VideoConfig.h
+++ b/Source/Core/VideoCommon/Src/VideoConfig.h
@@ -108,6 +108,7 @@ struct VideoConfig
bool bHiresTextures;
bool bDumpEFBTarget;
bool bDumpFrames;
+ bool bUseFFV1;
bool bFreeLook;
bool bAnaglyphStereo;
int iAnaglyphStereoSeparation;