summaryrefslogtreecommitdiffstats
path: root/win/C#/interop/Converters.cs
blob: e5491995b81c4e29e50cf20c228663081e426cdf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace HandBrake.Interop
{
    public static class Converters
    {
        private static Dictionary<double, int> vrates = new Dictionary<double, int>
        {
            {5, 5400000},
            {10, 2700000},
            {12, 2250000},
            {15, 1800000},
            {23.976, 1126125},
            {24, 1125000},
            {25, 1080000},
            {29.97, 900900}
        };

        public static int FramerateToVrate(double framerate)
        {
            if (!vrates.ContainsKey(framerate))
            {
                throw new ArgumentException("Framerate not recognized.", "framerate");
            }

            return vrates[framerate];
        }
    }
}