summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolaj Olsson <nikse.dk@gmail.com>2016-03-10 22:33:33 +0100
committerJames Ross-Gowan <rossymiles@gmail.com>2016-03-31 21:38:25 +1100
commitca6be6fc155a98d02ef9fcd8085cff750c4efebd (patch)
treed398d153a858711c7d678e129960bed8442d7af7
parent4d7638ab0f2f841de4992ca519d6556e5b650a44 (diff)
downloadmpv-examples-ca6be6fc155a98d02ef9fcd8085cff750c4efebd.tar.bz2
mpv-examples-ca6be6fc155a98d02ef9fcd8085cff750c4efebd.tar.xz
Add C# Windows Forms example
-rw-r--r--libmpv/README.md6
-rw-r--r--libmpv/csharp/.gitignore5
-rw-r--r--libmpv/csharp/App.config6
-rw-r--r--libmpv/csharp/Form1.Designer.cs133
-rw-r--r--libmpv/csharp/Form1.cs207
-rw-r--r--libmpv/csharp/Form1.resx123
-rw-r--r--libmpv/csharp/Program.cs22
-rw-r--r--libmpv/csharp/Properties/AssemblyInfo.cs36
-rw-r--r--libmpv/csharp/Properties/Resources.Designer.cs71
-rw-r--r--libmpv/csharp/Properties/Resources.resx117
-rw-r--r--libmpv/csharp/Properties/Settings.Designer.cs30
-rw-r--r--libmpv/csharp/Properties/Settings.settings7
-rw-r--r--libmpv/csharp/WinForm.csproj83
-rw-r--r--libmpv/csharp/WinForm.sln22
14 files changed, 868 insertions, 0 deletions
diff --git a/libmpv/README.md b/libmpv/README.md
index c21deb5..f1b7828 100644
--- a/libmpv/README.md
+++ b/libmpv/README.md
@@ -84,6 +84,12 @@ Similar to the cocoa sample, but shows how to integrate mpv's OpenGL renderer
using libmpv's opengl-cb API. Since it does not require complicated interaction
with Cocoa elements from different libraries, it's more robust.
+### csharp
+
+Shows how to use libmpv from C# on Windows. Uses Platform Invoke to call into
+mpv-1.dll directly and uses native window embedding to show the video in a
+Windows Forms control.
+
### qt
Shows how to embed the mpv video window in Qt (using normal desktop widgets).
diff --git a/libmpv/csharp/.gitignore b/libmpv/csharp/.gitignore
new file mode 100644
index 0000000..ae4df3b
--- /dev/null
+++ b/libmpv/csharp/.gitignore
@@ -0,0 +1,5 @@
+/bin/
+/obj/
+/.vs/
+*.suo
+*.user
diff --git a/libmpv/csharp/App.config b/libmpv/csharp/App.config
new file mode 100644
index 0000000..88fa402
--- /dev/null
+++ b/libmpv/csharp/App.config
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+ <startup>
+ <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
+ </startup>
+</configuration> \ No newline at end of file
diff --git a/libmpv/csharp/Form1.Designer.cs b/libmpv/csharp/Form1.Designer.cs
new file mode 100644
index 0000000..d8805e9
--- /dev/null
+++ b/libmpv/csharp/Form1.Designer.cs
@@ -0,0 +1,133 @@
+using System;
+using System.ComponentModel;
+using System.Drawing;
+using System.Runtime.InteropServices;
+using System.Windows.Forms;
+
+namespace mpv
+{
+ partial class Form1
+ {
+ /// <summary>
+ /// Required designer variable.
+ /// </summary>
+ private 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.textBoxVideoSampleFileName = new System.Windows.Forms.TextBox();
+ this.pictureBox1 = new System.Windows.Forms.PictureBox();
+ this.buttonPlayPause = new System.Windows.Forms.Button();
+ this.buttonStop = new System.Windows.Forms.Button();
+ this.buttonLoadVideo = new System.Windows.Forms.Button();
+ this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
+ this.SuspendLayout();
+ //
+ // textBoxVideoSampleFileName
+ //
+ this.textBoxVideoSampleFileName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.textBoxVideoSampleFileName.Location = new System.Drawing.Point(13, 379);
+ this.textBoxVideoSampleFileName.Name = "textBoxVideoSampleFileName";
+ this.textBoxVideoSampleFileName.Size = new System.Drawing.Size(514, 20);
+ this.textBoxVideoSampleFileName.TabIndex = 4;
+ //
+ // pictureBox1
+ //
+ this.pictureBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.pictureBox1.Location = new System.Drawing.Point(13, 12);
+ this.pictureBox1.Name = "pictureBox1";
+ this.pictureBox1.Size = new System.Drawing.Size(514, 333);
+ this.pictureBox1.TabIndex = 5;
+ this.pictureBox1.TabStop = false;
+ //
+ // buttonPlayPause
+ //
+ this.buttonPlayPause.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonPlayPause.Location = new System.Drawing.Point(305, 351);
+ this.buttonPlayPause.Name = "buttonPlayPause";
+ this.buttonPlayPause.Size = new System.Drawing.Size(108, 23);
+ this.buttonPlayPause.TabIndex = 7;
+ this.buttonPlayPause.Text = "Play/pause";
+ this.buttonPlayPause.UseVisualStyleBackColor = true;
+ this.buttonPlayPause.Click += new System.EventHandler(this.buttonPlayPause_Click);
+ //
+ // buttonStop
+ //
+ this.buttonStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.buttonStop.Location = new System.Drawing.Point(419, 351);
+ this.buttonStop.Name = "buttonStop";
+ this.buttonStop.Size = new System.Drawing.Size(108, 23);
+ this.buttonStop.TabIndex = 8;
+ this.buttonStop.Text = "Stop";
+ this.buttonStop.UseVisualStyleBackColor = true;
+ this.buttonStop.Click += new System.EventHandler(this.buttonStop_Click);
+ //
+ // buttonLoadVideo
+ //
+ this.buttonLoadVideo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.buttonLoadVideo.Location = new System.Drawing.Point(12, 351);
+ this.buttonLoadVideo.Name = "buttonLoadVideo";
+ this.buttonLoadVideo.Size = new System.Drawing.Size(108, 23);
+ this.buttonLoadVideo.TabIndex = 10;
+ this.buttonLoadVideo.Text = "Open video file...";
+ this.buttonLoadVideo.UseVisualStyleBackColor = true;
+ this.buttonLoadVideo.Click += new System.EventHandler(this.buttonLoadVideo_Click);
+ //
+ // openFileDialog1
+ //
+ this.openFileDialog1.FileName = "openFileDialog1";
+ //
+ // Form1
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.ClientSize = new System.Drawing.Size(534, 411);
+ this.Controls.Add(this.buttonLoadVideo);
+ this.Controls.Add(this.buttonStop);
+ this.Controls.Add(this.buttonPlayPause);
+ this.Controls.Add(this.pictureBox1);
+ this.Controls.Add(this.textBoxVideoSampleFileName);
+ this.KeyPreview = true;
+ this.MinimumSize = new System.Drawing.Size(550, 450);
+ this.Name = "Form1";
+ this.Text = "mpv player";
+ this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Form1_FormClosing);
+ ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
+ this.ResumeLayout(false);
+ this.PerformLayout();
+
+ }
+
+ #endregion
+ private TextBox textBoxVideoSampleFileName;
+ private PictureBox pictureBox1;
+ private Button buttonPlayPause;
+ private Button buttonStop;
+ private Button buttonLoadVideo;
+ private OpenFileDialog openFileDialog1;
+ }
+}
+
diff --git a/libmpv/csharp/Form1.cs b/libmpv/csharp/Form1.cs
new file mode 100644
index 0000000..186ddf4
--- /dev/null
+++ b/libmpv/csharp/Form1.cs
@@ -0,0 +1,207 @@
+using System;
+using System.Globalization;
+using System.Text;
+using System.Windows.Forms;
+using System.Runtime.InteropServices;
+
+namespace mpv
+{
+ public partial class Form1 : Form
+ {
+ private const int MpvFormatString = 1;
+ private IntPtr _libMpvDll;
+ private IntPtr _mpvHandle;
+
+ [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi, BestFitMapping = false)]
+ internal static extern IntPtr LoadLibrary(string dllToLoad);
+
+ [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi, BestFitMapping = false)]
+ internal static extern IntPtr GetProcAddress(IntPtr hModule, string procedureName);
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate IntPtr MpvCreate();
+ private MpvCreate _mpvCreate;
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate int MpvInitialize(IntPtr mpvHandle);
+ private MpvInitialize _mpvInitialize;
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate int MpvCommand(IntPtr mpvHandle, IntPtr strings);
+ private MpvCommand _mpvCommand;
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate int MpvTerminateDestroy(IntPtr mpvHandle);
+ private MpvTerminateDestroy _mpvTerminateDestroy;
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate int MpvSetOption(IntPtr mpvHandle, byte[] name, int format, ref long data);
+ private MpvSetOption _mpvSetOption;
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate int MpvSetOptionString(IntPtr mpvHandle, byte[] name, byte[] value);
+ private MpvSetOptionString _mpvSetOptionString;
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate int MpvGetPropertystring(IntPtr mpvHandle, byte[] name, int format, ref IntPtr data);
+ private MpvGetPropertystring _mpvGetPropertyString;
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate int MpvSetProperty(IntPtr mpvHandle, byte[] name, int format, ref byte[] data);
+ private MpvSetProperty _mpvSetProperty;
+
+ [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
+ private delegate void MpvFree(IntPtr data);
+ private MpvFree _mpvFree;
+
+ public Form1()
+ {
+ InitializeComponent();
+ }
+
+ private object GetDllType(Type type, string name)
+ {
+ IntPtr address = GetProcAddress(_libMpvDll, name);
+ if (address != IntPtr.Zero)
+ return Marshal.GetDelegateForFunctionPointer(address, type);
+ return null;
+ }
+
+ private void LoadMpvDynamic()
+ {
+ _libMpvDll = LoadLibrary("mpv-1.dll"); // The dll is included in the DEV builds by lachs0r: https://mpv.srsfckn.biz/
+ _mpvCreate = (MpvCreate)GetDllType(typeof(MpvCreate), "mpv_create");
+ _mpvInitialize = (MpvInitialize)GetDllType(typeof(MpvInitialize), "mpv_initialize");
+ _mpvTerminateDestroy = (MpvTerminateDestroy)GetDllType(typeof(MpvTerminateDestroy), "mpv_terminate_destroy");
+ _mpvCommand = (MpvCommand)GetDllType(typeof(MpvCommand), "mpv_command");
+ _mpvSetOption = (MpvSetOption)GetDllType(typeof(MpvSetOption), "mpv_set_option");
+ _mpvSetOptionString = (MpvSetOptionString)GetDllType(typeof(MpvSetOptionString), "mpv_set_option_string");
+ _mpvGetPropertyString = (MpvGetPropertystring)GetDllType(typeof(MpvGetPropertystring), "mpv_get_property");
+ _mpvSetProperty = (MpvSetProperty)GetDllType(typeof(MpvSetProperty), "mpv_set_property");
+ _mpvFree = (MpvFree)GetDllType(typeof(MpvFree), "mpv_free");
+ }
+
+ public void Pause()
+ {
+ if (_mpvHandle == IntPtr.Zero)
+ return;
+
+ var bytes = GetUtf8Bytes("yes");
+ _mpvSetProperty(_mpvHandle, GetUtf8Bytes("pause"), MpvFormatString, ref bytes);
+ }
+
+ private void Play()
+ {
+ if (_mpvHandle == IntPtr.Zero)
+ return;
+
+ var bytes = GetUtf8Bytes("no");
+ _mpvSetProperty(_mpvHandle, GetUtf8Bytes("pause"), MpvFormatString, ref bytes);
+ }
+
+ public bool IsPaused()
+ {
+ if (_mpvHandle == IntPtr.Zero)
+ return true;
+
+ var lpBuffer = IntPtr.Zero;
+ _mpvGetPropertyString(_mpvHandle, GetUtf8Bytes("pause"), MpvFormatString, ref lpBuffer);
+ var isPaused = Marshal.PtrToStringAnsi(lpBuffer) == "yes";
+ _mpvFree(lpBuffer);
+ return isPaused;
+ }
+
+ public void SetTime(double value)
+ {
+ if (_mpvHandle == IntPtr.Zero)
+ return;
+
+ DoMpvCommand("seek", value.ToString(CultureInfo.InvariantCulture), "absolute");
+ }
+
+ private static byte[] GetUtf8Bytes(string s)
+ {
+ return Encoding.UTF8.GetBytes(s + "\0");
+ }
+
+ public static IntPtr AllocateUtf8IntPtrArrayWithSentinel(string[] arr, out IntPtr[] byteArrayPointers)
+ {
+ int numberOfStrings = arr.Length + 1; // add extra element for extra null pointer last (sentinel)
+ byteArrayPointers = new IntPtr[numberOfStrings];
+ IntPtr rootPointer = Marshal.AllocCoTaskMem(IntPtr.Size * numberOfStrings);
+ for (int index = 0; index < arr.Length; index++)
+ {
+ var bytes = GetUtf8Bytes(arr[index]);
+ IntPtr unmanagedPointer = Marshal.AllocHGlobal(bytes.Length);
+ Marshal.Copy(bytes, 0, unmanagedPointer, bytes.Length);
+ byteArrayPointers[index] = unmanagedPointer;
+ }
+ Marshal.Copy(byteArrayPointers, 0, rootPointer, numberOfStrings);
+ return rootPointer;
+ }
+
+ private void DoMpvCommand(params string[] args)
+ {
+ IntPtr[] byteArrayPointers;
+ var mainPtr = AllocateUtf8IntPtrArrayWithSentinel(args, out byteArrayPointers);
+ _mpvCommand(_mpvHandle, mainPtr);
+ foreach (var ptr in byteArrayPointers)
+ {
+ Marshal.FreeHGlobal(ptr);
+ }
+ Marshal.FreeHGlobal(mainPtr);
+ }
+
+ private void buttonPlay_Click(object sender, EventArgs e)
+ {
+ if (_mpvHandle != IntPtr.Zero)
+ _mpvTerminateDestroy(_mpvHandle);
+
+ LoadMpvDynamic();
+ if (_libMpvDll == IntPtr.Zero)
+ return;
+
+ _mpvHandle = _mpvCreate.Invoke();
+ if (_mpvHandle == IntPtr.Zero)
+ return;
+
+ _mpvInitialize.Invoke(_mpvHandle);
+ _mpvSetOptionString(_mpvHandle, GetUtf8Bytes("vo"), GetUtf8Bytes("direct3d"));
+ _mpvSetOptionString(_mpvHandle, GetUtf8Bytes("keep-open"), GetUtf8Bytes("always"));
+ int mpvFormatInt64 = 4;
+ var windowId = pictureBox1.Handle.ToInt64();
+ _mpvSetOption(_mpvHandle, GetUtf8Bytes("wid"), mpvFormatInt64, ref windowId);
+ DoMpvCommand("loadfile", textBoxVideoSampleFileName.Text);
+ }
+
+ private void buttonPlayPause_Click(object sender, EventArgs e)
+ {
+ if (IsPaused())
+ Play();
+ else
+ Pause();
+ }
+
+ private void buttonStop_Click(object sender, EventArgs e)
+ {
+ Pause();
+ SetTime(0);
+ }
+
+ private void buttonLoadVideo_Click(object sender, EventArgs e)
+ {
+ openFileDialog1.FileName = String.Empty;
+ if (openFileDialog1.ShowDialog(this) == DialogResult.OK)
+ {
+ textBoxVideoSampleFileName.Text = openFileDialog1.FileName;
+ buttonPlay_Click(null, null);
+ }
+ }
+
+ private void Form1_FormClosing(object sender, FormClosingEventArgs e)
+ {
+ if (_mpvHandle != IntPtr.Zero)
+ _mpvTerminateDestroy(_mpvHandle);
+ }
+ }
+}
diff --git a/libmpv/csharp/Form1.resx b/libmpv/csharp/Form1.resx
new file mode 100644
index 0000000..9bad2f5
--- /dev/null
+++ b/libmpv/csharp/Form1.resx
@@ -0,0 +1,123 @@
+<?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>
+ <metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+ <value>17, 17</value>
+ </metadata>
+</root> \ No newline at end of file
diff --git a/libmpv/csharp/Program.cs b/libmpv/csharp/Program.cs
new file mode 100644
index 0000000..578e622
--- /dev/null
+++ b/libmpv/csharp/Program.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace mpv
+{
+ static class Program
+ {
+ /// <summary>
+ /// The main entry point for the application.
+ /// </summary>
+ [STAThread]
+ static void Main()
+ {
+ Application.EnableVisualStyles();
+ Application.SetCompatibleTextRenderingDefault(false);
+ Application.Run(new Form1());
+ }
+ }
+}
diff --git a/libmpv/csharp/Properties/AssemblyInfo.cs b/libmpv/csharp/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..cb1adbf
--- /dev/null
+++ b/libmpv/csharp/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("mpv")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("mpv")]
+[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("1751f378-8edf-4b62-be6d-304c7c287089")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/libmpv/csharp/Properties/Resources.Designer.cs b/libmpv/csharp/Properties/Resources.Designer.cs
new file mode 100644
index 0000000..1a622a2
--- /dev/null
+++ b/libmpv/csharp/Properties/Resources.Designer.cs
@@ -0,0 +1,71 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace mpv.Properties
+{
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources
+ {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources()
+ {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager
+ {
+ get
+ {
+ if ((resourceMan == null))
+ {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("mpv.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture
+ {
+ get
+ {
+ return resourceCulture;
+ }
+ set
+ {
+ resourceCulture = value;
+ }
+ }
+ }
+}
diff --git a/libmpv/csharp/Properties/Resources.resx b/libmpv/csharp/Properties/Resources.resx
new file mode 100644
index 0000000..af7dbeb
--- /dev/null
+++ b/libmpv/csharp/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?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.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: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" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </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" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root> \ No newline at end of file
diff --git a/libmpv/csharp/Properties/Settings.Designer.cs b/libmpv/csharp/Properties/Settings.Designer.cs
new file mode 100644
index 0000000..640d47c
--- /dev/null
+++ b/libmpv/csharp/Properties/Settings.Designer.cs
@@ -0,0 +1,30 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:4.0.30319.42000
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------