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:
Glenn Rice 2011-03-25 18:12:40 +00:00
parent df9f614b58
commit c99c247ed5
5 changed files with 24 additions and 31 deletions

View File

@ -924,8 +924,11 @@ void CFrame::StartGame(const std::string& filename)
wxBeginBusyCursor(); wxBeginBusyCursor();
DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
if (!BootManager::BootCore(filename)) if (!BootManager::BootCore(filename))
{ {
DoFullscreen(false);
// Destroy the renderer frame when not rendering to main // Destroy the renderer frame when not rendering to main
if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain) if (!SConfig::GetInstance().m_LocalCoreStartupParameter.bRenderToMain)
m_RenderFrame->Destroy(); m_RenderFrame->Destroy();
@ -940,8 +943,6 @@ void CFrame::StartGame(const std::string& filename)
X11Utils::XWindowFromHandle(GetHandle()), true); X11Utils::XWindowFromHandle(GetHandle()), true);
#endif #endif
DoFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
#ifdef _WIN32 #ifdef _WIN32
::SetFocus((HWND)m_RenderParent->GetHandle()); ::SetFocus((HWND)m_RenderParent->GetHandle());
#else #else

View File

@ -45,10 +45,10 @@ static u32 g_ImageTemp[DVD_BANNER_WIDTH * DVD_BANNER_HEIGHT];
GameListItem::GameListItem(const std::string& _rFileName) GameListItem::GameListItem(const std::string& _rFileName)
: m_FileName(_rFileName) : m_FileName(_rFileName)
, m_emu_state(0)
, m_FileSize(0) , m_FileSize(0)
, m_Valid(false) , m_Valid(false)
, m_BlobCompressed(false) , m_BlobCompressed(false)
, m_emu_state(0)
{ {
if (LoadFromCache()) if (LoadFromCache())
{ {

View File

@ -214,7 +214,6 @@ AVStream *s_Stream = NULL;
AVFrame *s_BGRFrame = NULL, *s_YUVFrame = NULL; AVFrame *s_BGRFrame = NULL, *s_YUVFrame = NULL;
uint8_t *s_YUVBuffer = NULL; uint8_t *s_YUVBuffer = NULL;
uint8_t *s_OutBuffer = NULL; uint8_t *s_OutBuffer = NULL;
struct SwsContext *s_SwsContext = NULL;
int s_width; int s_width;
int s_height; int s_height;
int s_size; int s_size;
@ -254,19 +253,15 @@ bool AVIDump::CreateFile()
return false; return false;
} }
if (g_Config.bUseFFV1) s_Stream->codec->codec_id =
{ g_Config.bUseFFV1 ? CODEC_ID_FFV1 : s_FormatContext->oformat->video_codec;
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->codec_type = AVMEDIA_TYPE_VIDEO;
s_Stream->codec->bit_rate = 400000; s_Stream->codec->bit_rate = 400000;
s_Stream->codec->width = s_width; s_Stream->codec->width = s_width;
s_Stream->codec->height = s_height; s_Stream->codec->height = s_height;
s_Stream->codec->time_base = (AVRational){1, VideoInterface::TargetRefreshRate}; s_Stream->codec->time_base = (AVRational){1, VideoInterface::TargetRefreshRate};
s_Stream->codec->gop_size = 12; 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); av_set_parameters(s_FormatContext, NULL);
@ -277,13 +272,6 @@ bool AVIDump::CreateFile()
return false; 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_BGRFrame = avcodec_alloc_frame();
s_YUVFrame = avcodec_alloc_frame(); s_YUVFrame = avcodec_alloc_frame();
@ -307,13 +295,20 @@ bool AVIDump::CreateFile()
return true; 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 // Convert image from BGR24 to desired pixel format, and scale to initial
sws_scale(s_SwsContext, s_BGRFrame->data, s_BGRFrame->linesize, 0, // width and height
s_height, s_YUVFrame->data, s_YUVFrame->linesize); 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 // Encode and write the image
int outsize = avcodec_encode_video(s_Stream->codec, s_OutBuffer, s_size, s_YUVFrame); 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); av_free(s_YUVFrame);
s_YUVFrame = NULL; s_YUVFrame = NULL;
if (s_SwsContext)
sws_freeContext(s_SwsContext);
s_SwsContext = NULL;
if (s_FormatContext) if (s_FormatContext)
{ {
if (s_FormatContext->pb) if (s_FormatContext->pb)
url_fclose(s_FormatContext->pb); url_fclose(s_FormatContext->pb);
av_free(s_FormatContext); av_free(s_FormatContext);
s_FormatContext = NULL;
} }
} }

View File

@ -39,7 +39,7 @@ class AVIDump
static void AddFrame(char *data); static void AddFrame(char *data);
#else #else
static bool Start(int w, int h); static bool Start(int w, int h);
static void AddFrame(uint8_t *data); static void AddFrame(uint8_t *data, int width, int height);
#endif #endif
static void Stop(); static void Stop();
}; };

View File

@ -984,7 +984,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
#ifdef _WIN32 #ifdef _WIN32
AVIDump::AddFrame((char *) data); AVIDump::AddFrame((char *) data);
#elif defined HAVE_LIBAV #elif defined HAVE_LIBAV
AVIDump::AddFrame(data); AVIDump::AddFrame(data, w, h);
#endif #endif
Core::Callback_VideoCopiedToXFB(false); Core::Callback_VideoCopiedToXFB(false);
return; return;
@ -1002,7 +1002,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
#ifdef _WIN32 #ifdef _WIN32
AVIDump::AddFrame((char *) data); AVIDump::AddFrame((char *) data);
#elif defined HAVE_LIBAV #elif defined HAVE_LIBAV
AVIDump::AddFrame(data); AVIDump::AddFrame(data, w, h);
#endif #endif
Core::Callback_VideoCopiedToXFB(false); Core::Callback_VideoCopiedToXFB(false);
return; return;
@ -1196,7 +1196,7 @@ void Renderer::Swap(u32 xfbAddr, FieldType field, u32 fbWidth, u32 fbHeight,cons
AVIDump::AddFrame((char *) data); AVIDump::AddFrame((char *) data);
#else #else
FlipImageData(data, w, h); FlipImageData(data, w, h);
AVIDump::AddFrame(data); AVIDump::AddFrame(data, w, h);
#endif #endif
} }