Skip to content

Commit de576bb

Browse files
committed
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)
1 parent 9b75d9c commit de576bb

File tree

11 files changed

+40
-1
lines changed

11 files changed

+40
-1
lines changed

BizHawk.Client.EmuHawk/AVOut/AVSync.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ public abstract class VWWrap : IVideoWriter
175175
{
176176
protected IVideoWriter w;
177177

178+
public bool UsesAudio { get { return w.UsesAudio; } }
179+
public bool UsesVideo { get { return w.UsesVideo; } }
180+
178181
public void SetVideoCodecToken(IDisposable token)
179182
{
180183
w.SetVideoCodecToken(token);

BizHawk.Client.EmuHawk/AVOut/AviWriter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,9 @@ public string DesiredExtension()
857857
{
858858
return "avi";
859859
}
860+
861+
public bool UsesAudio { get { return parameters.has_audio; } }
862+
public bool UsesVideo { get { return true; } }
860863
}
861864
}
862865

BizHawk.Client.EmuHawk/AVOut/FFmpegWriter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,5 +291,8 @@ public void SetDefaultVideoCodecToken()
291291
{
292292
token = FFmpegWriterForm.FormatPreset.GetDefaultPreset();
293293
}
294+
295+
public bool UsesAudio { get { return true; } }
296+
public bool UsesVideo { get { return true; } }
294297
}
295298
}

BizHawk.Client.EmuHawk/AVOut/GifWriter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,5 +227,8 @@ public void Dispose()
227227
f = null;
228228
}
229229
}
230+
231+
public bool UsesAudio { get { return false; } }
232+
public bool UsesVideo { get { return true; } }
230233
}
231234
}

BizHawk.Client.EmuHawk/AVOut/IVideoWriter.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,15 @@ public interface IVideoWriter : IDisposable
1919
/// </summary>
2020
void SetDefaultVideoCodecToken();
2121

22+
/// <summary>
23+
/// Returns whether this videowriter dumps audio
24+
/// </summary>
25+
bool UsesAudio { get; }
26+
27+
/// <summary>
28+
/// Returns whether this videowriter dumps video
29+
/// </summary>
30+
bool UsesVideo { get; }
2231

2332
// why no OpenFile(IEnumerator<string>) ?
2433
// different video writers may have different ideas of how and why splitting is to occur

BizHawk.Client.EmuHawk/AVOut/ImageSequenceWriter.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public void SetDefaultVideoCodecToken()
2424
{
2525
}
2626

27+
public bool UsesAudio { get { return false; } }
28+
public bool UsesVideo { get { return true; } }
2729

2830
public void OpenFile(string baseName)
2931
{

BizHawk.Client.EmuHawk/AVOut/JMDWriter.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -790,5 +790,10 @@ public void SetDefaultVideoCodecToken()
790790
}
791791

792792
public void SetFrame(int frame) { }
793+
794+
public bool UsesAudio { get { return true; } }
795+
public bool UsesVideo { get { return true; } }
793796
}
797+
798+
794799
}

BizHawk.Client.EmuHawk/AVOut/NutWriter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,5 +138,8 @@ public void SetDefaultVideoCodecToken()
138138
{
139139
// ignored
140140
}
141+
142+
public bool UsesAudio { get { return true; } }
143+
public bool UsesVideo { get { return true; } }
141144
}
142145
}

BizHawk.Client.EmuHawk/AVOut/SynclessRecorder.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,9 @@ public void AddSamples(short[] samples)
6868
wwv.Dispose();
6969
}
7070

71+
public bool UsesAudio { get { return true; } }
72+
public bool UsesVideo { get { return true; } }
73+
7174
class DummyDisposable : IDisposable { public void Dispose() { } }
7275

7376
public IDisposable AcquireVideoCodecToken(IWin32Window hwnd) { return new DummyDisposable(); }

BizHawk.Client.EmuHawk/AVOut/WavWriter.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,9 @@ public void SetMovieParameters(int fpsnum, int fpsden) { }
205205
public void SetVideoParameters(int width, int height) { }
206206
public void SetFrame(int frame) { }
207207

208+
public bool UsesAudio { get { return true; } }
209+
public bool UsesVideo { get { return false; } }
210+
208211
class WavWriterVToken : IDisposable
209212
{
210213
public void Dispose() { }

0 commit comments

Comments
 (0)