diff options
author | sr55 <[email protected]> | 2015-05-03 17:18:59 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-05-03 17:18:59 +0000 |
commit | 0be4e18bacefa6b7bc63731b4a004a6ff772af20 (patch) | |
tree | 405ba4add7d0086d363a44e00a6b8a7ddc1c0163 /win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs | |
parent | 6689ba81c2919ef34d85da357d4b56b90507824b (diff) |
WinGui: Some Model Re-factoring by RandomEngy
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@7151 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs')
-rw-r--r-- | win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs | 211 |
1 files changed, 136 insertions, 75 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs index 714de6547..69075a7f9 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/HandBrakeEncoderHelpers.cs @@ -33,33 +33,33 @@ namespace HandBrake.ApplicationServices.Interop /// </summary>
private static List<HBVideoEncoder> videoEncoders;
- /// <summary>
- /// Video framerates in pts.
- /// </summary>
- private static List<HBRate> videoFramerates;
-
- /// <summary>
- /// List of HandBrake mixdowns.
+ /// <summary> + /// Video framerates in pts. + /// </summary> + private static List<HBRate> videoFramerates; + + /// <summary> + /// List of HandBrake mixdowns. /// </summary>
private static List<HBMixdown> mixdowns;
- /// <summary>
- /// List of HandBrake containers.
- /// </summary>
- private static List<HBContainer> containers;
-
- /// <summary>
- /// The audio bitrates.
+ /// <summary> + /// List of HandBrake containers. + /// </summary> + private static List<HBContainer> containers; + + /// <summary> + /// The audio bitrates. /// </summary>
private static List<int> audioBitrates;
- /// <summary>
- /// Audio sample rates in Hz.
- /// </summary>
- private static List<HBRate> audioSampleRates;
-
- /// <summary>
- /// Initializes static members of the HandBrakeEncoderHelpers class.
+ /// <summary> + /// Audio sample rates in Hz. + /// </summary> + private static List<HBRate> audioSampleRates; + + /// <summary> + /// Initializes static members of the HandBrakeEncoderHelpers class. /// </summary>
static HandBrakeEncoderHelpers()
{
@@ -109,13 +109,13 @@ namespace HandBrake.ApplicationServices.Interop {
videoFramerates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_video_framerate_get_next, HandBrakeUnitConversionHelpers.NativeToRate);
}
-
- return videoFramerates;
- }
- }
-
- /// <summary>
- /// Gets a list of supported mixdowns.
+ + return videoFramerates; + } + } + + /// <summary> + /// Gets a list of supported mixdowns. /// </summary>
public static List<HBMixdown> Mixdowns
{
@@ -257,12 +257,73 @@ namespace HandBrake.ApplicationServices.Interop public static HBContainer GetContainer(string shortName)
{
return Containers.SingleOrDefault(c => c.ShortName == shortName);
- }
-
- /// <summary>
- /// Determines if the given encoder is compatible with the given track.
- /// </summary>
- /// <param name="codecId">
+ } + + /// <summary> + /// Returns true if the subtitle source type can be set to forced only. + /// </summary> + /// <param name="source">The subtitle source type (SSA, VobSub, etc)</param> + /// <returns>True if the subtitle source type can be set to forced only.</returns> + public static bool SubtitleCanSetForcedOnly(int source) + { + return HBFunctions.hb_subtitle_can_force(source) > 0; + } + + /// <summary> + /// Returns true if the subtitle source type can be burned in. + /// </summary> + /// <param name="source">The subtitle source type (SSA, VobSub, etc)</param> + /// <returns>True if the subtitle source type can be burned in.</returns> + public static bool SubtitleCanBurn(int source) + { + return HBFunctions.hb_subtitle_can_burn(source) > 0; + } + + /// <summary> + /// Returns true if the subtitle type can be passed through using the given muxer. + /// </summary> + /// <param name="subtitleSourceType">The subtitle source type (SSA, VobSub, etc)</param> + /// <param name="muxer">The ID of the muxer.</param> + /// <returns>True if the subtitle type can be passed through with the given muxer.</returns> + public static bool SubtitleCanPassthrough(int subtitleSourceType, int muxer) + { + return HBFunctions.hb_subtitle_can_pass(subtitleSourceType, muxer) > 0; + } + + /// <summary> + /// Gets the subtitle source type's name. + /// </summary> + /// <param name="source">The subtitle source type (SSA, VobSub, etc).</param> + /// <returns>The name of the subtitle source.</returns> + public static string GetSubtitleSourceName(int source) + { + switch ((hb_subtitle_s_subsource)source) + { + case hb_subtitle_s_subsource.CC608SUB: + return "CC608"; + case hb_subtitle_s_subsource.CC708SUB: + return "CC708"; + case hb_subtitle_s_subsource.SRTSUB: + return "SRT"; + case hb_subtitle_s_subsource.SSASUB: + return "SSA"; + case hb_subtitle_s_subsource.TX3GSUB: + return "TX3G"; + case hb_subtitle_s_subsource.UTF8SUB: + return "UTF8"; + case hb_subtitle_s_subsource.VOBSUB: + return "VobSub"; + case hb_subtitle_s_subsource.PGSSUB: + return "PGS"; + default: + return string.Empty; + } + } + + /// <summary> + /// Determines if the given encoder is compatible with the given track. + /// </summary> + /// <param name="codecId"> /// The codec Id.
/// </param>
/// <param name="encoder">
@@ -307,13 +368,13 @@ namespace HandBrake.ApplicationServices.Interop /// </param>
/// <returns>
/// True if the encoder supports the mixdown.
- /// </returns>
- public static bool MixdownHasCodecSupport(HBMixdown mixdown, HBAudioEncoder encoder)
- {
- return HBFunctions.hb_mixdown_has_codec_support(mixdown.Id, (uint) encoder.Id) > 0;
- }
-
- /// <summary>
+ /// </returns> + public static bool MixdownHasCodecSupport(HBMixdown mixdown, HBAudioEncoder encoder) + { + return HBFunctions.hb_mixdown_has_codec_support(mixdown.Id, (uint)encoder.Id) > 0; + } + + /// <summary> /// Determines if DRC can be applied to the given track with the given encoder.
/// </summary>
/// <param name="trackNumber">
@@ -428,15 +489,15 @@ namespace HandBrake.ApplicationServices.Interop 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
- };
- }
+ + 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.
@@ -475,13 +536,13 @@ namespace HandBrake.ApplicationServices.Interop /// </param>
/// <returns>
/// The default bitrate for these parameters.
- /// </returns>
- public static int GetDefaultBitrate(HBAudioEncoder encoder, int sampleRate, HBMixdown mixdown)
- {
- return HBFunctions.hb_audio_bitrate_get_default((uint) encoder.Id, sampleRate, mixdown.Id);
- }
-
- /// <summary>
+ /// </returns> + public static int GetDefaultBitrate(HBAudioEncoder encoder, int sampleRate, HBMixdown mixdown) + { + return HBFunctions.hb_audio_bitrate_get_default((uint)encoder.Id, sampleRate, mixdown.Id); + } + + /// <summary> /// Gets limits on audio quality for a given encoder.
/// </summary>
/// <param name="encoderId">
@@ -495,15 +556,15 @@ namespace HandBrake.ApplicationServices.Interop float low = 0, high = 0, granularity = 0;
int direction = 0;
HBFunctions.hb_audio_quality_get_limits((uint)encoderId, ref low, ref high, ref granularity, ref direction);
-
- return new RangeLimits
- {
- Low = low,
- High = high,
- Granularity = granularity,
- Ascending = direction == 0
- };
- }
+ + return new RangeLimits + { + Low = low, + High = high, + Granularity = granularity, + Ascending = direction == 0 + }; + } /// <summary>
/// Gets limits on audio compression for a given encoder.
@@ -519,14 +580,14 @@ namespace HandBrake.ApplicationServices.Interop float low = 0, high = 0, granularity = 0;
int direction = 0;
HBFunctions.hb_audio_compression_get_limits((uint)encoderId, ref low, ref high, ref granularity, ref direction);
-
- return new RangeLimits
- {
- Low = low,
- High = high,
- Granularity = granularity,
- Ascending = direction == 0
- };
- }
+ + return new RangeLimits + { + Low = low, + High = high, + Granularity = granularity, + Ascending = direction == 0 + }; + } }
}
|