/// <summary>\r
/// Gets or sets the short name.\r
/// </summary>\r
- public string Name { get; set; }\r
+ public string Name { get; private set; }\r
}\r
}\r
<Compile Include="Interop\Helpers\InteropUtilities.cs" />\r
<Compile Include="Interop\Helpers\NativeList.cs" />\r
<Compile Include="Interop\Helpers\Utilities.cs" />\r
- <Compile Include="Interop\Helpers\Validate.cs" />\r
<Compile Include="Interop\Interfaces\IHandBrakeInstance.cs" />\r
<Compile Include="Interop\Json\Anamorphic\AnamorphicGeometry.cs" />\r
<Compile Include="Interop\Json\Anamorphic\DestSettings.cs" />\r
public class EncodeCompletedEventArgs : EventArgs\r
{\r
/// <summary>\r
- /// Gets or sets a value indicating whether an error occurred during the encode.\r
+ /// Initializes a new instance of the <see cref="EncodeCompletedEventArgs"/> class.\r
/// </summary>\r
- public bool Error { get; set; }\r
+ /// <param name="error">\r
+ /// The error.\r
+ /// </param>\r
+ public EncodeCompletedEventArgs(bool error)\r
+ {\r
+ this.Error = error;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets a value indicating whether an error occurred during the encode.\r
+ /// </summary>\r
+ public bool Error { get; private set; }\r
}\r
}\r
public class EncodeProgressEventArgs : EventArgs\r
{\r
/// <summary>\r
- /// Gets or sets FractionComplete.\r
+ /// Initializes a new instance of the <see cref="EncodeProgressEventArgs"/> class.\r
/// </summary>\r
- public double FractionComplete { get; set; }\r
+ /// <param name="fractionComplete">\r
+ /// The fraction complete.\r
+ /// </param>\r
+ /// <param name="currentFrameRate">\r
+ /// The current frame rate.\r
+ /// </param>\r
+ /// <param name="averageFrameRate">\r
+ /// The average frame rate.\r
+ /// </param>\r
+ /// <param name="estimatedTimeLeft">\r
+ /// The estimated time left.\r
+ /// </param>\r
+ /// <param name="passId">\r
+ /// The pass id.\r
+ /// </param>\r
+ /// <param name="pass">\r
+ /// The pass.\r
+ /// </param>\r
+ /// <param name="passCount">\r
+ /// The pass count.\r
+ /// </param>\r
+ public EncodeProgressEventArgs(double fractionComplete, double currentFrameRate, double averageFrameRate, TimeSpan estimatedTimeLeft, int passId, int pass, int passCount)\r
+ {\r
+ this.FractionComplete = fractionComplete;\r
+ this.CurrentFrameRate = currentFrameRate;\r
+ this.AverageFrameRate = averageFrameRate;\r
+ this.EstimatedTimeLeft = estimatedTimeLeft;\r
+ this.PassId = passId;\r
+ this.Pass = pass;\r
+ this.PassCount = passCount;\r
+ }\r
\r
/// <summary>\r
- /// Gets or sets CurrentFrameRate.\r
+ /// Gets the % Complete.\r
/// </summary>\r
- public double CurrentFrameRate { get; set; }\r
+ public double FractionComplete { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets AverageFrameRate.\r
+ /// Gets the Current FrameRate.\r
/// </summary>\r
- public double AverageFrameRate { get; set; }\r
+ public double CurrentFrameRate { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets EstimatedTimeLeft.\r
+ /// Gets the Average FrameRate.\r
/// </summary>\r
- public TimeSpan EstimatedTimeLeft { get; set; }\r
+ public double AverageFrameRate { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the pass ID.\r
+ /// Gets the Estimated Time Left.\r
+ /// </summary>\r
+ public TimeSpan EstimatedTimeLeft { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets the pass ID.\r
/// </summary>\r
/// <remarks>\r
/// -1: Subtitle scan\r
/// 1: Encode first pass\r
/// 2: Encode second pass\r
/// </remarks>\r
- public int PassId { get; set; }\r
+ public int PassId { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the current encoding pass. (1-based)\r
+ /// Gets the current encoding pass. (1-based)\r
/// </summary>\r
- public int Pass { get; set; }\r
+ public int Pass { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the pass count.\r
+ /// Gets the pass count.\r
/// </summary>\r
- public int PassCount { get; set; }\r
+ public int PassCount { get; private set; }\r
}\r
}\r
public class MessageLoggedEventArgs : EventArgs\r
{\r
/// <summary>\r
- /// Gets or sets Message.\r
+ /// Initializes a new instance of the <see cref="MessageLoggedEventArgs"/> class.\r
/// </summary>\r
- public string Message { get; set; }\r
+ /// <param name="message">\r
+ /// The message.\r
+ /// </param>\r
+ public MessageLoggedEventArgs(string message)\r
+ {\r
+ this.Message = message;\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets the Message.\r
+ /// </summary>\r
+ public string Message { get; private set; }\r
}\r
}\r
public class ScanProgressEventArgs : EventArgs\r
{\r
/// <summary>\r
- /// Gets or sets the total progress fraction for the scan.\r
+ /// Initializes a new instance of the <see cref="ScanProgressEventArgs"/> class.\r
/// </summary>\r
- public double Progress { get; set; }\r
+ /// <param name="progress">\r
+ /// The progress.\r
+ /// </param>\r
+ /// <param name="currentPreview">\r
+ /// The current preview.\r
+ /// </param>\r
+ /// <param name="previews">\r
+ /// The previews.\r
+ /// </param>\r
+ /// <param name="currentTitle">\r
+ /// The current title.\r
+ /// </param>\r
+ /// <param name="titles">\r
+ /// The titles.\r
+ /// </param>\r
+ public ScanProgressEventArgs(double progress, int currentPreview, int previews, int currentTitle, int titles)\r
+ {\r
+ this.Progress = progress;\r
+ this.CurrentPreview = currentPreview;\r
+ this.Previews = previews;\r
+ this.CurrentTitle = currentTitle;\r
+ this.Titles = titles;\r
+ }\r
\r
/// <summary>\r
- /// Gets or sets the current preview being processed on the scan.\r
+ /// Gets the total progress fraction for the scan.\r
/// </summary>\r
- public int CurrentPreview { get; set; }\r
+ public double Progress { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the total number of previews to process.\r
+ /// Gets the current preview being processed on the scan.\r
/// </summary>\r
- public int Previews { get; set; }\r
+ public int CurrentPreview { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the current title being processed on the scan.\r
+ /// Gets the total number of previews to process.\r
/// </summary>\r
- public int CurrentTitle { get; set; }\r
+ public int Previews { get; private set; }\r
\r
/// <summary>\r
- /// Gets or sets the total number of titles to process.\r
+ /// Gets the current title being processed on the scan.\r
/// </summary>\r
- public int Titles { get; set; }\r
+ public int CurrentTitle { get; private set; }\r
+\r
+ /// <summary>\r
+ /// Gets the total number of titles to process.\r
+ /// </summary>\r
+ public int Titles { get; private set; }\r
}\r
}\r
public BitmapImage GetPreview(PreviewSettings settings, int previewNumber)\r
{\r
SourceTitle title = this.Titles.TitleList.FirstOrDefault(t => t.Index == settings.TitleNumber);\r
- Validate.NotNull(title, "GetPreview: Title should not have been null. This is probably a bug.");\r
\r
// Create the Expected Output Geometry details for libhb.\r
hb_geometry_settings_s uiGeometry = new hb_geometry_settings_s\r
{\r
if (this.ScanProgress != null)\r
{\r
- this.ScanProgress(this, new ScanProgressEventArgs\r
- {\r
- Progress = state.Scanning.Progress, \r
- CurrentPreview = state.Scanning.Preview, \r
- Previews = state.Scanning.PreviewCount, \r
- CurrentTitle = state.Scanning.Title, \r
- Titles = state.Scanning.TitleCount\r
- });\r
+ this.ScanProgress(this, new ScanProgressEventArgs(state.Scanning.Progress, state.Scanning.Preview, state.Scanning.PreviewCount, state.Scanning.Title, state.Scanning.TitleCount));\r
}\r
}\r
else if (state != null && state.State == NativeConstants.HB_STATE_SCANDONE)\r
{\r
if (this.EncodeProgress != null)\r
{\r
- var progressEventArgs = new EncodeProgressEventArgs\r
- {\r
- FractionComplete = state.Working.Progress, \r
- CurrentFrameRate = state.Working.Rate, \r
- AverageFrameRate = state.Working.RateAvg, \r
- EstimatedTimeLeft = new TimeSpan(state.Working.Hours, state.Working.Minutes, state.Working.Seconds),\r
- PassId = state.Working.PassID,\r
- Pass = state.Working.Pass,\r
- PassCount = state.Working.PassCount\r
- };\r
+ var progressEventArgs = new EncodeProgressEventArgs(state.Working.Progress, state.Working.Rate, state.Working.RateAvg, new TimeSpan(state.Working.Hours, state.Working.Minutes, state.Working.Seconds),\r
+ state.Working.PassID, state.Working.Pass, state.Working.PassCount);\r
\r
this.EncodeProgress(this, progressEventArgs);\r
}\r
\r
if (this.EncodeCompleted != null)\r
{\r
- this.EncodeCompleted(this, new EncodeCompletedEventArgs\r
- {\r
- Error = state.WorkDone.Error != (int)hb_error_code.HB_ERROR_NONE\r
- });\r
+ this.EncodeCompleted(\r
+ this,\r
+ new EncodeCompletedEventArgs(state.WorkDone.Error != (int)hb_error_code.HB_ERROR_NONE));\r
}\r
}\r
}\r
/// <returns>\r
/// The converted model.\r
/// </returns>\r
- public static HBVideoEncoder NativeToVideoEncoder(hb_encoder_s encoder)\r
+ internal static HBVideoEncoder NativeToVideoEncoder(hb_encoder_s encoder)\r
{\r
return new HBVideoEncoder\r
{\r
/// <returns>\r
/// The converted model.\r
/// </returns>\r
- public static HBAudioEncoder NativeToAudioEncoder(hb_encoder_s encoder)\r
+ internal static HBAudioEncoder NativeToAudioEncoder(hb_encoder_s encoder)\r
{\r
var result = new HBAudioEncoder\r
{\r
/// <returns>\r
/// The converted rate object.\r
/// </returns>\r
- public static HBRate NativeToRate(hb_rate_s rate)\r
+ internal static HBRate NativeToRate(hb_rate_s rate)\r
{\r
return new HBRate\r
{\r
/// <returns>\r
/// The converted model.\r
/// </returns>\r
- public static HBMixdown NativeToMixdown(hb_mixdown_s mixdown)\r
+ internal static HBMixdown NativeToMixdown(hb_mixdown_s mixdown)\r
{\r
return new HBMixdown\r
{\r
/// <returns>\r
/// The converted structure.\r
/// </returns>\r
- public static HBContainer NativeToContainer(hb_container_s container)\r
+ internal static HBContainer NativeToContainer(hb_container_s container)\r
{\r
return new HBContainer\r
{\r
/// <returns>\r
/// The converted structure.\r
/// </returns>\r
- public static Language NativeToLanguage(iso639_lang_t language)\r
+ internal static Language NativeToLanguage(iso639_lang_t language)\r
{\r
string englishName = InteropUtilities.ToStringFromUtf8Ptr(language.eng_name);\r
string nativeName = InteropUtilities.ToStringFromUtf8Ptr(language.native_name);\r
{\r
if (MessageLogged != null)\r
{\r
- MessageLogged(null, new MessageLoggedEventArgs { Message = message });\r
+ MessageLogged(null, new MessageLoggedEventArgs(message));\r
}\r
\r
Debug.WriteLine(message);\r
{\r
if (ErrorLogged != null)\r
{\r
- ErrorLogged(null, new MessageLoggedEventArgs { Message = message });\r
+ ErrorLogged(null, new MessageLoggedEventArgs(message));\r
}\r
\r
Debug.WriteLine("ERROR: " + message);\r
\r
namespace HandBrake.ApplicationServices.Interop.HbLib\r
{\r
- public enum hb_anamorphic_mode_t\r
+ internal enum hb_anamorphic_mode_t\r
{\r
HB_ANAMORPHIC_NONE,\r
HB_ANAMORPHIC_STRICT,\r
using System.Runtime.InteropServices;\r
\r
[StructLayout(LayoutKind.Sequential)]\r
- public struct hb_container_s\r
+ internal struct hb_container_s\r
{\r
[MarshalAs(UnmanagedType.LPStr)]\r
public string name;\r
using System.Runtime.InteropServices;\r
\r
[StructLayout(LayoutKind.Sequential)]\r
- public struct hb_encoder_s\r
+ internal struct hb_encoder_s\r
{\r
[MarshalAs(UnmanagedType.LPStr)]\r
public string name;\r
using System.Runtime.InteropServices;\r
\r
[StructLayout(LayoutKind.Sequential)]\r
- public struct hb_mixdown_s\r
+ internal struct hb_mixdown_s\r
{\r
[MarshalAs(UnmanagedType.LPStr)]\r
public string name;\r
using System.Runtime.InteropServices;\r
\r
[StructLayout(LayoutKind.Sequential)]\r
- public struct hb_rate_s\r
+ internal struct hb_rate_s\r
{\r
/// char*\r
[MarshalAs(UnmanagedType.LPStr)]\r
using System.Runtime.InteropServices;\r
\r
[StructLayout(LayoutKind.Sequential)]\r
- public struct iso639_lang_t\r
+ internal struct iso639_lang_t\r
{\r
public IntPtr eng_name;\r
\r
\r
namespace HandBrake.ApplicationServices.Interop.Model.Preview\r
{\r
- using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
+ using Encoding;\r
\r
/// <summary>\r
/// The preview settings.\r
<Compile Include="EventArgs\SettingChangedEventArgs.cs" />\r
<Compile Include="Exceptions\GeneralApplicationException.cs" />\r
<Compile Include="Extensions\StringExtensions.cs" />\r
+ <Compile Include="Helpers\Validate.cs" />\r
<Compile Include="Model\Audio\AudioTrackDefaultsMode.cs" />\r
<Compile Include="Model\Audio\AudioBehaviourModes.cs" />\r
<Compile Include="Model\Audio\AudioBehaviours.cs" />\r
keep = settingMode,\r
maxWidth = job.MaxWidth,\r
maxHeight = job.MaxHeight,\r
- mode = (int)(hb_anamorphic_mode_t)job.AnamorphicMode,\r
+ mode = (int)job.AnamorphicMode,\r
modulus = job.Modulus.HasValue ? job.Modulus.Value : 16,\r
geometry = new hb_geometry_s { height = job.Height, width = job.Width, par = job.AnamorphicMode != Anamorphic.Custom ? new hb_rational_t { den = title.ParH, num = title.ParW } : new hb_rational_t { den = job.ParH, num = job.ParW }}\r
};\r
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="Validate.cs" company="HandBrake Project (http://handbrake.fr)">\r
-// This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License.\r
-// </copyright>\r
-// <summary>\r
-// The validate.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Helpers\r
-{\r
- using System;\r
-\r
- /// <summary>\r
- /// The validate.\r
- /// </summary>\r
- public class Validate\r
- {\r
- /// <summary>\r
- /// The not null.\r
- /// </summary>\r
- /// <param name="item">\r
- /// The item.\r
- /// </param>\r
- /// <param name="message">\r
- /// The message.\r
- /// </param>\r
- /// <exception cref="ArgumentException">\r
- /// Thrown when the input object is null\r
- /// </exception>\r
- public static void NotNull(object item, string message)\r
- {\r
- if (item == null)\r
- {\r
- throw new ArgumentException(message);\r
- }\r
- }\r
- }\r
-}\r
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="Validate.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>
+// The validate.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrakeWPF.Helpers
+{
+ using System;
+
+ /// <summary>
+ /// The validate.
+ /// </summary>
+ public class Validate
+ {
+ /// <summary>
+ /// The not null.
+ /// </summary>
+ /// <param name="item">
+ /// The item.
+ /// </param>
+ /// <param name="message">
+ /// The message.
+ /// </param>
+ /// <exception cref="ArgumentException">
+ /// Thrown when the input object is null
+ /// </exception>
+ public static void NotNull(object item, string message)
+ {
+ if (item == null)
+ {
+ throw new ArgumentException(message);
+ }
+ }
+ }
+}
using PointToPointMode = HandBrakeWPF.Services.Encode.Model.Models.PointToPointMode;
using Subtitle = HandBrake.ApplicationServices.Interop.Json.Encode.Subtitles;
using SubtitleTrack = HandBrakeWPF.Services.Encode.Model.Models.SubtitleTrack;
+ using Validate = HandBrakeWPF.Helpers.Validate;
/// <summary>
/// This factory takes the internal EncodeJob object and turns it into a set of JSON models