forked from dolphin-emu/dolphin
When using the "Start Renderer in Fullscreen" option, really start in fullscreen. In other words this now switches to fullscreen before the renderer is initiated instead of after. This is a partial fix for issue 4316.
Also, if the render window size changes while frame dumping, scale the resulting video to prevent clipping on linux. This is a complete fix for issue 4316 on linux. I don't know how to implement this on windows though. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7412 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
@@ -924,8 +924,11 @@ void CFrame::StartGame(const std::string& filename)
|
||||
|
||||
wxBeginBusyCursor();
|
||||
|
||||
DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
|
||||
|
||||
if (!BootManager::BootCore(filename))
|
||||
{
|
||||
DoFullscreen(false);
|
||||
// Destroy the renderer frame when not rendering to main
|
||||
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
|
||||
m_RenderFrame->Destroy();
|
||||
@@ -940,8 +943,6 @@ void CFrame::StartGame(const std::string& filename)
|
||||
X11Utils::XWindowFromHandle(GetHandle()), true);
|
||||
#endif
|
||||
|
||||
DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
|
||||
|
||||
#ifdef _WIN32
|
||||
::SetFocus((HWND)m_RenderParent->GetHandle());
|
||||
#else
|
||||
|
@@ -45,10 +45,10 @@ static u32 g_ImageTemp[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT];
|
||||
|
||||
GameListItem::GameListItem(const std::string& _rFileName)
|
||||
: m_FileName(_rFileName)
|
||||
, m_emu_state(0)
|
||||
, m_FileSize(0)
|
||||
, m_Valid(false)
|
||||
, m_BlobCompressed(false)
|
||||
, m_emu_state(0)
|
||||
{
|
||||
if (LoadFromCache())
|
||||
{
|
||||
|
@@ -214,7 +214,6 @@ AVStream *s_Stream = NULL;
|
||||
AVFrame *s_BGRFrame = NULL, *s_YUVFrame = NULL;
|
||||
uint8_t *s_YUVBuffer = NULL;
|
||||
uint8_t *s_OutBuffer = NULL;
|
||||
struct SwsContext *s_SwsContext = NULL;
|
||||
int s_width;
|
||||
int s_height;
|
||||
int s_size;
|
||||
@@ -254,19 +253,15 @@ 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_id =
|
||||
g_Config.bUseFFV1 ? CODEC_ID_FFV1 : s_FormatContext->oformat->video_codec;
|
||||
s_Stream->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||
s_Stream->codec->bit_rate = 400000;
|
||||
s_Stream->codec->width = s_width;
|
||||
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 = (g_Config.bUseFFV1) ? PIX_FMT_BGRA : PIX_FMT_YUV420P;
|
||||
s_Stream->codec->pix_fmt = g_Config.bUseFFV1 ? PIX_FMT_BGRA : PIX_FMT_YUV420P;
|
||||
|
||||
av_set_parameters(s_FormatContext, NULL);
|
||||
|
||||
@@ -277,13 +272,6 @@ bool AVIDump::CreateFile()
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!(s_SwsContext = sws_getContext(s_width, s_height, PIX_FMT_BGR24, s_width, s_height,
|
||||
s_Stream->codec->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL)))
|
||||
{
|
||||
CloseFile();
|
||||
return false;
|
||||
}
|
||||
|
||||
s_BGRFrame = avcodec_alloc_frame();
|
||||
s_YUVFrame = avcodec_alloc_frame();
|
||||
|
||||
@@ -307,13 +295,20 @@ bool AVIDump::CreateFile()
|
||||
return true;
|
||||
}
|
||||
|
||||
void AVIDump::AddFrame(uint8_t *data)
|
||||
void AVIDump::AddFrame(uint8_t *data, int width, int height)
|
||||
{
|
||||
avpicture_fill((AVPicture *)s_BGRFrame, data, PIX_FMT_BGR24, s_width, s_height);
|
||||
avpicture_fill((AVPicture *)s_BGRFrame, data, PIX_FMT_BGR24, width, height);
|
||||
|
||||
// Convert image from BGR24 to YUV420P
|
||||
sws_scale(s_SwsContext, s_BGRFrame->data, s_BGRFrame->linesize, 0,
|
||||
s_height, s_YUVFrame->data, s_YUVFrame->linesize);
|
||||
// Convert image from BGR24 to desired pixel format, and scale to initial
|
||||
// width and height
|
||||
struct SwsContext *s_SwsContext;
|
||||
if ((s_SwsContext = sws_getContext(width, height, PIX_FMT_BGR24, s_width, s_height,
|
||||
s_Stream->codec->pix_fmt, SWS_BICUBIC, NULL, NULL, NULL)))
|
||||
{
|
||||
sws_scale(s_SwsContext, s_BGRFrame->data, s_BGRFrame->linesize, 0,
|
||||
height, s_YUVFrame->data, s_YUVFrame->linesize);
|
||||
sws_freeContext(s_SwsContext);
|
||||
}
|
||||
|
||||
// Encode and write the image
|
||||
int outsize = avcodec_encode_video(s_Stream->codec, s_OutBuffer, s_size, s_YUVFrame);
|
||||
@@ -372,15 +367,12 @@ void AVIDump::CloseFile()
|
||||
av_free(s_YUVFrame);
|
||||
s_YUVFrame = NULL;
|
||||
|
||||
if (s_SwsContext)
|
||||
sws_freeContext(s_SwsContext);
|
||||
s_SwsContext = NULL;
|
||||
|
||||
if (s_FormatContext)
|
||||
{
|
||||
if (s_FormatContext->pb)
|
||||
url_fclose(s_FormatContext->pb);
|
||||
av_free(s_FormatContext);
|
||||
s_FormatContext = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -39,7 +39,7 @@ class AVIDump
|
||||
static void AddFrame(char *data);
|
||||
#else
|
||||
static bool Start(int w, int h);
|
||||
static void AddFrame(uint8_t *data);
|
||||
static void AddFrame(uint8_t *data, int width, int height);
|
||||
#endif
|
||||
static void Stop();
|
||||
};
|
||||
|
@@ -984,7 +984,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
#ifdef _WIN32
|
||||
AVIDump::AddFrame((char *) data);
|
||||
#elif defined HAVE_LIBAV
|
||||
AVIDump::AddFrame(data);
|
||||
AVIDump::AddFrame(data, w, h);
|
||||
#endif
|
||||
Core::Callback_VideoCopiedToXFB(false);
|
||||
return;
|
||||
@@ -1002,7 +1002,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
#ifdef _WIN32
|
||||
AVIDump::AddFrame((char *) data);
|
||||
#elif defined HAVE_LIBAV
|
||||
AVIDump::AddFrame(data);
|
||||
AVIDump::AddFrame(data, w, h);
|
||||
#endif
|
||||
Core::Callback_VideoCopiedToXFB(false);
|
||||
return;
|
||||
@@ -1196,7 +1196,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
|
||||
AVIDump::AddFrame((char *) data);
|
||||
#else
|
||||
FlipImageData(data, w, h);
|
||||
AVIDump::AddFrame(data);
|
||||
AVIDump::AddFrame(data, w, h);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user