OSDN Git Service

import original 0.9.5 release
[handbrake-jp/handbrake-jp.git] / win / C# / interop / Converters.cs
diff --git a/win/C#/interop/Converters.cs b/win/C#/interop/Converters.cs
new file mode 100644 (file)
index 0000000..e549199
--- /dev/null
@@ -0,0 +1,32 @@
+using System;\r
+using System.Collections.Generic;\r
+using System.Linq;\r
+using System.Text;\r
+\r
+namespace HandBrake.Interop\r
+{\r
+    public static class Converters\r
+    {\r
+        private static Dictionary<double, int> vrates = new Dictionary<double, int>\r
+        {\r
+            {5, 5400000},\r
+            {10, 2700000},\r
+            {12, 2250000},\r
+            {15, 1800000},\r
+            {23.976, 1126125},\r
+            {24, 1125000},\r
+            {25, 1080000},\r
+            {29.97, 900900}\r
+        };\r
+\r
+        public static int FramerateToVrate(double framerate)\r
+        {\r
+            if (!vrates.ContainsKey(framerate))\r
+            {\r
+                throw new ArgumentException("Framerate not recognized.", "framerate");\r
+            }\r
+\r
+            return vrates[framerate];\r
+        }\r
+    }\r
+}\r