diff options
Diffstat (limited to 'win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs')
-rw-r--r-- | win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs index 42d200e57..1369b32c1 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs @@ -11,7 +11,8 @@ namespace HandBrake.Interop {
using System;
using System.Collections.Generic;
-
+ using System.Globalization;
+ using System.Runtime.InteropServices;
using HandBrake.Interop.HbLib;
using HandBrake.Interop.Model.Encoding;
using HandBrake.Interop.SourceData;
@@ -37,7 +38,7 @@ namespace HandBrake.Interop VideoRates = new Dictionary<double, int>();
foreach (var framerate in Encoders.VideoFramerates)
{
- VideoRates.Add(double.Parse(framerate.Name), framerate.Rate);
+ VideoRates.Add(double.Parse(framerate.Name, CultureInfo.InvariantCulture), framerate.Rate);
}
}
@@ -231,6 +232,23 @@ namespace HandBrake.Interop }
/// <summary>
+ /// Converts a native language structure to a Language object.
+ /// </summary>
+ /// <param name="language">The structure to convert.</param>
+ /// <returns>The converted structure.</returns>
+ public static Language NativeToLanguage(iso639_lang_t language)
+ {
+ string englishName = InteropUtilities.ReadUtf8Ptr(language.eng_name);
+ string nativeName = InteropUtilities.ReadUtf8Ptr(language.native_name);
+ return new Language
+ {
+ Code = language.iso639_2,
+ EnglishName = englishName,
+ NativeName = nativeName
+ };
+ }
+
+ /// <summary>
/// Converts the PTS amount to a TimeSpan. There may be some accuracy loss here.
/// </summary>
/// <param name="pts">The PTS to convert.</param>
|