AVWriters now implement UsesAudio and UsesVideo so that the frontend can decide how much work it needs to tell the core to do to fulfill the AVWriter's needs (fixes #593)
This commit is contained in:
parent
9b75d9c359
commit
de576bb067
|
@ -175,6 +175,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
protected IVideoWriter w;
|
||||
|
||||
public bool UsesAudio { get { return w.UsesAudio; } }
|
||||
public bool UsesVideo { get { return w.UsesVideo; } }
|
||||
|
||||
public void SetVideoCodecToken(IDisposable token)
|
||||
{
|
||||
w.SetVideoCodecToken(token);
|
||||
|
|
|
@ -857,6 +857,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
return "avi";
|
||||
}
|
||||
|
||||
public bool UsesAudio { get { return parameters.has_audio; } }
|
||||
public bool UsesVideo { get { return true; } }
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -291,5 +291,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
token = FFmpegWriterForm.FormatPreset.GetDefaultPreset();
|
||||
}
|
||||
|
||||
public bool UsesAudio { get { return true; } }
|
||||
public bool UsesVideo { get { return true; } }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -227,5 +227,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
f = null;
|
||||
}
|
||||
}
|
||||
|
||||
public bool UsesAudio { get { return false; } }
|
||||
public bool UsesVideo { get { return true; } }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,15 @@ namespace BizHawk.Client.EmuHawk
|
|||
/// </summary>
|
||||
void SetDefaultVideoCodecToken();
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether this videowriter dumps audio
|
||||
/// </summary>
|
||||
bool UsesAudio { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns whether this videowriter dumps video
|
||||
/// </summary>
|
||||
bool UsesVideo { get; }
|
||||
|
||||
// why no OpenFile(IEnumerator<string>) ?
|
||||
// different video writers may have different ideas of how and why splitting is to occur
|
||||
|
|
|
@ -24,6 +24,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
}
|
||||
|
||||
public bool UsesAudio { get { return false; } }
|
||||
public bool UsesVideo { get { return true; } }
|
||||
|
||||
public void OpenFile(string baseName)
|
||||
{
|
||||
|
|
|
@ -790,5 +790,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
}
|
||||
|
||||
public void SetFrame(int frame) { }
|
||||
|
||||
public bool UsesAudio { get { return true; } }
|
||||
public bool UsesVideo { get { return true; } }
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -138,5 +138,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
public bool UsesAudio { get { return true; } }
|
||||
public bool UsesVideo { get { return true; } }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -68,6 +68,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
wwv.Dispose();
|
||||
}
|
||||
|
||||
public bool UsesAudio { get { return true; } }
|
||||
public bool UsesVideo { get { return true; } }
|
||||
|
||||
class DummyDisposable : IDisposable { public void Dispose() { } }
|
||||
|
||||
public IDisposable AcquireVideoCodecToken(IWin32Window hwnd) { return new DummyDisposable(); }
|
||||
|
|
|
@ -205,6 +205,9 @@ namespace BizHawk.Client.EmuHawk
|
|||
public void SetVideoParameters(int width, int height) { }
|
||||
public void SetFrame(int frame) { }
|
||||
|
||||
public bool UsesAudio { get { return true; } }
|
||||
public bool UsesVideo { get { return false; } }
|
||||
|
||||
class WavWriterVToken : IDisposable
|
||||
{
|
||||
public void Dispose() { }
|
||||
|
|
|
@ -2817,8 +2817,10 @@ namespace BizHawk.Client.EmuHawk
|
|||
coreskipaudio = true;
|
||||
|
||||
{
|
||||
bool render = !_throttle.skipnextframe || _currAviWriter != null;
|
||||
bool render = !_throttle.skipnextframe;
|
||||
bool renderSound = !coreskipaudio;
|
||||
if (_currAviWriter != null && _currAviWriter.UsesVideo) render = true;
|
||||
if (_currAviWriter != null && _currAviWriter.UsesAudio) renderSound = true;
|
||||
Global.Emulator.FrameAdvance(render, renderSound);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue