From 2a19edca91dba884dcc7b2a03d59348cdcb78cbe Mon Sep 17 00:00:00 2001 From: feos Date: Thu, 17 Dec 2015 00:23:52 +0300 Subject: [PATCH] avi: try to remember previously used codec. todo: fix canceling codec selection but then going ahead and recording. --- BizHawk.Client.EmuHawk/AVOut/AviWriter.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/BizHawk.Client.EmuHawk/AVOut/AviWriter.cs b/BizHawk.Client.EmuHawk/AVOut/AviWriter.cs index 0f3556fa3e..e1ebca51de 100644 --- a/BizHawk.Client.EmuHawk/AVOut/AviWriter.cs +++ b/BizHawk.Client.EmuHawk/AVOut/AviWriter.cs @@ -584,7 +584,8 @@ namespace BizHawk.Client.EmuHawk int ret = Win32.AVISaveOptions(owner, 0, 1, streams, infPtrs); - opts = (Win32.AVICOMPRESSOPTIONS)Marshal.PtrToStructure(mem, typeof(Win32.AVICOMPRESSOPTIONS)); + if (ret == 1) + opts = (Win32.AVICOMPRESSOPTIONS)Marshal.PtrToStructure(mem, typeof(Win32.AVICOMPRESSOPTIONS)); Marshal.FreeHGlobal(mem); @@ -653,6 +654,11 @@ namespace BizHawk.Client.EmuHawk { comprOptions = currVideoCodecToken.comprOptions; } + else if (!string.IsNullOrEmpty(Global.Config.AVICodecToken)) + { + comprOptions = CodecToken.DeSerialize(Global.Config.AVICodecToken).comprOptions; + } + if (AVISaveOptions(pAviRawVideoStream, ref comprOptions, hwnd) != 0) { CodecToken ret = CodecToken.TakePossession(comprOptions);