add ImageSequenceWriter AVDumper
This commit is contained in:
parent
5636c1b6a1
commit
fc699590f5
|
@ -0,0 +1,98 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
|
||||
using BizHawk.Common.IOExtensions;
|
||||
using BizHawk.Emulation.Common;
|
||||
|
||||
namespace BizHawk.Client.EmuHawk
|
||||
{
|
||||
/// <summary>
|
||||
/// Writes a sequence of 24bpp PNG or JPG files
|
||||
/// </summary>
|
||||
[VideoWriter("imagesequence", "Image sequence writer", "Writes a sequence of 24bpp PNG or JPG files (default compression quality)")]
|
||||
public class ImageSequenceWriter : IDisposable, IVideoWriter
|
||||
{
|
||||
string BaseName;
|
||||
int Frame;
|
||||
|
||||
public void SetVideoCodecToken(IDisposable token)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetDefaultVideoCodecToken()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
public void OpenFile(string baseName)
|
||||
{
|
||||
BaseName = baseName;
|
||||
}
|
||||
|
||||
public void CloseFile()
|
||||
{
|
||||
}
|
||||
|
||||
public void SetFrame(int frame)
|
||||
{
|
||||
//eh? this gets ditched somehow
|
||||
}
|
||||
|
||||
public void AddFrame(IVideoProvider source)
|
||||
{
|
||||
string ext = Path.GetExtension(BaseName);
|
||||
string name = Path.GetFileNameWithoutExtension(BaseName) + "_" + Frame.ToString();
|
||||
name += ext;
|
||||
name = Path.Combine(Path.GetDirectoryName(BaseName), name);
|
||||
BizHawk.Bizware.BizwareGL.BitmapBuffer bb = new Bizware.BizwareGL.BitmapBuffer(source.BufferWidth, source.BufferHeight, source.GetVideoBuffer());
|
||||
using (var bmp = bb.ToSysdrawingBitmap())
|
||||
{
|
||||
if (ext.ToUpper() == ".PNG")
|
||||
bmp.Save(name, System.Drawing.Imaging.ImageFormat.Png);
|
||||
else if (ext.ToUpper() == ".JPG")
|
||||
bmp.Save(name, System.Drawing.Imaging.ImageFormat.Jpeg);
|
||||
}
|
||||
Frame++;
|
||||
}
|
||||
|
||||
public void AddSamples(short[] samples)
|
||||
{
|
||||
}
|
||||
|
||||
class CodecToken : IDisposable
|
||||
{
|
||||
public void Dispose() { }
|
||||
}
|
||||
|
||||
public IDisposable AcquireVideoCodecToken(System.Windows.Forms.IWin32Window hwnd)
|
||||
{
|
||||
return new CodecToken();
|
||||
}
|
||||
|
||||
public void SetMovieParameters(int fpsnum, int fpsden)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetVideoParameters(int width, int height)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetAudioParameters(int sampleRate, int channels, int bits)
|
||||
{
|
||||
}
|
||||
|
||||
public void SetMetaData(string gameName, string authors, ulong lengthMS, ulong rerecords)
|
||||
{
|
||||
}
|
||||
|
||||
public string DesiredExtension()
|
||||
{
|
||||
return "png";
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
|
@ -160,6 +160,7 @@
|
|||
</Compile>
|
||||
<Compile Include="AVOut\NutMuxer.cs" />
|
||||
<Compile Include="AVOut\NutWriter.cs" />
|
||||
<Compile Include="AVOut\ImageSequenceWriter.cs" />
|
||||
<Compile Include="AVOut\SynclessRecorder.cs" />
|
||||
<Compile Include="AVOut\SynclessRecordingTools.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
|
Loading…
Reference in New Issue