Add user interface to select compression options (level and number of threads) for JMD dumper.
This commit is contained in:
parent
037870eb43
commit
1980011952
|
@ -175,6 +175,12 @@
|
|||
<Compile Include="Input\ControllerBinding.cs" />
|
||||
<Compile Include="Input\GamePad.cs" Condition=" '$(OS)' == 'Windows_NT' " />
|
||||
<Compile Include="Input\Input.cs" />
|
||||
<Compile Include="JMDForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="JMDForm.Designer.cs">
|
||||
<DependentUpon>JMDForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="JMDWriter.cs" />
|
||||
<Compile Include="LogConsole.cs" />
|
||||
<Compile Include="LogWindow.cs">
|
||||
|
@ -305,6 +311,9 @@
|
|||
<DependentUpon>Debugger.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="JMDForm.resx">
|
||||
<DependentUpon>JMDForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="MainForm.resx">
|
||||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
<SubType>Designer</SubType>
|
||||
|
|
|
@ -39,6 +39,7 @@ namespace BizHawk
|
|||
|
||||
/// <summary>
|
||||
/// obtain a set of recording compression parameters
|
||||
/// return null on user cancel
|
||||
/// </summary>
|
||||
/// <param name="hwnd">hwnd to attach to if the user is shown config dialog</param>
|
||||
/// <returns>codec token, dispose of it when you're done with it</returns>
|
||||
|
|
|
@ -0,0 +1,178 @@
|
|||
namespace BizHawk.MultiClient
|
||||
{
|
||||
partial class JMDForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// Clean up any resources being used.
|
||||
/// </summary>
|
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region Windows Form Designer generated code
|
||||
|
||||
/// <summary>
|
||||
/// Required method for Designer support - do not modify
|
||||
/// the contents of this method with the code editor.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.okButton = new System.Windows.Forms.Button();
|
||||
this.threadsBar = new System.Windows.Forms.TrackBar();
|
||||
this.compressionBar = new System.Windows.Forms.TrackBar();
|
||||
this.threadLeft = new System.Windows.Forms.Label();
|
||||
this.threadRight = new System.Windows.Forms.Label();
|
||||
this.compressionLeft = new System.Windows.Forms.Label();
|
||||
this.compressionRight = new System.Windows.Forms.Label();
|
||||
this.threadTop = new System.Windows.Forms.Label();
|
||||
this.compressionTop = new System.Windows.Forms.Label();
|
||||
this.cancelButton = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.threadsBar)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.compressionBar)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// okButton
|
||||
//
|
||||
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
|
||||
this.okButton.Location = new System.Drawing.Point(23, 224);
|
||||
this.okButton.Name = "okButton";
|
||||
this.okButton.Size = new System.Drawing.Size(117, 30);
|
||||
this.okButton.TabIndex = 0;
|
||||
this.okButton.Text = "OK";
|
||||
this.okButton.UseVisualStyleBackColor = true;
|
||||
this.okButton.Click += new System.EventHandler(this.okButton_Click);
|
||||
//
|
||||
// threadsBar
|
||||
//
|
||||
this.threadsBar.Location = new System.Drawing.Point(88, 68);
|
||||
this.threadsBar.Name = "threadsBar";
|
||||
this.threadsBar.Size = new System.Drawing.Size(104, 42);
|
||||
this.threadsBar.TabIndex = 5;
|
||||
this.threadsBar.Scroll += new System.EventHandler(this.threadsBar_Scroll);
|
||||
//
|
||||
// compressionBar
|
||||
//
|
||||
this.compressionBar.Location = new System.Drawing.Point(88, 138);
|
||||
this.compressionBar.Name = "compressionBar";
|
||||
this.compressionBar.Size = new System.Drawing.Size(104, 42);
|
||||
this.compressionBar.TabIndex = 9;
|
||||
this.compressionBar.Scroll += new System.EventHandler(this.compressionBar_Scroll);
|
||||
//
|
||||
// threadLeft
|
||||
//
|
||||
this.threadLeft.AutoSize = true;
|
||||
this.threadLeft.Location = new System.Drawing.Point(47, 68);
|
||||
this.threadLeft.Name = "threadLeft";
|
||||
this.threadLeft.Size = new System.Drawing.Size(35, 13);
|
||||
this.threadLeft.TabIndex = 2;
|
||||
this.threadLeft.Text = "label1";
|
||||
//
|
||||
// threadRight
|
||||
//
|
||||
this.threadRight.AutoSize = true;
|
||||
this.threadRight.Location = new System.Drawing.Point(198, 68);
|
||||
this.threadRight.Name = "threadRight";
|
||||
this.threadRight.Size = new System.Drawing.Size(35, 13);
|
||||
this.threadRight.TabIndex = 4;
|
||||
this.threadRight.Text = "label2";
|
||||
//
|
||||
// compressionLeft
|
||||
//
|
||||
this.compressionLeft.AutoSize = true;
|
||||
this.compressionLeft.Location = new System.Drawing.Point(47, 148);
|
||||
this.compressionLeft.Name = "compressionLeft";
|
||||
this.compressionLeft.Size = new System.Drawing.Size(35, 13);
|
||||
this.compressionLeft.TabIndex = 6;
|
||||
this.compressionLeft.Text = "label3";
|
||||
//
|
||||
// compressionRight
|
||||
//
|
||||
this.compressionRight.AutoSize = true;
|
||||
this.compressionRight.Location = new System.Drawing.Point(198, 148);
|
||||
this.compressionRight.Name = "compressionRight";
|
||||
this.compressionRight.Size = new System.Drawing.Size(35, 13);
|
||||
this.compressionRight.TabIndex = 8;
|
||||
this.compressionRight.Text = "label4";
|
||||
//
|
||||
// threadTop
|
||||
//
|
||||
this.threadTop.AutoSize = true;
|
||||
this.threadTop.Location = new System.Drawing.Point(94, 52);
|
||||
this.threadTop.Name = "threadTop";
|
||||
this.threadTop.Size = new System.Drawing.Size(98, 13);
|
||||
this.threadTop.TabIndex = 3;
|
||||
this.threadTop.Text = "Number of Threads";
|
||||
this.threadTop.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// compressionTop
|
||||
//
|
||||
this.compressionTop.AutoSize = true;
|
||||
this.compressionTop.Location = new System.Drawing.Point(96, 122);
|
||||
this.compressionTop.Name = "compressionTop";
|
||||
this.compressionTop.Size = new System.Drawing.Size(96, 13);
|
||||
this.compressionTop.TabIndex = 7;
|
||||
this.compressionTop.Text = "Compression Level";
|
||||
this.compressionTop.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// cancelButton
|
||||
//
|
||||
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.cancelButton.Location = new System.Drawing.Point(158, 224);
|
||||
this.cancelButton.Name = "cancelButton";
|
||||
this.cancelButton.Size = new System.Drawing.Size(122, 30);
|
||||
this.cancelButton.TabIndex = 1;
|
||||
this.cancelButton.Text = "Cancel";
|
||||
this.cancelButton.UseVisualStyleBackColor = true;
|
||||
this.cancelButton.Click += new System.EventHandler(this.cancelButton_Click);
|
||||
//
|
||||
// JMDForm
|
||||
//
|
||||
this.AcceptButton = this.okButton;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.CancelButton = this.cancelButton;
|
||||
this.ClientSize = new System.Drawing.Size(292, 273);
|
||||
this.Controls.Add(this.cancelButton);
|
||||
this.Controls.Add(this.compressionTop);
|
||||
this.Controls.Add(this.threadTop);
|
||||
this.Controls.Add(this.compressionRight);
|
||||
this.Controls.Add(this.compressionLeft);
|
||||
this.Controls.Add(this.threadRight);
|
||||
this.Controls.Add(this.threadLeft);
|
||||
this.Controls.Add(this.compressionBar);
|
||||
this.Controls.Add(this.threadsBar);
|
||||
this.Controls.Add(this.okButton);
|
||||
this.Name = "JMDForm";
|
||||
this.Text = "JMD Compression Options";
|
||||
((System.ComponentModel.ISupportInitialize)(this.threadsBar)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.compressionBar)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.Button okButton;
|
||||
private System.Windows.Forms.TrackBar threadsBar;
|
||||
private System.Windows.Forms.TrackBar compressionBar;
|
||||
private System.Windows.Forms.Label threadLeft;
|
||||
private System.Windows.Forms.Label threadRight;
|
||||
private System.Windows.Forms.Label compressionLeft;
|
||||
private System.Windows.Forms.Label compressionRight;
|
||||
private System.Windows.Forms.Label threadTop;
|
||||
private System.Windows.Forms.Label compressionTop;
|
||||
private System.Windows.Forms.Button cancelButton;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,87 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace BizHawk.MultiClient
|
||||
{
|
||||
public partial class JMDForm : Form
|
||||
{
|
||||
public JMDForm()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void okButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void cancelButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void threadsBar_Scroll(object sender, EventArgs e)
|
||||
{
|
||||
threadTop.Text = String.Format("Number of compression threads: {0}", threadsBar.Value);
|
||||
}
|
||||
|
||||
private void compressionBar_Scroll(object sender, EventArgs e)
|
||||
{
|
||||
if (compressionBar.Value == compressionBar.Minimum)
|
||||
compressionTop.Text = "Compression Level: NONE";
|
||||
else
|
||||
compressionTop.Text = String.Format("Compression Level: {0}", compressionBar.Value);
|
||||
}
|
||||
|
||||
// we are given a HWND and need a IWin32Window
|
||||
class WindowWrapper : IWin32Window
|
||||
{
|
||||
public WindowWrapper (IntPtr handle)
|
||||
{
|
||||
hwnd = handle;
|
||||
}
|
||||
public IntPtr Handle
|
||||
{
|
||||
get { return hwnd; }
|
||||
}
|
||||
IntPtr hwnd;
|
||||
}
|
||||
|
||||
|
||||
public static bool DoCompressionDlg(ref int threads, ref int complevel, int tmin, int tmax, int cmin, int cmax, IntPtr hwnd)
|
||||
{
|
||||
JMDForm j = new JMDForm();
|
||||
j.threadsBar.Minimum = tmin;
|
||||
j.threadsBar.Maximum = tmax;
|
||||
j.compressionBar.Minimum = cmin;
|
||||
j.compressionBar.Maximum = cmax;
|
||||
j.threadsBar.Value = threads;
|
||||
j.compressionBar.Value = complevel;
|
||||
j.threadsBar_Scroll(null, null);
|
||||
j.compressionBar_Scroll(null, null);
|
||||
j.threadLeft.Text = String.Format("{0}", tmin);
|
||||
j.threadRight.Text = String.Format("{0}", tmax);
|
||||
j.compressionLeft.Text = String.Format("{0}", cmin);
|
||||
j.compressionRight.Text = String.Format("{0}", cmax);
|
||||
|
||||
DialogResult d = j.ShowDialog(new WindowWrapper(hwnd));
|
||||
|
||||
threads = j.threadsBar.Value;
|
||||
complevel = j.compressionBar.Value;
|
||||
|
||||
j.Dispose();
|
||||
if (d == DialogResult.OK)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,120 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
|
@ -25,13 +25,13 @@ namespace BizHawk.MultiClient
|
|||
public int compressionlevel
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
set;
|
||||
}
|
||||
|
||||
public int numthreads
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
set;
|
||||
}
|
||||
|
||||
public CodecToken()
|
||||
|
@ -134,8 +134,19 @@ namespace BizHawk.MultiClient
|
|||
/// <returns>codec token, dispose of it when you're done with it</returns>
|
||||
public IDisposable AcquireVideoCodecToken(IntPtr hwnd)
|
||||
{
|
||||
// no user interaction for now
|
||||
return new CodecToken();
|
||||
CodecToken ret = new CodecToken();
|
||||
|
||||
int t = ret.numthreads;
|
||||
// Deflater.DEFAULT_COMPRESSION is actually a magic value and is not in the range, so guestimate
|
||||
int c = (Deflater.BEST_COMPRESSION + Deflater.NO_COMPRESSION) / 2;
|
||||
|
||||
if (!JMDForm.DoCompressionDlg(ref t, ref c, 1, 6, Deflater.NO_COMPRESSION, Deflater.BEST_COMPRESSION, hwnd))
|
||||
return null;
|
||||
|
||||
ret.numthreads = t;
|
||||
ret.compressionlevel = c;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -2681,7 +2681,14 @@ namespace BizHawk.MultiClient
|
|||
aw.SetMovieParameters(fps, 0x01000000);
|
||||
aw.SetVideoParameters(Global.Emulator.VideoProvider.BufferWidth, Global.Emulator.VideoProvider.BufferHeight);
|
||||
aw.SetAudioParameters(44100, 2, 16);
|
||||
var token = aw.AcquireVideoCodecToken(Global.MainForm.Handle); //, null);
|
||||
var token = aw.AcquireVideoCodecToken(Global.MainForm.Handle);
|
||||
if (token == null)
|
||||
{
|
||||
Global.OSD.AddMessage("AVI capture canceled.");
|
||||
aw.Dispose();
|
||||
return;
|
||||
}
|
||||
|
||||
aw.SetVideoCodecToken(token);
|
||||
aw.OpenFile(sfd.FileName);
|
||||
|
||||
|
|
Loading…
Reference in New Issue