diff options
author | randomengy <[email protected]> | 2013-08-23 03:06:23 +0000 |
---|---|---|
committer | randomengy <[email protected]> | 2013-08-23 03:06:23 +0000 |
commit | 1270ebc49fc8dc11ea509815094faacfa8338834 (patch) | |
tree | e6deed5b54b8c45f4efab2d42ce56f2579ec42cf /win/CS | |
parent | bd8ccfa4473bdad2340a6a191d465f2252e62efe (diff) |
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
Diffstat (limited to 'win/CS')
16 files changed, 238 insertions, 304 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>
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs index 18beda7cc..7557ed94f 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInstance.cs @@ -1650,14 +1650,12 @@ namespace HandBrake.Interop nativeAudio.config.output.track = outputTrack;
nativeAudio.config.output.codec = (uint)encoder.Id;
+ nativeAudio.config.output.compression_level = -1;
+ nativeAudio.config.output.samplerate = nativeAudio.config.input.samplerate;
if (!encoder.IsPassthrough)
{
- if (encoding.SampleRateRaw == 0)
- {
- nativeAudio.config.output.samplerate = nativeAudio.config.input.samplerate;
- }
- else
+ if (encoding.SampleRateRaw != 0)
{
nativeAudio.config.output.samplerate = encoding.SampleRateRaw;
}
@@ -1668,7 +1666,7 @@ namespace HandBrake.Interop if (encoding.EncodeRateType == AudioEncodeRateType.Bitrate)
{
// Disable quality targeting.
- nativeAudio.config.output.quality = -1;
+ nativeAudio.config.output.quality = -3;
if (encoding.Bitrate == 0)
{
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj index 06e8394e7..d213ca39a 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj @@ -143,7 +143,7 @@ <Compile Include="Interfaces\IHandBrakeInstance.cs" />
<Compile Include="InteropUtilities.cs" />
<Compile Include="Language.cs" />
- <Compile Include="LanguageCodes.cs" />
+ <Compile Include="Languages.cs" />
<Compile Include="MarshalingConstants.cs" />
<Compile Include="EventArgs\MessageLoggedEventArgs.cs" />
<Compile Include="Model\Cropping.cs" />
@@ -178,6 +178,7 @@ <Compile Include="Model\SourceType.cs" />
<Compile Include="Model\SrtSubtitle.cs" />
<Compile Include="Model\Subtitles.cs" />
+ <Compile Include="Model\VideoQualityLimits.cs" />
<Compile Include="Model\VideoRangeType.cs" />
<Compile Include="NativeList.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs index 48e8117be..4a99043ef 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs @@ -146,8 +146,8 @@ namespace HandBrake.Interop {
if (!string.IsNullOrEmpty(message))
{
- // This error happens in normal operations. Log it as a message.
- if (message == "dvd: ifoOpen failed")
+ // These errors happen in normal operations. Log them as messages.
+ if (message == "dvd: ifoOpen failed" || message.Contains("avformat_seek_file failed"))
{
SendMessageEvent(message);
return;
@@ -222,7 +222,6 @@ namespace HandBrake.Interop throw new ArgumentException("height must be positive.");
}
- HBFunctions.hb_init(0, 0);
IntPtr ptr = HBFunctions.hb_x264_param_unparse(
preset,
string.Join(",", tunes),
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs index 25f595995..4afcf9b8b 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/HbFunctions.cs @@ -244,6 +244,11 @@ namespace HandBrake.Interop.HbLib [DllImport("hb.dll", EntryPoint = "hb_audio_bitrate_get_next", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr hb_audio_bitrate_get_next(IntPtr last);
+ [DllImport("hb.dll", EntryPoint = "hb_video_quality_get_limits", CallingConvention = CallingConvention.Cdecl)]
+ public static extern void hb_video_quality_get_limits(uint codec, ref float low, ref float high, ref float granularity, ref int direction);
+
+ [DllImport("hb.dll", EntryPoint = "hb_video_quality_get_name", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr hb_video_quality_get_name(uint codec);
[DllImport("hb.dll", EntryPoint = "hb_audio_quality_get_limits", CallingConvention = CallingConvention.Cdecl)]
public static extern void hb_audio_quality_get_limits(uint codec, ref float low, ref float high, ref float granularity, ref int direction);
@@ -322,7 +327,11 @@ namespace HandBrake.Interop.HbLib [DllImport("hb.dll", EntryPoint = "hb_audio_encoder_get_next", CallingConvention = CallingConvention.Cdecl)]
public static extern IntPtr hb_audio_encoder_get_next(IntPtr last);
+ [DllImport("hb.dll", EntryPoint = "lang_get_next", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr lang_get_next(IntPtr last);
+ [DllImport("hb.dll", EntryPoint = "lang_for_code2", CallingConvention = CallingConvention.Cdecl)]
+ public static extern IntPtr lang_for_code2([In] [MarshalAs(UnmanagedType.LPStr)] string code2);
@@ -379,7 +388,7 @@ namespace HandBrake.Interop.HbLib public static extern int hb_check_h264_level([In] [MarshalAs(UnmanagedType.LPStr)] string level, int width, int height, int fps_num, int fps_den, int interlaced, int fake_interlaced);
[DllImport("hb.dll", EntryPoint = "hb_x264_param_unparse", CallingConvention = CallingConvention.Cdecl)]
- public static extern IntPtr hb_x264_param_unparse(
+ public static extern IntPtr hb_x264_param_unparse(
[In] [MarshalAs(UnmanagedType.LPStr)] string x264_preset,
[In] [MarshalAs(UnmanagedType.LPStr)] string x264_tune,
[In] [MarshalAs(UnmanagedType.LPStr)] string x264_encopts,
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs index 6d6e62a34..aef4c5a69 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/Misc.cs @@ -77,6 +77,23 @@ namespace HandBrake.Interop.HbLib }
[StructLayout(LayoutKind.Sequential)]
+ public struct iso639_lang_t
+ {
+ public IntPtr eng_name;
+
+ public IntPtr native_name;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string iso639_1;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string iso639_2;
+
+ [MarshalAs(UnmanagedType.LPStr)]
+ public string iso639_2b;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
public struct hb_encoder_s
{
[MarshalAs(UnmanagedType.LPStr)]
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs index a219c3db9..a598ccb80 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HbLib/hb_audio.cs @@ -72,6 +72,8 @@ namespace HandBrake.Interop.HbLib public int dither_method;
public IntPtr name;
+
+ public int delay;
}
public enum hb_mixdown
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs index bd58ec6a0..c270860d0 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/InteropUtilities.cs @@ -13,7 +13,7 @@ namespace HandBrake.Interop using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
-
+ using System.Text;
using HandBrake.Interop.HbLib;
using Model.Encoding;
@@ -34,6 +34,30 @@ namespace HandBrake.Interop }
/// <summary>
+ /// Reads the given native UTF-8 string.
+ /// </summary>
+ /// <param name="stringPtr">The pointer to the string.</param>
+ /// <returns>The resulting string.</returns>
+ public static string ReadUtf8Ptr(IntPtr stringPtr)
+ {
+ var data = new List<byte>();
+ var ptr = stringPtr;
+ var offset = 0;
+ while (true)
+ {
+ byte ch = Marshal.ReadByte(ptr, offset++);
+ if (ch == 0)
+ {
+ break;
+ }
+
+ data.Add(ch);
+ }
+
+ return Encoding.UTF8.GetString(data.ToArray());
+ }
+
+ /// <summary>
/// Converts the given native HandBrake list to a managed list.
/// </summary>
/// <typeparam name="T">The type of structure in the list.</typeparam>
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Language.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Language.cs index ec55ffeaf..c2f17281e 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Language.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Language.cs @@ -9,34 +9,40 @@ namespace HandBrake.Interop
{
- /// <summary>
+ /// <summary>
/// Represents a language.
/// </summary>
public class Language
{
/// <summary>
- /// Initializes a new instance of the Language class.
+ /// Gets or sets the english name of the language.
/// </summary>
- /// <param name="code">The code for the langauge.</param>
- public Language(string code)
- {
- this.Code = code;
- }
+ public string EnglishName { get; set; }
/// <summary>
- /// Gets the friendly name of the language.
+ /// Gets or sets the native name of the language.
/// </summary>
- public string Name
- {
- get
- {
- return LanguageCodes.Decode(this.Code);
- }
- }
+ public string NativeName { get; set; }
/// <summary>
/// Gets or sets the language code.
/// </summary>
public string Code { get; set; }
+
+ /// <summary>
+ /// Gets the display string for the language.
+ /// </summary>
+ public string Display
+ {
+ get
+ {
+ if (!string.IsNullOrEmpty(this.NativeName) && this.NativeName != this.EnglishName)
+ {
+ return this.EnglishName + " (" + this.NativeName + ")";
+ }
+
+ return this.EnglishName;
+ }
+ }
}
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/LanguageCodes.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/LanguageCodes.cs deleted file mode 100644 index 7fbb7be1f..000000000 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/LanguageCodes.cs +++ /dev/null @@ -1,255 +0,0 @@ -// --------------------------------------------------------------------------------------------------------------------
-// <copyright file="LanguageCodes.cs" company="HandBrake Project (http://handbrake.fr)">
-// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
-// </copyright>
-// <summary>
-// Contains utilities for converting language codes.
-// </summary>
-// --------------------------------------------------------------------------------------------------------------------
-
-namespace HandBrake.Interop
-{
- using System.Collections.Generic;
- using System.Linq;
-
- /// <summary>
- /// Contains utilities for converting language codes.
- /// </summary>
- public static class LanguageCodes
- {
- /// <summary>
- /// The map of language codes to friendly names.
- /// </summary>
- private static Dictionary<string, string> languageMap;
-
- /// <summary>
- /// Gets the map of language codes to friendly names.
- /// </summary>
- private static Dictionary<string, string> LanguageMap
- {
- get
- {
- if (languageMap == null)
- {
- languageMap = new Dictionary<string, string>
- {
- {"und", "Unspecified"},
- {"eng", "English"},
- {"deu", "Deutsch"},
- {"fra", "Français"},
- {"spa", "Español"},
- {"rus", "Russian"},
- {"aar", "Afar"},
- {"abk", "Abkhazian"},
- {"afr", "Afrikaans"},
- {"aka", "Akan"},
- {"sqi", "Albanian"},
- {"amh", "Amharic"},
- {"ara", "Arabic"},
- {"arg", "Aragonese"},
- {"hye", "Armenian"},
- {"asm", "Assamese"},
- {"ava", "Avaric"},
- {"ave", "Avestan"},
- {"aym", "Aymara"},
- {"aze", "Azerbaijani"},
- {"bak", "Bashkir"},
- {"bam", "Bambara"},
- {"eus", "Basque"},
- {"bel", "Belarusian"},
- {"ben", "Bengali"},
- {"bih", "Bihari"},
- {"bis", "Bislama"},
- {"bos", "Bosnian"},
- {"bre", "Breton"},
- {"bul", "Bulgarian"},
- {"mya", "Burmese"},
- {"cat", "Catalan"},
- {"cha", "Chamorro"},
- {"che", "Chechen"},
- {"zho", "Chinese"},
- {"chu", "Church Slavic"},
- {"chv", "Chuvash"},
- {"cor", "Cornish"},
- {"cos", "Corsican"},
- {"cre", "Cree"},
- {"ces", "Czech"},
- {"dan", "Dansk"},
- {"div", "Divehi"},
- {"nld", "Nederlands"},
- {"dzo", "Dzongkha"},
- {"epo", "Esperanto"},
- {"est", "Estonian"},
- {"ewe", "Ewe"},
- {"fao", "Faroese"},
- {"fij", "Fijian"},
- {"fin", "Suomi"},
- {"fry", "Western Frisian"},
- {"ful", "Fulah"},
- {"kat", "Georgian"},
- {"gla", "Gaelic (Scots)"},
- {"gle", "Irish"},
- {"glg", "Galician"},
- {"glv", "Manx"},
- {"ell", "Greek Modern"},
- {"grn", "Guarani"},
- {"guj", "Gujarati"},
- {"hat", "Haitian"},
- {"hau", "Hausa"},
- {"heb", "Hebrew"},
- {"her", "Herero"},
- {"hin", "Hindi"},
- {"hmo", "Hiri Motu"},
- {"hun", "Magyar"},
- {"ibo", "Igbo"},
- {"isl", "Islenska"},
- {"ido", "Ido"},
- {"iii", "Sichuan Yi"},
- {"iku", "Inuktitut"},
- {"ile", "Interlingue"},
- {"ina", "Interlingua"},
- {"ind", "Indonesian"},
- {"ipk", "Inupiaq"},
- {"ita", "Italiano"},
- {"jav", "Javanese"},
- {"jpn", "Japanese"},
- {"kal", "Kalaallisut"},
- {"kan", "Kannada"},
- {"kas", "Kashmiri"},
- {"kau", "Kanuri"},
- {"kaz", "Kazakh"},
- {"khm", "Central Khmer"},
- {"kik", "Kikuyu"},
- {"kin", "Kinyarwanda"},
- {"kir", "Kirghiz"},
- {"kom", "Komi"},
- {"kon", "Kongo"},
- {"kor", "Korean"},
- {"kua", "Kuanyama"},
- {"kur", "Kurdish"},
- {"lao", "Lao"},
- {"lat", "Latin"},
- {"lav", "Latvian"},
- {"lim", "Limburgan"},
- {"lin", "Lingala"},
- {"lit", "Lithuanian"},
- {"ltz", "Luxembourgish"},
- {"lub", "Luba-Katanga"},
- {"lug", "Ganda"},
- {"mkd", "Macedonian"},
- {"mah", "Marshallese"},
- {"mal", "Malayalam"},
- {"mri", "Maori"},
- {"mar", "Marathi"},
- {"msa", "Malay"},
- {"mlg", "Malagasy"},
- {"mlt", "Maltese"},
- {"mol", "Moldavian"},
- {"mon", "Mongolian"},
- {"nau", "Nauru"},
- {"nav", "Navajo"},
- {"nbl", "Ndebele, South"},
- {"nde", "Ndebele, North"},
- {"ndo", "Ndonga"},
- {"nep", "Nepali"},
- {"nno", "Norwegian Nynorsk"},
- {"nob", "Norwegian Bokmål"},
- {"nor", "Norsk"},
- {"nya", "Chichewa; Nyanja"},
- {"oci", "Occitan"},
- {"oji", "Ojibwa"},
- {"ori", "Oriya"},
- {"orm", "Oromo"},
- {"oss", "Ossetian"},
- {"pan", "Panjabi"},
- {"fas", "Persian"},
- {"pli", "Pali"},
- {"pol", "Polish"},
- {"por", "Portugues"},
- {"pus", "Pushto"},
- {"que", "Quechua"},
- {"roh", "Romansh"},
- {"ron", "Romanian"},
- {"run", "Rundi"},
- {"sag", "Sango"},
- {"san", "Sanskrit"},
- {"srp", "Serbian"},
- {"hrv", "Hrvatski"},
- {"sin", "Sinhala"},
- {"slk", "Slovak"},
- {"slv", "Slovenian"},
- {"sme", "Northern Sami"},
- {"smo", "Samoan"},
- {"sna", "Shona"},
- {"snd", "Sindhi"},
- {"som", "Somali"},
- {"sot", "Sotho Southern"},
- {"srd", "Sardinian"},
- {"ssw", "Swati"},
- {"sun", "Sundanese"},
- {"swa", "Swahili"},
- {"swe", "Svenska"},
- {"tah", "Tahitian"},
- {"tam", "Tamil"},
- {"tat", "Tatar"},
- {"tel", "Telugu"},
- {"tgk", "Tajik"},
- {"tgl", "Tagalog"},
- {"tha", "Thai"},
- {"bod", "Tibetan"},
- {"tir", "Tigrinya"},
- {"ton", "Tonga"},
- {"tsn", "Tswana"},
- {"tso", "Tsonga"},
- {"tuk", "Turkmen"},
- {"tur", "Turkish"},
- {"twi", "Twi"},
- {"uig", "Uighur"},
- {"ukr", "Ukrainian"},
- {"urd", "Urdu"},
- {"uzb", "Uzbek"},
- {"ven", "Venda"},
- {"vie", "Vietnamese"},
- {"vol", "Volapük"},
- {"cym", "Welsh"},
- {"wln", "Walloon"},
- {"wol", "Wolof"},
- {"xho", "Xhosa"},
- {"yid", "Yiddish"},
- {"yor", "Yoruba"},
- {"zha", "Zhuang"},
- {"zul", "Zulu"}
- };
- }
-
- return languageMap;
- }
- }
-
- /// <summary>
- /// Gets a list of all languages.
- /// </summary>
- public static IList<Language> Languages
- {
- get
- {
- return LanguageMap.Keys.Select(languageCode => new Language(languageCode)).ToList();
- }
- }
-
- /// <summary>
- /// Gives the friendly name of the language with the given code.
- /// </summary>
- /// <param name="languageCode">The language code.</param>
- /// <returns>The friendly name of the language.</returns>
- public static string Decode(string languageCode)
- {
- if (LanguageMap.ContainsKey(languageCode))
- {
- return LanguageMap[languageCode];
- }
-
- return "Unknown";
- }
- }
-}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Languages.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Languages.cs new file mode 100644 index 000000000..f8d3db624 --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Languages.cs @@ -0,0 +1,54 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="LanguageCodes.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// Contains utilities for converting language codes.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop
+{
+ using System.Collections.Generic;
+ using HbLib;
+
+ /// <summary>
+ /// Contains utilities for converting language codes.
+ /// </summary>
+ public static class Languages
+ {
+ /// <summary>
+ /// The list of all languages.
+ /// </summary>
+ private static IList<Language> allLanguages;
+
+ /// <summary>
+ /// Gets a list of all languages.
+ /// </summary>
+ public static IList<Language> AllLanguages
+ {
+ get
+ {
+ if (allLanguages == null)
+ {
+ allLanguages = InteropUtilities.GetListFromIterator<iso639_lang_t, Language>(
+ HBFunctions.lang_get_next,
+ Converters.NativeToLanguage);
+ }
+
+ return allLanguages;
+ }
+ }
+
+ /// <summary>
+ /// Gets the language object for the given code.
+ /// </summary>
+ /// <param name="code">The ISO-639-2 code for the language.</param>
+ /// <returns>Object that describes the language.</returns>
+ public static Language Get(string code)
+ {
+ iso639_lang_t language = InteropUtilities.ReadStructure<iso639_lang_t>(HBFunctions.lang_for_code2(code));
+ return Converters.NativeToLanguage(language);
+ }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/BitrateLimits.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/BitrateLimits.cs index ed9905960..322ff5c9c 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/BitrateLimits.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/BitrateLimits.cs @@ -5,23 +5,23 @@ // <summary>
// Defines the BitrateLimits type.
// </summary>
-// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.Interop.Model +// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Model
{
- /// <summary>
- /// The bitrate limits.
- /// </summary>
- public class BitrateLimits + /// <summary>
+ /// Represents bitrate limits as a range.
+ /// </summary>
+ public class BitrateLimits
{
- /// <summary>
- /// Gets or sets the low.
- /// </summary>
- public int Low { get; set; }
+ /// <summary>
+ /// The inclusive lower limit for the bitrate.
+ /// </summary>
+ public int Low { get; set; }
- /// <summary>
- /// Gets or sets the high.
- /// </summary>
- public int High { get; set; } - } -} + /// <summary>
+ /// The inclusive upper limit for the bitrate.
+ /// </summary>
+ public int High { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs index ebfefff0a..e8d546237 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs @@ -263,6 +263,29 @@ namespace HandBrake.Interop.Model }
/// <summary>
+ /// Gets the video quality limits for the given video codec.
+ /// </summary>
+ /// <param name="encoder">The video encoder to check.</param>
+ /// <returns>Limits on the video quality for the encoder.</returns>
+ public static VideoQualityLimits GetVideoQualityLimits(HBVideoEncoder encoder)
+ {
+ float low = 0;
+ float high = 0;
+ float granularity = 0;
+ int direction = 0;
+
+ HBFunctions.hb_video_quality_get_limits((uint)encoder.Id, ref low, ref high, ref granularity, ref direction);
+
+ return new VideoQualityLimits
+ {
+ Low = low,
+ High = high,
+ Granularity = granularity,
+ Ascending = direction == 0
+ };
+ }
+
+ /// <summary>
/// Sanitizes an audio bitrate given the output codec, sample rate and mixdown.
/// </summary>
/// <param name="audioBitrate">The desired audio bitrate.</param>
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs index 6d2aafec3..2863d3b48 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/EncodingProfile.cs @@ -123,7 +123,8 @@ namespace HandBrake.Interop.Model.Encoding Framerate = this.Framerate,
ConstantFramerate = this.ConstantFramerate,
- AudioEncodings = new List<AudioEncoding>(this.AudioEncodings)
+ AudioEncodings = new List<AudioEncoding>(this.AudioEncodings),
+ AudioEncoderFallback = this.AudioEncoderFallback
};
return profile;
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/VideoQualityLimits.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/VideoQualityLimits.cs new file mode 100644 index 000000000..72d5bd9ef --- /dev/null +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/VideoQualityLimits.cs @@ -0,0 +1,37 @@ +// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="VideoQualityLimits.cs" company="HandBrake Project (http://handbrake.fr)">
+// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.
+// </copyright>
+// <summary>
+// Defines the VideoQualityLimits type.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Model
+{
+ /// <summary>
+ /// Represents limits on video quality for a particular encoder.
+ /// </summary>
+ public class VideoQualityLimits
+ {
+ /// <summary>
+ /// Gets or sets the inclusive lower limit for the quality.
+ /// </summary>
+ public float Low { get; set; }
+
+ /// <summary>
+ /// Gets or sets the inclusive upper limit for the quality.
+ /// </summary>
+ public float High { get; set; }
+
+ /// <summary>
+ /// Gets or sets the granularity for the quality.
+ /// </summary>
+ public float Granularity { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether the quality increases as the number increases.
+ /// </summary>
+ public bool Ascending { get; set; }
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs index 2902f4f11..9f0e040c4 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Properties/AssemblyInfo.cs @@ -32,5 +32,5 @@ using System.Runtime.InteropServices; // 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.43.0.0")]
-[assembly: AssemblyFileVersion("1.43.0.0")]
+[assembly: AssemblyVersion("1.47.0.0")]
+[assembly: AssemblyFileVersion("1.47.0.0")]
|