Use ffmpeg for Windows Video Dumping instead of VFW

This commit is contained in:
Fog
2015-01-17 13:47:07 -05:00
parent e7f2a04699
commit 6cad635bd8
313 changed files with 260584 additions and 379 deletions

View File

@ -35,6 +35,9 @@
#include "VideoBackends/OGL/TextureConverter.h"
#include "VideoBackends/OGL/VertexManager.h"
#if defined(HAVE_LIBAV) || defined (WIN32)
#include "VideoCommon/AVIDump.h"
#endif
#include "VideoCommon/BPFunctions.h"
#include "VideoCommon/BPStructs.h"
#include "VideoCommon/DriverDetails.h"
@ -49,10 +52,6 @@
#include "VideoCommon/VertexShaderManager.h"
#include "VideoCommon/VideoConfig.h"
#if defined _WIN32 || defined HAVE_LIBAV
#include "VideoCommon/AVIDump.h"
#endif
void VideoConfig::UpdateProjectionHack()
{
@ -1415,7 +1414,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);
@ -1535,7 +1534,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);
@ -1552,11 +1551,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);
@ -1570,11 +1565,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;
@ -1596,45 +1588,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