diff options
author | sr55 <[email protected]> | 2015-01-09 21:24:39 +0000 |
---|---|---|
committer | sr55 <[email protected]> | 2015-01-09 21:24:39 +0000 |
commit | 2dc567b1f18fd8ed09f21df0a8c3e3a3bd1499ea (patch) | |
tree | 39567c816dea83151410b524b4f85e9e5906bfd7 | |
parent | 152cabeebf37e9f45c49769e8abe64cd5867ad86 (diff) |
WinGui: Move the Encoders class to the root level of the Interop Library and Rename to HandBrakeEncoderHelpers. All the HandBrake API calls we make now have wrappers at the top level of this project.
Remove some region from small classes where they don't offer any benifit.
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@6706 b64f7644-9d1e-0410-96f1-a4d463321fa5
15 files changed, 51 insertions, 92 deletions
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs index 100ea1554..8f7003c29 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Converters/Converters.cs @@ -36,7 +36,7 @@ namespace HandBrake.Interop.Converters HandBrakeUtils.EnsureGlobalInit();
VideoRates = new Dictionary<double, int>();
- foreach (var framerate in Encoders.VideoFramerates)
+ foreach (var framerate in HandBrakeEncoderHelpers.VideoFramerates)
{
VideoRates.Add(double.Parse(framerate.Name, CultureInfo.InvariantCulture), framerate.Rate);
}
@@ -100,10 +100,10 @@ namespace HandBrake.Interop.Converters Id = encoder.codec,
ShortName = encoder.short_name,
DisplayName = encoder.name,
- CompatibleContainers = encoder.muxers,
- QualityLimits = Encoders.GetAudioQualityLimits(encoder.codec),
+ CompatibleContainers = encoder.muxers,
+ QualityLimits = HandBrakeEncoderHelpers.GetAudioQualityLimits(encoder.codec),
DefaultQuality = HBFunctions.hb_audio_quality_get_default((uint)encoder.codec),
- CompressionLimits = Encoders.GetAudioCompressionLimits(encoder.codec),
+ CompressionLimits = HandBrakeEncoderHelpers.GetAudioCompressionLimits(encoder.codec),
DefaultCompression =
HBFunctions.hb_audio_compression_get_default((uint)encoder.codec)
};
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeEncoderHelpers.cs index 8a4c737f0..80b1fc3ad 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoders.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeEncoderHelpers.cs @@ -7,21 +7,21 @@ // </summary>
// --------------------------------------------------------------------------------------------------------------------
-namespace HandBrake.Interop.Model
+namespace HandBrake.Interop
{
using System.Collections.Generic;
using System.Linq;
- using HandBrake.Interop.Converters;
using HandBrake.Interop.HbLib;
using HandBrake.Interop.Helpers;
+ using HandBrake.Interop.Model;
using HandBrake.Interop.Model.Encoding;
using HandBrake.Interop.Model.Scan;
/// <summary>
/// The encoders.
/// </summary>
- public static class Encoders
+ public static class HandBrakeEncoderHelpers
{
/// <summary>
/// The audio encoders.
@@ -59,9 +59,9 @@ namespace HandBrake.Interop.Model private static List<HBRate> audioSampleRates;
/// <summary>
- /// Initializes static members of the Encoders class.
+ /// Initializes static members of the EncoderHelpers class.
/// </summary>
- static Encoders()
+ static HandBrakeEncoderHelpers()
{
HandBrakeUtils.EnsureGlobalInit();
}
@@ -75,7 +75,7 @@ namespace HandBrake.Interop.Model {
if (audioEncoders == null)
{
- audioEncoders = InteropUtilities.ToListFromIterator<hb_encoder_s, HBAudioEncoder>(HBFunctions.hb_audio_encoder_get_next, Converters.NativeToAudioEncoder);
+ audioEncoders = InteropUtilities.ToListFromIterator<hb_encoder_s, HBAudioEncoder>(HBFunctions.hb_audio_encoder_get_next, Converters.Converters.NativeToAudioEncoder);
}
return audioEncoders;
@@ -91,7 +91,7 @@ namespace HandBrake.Interop.Model {
if (videoEncoders == null)
{
- videoEncoders = InteropUtilities.ToListFromIterator<hb_encoder_s, HBVideoEncoder>(HBFunctions.hb_video_encoder_get_next, Converters.NativeToVideoEncoder);
+ videoEncoders = InteropUtilities.ToListFromIterator<hb_encoder_s, HBVideoEncoder>(HBFunctions.hb_video_encoder_get_next, Converters.Converters.NativeToVideoEncoder);
}
return videoEncoders;
@@ -107,7 +107,7 @@ namespace HandBrake.Interop.Model {
if (videoFramerates == null)
{
- videoFramerates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_video_framerate_get_next, Converters.NativeToRate);
+ videoFramerates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_video_framerate_get_next, Converters.Converters.NativeToRate);
}
return videoFramerates;
@@ -123,7 +123,7 @@ namespace HandBrake.Interop.Model {
if (mixdowns == null)
{
- mixdowns = InteropUtilities.ToListFromIterator<hb_mixdown_s, HBMixdown>(HBFunctions.hb_mixdown_get_next, Converters.NativeToMixdown);
+ mixdowns = InteropUtilities.ToListFromIterator<hb_mixdown_s, HBMixdown>(HBFunctions.hb_mixdown_get_next, Converters.Converters.NativeToMixdown);
}
return mixdowns;
@@ -155,7 +155,7 @@ namespace HandBrake.Interop.Model {
if (audioSampleRates == null)
{
- audioSampleRates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_audio_samplerate_get_next, Converters.NativeToRate);
+ audioSampleRates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_audio_samplerate_get_next, Converters.Converters.NativeToRate);
}
return audioSampleRates;
@@ -171,7 +171,7 @@ namespace HandBrake.Interop.Model {
if (containers == null)
{
- containers = InteropUtilities.ToListFromIterator<hb_container_s, HBContainer>(HBFunctions.hb_container_get_next, Converters.NativeToContainer);
+ containers = InteropUtilities.ToListFromIterator<hb_container_s, HBContainer>(HBFunctions.hb_container_get_next, Converters.Converters.NativeToContainer);
}
return containers;
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj index 936cff5bb..da3060766 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeInterop.csproj @@ -229,7 +229,7 @@ <Compile Include="EventArgs\MessageLoggedEventArgs.cs" />
<Compile Include="Model\Cropping.cs" />
<Compile Include="Model\EncodeJob.cs" />
- <Compile Include="Model\Encoders.cs" />
+ <Compile Include="HandBrakeEncoderHelpers.cs" />
<Compile Include="Model\Encoding\Anamorphic.cs" />
<Compile Include="Model\Encoding\AudioEncodeRateType.cs" />
<Compile Include="Model\Encoding\CroppingType.cs" />
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs index c1f5a5cad..4cb51886d 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/HandBrakeUtils.cs @@ -393,7 +393,7 @@ namespace HandBrake.Interop int samplesPerFrame = GetAudioSamplesPerFrame(encoding.Encoder);
int audioBitrate;
- HBAudioEncoder audioEncoder = Encoders.GetAudioEncoder(encoding.Encoder);
+ HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(encoding.Encoder);
if (audioEncoder.IsPassthrough)
{
@@ -414,10 +414,10 @@ namespace HandBrake.Interop }
else
{
- outputBitrate = Encoders.GetDefaultBitrate(
+ outputBitrate = HandBrakeEncoderHelpers.GetDefaultBitrate(
audioEncoder,
- encoding.SampleRateRaw == 0 ? track.SampleRate : encoding.SampleRateRaw,
- Encoders.SanitizeMixdown(Encoders.GetMixdown(encoding.Mixdown), audioEncoder, track.ChannelLayout));
+ encoding.SampleRateRaw == 0 ? track.SampleRate : encoding.SampleRateRaw,
+ HandBrakeEncoderHelpers.SanitizeMixdown(HandBrakeEncoderHelpers.GetMixdown(encoding.Mixdown), audioEncoder, track.ChannelLayout));
}
// Output bitrate is in kbps.
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs index f9e3ef074..88bae4116 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Json/Factories/EncodeFactory.cs @@ -216,7 +216,7 @@ namespace HandBrake.Interop.Json.Factories {
Video video = new Video();
- HBVideoEncoder videoEncoder = Encoders.VideoEncoders.FirstOrDefault(e => e.ShortName == job.EncodingProfile.VideoEncoder);
+ HBVideoEncoder videoEncoder = HandBrakeEncoderHelpers.VideoEncoders.FirstOrDefault(e => e.ShortName == job.EncodingProfile.VideoEncoder);
Validate.NotNull(videoEncoder, "Video encoder " + job.EncodingProfile.VideoEncoder + " not recognized.");
if (videoEncoder != null)
{
@@ -251,7 +251,7 @@ namespace HandBrake.Interop.Json.Factories if (!string.IsNullOrEmpty(job.EncodingProfile.AudioEncoderFallback))
{
- HBAudioEncoder audioEncoder = Encoders.GetAudioEncoder(job.EncodingProfile.AudioEncoderFallback);
+ HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(job.EncodingProfile.AudioEncoderFallback);
Validate.NotNull(audioEncoder, "Unrecognized fallback audio encoder: " + job.EncodingProfile.AudioEncoderFallback);
audio.FallbackEncoder = audioEncoder.Id;
}
@@ -262,10 +262,10 @@ namespace HandBrake.Interop.Json.Factories int numTracks = 0;
foreach (AudioEncoding item in job.EncodingProfile.AudioEncodings)
{
- HBAudioEncoder encoder = Encoders.GetAudioEncoder(item.Encoder);
+ HBAudioEncoder encoder = HandBrakeEncoderHelpers.GetAudioEncoder(item.Encoder);
Validate.NotNull(encoder, "Unrecognized audio encoder:" + item.Encoder);
- HBMixdown mixdown = Encoders.GetMixdown(item.Mixdown);
+ HBMixdown mixdown = HandBrakeEncoderHelpers.GetMixdown(item.Mixdown);
Validate.NotNull(mixdown, "Unrecognized audio mixdown:" + item.Mixdown);
AudioList audioTrack = new AudioList
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncodeRateType.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncodeRateType.cs index 6017b872c..dbd625604 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncodeRateType.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/AudioEncodeRateType.cs @@ -5,16 +5,16 @@ // <summary>
// The audio encode rate type.
// </summary>
-// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.Interop.Model.Encoding +// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Model.Encoding
{
/// <summary>
/// The audio encode rate type.
/// </summary>
- public enum AudioEncodeRateType - { - Bitrate, - Quality - } -} + public enum AudioEncodeRateType
+ {
+ Bitrate,
+ Quality
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Container.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Container.cs index 50261cfdc..59b4277c1 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Container.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/Container.cs @@ -5,24 +5,24 @@ // <summary>
// Defines the Container type.
// </summary>
-// -------------------------------------------------------------------------------------------------------------------- - -namespace HandBrake.Interop.Model.Encoding -{ - using System; +// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.Interop.Model.Encoding
+{
+ using System;
using System.ComponentModel.DataAnnotations;
/// <summary>
/// The container.
/// </summary>
- [Flags] - public enum Container - { - None = 0x0, - - [Display(Name = "MP4")] - MP4, - [Display(Name = "MKV")] - MKV - } -} + [Flags]
+ public enum Container
+ {
+ None = 0x0,
+
+ [Display(Name = "MP4")]
+ MP4,
+ [Display(Name = "MKV")]
+ MKV
+ }
+}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBAudioEncoder.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBAudioEncoder.cs index 6bcd8e0d7..088f448c5 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBAudioEncoder.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBAudioEncoder.cs @@ -16,8 +16,6 @@ namespace HandBrake.Interop.Model.Encoding /// </summary>
public class HBAudioEncoder
{
- #region Public Properties
-
/// <summary>
/// Gets or sets the compatible containers.
/// </summary>
@@ -90,7 +88,5 @@ namespace HandBrake.Interop.Model.Encoding return this.QualityLimits.High >= 0;
}
}
-
- #endregion
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBContainer.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBContainer.cs index 3b6feea48..18fc3911e 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBContainer.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/HBContainer.cs @@ -14,8 +14,6 @@ namespace HandBrake.Interop.Model.Encoding /// </summary>
public class HBContainer
{
- #region Public Properties
-
/// <summary>
/// Gets or sets the default extension.
/// </summary>
@@ -35,7 +33,5 @@ namespace HandBrake.Interop.Model.Encoding /// Gets or sets the short name.
/// </summary>
public string ShortName { get; set; }
-
- #endregion
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs index ad2bc9063..bc0983ff1 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Encoding/x264/x264Profile.cs @@ -26,15 +26,6 @@ namespace HandBrake.Interop.Model.Encoding.x264 Main,
[Display(Name = "High")]
- High,
-
- //[Display(Name = "High 10")]
- //High10, HandBrake does not yet support 10bit.
-
- //[Display(Name = "High 422")]
- //High422, Not supported
-
- //[Display(Name = "High 444")]
- // High444, Use Auto Instead.
+ High
}
}
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/RangeLimits.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/RangeLimits.cs index 2c30b2b44..420126cca 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/RangeLimits.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/RangeLimits.cs @@ -14,8 +14,6 @@ namespace HandBrake.Interop.Model /// </summary>
public class RangeLimits
{
- #region Properties
-
/// <summary>
/// Gets or sets a value indicating whether ascending.
/// </summary>
@@ -35,7 +33,5 @@ namespace HandBrake.Interop.Model /// Gets or sets the low.
/// </summary>
public float Low { get; set; }
-
- #endregion
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Size.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Size.cs index dcc58e0e3..0cf7eb5b0 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Size.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Size.cs @@ -14,8 +14,6 @@ namespace HandBrake.Interop.Model /// </summary>
public class Size
{
- #region Constructors and Destructors
-
/// <summary>
/// Initializes a new instance of the <see cref="Size"/> class.
/// </summary>
@@ -31,10 +29,6 @@ namespace HandBrake.Interop.Model this.Height = height;
}
- #endregion
-
- #region Properties
-
/// <summary>
/// Gets or sets the height.
/// </summary>
@@ -44,7 +38,5 @@ namespace HandBrake.Interop.Model /// Gets or sets the width.
/// </summary>
public int Width { get; set; }
-
- #endregion
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SourceSubtitle.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SourceSubtitle.cs index e4bb3c39e..ab5f8c610 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SourceSubtitle.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SourceSubtitle.cs @@ -14,8 +14,6 @@ namespace HandBrake.Interop.Model /// </summary>
public class SourceSubtitle
{
- #region Properties
-
/// <summary>
/// Gets or sets a value indicating whether the subtitle track should be burned in.
/// </summary>
@@ -36,10 +34,6 @@ namespace HandBrake.Interop.Model /// </summary>
public int TrackNumber { get; set; }
- #endregion
-
- #region Public Methods
-
/// <summary>
/// The clone.
/// </summary>
@@ -56,7 +50,5 @@ namespace HandBrake.Interop.Model BurnedIn = this.BurnedIn
};
}
-
- #endregion
}
}
\ No newline at end of file diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SrtSubtitle.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SrtSubtitle.cs index 9a60c8ab3..336f7ccac 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SrtSubtitle.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/SrtSubtitle.cs @@ -25,7 +25,7 @@ namespace HandBrake.Interop.Model public bool Default { get; set; }
/// <summary>
- /// Gets or sets a value indicating the subtitle track should be burned in.
+ /// Gets or sets a value indicating whether the subtitle track should be burned in.
/// </summary>
public bool BurnedIn { get; set; }
diff --git a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Subtitles.cs b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Subtitles.cs index 843d0d442..0d16c4c41 100644 --- a/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Subtitles.cs +++ b/win/CS/HandBrake.Interop/HandBrakeInterop/Model/Subtitles.cs @@ -16,8 +16,6 @@ namespace HandBrake.Interop.Model /// </summary>
public class Subtitles
{
- #region Properties
-
/// <summary>
/// Gets or sets the source subtitles.
/// </summary>
@@ -27,7 +25,5 @@ namespace HandBrake.Interop.Model /// Gets or sets the srt subtitles.
/// </summary>
public List<SrtSubtitle> SrtSubtitles { get; set; }
-
- #endregion
}
}
\ No newline at end of file |