From 1270ebc49fc8dc11ea509815094faacfa8338834 Mon Sep 17 00:00:00 2001 From: randomengy Date: Fri, 23 Aug 2013 03:06:23 +0000 Subject: Interop: Updated some structs to keep up with libhb. Exposed video quality limits. Exposed libhb language list. Suppressed a non-fatal avformat seek error. Fixed localization error in video rates list. Fixed missing sample rate for encoder-specific passthroughs. Fixed "disabled" quality level. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@5740 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- .../HandBrakeInterop/Converters.cs | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'win/CS/HandBrake.Interop/HandBrakeInterop/Converters.cs') 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(); foreach (var framerate in Encoders.VideoFramerates) { - VideoRates.Add(double.Parse(framerate.Name), framerate.Rate); + VideoRates.Add(double.Parse(framerate.Name, CultureInfo.InvariantCulture), framerate.Rate); } } @@ -230,6 +231,23 @@ namespace HandBrake.Interop }; } + /// + /// Converts a native language structure to a Language object. + /// + /// The structure to convert. + /// The converted structure. + 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 + }; + } + /// /// Converts the PTS amount to a TimeSpan. There may be some accuracy loss here. /// -- cgit v1.2.3