summaryrefslogtreecommitdiff
path: root/Source/Core/VideoBackends/OGL/Render.cpp
diff options
context:
space:
mode:
authorPierre Bourdon <delroth@gmail.com>2016-01-09 01:01:05 +0100
committerPierre Bourdon <delroth@gmail.com>2016-01-09 01:01:05 +0100
commitbf1c53a6e8f18d45682af7a16d17b1173536254b (patch)
treeecfc3fe7522b175cba68dca3fb0eeea3a90d4668 /Source/Core/VideoBackends/OGL/Render.cpp
parentb56a084b0b04cd5e229eefb069579325a2095d3a (diff)
parent66595b0ac98cea09c249202aa8bcde78f434808a (diff)
Merge pull request #3451 from RisingFog/libav
Use ffmpeg for Windows Video Dumping instead of VFW
Diffstat (limited to 'Source/Core/VideoBackends/OGL/Render.cpp')
-rw-r--r--Source/Core/VideoBackends/OGL/Render.cpp76
1 files changed, 8 insertions, 68 deletions
diff --git a/Source/Core/VideoBackends/OGL/Render.cpp b/Source/Core/VideoBackends/OGL/Render.cpp
index 620bb5a9f3..67672a0460 100644
--- a/Source/Core/VideoBackends/OGL/Render.cpp
+++ b/Source/Core/VideoBackends/OGL/Render.cpp
@@ -32,6 +32,9 @@
#include "VideoBackends/OGL/TextureCache.h"
#include "VideoBackends/OGL/VertexManager.h"
+#if defined(HAVE_LIBAV) || defined (_WIN32)
+#include "VideoCommon/AVIDump.h"
+#endif
#include "VideoCommon/BPFunctions.h"
#include "VideoCommon/DriverDetails.h"
#include "VideoCommon/Fifo.h"
@@ -42,10 +45,6 @@
#include "VideoCommon/VertexShaderManager.h"
#include "VideoCommon/VideoConfig.h"
-#if defined _WIN32 || defined HAVE_LIBAV
-#include "VideoCommon/AVIDump.h"
-#endif
-
void VideoConfig::UpdateProjectionHack()
{
@@ -1216,7 +1215,7 @@ void Renderer::SetBlendMode(bool forceUpdate)
static void DumpFrame(const std::vector<u8>& data, int w, int h)
{
-#if defined(HAVE_LIBAV) || defined(_WIN32)
+#if defined(HAVE_LIBAV) || defined (_WIN32)
if (SConfig::GetInstance().m_DumpFrames && !data.empty())
{
AVIDump::AddFrame(&data[0], w, h);
@@ -1340,7 +1339,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
// Frame dumping disabled entirely on GLES3
if (GLInterface->GetMode() == GLInterfaceMode::MODE_OPENGL)
{
-#if defined _WIN32 || defined HAVE_LIBAV
+#if defined(HAVE_LIBAV) || defined (_WIN32)
if (SConfig::GetInstance().m_DumpFrames)
{
std::lock_guard<std::mutex> lk(s_criticalScreenshot);
@@ -1357,11 +1356,7 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
{
if (!bLastFrameDumped)
{
- #ifdef _WIN32
- bAVIDumping = AVIDump::Start(nullptr, w, h);
- #else
- bAVIDumping = AVIDump::Start(w, h);
- #endif
+ bAVIDumping = AVIDump::Start(w, h);
if (!bAVIDumping)
{
OSD::AddMessage("AVIDump Start failed", 2000);
@@ -1375,11 +1370,8 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
}
if (bAVIDumping)
{
- #ifndef _WIN32
- FlipImageData(&frame_data[0], w, h);
- #endif
-
- AVIDump::AddFrame(&frame_data[0], w, h);
+ FlipImageData(&frame_data[0], w, h);
+ AVIDump::AddFrame(&frame_data[0], w, h);
}
bLastFrameDumped = true;
@@ -1401,45 +1393,6 @@ void Renderer::SwapImpl(u32 xfbAddr, u32 fbWidth, u32 fbStride, u32 fbHeight, co
}
bLastFrameDumped = false;
}
-#else
- if (SConfig::GetInstance().m_DumpFrames)
- {
- std::lock_guard<std::mutex> lk(s_criticalScreenshot);
- std::string movie_file_name;
- w = GetTargetRectangle().GetWidth();
- h = GetTargetRectangle().GetHeight();
- frame_data.resize(3 * w * h);
- glPixelStorei(GL_PACK_ALIGNMENT, 1);
- glReadPixels(GetTargetRectangle().left, GetTargetRectangle().bottom, w, h, GL_BGR, GL_UNSIGNED_BYTE, &frame_data[0]);
-
- if (!bLastFrameDumped)
- {
- movie_file_name = File::GetUserPath(D_DUMPFRAMES_IDX) + "framedump.raw";
- File::CreateFullPath(movie_file_name);
- pFrameDump.Open(movie_file_name, "wb");
- if (!pFrameDump)
- {
- OSD::AddMessage("Error opening framedump.raw for writing.", 2000);
- }
- else
- {
- OSD::AddMessage(StringFromFormat("Dumping Frames to \"%s\" (%dx%d RGB24)", movie_file_name.c_str(), w, h), 2000);
- }
- }
- if (pFrameDump)
- {
- FlipImageData(&frame_data[0], w, h);
- pFrameDump.WriteBytes(&frame_data[0], w * 3 * h);
- pFrameDump.Flush();
- }
- bLastFrameDumped = true;
- }
- else
- {
- if (bLastFrameDumped)
- pFrameDump.Close();
- bLastFrameDumped = false;
- }
#endif
}
// Finish up the current frame, print some stats
@@ -1687,19 +1640,6 @@ void Renderer::SetInterlacingMode()
// TODO
}
-void Renderer::FlipImageData(u8 *data, int w, int h, int pixel_width)
-{
- // Flip image upside down. Damn OpenGL.
- for (int y = 0; y < h / 2; ++y)
- {
- for (int x = 0; x < w; ++x)
- {
- for (int delta = 0; delta < pixel_width; ++delta)
- std::swap(data[(y * w + x) * pixel_width + delta], data[((h - 1 - y) * w + x) * pixel_width + delta]);
- }
- }
-}
-
}
namespace OGL