Made most of the exposed objects immutable.
\r
HBFunctions.hb_audio_bitrate_get_limits((uint)encoder.Id, sampleRate, mixdown.Id, ref low, ref high);\r
\r
- return new BitrateLimits { Low = low, High = high };\r
+ return new BitrateLimits(low, high);\r
}\r
\r
/// <summary>\r
\r
HBFunctions.hb_video_quality_get_limits((uint)encoder.Id, ref low, ref high, ref granularity, ref direction);\r
\r
- return new VideoQualityLimits\r
- {\r
- Low = low, \r
- High = high, \r
- Granularity = granularity, \r
- Ascending = direction == 0\r
- };\r
+ return new VideoQualityLimits(low, high, granularity, direction == 0);\r
}\r
\r
/// <summary>\r
int direction = 0;\r
HBFunctions.hb_audio_quality_get_limits((uint)encoderId, ref low, ref high, ref granularity, ref direction);\r
\r
- return new RangeLimits\r
- {\r
- Low = low, \r
- High = high, \r
- Granularity = granularity, \r
- Ascending = direction == 0\r
- };\r
+ return new RangeLimits(direction == 0, granularity, high, low);\r
}\r
\r
/// <summary>\r
int direction = 0;\r
HBFunctions.hb_audio_compression_get_limits((uint)encoderId, ref low, ref high, ref granularity, ref direction);\r
\r
- return new RangeLimits\r
- {\r
- Low = low, \r
- High = high, \r
- Granularity = granularity, \r
- Ascending = direction == 0\r
- };\r
+ return new RangeLimits(direction == 0, granularity, high, low);\r
}\r
\r
/// <summary>\r
/// </returns>\r
internal static HBVideoEncoder NativeToVideoEncoder(hb_encoder_s encoder)\r
{\r
- return new HBVideoEncoder\r
- {\r
- Id = encoder.codec, \r
- ShortName = encoder.short_name, \r
- DisplayName = encoder.name, \r
- CompatibleContainers = encoder.muxers\r
- };\r
+ return new HBVideoEncoder(encoder.muxers, encoder.name, encoder.codec, encoder.short_name);\r
}\r
\r
/// <summary>\r
/// </returns>\r
internal static HBAudioEncoder NativeToAudioEncoder(hb_encoder_s encoder)\r
{\r
- var result = new HBAudioEncoder\r
- {\r
- Id = encoder.codec, \r
- ShortName = encoder.short_name, \r
- DisplayName = encoder.name, \r
- CompatibleContainers = encoder.muxers,\r
- QualityLimits = HandBrakeEncoderHelpers.GetAudioQualityLimits(encoder.codec), \r
- DefaultQuality = HBFunctions.hb_audio_quality_get_default((uint)encoder.codec), \r
- CompressionLimits = HandBrakeEncoderHelpers.GetAudioCompressionLimits(encoder.codec), \r
- DefaultCompression =\r
- HBFunctions.hb_audio_compression_get_default((uint)encoder.codec)\r
- };\r
+ var result = new HBAudioEncoder(\r
+ encoder.muxers,\r
+ HandBrakeEncoderHelpers.GetAudioCompressionLimits(encoder.codec),\r
+ HBFunctions.hb_audio_compression_get_default((uint)encoder.codec),\r
+ HBFunctions.hb_audio_quality_get_default((uint)encoder.codec),\r
+ encoder.name,\r
+ encoder.codec,\r
+ HandBrakeEncoderHelpers.GetAudioQualityLimits(encoder.codec),\r
+ encoder.short_name\r
+ );\r
\r
return result;\r
}\r
/// </returns>\r
internal static HBRate NativeToRate(hb_rate_s rate)\r
{\r
- return new HBRate\r
- {\r
- Name = rate.name, \r
- Rate = rate.rate\r
- };\r
+ return new HBRate(rate.name, rate.rate);\r
}\r
\r
/// <summary>\r
/// </returns>\r
internal static HBMixdown NativeToMixdown(hb_mixdown_s mixdown)\r
{\r
- return new HBMixdown\r
- {\r
- Id = mixdown.amixdown, \r
- ShortName = mixdown.short_name, \r
- DisplayName = mixdown.name\r
- };\r
+ return new HBMixdown(mixdown.name, mixdown.amixdown, mixdown.short_name);\r
}\r
\r
/// <summary>\r
/// </returns>\r
internal static HBContainer NativeToContainer(hb_container_s container)\r
{\r
- return new HBContainer\r
- {\r
- DisplayName = container.name, \r
- ShortName = container.short_name, \r
- DefaultExtension = container.default_extension, \r
- Id = container.format\r
- };\r
+ return new HBContainer(container.default_extension, container.name, container.format, container.short_name);\r
}\r
\r
/// <summary>\r
{\r
string englishName = InteropUtilities.ToStringFromUtf8Ptr(language.eng_name);\r
string nativeName = InteropUtilities.ToStringFromUtf8Ptr(language.native_name);\r
- return new Language\r
- {\r
- Code = language.iso639_2, \r
- EnglishName = englishName, \r
- NativeName = nativeName\r
- };\r
+ return new Language(englishName, nativeName, language.iso639_2);\r
}\r
\r
/// <summary>\r
public class BitrateLimits\r
{\r
/// <summary>\r
- /// Gets or sets the inclusive lower limit for the bitrate.\r
+ /// Initializes a new instance of the <see cref="BitrateLimits"/> class.\r
/// </summary>\r
- public int Low { get; set; }\r
+ /// <param name="low">\r
+ /// The low.\r
+ /// </param>\r
+ /// <param name="high">\r
+ /// The high.\r
+ /// </param>\r
+ public BitrateLimits(int low, int high)\r
+ {\r
+ this.Low = low;\r
+ this.High = high;\r
+ }\r
\r
/// <summary>\r
- /// Gets or sets the inclusive upper limit for the bitrate.\r
+ /// Gets the inclusive lower limit for the bitrate.\r
/// </summary>\r
- public int High { get; set; }\r
+ public int Low { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets the inclusive upper limit for the bitrate.\r
+ /// </summary>\r
+ public int High { get; private set; }\r
}\r
}\r
public class HBAudioEncoder\r
{\r
/// <summary>\r
- /// Gets or sets the compatible containers.\r
+ /// Initializes a new instance of the <see cref="HBAudioEncoder"/> class.\r
/// </summary>\r
- public int CompatibleContainers { get; set; }\r
+ /// <param name="compatibleContainers">\r
+ /// The compatible containers.\r
+ /// </param>\r
+ /// <param name="compressionLimits">\r
+ /// The compression limits.\r
+ /// </param>\r
+ /// <param name="defaultCompression">\r
+ /// The default compression.\r
+ /// </param>\r
+ /// <param name="defaultQuality">\r
+ /// The default quality.\r
+ /// </param>\r
+ /// <param name="displayName">\r
+ /// The display name.\r
+ /// </param>\r
+ /// <param name="id">\r
+ /// The id.\r
+ /// </param>\r
+ /// <param name="qualityLimits">\r
+ /// The quality limits.\r
+ /// </param>\r
+ /// <param name="shortName">\r
+ /// The short name.\r
+ /// </param>\r
+ public HBAudioEncoder(int compatibleContainers, RangeLimits compressionLimits, float defaultCompression, float defaultQuality, string displayName, int id, RangeLimits qualityLimits, string shortName)\r
+ {\r
+ this.CompatibleContainers = compatibleContainers;\r
+ this.CompressionLimits = compressionLimits;\r
+ this.DefaultCompression = defaultCompression;\r
+ this.DefaultQuality = defaultQuality;\r
+ this.DisplayName = displayName;\r
+ this.Id = id;\r
+ this.QualityLimits = qualityLimits;\r
+ this.ShortName = shortName;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets the compatible containers.\r
+ /// </summary>\r
+ public int CompatibleContainers { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the compression limits.\r
+ /// Gets the compression limits.\r
/// </summary>\r
- public RangeLimits CompressionLimits { get; set; }\r
+ public RangeLimits CompressionLimits { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the default compression.\r
+ /// Gets the default compression.\r
/// </summary>\r
- public float DefaultCompression { get; set; }\r
+ public float DefaultCompression { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the default quality.\r
+ /// Gets the default quality.\r
/// </summary>\r
- public float DefaultQuality { get; set; }\r
+ public float DefaultQuality { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the display name.\r
+ /// Gets the display name.\r
/// </summary>\r
- public string DisplayName { get; set; }\r
+ public string DisplayName { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the id.\r
+ /// Gets the id.\r
/// </summary>\r
- public int Id { get; set; }\r
+ public int Id { get; private set; }\r
\r
/// <summary>\r
/// Gets a value indicating whether the encoder is passthrough.\r
public class HBContainer\r
{\r
/// <summary>\r
- /// Gets or sets the default extension.\r
+ /// Initializes a new instance of the <see cref="HBContainer"/> class.\r
/// </summary>\r
- public string DefaultExtension { get; set; }\r
+ /// <param name="defaultExtension">\r
+ /// The default extension.\r
+ /// </param>\r
+ /// <param name="displayName">\r
+ /// The display name.\r
+ /// </param>\r
+ /// <param name="id">\r
+ /// The id.\r
+ /// </param>\r
+ /// <param name="shortName">\r
+ /// The short name.\r
+ /// </param>\r
+ public HBContainer(string defaultExtension, string displayName, int id, string shortName)\r
+ {\r
+ this.DefaultExtension = defaultExtension;\r
+ this.DisplayName = displayName;\r
+ this.Id = id;\r
+ this.ShortName = shortName;\r
+ }\r
\r
/// <summary>\r
- /// Gets or sets the display name.\r
+ /// Gets the default extension.\r
/// </summary>\r
- public string DisplayName { get; set; }\r
+ public string DefaultExtension { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the id.\r
+ /// Gets the display name.\r
/// </summary>\r
- public int Id { get; set; }\r
+ public string DisplayName { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the short name.\r
+ /// Gets the id.\r
/// </summary>\r
- public string ShortName { get; set; }\r
+ public int Id { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets the short name.\r
+ /// </summary>\r
+ public string ShortName { get; private set; }\r
}\r
}
\ No newline at end of file
/// </summary>\r
public class HBMixdown\r
{\r
- #region Public Properties\r
-\r
/// <summary>\r
- /// Gets or sets the display name.\r
+ /// Initializes a new instance of the <see cref="HBMixdown"/> class.\r
/// </summary>\r
- public string DisplayName { get; set; }\r
+ /// <param name="displayName">\r
+ /// The display name.\r
+ /// </param>\r
+ /// <param name="id">\r
+ /// The id.\r
+ /// </param>\r
+ /// <param name="shortName">\r
+ /// The short name.\r
+ /// </param>\r
+ public HBMixdown(string displayName, int id, string shortName)\r
+ {\r
+ this.DisplayName = displayName;\r
+ this.Id = id;\r
+ this.ShortName = shortName;\r
+ }\r
\r
/// <summary>\r
- /// Gets or sets the id.\r
+ /// Gets the display name.\r
/// </summary>\r
- public int Id { get; set; }\r
+ public string DisplayName { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the short name.\r
+ /// Gets the id.\r
/// </summary>\r
- public string ShortName { get; set; }\r
+ public int Id { get; private set; }\r
\r
- #endregion\r
+ /// <summary>\r
+ /// Gets the short name.\r
+ /// </summary>\r
+ public string ShortName { get; private set; }\r
}\r
}
\ No newline at end of file
public class HBRate\r
{\r
/// <summary>\r
- /// Gets or sets the name to use for this rate.\r
+ /// Initializes a new instance of the <see cref="HBRate"/> class.\r
/// </summary>\r
- public string Name { get; set; }\r
+ /// <param name="name">\r
+ /// The name.\r
+ /// </param>\r
+ /// <param name="rate">\r
+ /// The rate.\r
+ /// </param>\r
+ public HBRate(string name, int rate)\r
+ {\r
+ this.Name = name;\r
+ this.Rate = rate;\r
+ }\r
\r
/// <summary>\r
- /// Gets or sets the raw rate.\r
+ /// Gets the name to use for this rate.\r
/// </summary>\r
- public int Rate { get; set; }\r
+ public string Name { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets the raw rate.\r
+ /// </summary>\r
+ public int Rate { get; private set; }\r
}\r
}\r
public class HBVideoEncoder\r
{\r
/// <summary>\r
- /// Gets or sets the compatible containers.\r
+ /// Initializes a new instance of the <see cref="HBVideoEncoder"/> class.\r
/// </summary>\r
- public int CompatibleContainers { get; set; }\r
+ /// <param name="compatibleContainers">\r
+ /// The compatible containers.\r
+ /// </param>\r
+ /// <param name="displayName">\r
+ /// The display name.\r
+ /// </param>\r
+ /// <param name="id">\r
+ /// The id.\r
+ /// </param>\r
+ /// <param name="shortName">\r
+ /// The short name.\r
+ /// </param>\r
+ public HBVideoEncoder(int compatibleContainers, string displayName, int id, string shortName)\r
+ {\r
+ this.CompatibleContainers = compatibleContainers;\r
+ this.DisplayName = displayName;\r
+ this.Id = id;\r
+ this.ShortName = shortName;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets the compatible containers.\r
+ /// </summary>\r
+ public int CompatibleContainers { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the display name.\r
+ /// Gets the display name.\r
/// </summary>\r
- public string DisplayName { get; set; }\r
+ public string DisplayName { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the id.\r
+ /// Gets the id.\r
/// </summary>\r
- public int Id { get; set; }\r
+ public int Id { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the short name.\r
+ /// Gets the short name.\r
/// </summary>\r
- public string ShortName { get; set; }\r
+ public string ShortName { get; private set; }\r
\r
/// <summary>\r
/// Gets the list of presets this encoder supports. (null if the encoder doesn't support presets)\r
public class Language\r
{\r
/// <summary>\r
- /// Gets or sets the english name of the language.\r
+ /// Initializes a new instance of the <see cref="Language"/> class.\r
/// </summary>\r
- public string EnglishName { get; set; }\r
+ /// <param name="englishName">\r
+ /// The english name.\r
+ /// </param>\r
+ /// <param name="nativeName">\r
+ /// The native name.\r
+ /// </param>\r
+ /// <param name="code">\r
+ /// The code.\r
+ /// </param>\r
+ public Language(string englishName, string nativeName, string code)\r
+ {\r
+ this.EnglishName = englishName;\r
+ this.NativeName = nativeName;\r
+ this.Code = code;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets the english name of the language.\r
+ /// </summary>\r
+ public string EnglishName { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the native name of the language.\r
+ /// Gets the native name of the language.\r
/// </summary>\r
- public string NativeName { get; set; }\r
+ public string NativeName { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the language code.\r
+ /// Gets the language code.\r
/// </summary>\r
- public string Code { get; set; }\r
+ public string Code { get; private set; }\r
\r
/// <summary>\r
/// Gets the display string for the language.\r
public class RangeLimits\r
{\r
/// <summary>\r
- /// Gets or sets a value indicating whether ascending.\r
+ /// Initializes a new instance of the <see cref="RangeLimits"/> class.\r
/// </summary>\r
- public bool Ascending { get; set; }\r
+ /// <param name="ascending">\r
+ /// The ascending.\r
+ /// </param>\r
+ /// <param name="granularity">\r
+ /// The granularity.\r
+ /// </param>\r
+ /// <param name="high">\r
+ /// The high.\r
+ /// </param>\r
+ /// <param name="low">\r
+ /// The low.\r
+ /// </param>\r
+ public RangeLimits(bool @ascending, float granularity, float high, float low)\r
+ {\r
+ this.Ascending = @ascending;\r
+ this.Granularity = granularity;\r
+ this.High = high;\r
+ this.Low = low;\r
+ }\r
\r
/// <summary>\r
- /// Gets or sets the granularity.\r
+ /// Gets a value indicating whether ascending.\r
/// </summary>\r
- public float Granularity { get; set; }\r
+ public bool Ascending { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the high.\r
+ /// Gets the granularity.\r
/// </summary>\r
- public float High { get; set; }\r
+ public float Granularity { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the low.\r
+ /// Gets the high.\r
/// </summary>\r
- public float Low { get; set; }\r
+ public float High { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets the low.\r
+ /// </summary>\r
+ public float Low { get; private set; }\r
}\r
}
\ No newline at end of file
}\r
\r
/// <summary>\r
- /// Gets or sets the height.\r
+ /// Gets the height.\r
/// </summary>\r
- public int Height { get; set; }\r
+ public int Height { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the width.\r
+ /// Gets the width.\r
/// </summary>\r
- public int Width { get; set; }\r
+ public int Width { get; private set; }\r
\r
/// <summary>\r
/// Gets a value indicating whether is empty.\r
}\r
\r
/// <summary>\r
- /// Gets or sets the resolution (width/height) of this Title\r
+ /// Gets the resolution (width/height) of this Title\r
/// </summary>\r
- public Size Resolution { get; set; }\r
+ public Size Resolution { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the pixel aspect ratio.\r
+ /// Gets the pixel aspect ratio.\r
/// </summary>\r
- public Size ParVal { get; set; }\r
+ public Size ParVal { get; private set; }\r
}\r
}\r
public class VideoQualityLimits\r
{\r
/// <summary>\r
- /// Gets or sets the inclusive lower limit for the quality.\r
+ /// Initializes a new instance of the <see cref="VideoQualityLimits"/> class.\r
/// </summary>\r
- public float Low { get; set; }\r
+ /// <param name="low">\r
+ /// The low.\r
+ /// </param>\r
+ /// <param name="high">\r
+ /// The high.\r
+ /// </param>\r
+ /// <param name="granularity">\r
+ /// The granularity.\r
+ /// </param>\r
+ /// <param name="ascending">\r
+ /// The ascending.\r
+ /// </param>\r
+ public VideoQualityLimits(float low, float high, float granularity, bool @ascending)\r
+ {\r
+ this.Low = low;\r
+ this.High = high;\r
+ this.Granularity = granularity;\r
+ this.Ascending = @ascending;\r
+ }\r
\r
/// <summary>\r
- /// Gets or sets the inclusive upper limit for the quality.\r
+ /// Gets the inclusive lower limit for the quality.\r
/// </summary>\r
- public float High { get; set; }\r
+ public float Low { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the granularity for the quality.\r
+ /// Gets the inclusive upper limit for the quality.\r
/// </summary>\r
- public float Granularity { get; set; }\r
+ public float High { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets a value indicating whether the quality increases as the number increases.\r
+ /// Gets the granularity for the quality.\r
/// </summary>\r
- public bool Ascending { get; set; }\r
+ public float Granularity { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets a value indicating whether the quality increases as the number increases.\r
+ /// </summary>\r
+ public bool Ascending { get; private set; }\r
}\r
}\r