AVIDump: Inline OSD error handling.

This fixes a review feedback in PR #4345.
This commit is contained in:
degasus 2016-10-16 13:26:37 +02:00
parent 03d8efc270
commit dad5041737
2 changed files with 9 additions and 11 deletions

View File

@ -23,7 +23,9 @@ extern "C" {
#include "Core/HW/SystemTimers.h" #include "Core/HW/SystemTimers.h"
#include "Core/HW/VideoInterface.h" //for TargetRefreshRate #include "Core/HW/VideoInterface.h" //for TargetRefreshRate
#include "Core/Movie.h" #include "Core/Movie.h"
#include "VideoCommon/AVIDump.h" #include "VideoCommon/AVIDump.h"
#include "VideoCommon/OnScreenDisplay.h"
#include "VideoCommon/VideoConfig.h" #include "VideoCommon/VideoConfig.h"
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 28, 1) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 28, 1)
@ -68,7 +70,10 @@ bool AVIDump::Start(int w, int h)
InitAVCodec(); InitAVCodec();
bool success = CreateFile(); bool success = CreateFile();
if (!success) if (!success)
{
CloseFile(); CloseFile();
OSD::AddMessage("AVIDump Start failed");
}
return success; return success;
} }
@ -148,6 +153,9 @@ bool AVIDump::CreateFile()
return false; return false;
} }
OSD::AddMessage(StringFromFormat("Dumping Frames to \"%s\" (%dx%d)", s_format_context->filename,
s_width, s_height));
return true; return true;
} }

View File

@ -660,7 +660,7 @@ bool Renderer::IsFrameDumping()
AVIDump::Stop(); AVIDump::Stop();
std::vector<u8>().swap(m_frame_data); std::vector<u8>().swap(m_frame_data);
m_AVI_dumping = false; m_AVI_dumping = false;
OSD::AddMessage("Stop dumping frames", 2000); OSD::AddMessage("Stop dumping frames");
} }
m_last_frame_dumped = false; m_last_frame_dumped = false;
#endif #endif
@ -698,16 +698,6 @@ void Renderer::DumpFrameData(const u8* data, int w, int h, int stride, u64 ticks
if (!m_last_frame_dumped) if (!m_last_frame_dumped)
{ {
m_AVI_dumping = AVIDump::Start(w, h); m_AVI_dumping = AVIDump::Start(w, h);
if (!m_AVI_dumping)
{
OSD::AddMessage("AVIDump Start failed", 2000);
}
else
{
OSD::AddMessage(StringFromFormat("Dumping Frames to \"%sframedump0.avi\" (%dx%d RGB24)",
File::GetUserPath(D_DUMPFRAMES_IDX).c_str(), w, h),
2000);
}
} }
if (m_AVI_dumping) if (m_AVI_dumping)
{ {