<Compile Include="Interop\Interfaces\IHandBrakeInstance.cs" />\r
<Compile Include="Interop\Json\Anamorphic\AnamorphicGeometry.cs" />\r
<Compile Include="Interop\Json\Anamorphic\DestSettings.cs" />\r
- <Compile Include="Interop\Json\Encode\QSV.cs" />\r
- <Compile Include="Interop\Json\Shared\PAR.cs" />\r
- <Compile Include="Interop\Json\Encode\Audio.cs" />\r
- <Compile Include="Interop\Json\Encode\AudioList.cs" />\r
- <Compile Include="Interop\Json\Encode\ChapterList.cs" />\r
- <Compile Include="Interop\Json\Encode\Destination.cs" />\r
- <Compile Include="Interop\Json\Encode\Filters.cs" />\r
- <Compile Include="Interop\Json\Encode\Filter.cs" />\r
- <Compile Include="Interop\Json\Encode\JsonEncodeObject.cs" />\r
- <Compile Include="Interop\Json\Encode\MetaData.cs" />\r
- <Compile Include="Interop\Json\Encode\Mp4Options.cs" />\r
- <Compile Include="Interop\Json\Encode\Range.cs" />\r
- <Compile Include="Interop\Json\Encode\SubtitleSearch.cs" />\r
- <Compile Include="Interop\Json\Encode\Source.cs" />\r
- <Compile Include="Interop\Json\Encode\SRT.cs" />\r
- <Compile Include="Interop\Json\Encode\Subtitles.cs" />\r
- <Compile Include="Interop\Json\Encode\SubtitleList.cs" />\r
- <Compile Include="Interop\Json\Encode\Video.cs" />\r
- <Compile Include="Interop\Factories\AnamorphicFactory.cs" />\r
- <Compile Include="Services\Encode\Factories\EncodeFactory.cs" />\r
- <Compile Include="Interop\Json\Scan\AudioTrack.cs" />\r
- <Compile Include="Interop\Json\Scan\ChapterTrack.cs" />\r
- <Compile Include="Interop\Json\Scan\Color.cs" />\r
- <Compile Include="Interop\Json\Scan\Duration.cs" />\r
- <Compile Include="Interop\Json\Scan\FrameRate.cs" />\r
- <Compile Include="Interop\Json\Shared\Geometry.cs" />\r
- <Compile Include="Interop\Json\Scan\JsonScanObject.cs" />\r
- <Compile Include="Interop\Json\Scan\MetaData.cs" />\r
- <Compile Include="Interop\Json\Scan\SubtitleTrack.cs" />\r
- <Compile Include="Interop\Json\Scan\SourceTitle.cs" />\r
- <Compile Include="Interop\Json\State\JsonState.cs" />\r
- <Compile Include="Interop\Json\State\Scanning.cs" />\r
+ <Compile Include="Interop\Json\Encode\QSV.cs" />
+ <Compile Include="Interop\Json\Shared\PAR.cs" />
+ <Compile Include="Interop\Json\Encode\Audio.cs" />
+ <Compile Include="Interop\Json\Encode\AudioTrack.cs" />
+ <Compile Include="Interop\Json\Encode\Chapter.cs" />
+ <Compile Include="Interop\Json\Encode\Destination.cs" />
+ <Compile Include="Interop\Json\Encode\Filters.cs" />
+ <Compile Include="Interop\Json\Encode\Filter.cs" />
+ <Compile Include="Interop\Json\Encode\JsonEncodeObject.cs" />
+ <Compile Include="Interop\Json\Encode\Metadata.cs" />
+ <Compile Include="Interop\Json\Encode\Mp4Options.cs" />
+ <Compile Include="Interop\Json\Encode\Range.cs" />
+ <Compile Include="Interop\Json\Encode\SubtitleSearch.cs" />
+ <Compile Include="Interop\Json\Encode\Source.cs" />
+ <Compile Include="Interop\Json\Encode\SRT.cs" />
+ <Compile Include="Interop\Json\Encode\Subtitles.cs" />
+ <Compile Include="Interop\Json\Encode\SubtitleTrack.cs" />
+ <Compile Include="Interop\Json\Encode\Video.cs" />
+ <Compile Include="Interop\Factories\AnamorphicFactory.cs" />
+ <Compile Include="Services\Encode\Factories\EncodeFactory.cs" />
+ <Compile Include="Interop\Json\Scan\SourceAudioTrack.cs" />
+ <Compile Include="Interop\Json\Scan\SourceChapter.cs" />
+ <Compile Include="Interop\Json\Scan\Color.cs" />
+ <Compile Include="Interop\Json\Scan\Duration.cs" />
+ <Compile Include="Interop\Json\Scan\FrameRate.cs" />
+ <Compile Include="Interop\Json\Shared\Geometry.cs" />
+ <Compile Include="Interop\Json\Scan\JsonScanObject.cs" />
+ <Compile Include="Interop\Json\Scan\SourceMetadata.cs" />
+ <Compile Include="Interop\Json\Scan\SourceSubtitleTrack.cs" />
+ <Compile Include="Interop\Json\Scan\SourceTitle.cs" />
+ <Compile Include="Interop\Json\State\JsonState.cs" />
+ <Compile Include="Interop\Json\State\Scanning.cs" />
<Compile Include="Interop\Json\State\WorkDone.cs" />\r
<Compile Include="Interop\Json\State\Working.cs" />\r
<Compile Include="Interop\Model\BitrateLimits.cs" />\r
using HandBrake.ApplicationServices.Interop.Json.Shared;\r
using HandBrake.ApplicationServices.Interop.Model;\r
using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
+ using HandBrake.ApplicationServices.Interop.Model.Preview;\r
using HandBrake.ApplicationServices.Services.Encode.Model;\r
\r
/// <summary>\r
{\r
int settingMode = (int)keepWidthOrHeight + (job.KeepDisplayAspect ? 0x04 : 0);\r
\r
- // Sanatise the Geometry First.\r
+ // Sanitize the Geometry First.\r
AnamorphicGeometry anamorphicGeometry = new AnamorphicGeometry\r
{\r
- SourceGeometry = new Geometry()\r
+ SourceGeometry = new Geometry\r
{\r
Width = title.Resolution.Width,\r
Height = title.Resolution.Height,\r
\r
return HandBrakeUtils.GetAnamorphicSize(anamorphicGeometry);\r
}\r
+\r
+ /// <summary>\r
+ /// Finds output geometry for the given preview settings and title.\r
+ /// </summary>\r
+ /// <param name="settings">The preview settings.</param>\r
+ /// <param name="title">Information on the title to consider.</param>\r
+ /// <returns></returns>\r
+ public static Geometry CreateGeometry(PreviewSettings settings, SourceVideoInfo title)\r
+ {\r
+ int settingMode = settings.KeepDisplayAspect ? 0x04 : 0;\r
+\r
+ // Sanitize the Geometry First.\r
+ AnamorphicGeometry anamorphicGeometry = new AnamorphicGeometry\r
+ {\r
+ SourceGeometry = new Geometry\r
+ {\r
+ Width = title.Resolution.Width,\r
+ Height = title.Resolution.Height,\r
+ PAR = new PAR { Num = title.ParVal.Width, Den = title.ParVal.Height }\r
+ },\r
+ DestSettings = new DestSettings\r
+ {\r
+ AnamorphicMode = (int)settings.Anamorphic,\r
+ Geometry =\r
+ {\r
+ Width = settings.Width,\r
+ Height = settings.Height,\r
+ PAR = new PAR\r
+ {\r
+ Num = settings.Anamorphic != Anamorphic.Custom ? title.ParVal.Width : settings.PixelAspectX,\r
+ Den = settings.Anamorphic != Anamorphic.Custom ? title.ParVal.Height : settings.PixelAspectY,\r
+ }\r
+ },\r
+ Keep = settingMode,\r
+ Crop = new List<int> { settings.Cropping.Top, settings.Cropping.Bottom, settings.Cropping.Left, settings.Cropping.Right },\r
+ Modulus = settings.Modulus ?? 16,\r
+ MaxWidth = settings.MaxWidth,\r
+ MaxHeight = settings.MaxHeight,\r
+ ItuPAR = false\r
+ }\r
+ };\r
+\r
+ if (settings.Anamorphic == Anamorphic.Custom)\r
+ {\r
+ anamorphicGeometry.DestSettings.Geometry.PAR = new PAR { Num = settings.PixelAspectX, Den = settings.PixelAspectY };\r
+ }\r
+ else\r
+ {\r
+ anamorphicGeometry.DestSettings.Geometry.PAR = new PAR { Num = title.ParVal.Width, Den = title.ParVal.Height };\r
+ }\r
+\r
+ return HandBrakeUtils.GetAnamorphicSize(anamorphicGeometry);\r
+ }\r
}\r
}\r
/// </summary>\r
private static List<HBVideoEncoder> videoEncoders;\r
\r
- /// <summary>\r
- /// Video framerates in pts.\r
- /// </summary>\r
- private static List<HBRate> videoFramerates; \r
-\r
- /// <summary>\r
- /// List of HandBrake mixdowns.\r
+ /// <summary>
+ /// Video framerates in pts.
+ /// </summary>
+ private static List<HBRate> videoFramerates;
+
+ /// <summary>
+ /// List of HandBrake mixdowns.
/// </summary>\r
private static List<HBMixdown> mixdowns;\r
\r
- /// <summary>\r
- /// List of HandBrake containers.\r
- /// </summary>\r
- private static List<HBContainer> containers; \r
-\r
- /// <summary>\r
- /// The audio bitrates.\r
+ /// <summary>
+ /// List of HandBrake containers.
+ /// </summary>
+ private static List<HBContainer> containers;
+
+ /// <summary>
+ /// The audio bitrates.
/// </summary>\r
private static List<int> audioBitrates;\r
\r
- /// <summary>\r
- /// Audio sample rates in Hz.\r
- /// </summary>\r
- private static List<HBRate> audioSampleRates; \r
-\r
- /// <summary>\r
- /// Initializes static members of the HandBrakeEncoderHelpers class.\r
+ /// <summary>
+ /// Audio sample rates in Hz.
+ /// </summary>
+ private static List<HBRate> audioSampleRates;
+
+ /// <summary>
+ /// Initializes static members of the HandBrakeEncoderHelpers class.
/// </summary>\r
static HandBrakeEncoderHelpers()\r
{\r
{\r
videoFramerates = InteropUtilities.ToListFromIterator<hb_rate_s, HBRate>(HBFunctions.hb_video_framerate_get_next, HandBrakeUnitConversionHelpers.NativeToRate);\r
}\r
-\r
- return videoFramerates;\r
- }\r
- } \r
-\r
- /// <summary>\r
- /// Gets a list of supported mixdowns.\r
+
+ return videoFramerates;
+ }
+ }
+
+ /// <summary>
+ /// Gets a list of supported mixdowns.
/// </summary>\r
public static List<HBMixdown> Mixdowns\r
{\r
public static HBContainer GetContainer(string shortName)\r
{\r
return Containers.SingleOrDefault(c => c.ShortName == shortName);\r
- }\r
-\r
- /// <summary>\r
- /// Determines if the given encoder is compatible with the given track.\r
- /// </summary>\r
- /// <param name="codecId">\r
+ }
+
+ /// <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.\r
/// </param>\r
/// <param name="encoder">\r
/// </param>\r
/// <returns>\r
/// True if the encoder supports the mixdown.\r
- /// </returns>\r
- public static bool MixdownHasCodecSupport(HBMixdown mixdown, HBAudioEncoder encoder)\r
- {\r
- return HBFunctions.hb_mixdown_has_codec_support(mixdown.Id, (uint) encoder.Id) > 0;\r
- }\r
-\r
- /// <summary>\r
+ /// </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.\r
/// </summary>\r
/// <param name="trackNumber">\r
int direction = 0;\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
- }\r
+
+ return new VideoQualityLimits
+ {
+ Low = low,
+ High = high,
+ Granularity = granularity,
+ Ascending = direction == 0
+ };
+ }
\r
/// <summary>\r
/// Sanitizes an audio bitrate given the output codec, sample rate and mixdown.\r
/// </param>\r
/// <returns>\r
/// The default bitrate for these parameters.\r
- /// </returns>\r
- public static int GetDefaultBitrate(HBAudioEncoder encoder, int sampleRate, HBMixdown mixdown)\r
- {\r
- return HBFunctions.hb_audio_bitrate_get_default((uint) encoder.Id, sampleRate, mixdown.Id);\r
- }\r
-\r
- /// <summary>\r
+ /// </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.\r
/// </summary>\r
/// <param name="encoderId">\r
float low = 0, high = 0, granularity = 0;\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
- }\r
+
+ return new RangeLimits
+ {
+ Low = low,
+ High = high,
+ Granularity = granularity,
+ Ascending = direction == 0
+ };
+ }
\r
/// <summary>\r
/// Gets limits on audio compression for a given encoder.\r
float low = 0, high = 0, granularity = 0;\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
- }\r
+
+ return new RangeLimits
+ {
+ Low = low,
+ High = high,
+ Granularity = granularity,
+ Ascending = direction == 0
+ };
+ }
}\r
}\r
/// </summary>\r
private IntPtr hbHandle;\r
\r
+ /// <summary>\r
+ /// The number of previews created during scan.\r
+ /// </summary>\r
+ private int previewCount;\r
+\r
/// <summary>\r
/// The timer to poll for scan status.\r
/// </summary>\r
{\r
get\r
{\r
- return this.Handle;\r
+ return this.hbHandle;\r
+ }\r
+ }\r
+\r
+ /// <summary>\r
+ /// Gets the number of previews created during scan.\r
+ /// </summary>\r
+ public int PreviewCount\r
+ {\r
+ get\r
+ {\r
+ return this.previewCount;\r
}\r
}\r
\r
/// </param>\r
public void StartScan(string path, int previewCount, TimeSpan minDuration, int titleIndex)\r
{\r
+ this.previewCount = previewCount;\r
+\r
IntPtr pathPtr = InteropUtilities.ToUtf8PtrFromString(path);\r
HBFunctions.hb_scan(this.hbHandle, pathPtr, titleIndex, previewCount, 1, (ulong)(minDuration.TotalSeconds * 90000));\r
Marshal.FreeHGlobal(pathPtr);\r
/// <remarks>\r
/// Only incorporates sizing and aspect ratio into preview image.\r
/// </remarks>\r
- /// <param name="job">\r
+ /// <param name="settings">\r
/// The encode job to preview.\r
/// </param>\r
/// <param name="previewNumber">\r
/// An image with the requested preview.\r
/// </returns>\r
[HandleProcessCorruptedStateExceptions]\r
- public BitmapImage GetPreview(PreviewSettings job, int previewNumber)\r
+ public BitmapImage GetPreview(PreviewSettings settings, int previewNumber)\r
{\r
- SourceTitle title = this.Titles.TitleList.FirstOrDefault(t => t.Index == job.Title);\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
- // Creat the Expected Output Geometry details for libhb.\r
+ // Create the Expected Output Geometry details for libhb.\r
hb_geometry_settings_s uiGeometry = new hb_geometry_settings_s\r
{\r
- crop = new[] { job.Cropping.Top, job.Cropping.Bottom, job.Cropping.Left, job.Cropping.Right }, \r
+ crop = new[] { settings.Cropping.Top, settings.Cropping.Bottom, settings.Cropping.Left, settings.Cropping.Right }, \r
itu_par = 0, \r
- keep = (int)AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH + (job.KeepDisplayAspect ? 0x04 : 0), // TODO Keep Width?\r
- maxWidth = job.MaxWidth ?? 0, \r
- maxHeight = job.MaxHeight ?? 0, \r
- mode = (int)(hb_anamorphic_mode_t)job.Anamorphic, \r
- modulus = job.Modulus ?? 16, \r
+ keep = settings.KeepDisplayAspect ? 0x04 : 0,\r
+ maxWidth = settings.MaxWidth, \r
+ maxHeight = settings.MaxHeight, \r
+ mode = (int)(hb_anamorphic_mode_t)settings.Anamorphic, \r
+ modulus = settings.Modulus ?? 16, \r
geometry = new hb_geometry_s\r
{\r
- height = job.Height ?? 0, \r
- width = job.Width ?? 0, \r
- par = job.Anamorphic != Anamorphic.Custom\r
+ height = settings.Height, \r
+ width = settings.Width, \r
+ par = settings.Anamorphic != Anamorphic.Custom\r
? new hb_rational_t { den = title.Geometry.PAR.Den, num = title.Geometry.PAR.Num }\r
- : new hb_rational_t { den = job.PixelAspectY, num = job.PixelAspectX }\r
+ : new hb_rational_t { den = settings.PixelAspectY, num = settings.PixelAspectX }\r
}\r
};\r
\r
- // Sanatise the input.\r
- Geometry resultGeometry = AnamorphicFactory.CreateGeometry(job, new SourceVideoInfo(new Size(title.Geometry.Width, title.Geometry.Height), new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den)), AnamorphicFactory.KeepSetting.HB_KEEP_WIDTH); // TODO this keep isn't right.\r
- int width = resultGeometry.Width * resultGeometry.PAR.Num / resultGeometry.PAR.Den;\r
+ // Sanitize the input.\r
+ Geometry resultGeometry = AnamorphicFactory.CreateGeometry(\r
+ settings,\r
+ new SourceVideoInfo(\r
+ new Size(title.Geometry.Width, title.Geometry.Height),\r
+ new Size(title.Geometry.PAR.Num, title.Geometry.PAR.Den)));\r
+ int width = resultGeometry.Width;\r
int height = resultGeometry.Height;\r
- uiGeometry.geometry.height = resultGeometry.Height; // Prased the height now.\r
- int outputWidth = width;\r
- int outputHeight = height;\r
- \r
+ uiGeometry.geometry.width = width;\r
+ uiGeometry.geometry.height = height;\r
+ uiGeometry.geometry.par.num = settings.PixelAspectX;\r
+ uiGeometry.geometry.par.den = settings.PixelAspectY;\r
+\r
// Fetch the image data from LibHb\r
- IntPtr resultingImageStuct = HBFunctions.hb_get_preview2(this.hbHandle, job.Title, previewNumber, ref uiGeometry, 0);\r
+ IntPtr resultingImageStuct = HBFunctions.hb_get_preview2(this.hbHandle, settings.TitleNumber, previewNumber, ref uiGeometry, 0);\r
hb_image_s image = InteropUtilities.ToStructureFromPtr<hb_image_s>(resultingImageStuct);\r
\r
// Copy the filled image buffer to a managed array.\r
byte[] managedBuffer = new byte[imageBufferSize];\r
Marshal.Copy(image.plane[0].data, managedBuffer, 0, imageBufferSize);\r
\r
- var bitmap = new Bitmap(outputWidth, outputHeight);\r
- BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, outputWidth, outputHeight), ImageLockMode.WriteOnly, PixelFormat.Format32bppRgb);\r
+ var bitmap = new Bitmap(width, height);\r
+ BitmapData bitmapData = bitmap.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format32bppRgb);\r
\r
IntPtr ptr = bitmapData.Scan0; // Pointer to the first pixel.\r
for (int i = 0; i < image.height; i++)\r
try\r
{\r
Marshal.Copy(managedBuffer, i * stride_width, ptr, stride_width);\r
- ptr = IntPtr.Add(ptr, outputWidth * 4);\r
+ ptr = IntPtr.Add(ptr, width * 4);\r
}\r
catch (Exception exc)\r
{\r
}\r
}\r
\r
+ /// <summary>\r
+ /// Determines if DRC can be applied to the given track with the given encoder.\r
+ /// </summary>\r
+ /// <param name="trackNumber">The track Number.</param>\r
+ /// <param name="encoder">The encoder to use for DRC.</param>\r
+ /// <param name="title">The title.</param>\r
+ /// <returns>True if DRC can be applied to the track with the given encoder.</returns>\r
+ public bool CanApplyDrc(int trackNumber, HBAudioEncoder encoder, int title)\r
+ {\r
+ return HBFunctions.hb_audio_can_apply_drc2(this.hbHandle, title, trackNumber, encoder.Id) > 0;\r
+ }\r
+\r
/// <summary>\r
/// Starts an encode with the given job.\r
/// </summary>\r
};\r
\r
string encode = JsonConvert.SerializeObject(encodeObject, Formatting.Indented, settings);\r
- LogHelper.LogMessage(new LogMessage(encode, LogMessageType.encodeJson, LogLevel.debug));\r
HBFunctions.hb_add_json(this.hbHandle, InteropUtilities.ToUtf8PtrFromString(encode));\r
HBFunctions.hb_start(this.hbHandle);\r
\r
GC.SuppressFinalize(this);\r
}\r
\r
+ /// <summary>\r
+ /// Gets a value indicating whether the object is disposed.\r
+ /// </summary>\r
+ public bool IsDisposed\r
+ {\r
+ get\r
+ {\r
+ return this.disposed;\r
+ }\r
+ }\r
+\r
/// <summary>\r
/// Frees any resources associated with this object.\r
/// </summary>\r
using HandBrake.ApplicationServices.Interop.Json.Shared;\r
using HandBrake.ApplicationServices.Services.Logging;\r
using HandBrake.ApplicationServices.Services.Logging.Model;\r
-\r
- using Newtonsoft.Json;\r
-\r
- /// <summary>\r
- /// HandBrake Interop Utilities\r
- /// </summary>\r
- public static class HandBrakeUtils\r
- {\r
- /// <summary>\r
- /// Estimated overhead in bytes for each frame in output container.\r
- /// </summary>\r
- internal const int ContainerOverheadPerFrame = 6;\r
-\r
- /// <summary>\r
- /// The callback for log messages from HandBrake.\r
- /// </summary>\r
- private static LoggingCallback loggingCallback;\r
+
+ using Newtonsoft.Json;
+
+ /// <summary>
+ /// HandBrake Interop Utilities
+ /// </summary>
+ public static class HandBrakeUtils
+ {
+ /// <summary>
+ /// The callback for log messages from HandBrake.
+ /// </summary>
+ private static LoggingCallback loggingCallback;
\r
/// <summary>\r
/// The callback for error messages from HandBrake.\r
\r
string x264Settings = Marshal.PtrToStringAnsi(ptr);\r
\r
- return x264Settings;\r
- }\r
-\r
- /// <summary>\r
- /// Gets the final size and PAR of the video, given anamorphic inputs.\r
- /// </summary>\r
- /// <param name="anamorphicGeometry">Anamorphic inputs.</param>\r
- /// <returns>The final size and PAR of the video.</returns>\r
- public static Geometry GetAnamorphicSize(AnamorphicGeometry anamorphicGeometry)\r
- {\r
- string encode = JsonConvert.SerializeObject(anamorphicGeometry, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });\r
- LogHelper.LogMessage(new LogMessage(encode, LogMessageType.encodeJson, LogLevel.debug));\r
- IntPtr json = HBFunctions.hb_set_anamorphic_size_json(Marshal.StringToHGlobalAnsi(encode));\r
- string result = Marshal.PtrToStringAnsi(json);\r
- return JsonConvert.DeserializeObject<Geometry>(result);\r
- }\r
-\r
- /// <summary>\r
- /// Sends the message logged event to any registered listeners.\r
+ return x264Settings;
+ }
+
+ /// <summary>
+ /// Gets the final size and PAR of the video, given anamorphic inputs.
+ /// </summary>
+ /// <param name="anamorphicGeometry">Anamorphic inputs.</param>
+ /// <returns>The final size and PAR of the video.</returns>
+ public static Geometry GetAnamorphicSize(AnamorphicGeometry anamorphicGeometry)
+ {
+ string encode = JsonConvert.SerializeObject(anamorphicGeometry, Formatting.Indented, new JsonSerializerSettings { NullValueHandling = NullValueHandling.Ignore });
+ LogHelper.LogMessage(new LogMessage(encode, LogMessageType.encodeJson, LogLevel.debug));
+ IntPtr json = HBFunctions.hb_set_anamorphic_size_json(Marshal.StringToHGlobalAnsi(encode));
+ string result = Marshal.PtrToStringAnsi(json);
+ return JsonConvert.DeserializeObject<Geometry>(result);
+ }
+
+ /// <summary>
+ /// Sends the message logged event to any registered listeners.
/// </summary>\r
/// <param name="message">\r
/// The message to send.\r
/// <summary>\r
/// Gets or sets the audio list.\r
/// </summary>\r
- public List<AudioList> AudioList { get; set; }\r
+ public List<AudioTrack> AudioList { get; set; }\r
\r
/// <summary>\r
/// Gets or sets the copy mask.\r
// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="AudioList.cs" company="HandBrake Project (http://handbrake.fr)">\r
+// <copyright file="AudioTrack.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 audio list.\r
+// Represents an audio track to encode.\r
// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Json.Encode\r
-{\r
- /// <summary>\r
- /// The audio list.\r
- /// </summary>\r
- public class AudioList\r
- {\r
- /// <summary>\r
- /// Gets or sets the bitrate.\r
- /// </summary>\r
- public int? Bitrate { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the compression level.\r
- /// </summary>\r
- public double? CompressionLevel { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the drc.\r
- /// </summary>\r
- public double DRC { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the encoder.\r
- /// </summary>\r
- public int Encoder { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the gain.\r
- /// </summary>\r
- public double Gain { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the mixdown.\r
- /// </summary>\r
- public int Mixdown { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets a value indicating whether normalize mix level.\r
- /// </summary>\r
- public bool NormalizeMixLevel { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the quality.\r
- /// </summary>\r
- public double? Quality { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the samplerate.\r
- /// </summary>\r
- public int Samplerate { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the Name of the audio track.\r
- /// </summary>\r
- public string Name { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the track.\r
- /// </summary>\r
- public int Track { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the dither method.\r
- /// </summary>\r
- public int DitherMethod { get; set; }\r
- }\r
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Json.Encode
+{
+ /// <summary>
+ /// Represents an audio track to encode.
+ /// </summary>
+ public class AudioTrack
+ {
+ /// <summary>
+ /// Gets or sets the bitrate.
+ /// </summary>
+ public int? Bitrate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the compression level.
+ /// </summary>
+ public double? CompressionLevel { get; set; }
+
+ /// <summary>
+ /// Gets or sets the drc.
+ /// </summary>
+ public double DRC { get; set; }
+
+ /// <summary>
+ /// Gets or sets the encoder.
+ /// </summary>
+ public int Encoder { get; set; }
+
+ /// <summary>
+ /// Gets or sets the gain.
+ /// </summary>
+ public double Gain { get; set; }
+
+ /// <summary>
+ /// Gets or sets the mixdown.
+ /// </summary>
+ public int Mixdown { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether normalize mix level.
+ /// </summary>
+ public bool NormalizeMixLevel { get; set; }
+
+ /// <summary>
+ /// Gets or sets the quality.
+ /// </summary>
+ public double? Quality { get; set; }
+
+ /// <summary>
+ /// Gets or sets the samplerate.
+ /// </summary>
+ public int Samplerate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the Name of the audio track.
+ /// </summary>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the track.
+ /// </summary>
+ public int Track { get; set; }
+
+ /// <summary>
+ /// Gets or sets the dither method.
+ /// </summary>
+ public int DitherMethod { get; set; }
+ }
}
\ No newline at end of file
// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="ChapterList.cs" company="HandBrake Project (http://handbrake.fr)">\r
+// <copyright file="Chapter.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 chapter list.\r
+// Represents a chapter to encode.\r
// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Json.Encode\r
-{\r
- /// <summary>\r
- /// The chapter list.\r
- /// </summary>\r
- public class ChapterList\r
- {\r
- /// <summary>\r
- /// Gets or sets the name.\r
- /// </summary>\r
- public string Name { get; set; }\r
- }\r
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Json.Encode
+{
+ /// <summary>
+ /// Represents a chapter to encode.
+ /// </summary>
+ public class Chapter
+ {
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+ }
}
\ No newline at end of file
/// <summary>\r
/// Gets or sets the chapter list.\r
/// </summary>\r
- public List<ChapterList> ChapterList { get; set; }\r
+ public List<Chapter> ChapterList { get; set; }\r
\r
/// <summary>\r
/// Gets or sets a value indicating whether chapter markers.\r
/// <summary>\r
/// Gets or sets the meta data.\r
/// </summary>\r
- public MetaData Metadata { get; set; }\r
+ public Metadata Metadata { get; set; }\r
\r
/// <summary>\r
/// Gets or sets the sequence id.\r
/// <summary>\r
/// The meta data.\r
/// </summary>\r
- public class MetaData\r
+ public class Metadata\r
{\r
/// <summary>\r
/// Gets or sets the album artist.\r
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="SubtitleList.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 subtitle list.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Json.Encode\r
-{\r
- /// <summary>\r
- /// The subtitle list.\r
- /// </summary>\r
- public class SubtitleList\r
- {\r
- /// <summary>\r
- /// Gets or sets a value indicating whether burn.\r
- /// </summary>\r
- public bool Burn { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets a value indicating whether default.\r
- /// </summary>\r
- public bool Default { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets a value indicating whether force.\r
- /// </summary>\r
- public bool Forced { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the id.\r
- /// </summary>\r
- public int ID { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the offset.\r
- /// </summary>\r
- public int Offset { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the track.\r
- /// </summary>\r
- public int Track { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the srt.\r
- /// </summary>\r
- public SRT SRT { get; set; }\r
- }\r
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SubtitleTrack.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>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Json.Encode
+{
+ /// <summary>
+ /// Represents a subtitle track to encode.
+ /// </summary>
+ public class SubtitleTrack
+ {
+ /// <summary>
+ /// Gets or sets a value indicating whether burn.
+ /// </summary>
+ public bool Burn { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether default.
+ /// </summary>
+ public bool Default { get; set; }
+
+ /// <summary>
+ /// Gets or sets a value indicating whether force.
+ /// </summary>
+ public bool Forced { get; set; }
+
+ /// <summary>
+ /// Gets or sets the id.
+ /// </summary>
+ public int ID { get; set; }
+
+ /// <summary>
+ /// Gets or sets the offset.
+ /// </summary>
+ public int Offset { get; set; }
+
+ /// <summary>
+ /// Gets or sets the track.
+ /// </summary>
+ public int Track { get; set; }
+
+ /// <summary>
+ /// Gets or sets the srt.
+ /// </summary>
+ public SRT SRT { get; set; }
+ }
}
\ No newline at end of file
/// </summary>\r
public SubtitleSearch Search { get; set; }\r
\r
- /// <summary>\r
- /// Gets or sets the subtitle list.\r
- /// </summary>\r
- public List<SubtitleList> SubtitleList { get; set; }\r
- }\r
+ /// <summary>
+ /// Gets or sets the subtitle list.
+ /// </summary>
+ public List<SubtitleTrack> SubtitleList { get; set; }
+ }
}
\ No newline at end of file
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="AudioTrack.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 audio list.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Json.Scan\r
-{\r
- /// <summary>\r
- /// The audio list.\r
- /// </summary>\r
- public class AudioTrack\r
- {\r
- /// <summary>\r
- /// Gets or sets the bit rate.\r
- /// </summary>\r
- public int BitRate { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the channel layout.\r
- /// </summary>\r
- public int ChannelLayout { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the description.\r
- /// </summary>\r
- public string Description { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the language.\r
- /// </summary>\r
- public string Language { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the language code.\r
- /// </summary>\r
- public string LanguageCode { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the sample rate.\r
- /// </summary>\r
- public int SampleRate { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the codec.\r
- /// </summary>\r
- public int Codec { get; set; }\r
- }\r
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceAudioTrack.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>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// An audio track from the source video.
+ /// </summary>
+ public class SourceAudioTrack
+ {
+ /// <summary>
+ /// Gets or sets the bit rate.
+ /// </summary>
+ public int BitRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the channel layout.
+ /// </summary>
+ public int ChannelLayout { get; set; }
+
+ /// <summary>
+ /// Gets or sets the description.
+ /// </summary>
+ public string Description { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language.
+ /// </summary>
+ public string Language { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language code.
+ /// </summary>
+ public string LanguageCode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the sample rate.
+ /// </summary>
+ public int SampleRate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the codec.
+ /// </summary>
+ public int Codec { get; set; }
+ }
}
\ No newline at end of file
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="ChapterTrack.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 chapter list.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Json.Scan\r
-{\r
- /// <summary>\r
- /// The chapter list.\r
- /// </summary>\r
- public class ChapterTrack\r
- {\r
- /// <summary>\r
- /// Gets or sets the duration.\r
- /// </summary>\r
- public Duration Duration { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the name.\r
- /// </summary>\r
- public string Name { get; set; }\r
- }\r
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceChapter.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>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The a chapter from a video source.
+ /// </summary>
+ public class SourceChapter
+ {
+ /// <summary>
+ /// Gets or sets the duration.
+ /// </summary>
+ public Duration Duration { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ public string Name { get; set; }
+ }
}
\ No newline at end of file
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="MetaData.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 meta data.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Json.Scan\r
-{\r
- /// <summary>\r
- /// The meta data.\r
- /// </summary>\r
- public class MetaData\r
- {\r
- }\r
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceMetadata.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 meta data.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The meta data.
+ /// </summary>
+ public class SourceMetadata
+ {
+ }
}
\ No newline at end of file
-// --------------------------------------------------------------------------------------------------------------------\r
-// <copyright file="SubtitleTrack.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 subtitle list.\r
-// </summary>\r
-// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Json.Scan\r
-{\r
- /// <summary>\r
- /// The subtitle list.\r
- /// </summary>\r
- public class SubtitleTrack\r
- {\r
- /// <summary>\r
- /// Gets or sets the format.\r
- /// </summary>\r
- public int Format { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the language.\r
- /// </summary>\r
- public string Language { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the language code.\r
- /// </summary>\r
- public string LanguageCode { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the source.\r
- /// </summary>\r
- public int Source { get; set; }\r
- }\r
+// --------------------------------------------------------------------------------------------------------------------
+// <copyright file="SourceSubtitleTrack.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 subtitle list.
+// </summary>
+// --------------------------------------------------------------------------------------------------------------------
+
+namespace HandBrake.ApplicationServices.Interop.Json.Scan
+{
+ /// <summary>
+ /// The subtitle list.
+ /// </summary>
+ public class SourceSubtitleTrack
+ {
+ /// <summary>
+ /// Gets or sets the format.
+ /// </summary>
+ public int Format { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language.
+ /// </summary>
+ public string Language { get; set; }
+
+ /// <summary>
+ /// Gets or sets the language code.
+ /// </summary>
+ public string LanguageCode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the source.
+ /// </summary>
+ public int Source { get; set; }
+ }
}
\ No newline at end of file
/// </summary>\r
public int AngleCount { get; set; }\r
\r
- /// <summary>\r
- /// Gets or sets the audio list.\r
- /// </summary>\r
- public List<AudioTrack> AudioList { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the chapter list.\r
- /// </summary>\r
- public List<ChapterTrack> ChapterList { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the color.\r
+ /// <summary>
+ /// Gets or sets the audio list.
+ /// </summary>
+ public List<SourceAudioTrack> AudioList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the chapter list.
+ /// </summary>
+ public List<SourceChapter> ChapterList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the color.
/// </summary>\r
public Color Color { get; set; }\r
\r
/// </summary>\r
public bool InterlaceDetected { get; set; }\r
\r
- /// <summary>\r
- /// Gets or sets the meta data.\r
- /// </summary>\r
- public MetaData MetaData { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the name.\r
+ /// <summary>
+ /// Gets or sets the meta data.
+ /// </summary>
+ public SourceMetadata MetaData { get; set; }
+
+ /// <summary>
+ /// Gets or sets the name.
/// </summary>\r
public string Name { get; set; }\r
\r
/// </summary>\r
public int Playlist { get; set; }\r
\r
- /// <summary>\r
- /// Gets or sets the subtitle list.\r
- /// </summary>\r
- public List<SubtitleTrack> SubtitleList { get; set; }\r
-\r
- /// <summary>\r
- /// Gets or sets the type.\r
+ /// <summary>
+ /// Gets or sets the subtitle list.
+ /// </summary>
+ public List<SourceSubtitleTrack> SubtitleList { get; set; }
+
+ /// <summary>
+ /// Gets or sets the type.
/// HB_DVD_TYPE = 0, HB_BD_TYPE, HB_STREAM_TYPE, HB_FF_STREAM_TYPE\r
/// </summary>\r
public int Type { get; set; }\r
// The preview settings.\r
// </summary>\r
// --------------------------------------------------------------------------------------------------------------------\r
-\r
-namespace HandBrake.ApplicationServices.Interop.Model.Preview\r
-{\r
- using HandBrake.ApplicationServices.Services.Encode.Model;\r
-\r
- /// <summary>\r
- /// The preview settings.\r
- /// </summary>\r
- public class PreviewSettings : EncodeTask\r
- {\r
- /// <summary>\r
- /// Initializes a new instance of the <see cref="PreviewSettings"/> class.\r
- /// </summary>\r
- /// <param name="task">\r
- /// The task.\r
- /// </param>\r
- public PreviewSettings(EncodeTask task)\r
- : base(task)\r
- {\r
- }\r
-\r
- // TODO flesh this out into a proper model.\r
- }\r
-}\r
+
+namespace HandBrake.ApplicationServices.Interop.Model.Preview
+{
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
+ using HandBrake.ApplicationServices.Services.Encode.Model;
+
+ /// <summary>
+ /// The preview settings.
+ /// </summary>
+ public class PreviewSettings
+ {
+ /// <summary>
+ /// Initializes a new instance of the <see cref="PreviewSettings"/> class.
+ /// </summary>
+ public PreviewSettings()
+ {
+ }
+
+ /// <summary>
+ /// Initializes a new instance of the <see cref="PreviewSettings"/> class.
+ /// </summary>
+ /// <param name="task">The task.</param>
+ public PreviewSettings(EncodeTask task)
+ {
+ }
+
+ public Cropping Cropping { get; set; }
+
+ public int MaxWidth { get; set; }
+
+ public int MaxHeight { get; set; }
+
+ public bool KeepDisplayAspect { get; set; }
+
+ public int TitleNumber { get; set; }
+
+ public Anamorphic Anamorphic { get; set; }
+
+ public int? Modulus { get; set; }
+
+ public int Width { get; set; }
+
+ public int Height { get; set; }
+
+ public int PixelAspectX { get; set; }
+
+ public int PixelAspectY { get; set; }
+ }
+}
using System.Linq;\r
using System.Runtime.InteropServices;\r
\r
- using HandBrake.ApplicationServices.Interop;\r
- using HandBrake.ApplicationServices.Interop.HbLib;\r
- using HandBrake.ApplicationServices.Interop.Helpers;\r
- using HandBrake.ApplicationServices.Interop.Json.Encode;\r
- using HandBrake.ApplicationServices.Interop.Json.Shared;\r
- using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
+ using HandBrake.ApplicationServices.Interop;
+ using HandBrake.ApplicationServices.Interop.HbLib;
+ using HandBrake.ApplicationServices.Interop.Helpers;
+ using HandBrake.ApplicationServices.Interop.Json;
+ using HandBrake.ApplicationServices.Interop.Json.Anamorphic;
+ using HandBrake.ApplicationServices.Interop.Json.Encode;
+ using HandBrake.ApplicationServices.Interop.Json.Shared;
+ using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrake.ApplicationServices.Model;\r
using HandBrake.ApplicationServices.Services.Encode.Model;\r
- using HandBrake.ApplicationServices.Services.Encode.Model.Models;\r
- using HandBrake.ApplicationServices.Utilities;\r
-\r
-\r
- /// <summary>\r
- /// This factory takes the internal EncodeJob object and turns it into a set of JSON models\r
+ using HandBrake.ApplicationServices.Services.Encode.Model.Models;
+ using HandBrake.ApplicationServices.Utilities;
+
+ using AudioTrack = HandBrake.ApplicationServices.Services.Encode.Model.Models.AudioTrack;
+ using Subtitle = HandBrake.ApplicationServices.Interop.Json.Encode.Subtitles;
+
+ /// <summary>
+ /// This factory takes the internal EncodeJob object and turns it into a set of JSON models
/// that can be deserialized by libhb.\r
/// </summary>\r
internal class EncodeFactory\r
/// <param name="configuration">\r
/// The configuration.\r
/// </param>\r
- /// <returns>\r
- /// The <see cref="JsonEncodeObject"/>.\r
- /// </returns>\r
- internal static JsonEncodeObject Create(EncodeTask job, HBConfiguration configuration) \r
- {\r
- JsonEncodeObject encode = new JsonEncodeObject\r
- {\r
- SequenceID = 0, \r
- Audio = CreateAudio(job), \r
- Destination = CreateDestination(job), \r
- Filters = CreateFilter(job), \r
- PAR = CreatePAR(job), \r
- Metadata = CreateMetaData(job),\r
- Source = CreateSource(job, configuration), \r
- Subtitle = CreateSubtitle(job),\r
- Video = CreateVideo(job, configuration)\r
- };\r
+ /// <returns>
+ /// The <see cref="JsonEncodeObject"/>.
+ /// </returns>
+ internal static JsonEncodeObject Create(EncodeTask job, HBConfiguration configuration)
+ {
+ JsonEncodeObject encode = new JsonEncodeObject
+ {
+ SequenceID = 0,
+ Audio = CreateAudio(job),
+ Destination = CreateDestination(job),
+ Filters = CreateFilters(job),
+ PAR = CreatePAR(job),
+ Metadata = CreateMetadata(job),
+ Source = CreateSource(job, configuration),
+ Subtitle = CreateSubtitle(job),
+ Video = CreateVideo(job, configuration)
+ };
\r
return encode;\r
}\r
{\r
Range range = new Range();\r
switch (job.PointToPointMode)\r
- {\r
- case PointToPointMode.Chapters:\r
- range.Type = "chapter";\r
- range.End = job.EndPoint;\r
- range.Start = job.StartPoint;\r
- break;\r
- case PointToPointMode.Seconds:\r
- range.Type = "time";\r
- range.Start = job.StartPoint * 90000;\r
- range.End = (job.EndPoint - job.StartPoint) * 90000; \r
- break;\r
- case PointToPointMode.Frames:\r
- range.Type = "frame";\r
- range.Start = job.StartPoint;\r
- range.End = job.EndPoint; \r
- break;\r
- case PointToPointMode.Preview:\r
- range.Type = "preview";\r
- range.Start = job.PreviewEncodeStartAt;\r
- range.SeekPoints = configuration.PreviewScanCount;\r
- range.End = job.PreviewEncodeDuration * 90000; \r
- break;\r
- }\r
-\r
- Source source = new Source\r
- {\r
- Title = job.Title, \r
- Range = range,\r
- Angle = job.Angle,\r
- Path = job.Source,\r
+ {
+ case PointToPointMode.Chapters:
+ range.Type = "chapter";
+ range.Start = job.StartPoint;
+ range.End = job.EndPoint;
+ break;
+ case PointToPointMode.Seconds:
+ range.Type = "time";
+ range.Start = job.StartPoint * 90000;
+ range.End = (job.EndPoint - job.StartPoint) * 90000;
+ break;
+ case PointToPointMode.Frames:
+ range.Type = "frame";
+ range.Start = job.StartPoint;
+ range.End = job.EndPoint;
+ break;
+ case PointToPointMode.Preview:
+ range.Type = "preview";
+ range.Start = job.PreviewEncodeStartAt;
+ range.SeekPoints = configuration.PreviewScanCount;
+ range.End = job.PreviewEncodeDuration * 90000;
+ break;
+ }
+
+ Source source = new Source
+ {
+ Title = job.Title,
+ Range = range,
+ Angle = job.Angle,
+ Path = job.Source,
};\r
return source;\r
}\r
/// The <see cref="Destination"/>.\r
/// </returns>\r
private static Destination CreateDestination(EncodeTask job)\r
- {\r
- Destination destination = new Destination\r
- {\r
- File = job.Destination, \r
- Mp4Options = new Mp4Options\r
- {\r
- IpodAtom = job.IPod5GSupport, \r
- Mp4Optimize = job.OptimizeMP4\r
- }, \r
- ChapterMarkers = job.IncludeChapterMarkers,\r
- Mux = HBFunctions.hb_container_get_from_name(job.OutputFormat == OutputFormat.Mp4 ? "av_mp4" : "av_mkv"), // TODO tidy up.\r
- ChapterList = new List<ChapterList>()\r
- };\r
-\r
- if (job.IncludeChapterMarkers)\r
- {\r
- foreach (ChapterMarker item in job.ChapterNames)\r
- {\r
- ChapterList chapter = new ChapterList { Name = item.ChapterName };\r
- destination.ChapterList.Add(chapter);\r
- }\r
- }\r
+ {
+ Destination destination = new Destination
+ {
+ File = job.Destination,
+ Mp4Options = new Mp4Options
+ {
+ IpodAtom = job.IPod5GSupport,
+ Mp4Optimize = job.OptimizeMP4
+ },
+ ChapterMarkers = job.IncludeChapterMarkers,
+ Mux = HBFunctions.hb_container_get_from_name(job.OutputFormat == OutputFormat.Mp4 ? "av_mp4" : "av_mkv"), // TODO tidy up.
+ ChapterList = new List<Chapter>()
+ };
+
+ if (job.IncludeChapterMarkers)
+ {
+ foreach (ChapterMarker item in job.ChapterNames)
+ {
+ Chapter chapter = new Chapter { Name = item.ChapterName };
+ destination.ChapterList.Add(chapter);
+ }
+ }
\r
return destination;\r
}\r
/// <param name="job">\r
/// The job.\r
/// </param>\r
- /// <returns>\r
- /// The <see cref="HandBrake.ApplicationServices.Interop.Json.Encode.Subtitles"/>.\r
- /// </returns>\r
- private static Subtitles CreateSubtitle(EncodeTask job)\r
- {\r
- Subtitles subtitle = new Subtitles\r
- {\r
- Search =\r
- new SubtitleSearch\r
- {\r
- Enable = false, \r
- Default = false, \r
- Burn = false, \r
- Forced = false\r
- }, \r
- SubtitleList = new List<SubtitleList>()\r
- };\r
-\r
- foreach (SubtitleTrack item in job.SubtitleTracks)\r
- {\r
- if (!item.IsSrtSubtitle)\r
- {\r
+ /// <returns>
+ /// The <see cref="HandBrake.ApplicationServices.Interop.Json.Encode.Subtitles"/>.
+ /// </returns>
+ private static Subtitle CreateSubtitle(EncodeTask job)
+ {
+ Subtitles subtitle = new Subtitles
+ {
+ Search =
+ new SubtitleSearch
+ {
+ Enable = false,
+ Default = false,
+ Burn = false,
+ Forced = false
+ },
+ SubtitleList = new List<HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack>()
+ };
+
+ foreach (HandBrake.ApplicationServices.Services.Encode.Model.Models.SubtitleTrack item in job.SubtitleTracks)
+ {
+ if (!item.IsSrtSubtitle)
+ {
// Handle Foreign Audio Search\r
if (item.SourceTrack.TrackNumber == 0)\r
{\r
subtitle.Search.Burn = item.Burned;\r
subtitle.Search.Default = item.Default;\r
subtitle.Search.Forced = item.Forced;\r
- }\r
- else\r
- {\r
- SubtitleList track = new SubtitleList { Burn = item.Burned, Default = item.Default, Forced = item.Forced, ID = item.SourceTrack.TrackNumber, Track = (item.SourceTrack.TrackNumber - 1) };\r
- subtitle.SubtitleList.Add(track);\r
- }\r
- }\r
- else\r
- {\r
- SubtitleList track = new SubtitleList\r
- {\r
- Track = -1, // Indicates SRT\r
- Default = item.Default,\r
+ }
+ else
+ {
+ HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack track = new HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack
+ {
+ Burn = item.Burned,
+ Default = item.Default,
+ Forced = item.Forced,
+ ID = item.SourceTrack.TrackNumber,
+ Track = (item.SourceTrack.TrackNumber - 1)
+ };
+
+ subtitle.SubtitleList.Add(track);
+ }
+ }
+ else
+ {
+ HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack track = new HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack
+ {
+ Track = -1, // Indicates SRT
+ Default = item.Default,
Offset = item.SrtOffset,\r
Burn = item.Burned,\r
SRT =\r
Codeset = item.SrtCharCode,\r
Language = item.SrtLang\r
}\r
- };\r
-\r
- subtitle.SubtitleList.Add(track);\r
- } \r
- }\r
-\r
- return subtitle;\r
+ };
+
+ subtitle.SubtitleList.Add(track);
+ }
+ }
+
+ return subtitle;
}\r
\r
/// <summary>\r
/// The <see cref="Audio"/>.\r
/// </returns>\r
private static Audio CreateAudio(EncodeTask job)\r
- {\r
- Audio audio = new Audio();\r
-\r
- List<uint> copyMaskList = new List<uint>(); \r
- if (job.AllowedPassthruOptions.AudioAllowAACPass) copyMaskList.Add(NativeConstants.HB_ACODEC_AAC_PASS);\r
- if (job.AllowedPassthruOptions.AudioAllowAC3Pass) copyMaskList.Add(NativeConstants.HB_ACODEC_AC3_PASS);\r
- if (job.AllowedPassthruOptions.AudioAllowDTSHDPass) copyMaskList.Add(NativeConstants.HB_ACODEC_DCA_HD_PASS);\r
+ {
+ Audio audio = new Audio();
+
+ List<uint> copyMaskList = new List<uint>();
+ if (job.AllowedPassthruOptions.AudioAllowAACPass) copyMaskList.Add(NativeConstants.HB_ACODEC_AAC_PASS);
+ if (job.AllowedPassthruOptions.AudioAllowAC3Pass) copyMaskList.Add(NativeConstants.HB_ACODEC_AC3_PASS);
+ if (job.AllowedPassthruOptions.AudioAllowDTSHDPass) copyMaskList.Add(NativeConstants.HB_ACODEC_DCA_HD_PASS);
if (job.AllowedPassthruOptions.AudioAllowDTSPass) copyMaskList.Add(NativeConstants.HB_ACODEC_DCA_PASS);\r
if (job.AllowedPassthruOptions.AudioAllowEAC3Pass) copyMaskList.Add(NativeConstants.HB_ACODEC_EAC3_PASS);\r
- if (job.AllowedPassthruOptions.AudioAllowFlacPass) copyMaskList.Add(NativeConstants.HB_ACODEC_FLAC_PASS);\r
- if (job.AllowedPassthruOptions.AudioAllowMP3Pass) copyMaskList.Add(NativeConstants.HB_ACODEC_MP3_PASS);\r
- if (job.AllowedPassthruOptions.AudioAllowTrueHDPass) copyMaskList.Add(NativeConstants.HB_ACODEC_TRUEHD_PASS);\r
- audio.CopyMask = copyMaskList.ToArray(); \r
-\r
- HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(job.AllowedPassthruOptions.AudioEncoderFallback));\r
- audio.FallbackEncoder = audioEncoder.Id;\r
-\r
- audio.AudioList = new List<AudioList>();\r
- foreach (AudioTrack item in job.AudioTracks)\r
- {\r
- HBAudioEncoder encoder = HandBrakeEncoderHelpers.GetAudioEncoder(ApplicationServices.Utilities.Converters.GetCliAudioEncoder(item.Encoder) );\r
- Validate.NotNull(encoder, "Unrecognized audio encoder:" + item.Encoder);\r
-\r
- HBMixdown mixdown = HandBrakeEncoderHelpers.GetMixdown(ApplicationServices.Utilities.Converters.GetCliMixDown(item.MixDown));\r
- Validate.NotNull(mixdown, "Unrecognized audio mixdown:" + ApplicationServices.Utilities.Converters.GetCliMixDown(item.MixDown));\r
-\r
- AudioList audioTrack = new AudioList\r
- {\r
- Track = (item.Track.HasValue ? item.Track.Value : 0) - 1,\r
- DRC = item.DRC, \r
- Encoder = encoder.Id, \r
- Gain = item.Gain, \r
- Mixdown = mixdown.Id, \r
- NormalizeMixLevel = false,\r
- Samplerate = GetSampleRateRaw(item.SampleRate),\r
- Name = item.TrackName,\r
+ if (job.AllowedPassthruOptions.AudioAllowFlacPass) copyMaskList.Add(NativeConstants.HB_ACODEC_FLAC_PASS);
+ if (job.AllowedPassthruOptions.AudioAllowMP3Pass) copyMaskList.Add(NativeConstants.HB_ACODEC_MP3_PASS);
+ if (job.AllowedPassthruOptions.AudioAllowTrueHDPass) copyMaskList.Add(NativeConstants.HB_ACODEC_TRUEHD_PASS);
+ audio.CopyMask = copyMaskList.ToArray();
+
+ HBAudioEncoder audioEncoder = HandBrakeEncoderHelpers.GetAudioEncoder(EnumHelper<AudioEncoder>.GetShortName(job.AllowedPassthruOptions.AudioEncoderFallback));
+ audio.FallbackEncoder = audioEncoder.Id;
+
+ audio.AudioList = new List<Interop.Json.Encode.AudioTrack>();
+ foreach (AudioTrack item in job.AudioTracks)
+ {
+ HBAudioEncoder encoder = HandBrakeEncoderHelpers.GetAudioEncoder(ApplicationServices.Utilities.Converters.GetCliAudioEncoder(item.Encoder));
+ Validate.NotNull(encoder, "Unrecognized audio encoder:" + item.Encoder);
+
+ HBMixdown mixdown = HandBrakeEncoderHelpers.GetMixdown(ApplicationServices.Utilities.Converters.GetCliMixDown(item.MixDown));
+ Validate.NotNull(mixdown, "Unrecognized audio mixdown:" + ApplicationServices.Utilities.Converters.GetCliMixDown(item.MixDown));
+
+ HandBrake.ApplicationServices.Interop.Json.Encode.AudioTrack audioTrack = new HandBrake.ApplicationServices.Interop.Json.Encode.AudioTrack
+ {
+ Track = (item.Track.HasValue ? item.Track.Value : 0) - 1,
+ DRC = item.DRC,
+ Encoder = encoder.Id,
+ Gain = item.Gain,
+ Mixdown = mixdown.Id,
+ NormalizeMixLevel = false,
+ Samplerate = GetSampleRateRaw(item.SampleRate),
+ Name = item.TrackName,
};\r
\r
if (!item.IsPassthru)\r
//if (item.EncodeRateType == AudioEncodeRateType.Compression)\r
//{\r
// audioTrack.CompressionLevel = item.Compression;\r
- //}\r
-\r
- //if (item.EncodeRateType == AudioEncodeRateType.Bitrate)\r
- // {\r
- audioTrack.Bitrate = item.Bitrate;\r
- // }\r
- }\r
-\r
- audio.AudioList.Add(audioTrack);\r
+ //}
+
+ //if (item.EncodeRateType == AudioEncodeRateType.Bitrate)
+ // {
+ audioTrack.Bitrate = item.Bitrate;
+ // }
+ }
+
+ audio.AudioList.Add(audioTrack);
}\r
\r
return audio;\r
/// <param name="job">\r
/// The job.\r
/// </param>\r
- /// <returns>\r
- /// The <see cref="Filters"/>.\r
- /// </returns>\r
- private static Filters CreateFilter(EncodeTask job)\r
- {\r
- Filters filter = new Filters\r
- {\r
- FilterList = new List<Filter>(), \r
- Grayscale = job.Grayscale\r
- };\r
-\r
+ /// <returns>
+ /// The <see cref="Filters"/>.
+ /// </returns>
+ private static Filters CreateFilters(EncodeTask job)
+ {
+ Filters filter = new Filters
+ {
+ FilterList = new List<Filter>(),
+ Grayscale = job.Grayscale
+ };
+
// Detelecine\r
if (job.Detelecine != Detelecine.Off)\r
{\r
filter.FilterList.Add(filterItem);\r
}\r
\r
- // CropScale Filter\r
- Filter cropScale = new Filter\r
- {\r
- ID = (int)hb_filter_ids.HB_FILTER_CROP_SCALE, \r
- Settings =\r
- string.Format(\r
- "{0}:{1}:{2}:{3}:{4}:{5}", \r
- job.Width, \r
- job.Height, \r
- job.Cropping.Top, \r
- job.Cropping.Bottom, \r
- job.Cropping.Left, \r
- job.Cropping.Right)\r
- };\r
- filter.FilterList.Add(cropScale);\r
+ // CropScale Filter
+ Filter cropScale = new Filter
+ {
+ ID = (int)hb_filter_ids.HB_FILTER_CROP_SCALE,
+ Settings =
+ string.Format(
+ "{0}:{1}:{2}:{3}:{4}:{5}",
+ job.Width,
+ job.Height,
+ job.Cropping.Top,
+ job.Cropping.Bottom,
+ job.Cropping.Left,
+ job.Cropping.Right)
+ };
+ filter.FilterList.Add(cropScale);
\r
// Rotate\r
/* TODO NOT SUPPORTED YET. */\r
/// The create meta data.\r
/// </summary>\r
/// <param name="job">\r
- /// The job.\r
- /// </param>\r
- /// <returns>\r
- /// The <see cref="Interop.Json.Encode.MetaData"/>.\r
- /// </returns>\r
- private static MetaData CreateMetaData(EncodeTask job)\r
- {\r
- MetaData metaData = new MetaData();\r
-\r
- /* TODO NOT SUPPORTED YET. */\r
- return metaData;\r
+ /// The job.
+ /// </param>
+ /// <returns>
+ /// The <see cref="Metadata"/>.
+ /// </returns>
+ private static Metadata CreateMetadata(EncodeTask job)
+ {
+ Metadata metaData = new Metadata();
+
+ /* TODO NOT SUPPORTED YET. */
+ return metaData;
}\r
}\r
}\r
/// </summary>\r
public interface IScan\r
{\r
- /// <summary>\r
- /// Scan has Started\r
- /// </summary>\r
- event EventHandler ScanStared;\r
-\r
- /// <summary>\r
- /// Scan has completed\r
+ /// <summary>
+ /// Scan has Started
+ /// </summary>
+ event EventHandler ScanStarted;
+
+ /// <summary>
+ /// Scan has completed
/// </summary>\r
event ScanCompletedStatus ScanCompleted;\r
\r
\r
#region Events\r
\r
- /// <summary>\r
- /// Scan has Started\r
- /// </summary>\r
- public event EventHandler ScanStared;\r
-\r
- /// <summary>\r
- /// Scan has completed\r
+ /// <summary>
+ /// Scan has Started
+ /// </summary>
+ public event EventHandler ScanStarted;
+
+ /// <summary>
+ /// Scan has completed
/// </summary>\r
public event ScanCompletedStatus ScanCompleted;\r
\r
\r
HandBrakeUtils.SetDvdNav(!configuraiton.IsDvdNavDisabled);\r
\r
- this.ServiceLogMessage("Starting Scan ...");\r
- this.instance.StartScan(sourcePath.ToString(), previewCount, minDuration, title != 0 ? title : 0);\r
-\r
- if (this.ScanStared != null)\r
- this.ScanStared(this, System.EventArgs.Empty);\r
- }\r
- catch (Exception exc)\r
- {\r
+ this.ServiceLogMessage("Starting Scan ...");
+ this.instance.StartScan(sourcePath.ToString(), previewCount, minDuration, title != 0 ? title : 0);
+
+ if (this.ScanStarted != null)
+ this.ScanStarted(this, System.EventArgs.Empty);
+ }
+ catch (Exception exc)
+ {
this.ServiceLogMessage("Scan Failed ..." + Environment.NewLine + exc);\r
this.Stop();\r
\r
Playlist = title.Type == 1 ? string.Format(" {0:d5}.MPLS", title.Playlist).Trim() : null,\r
FramerateNumerator = title.FrameRate.Num,\r
FramerateDenominator = title.FrameRate.Den\r
- };\r
-\r
- int currentTrack = 1;\r
- foreach (ChapterTrack chapter in title.ChapterList)\r
- {\r
- string chapterName = !string.IsNullOrEmpty(chapter.Name) ? chapter.Name : string.Empty;\r
- converted.Chapters.Add(new Chapter(currentTrack, chapterName, new TimeSpan(chapter.Duration.Hours, chapter.Duration.Minutes, chapter.Duration.Seconds)));\r
+ };
+
+ int currentTrack = 1;
+ foreach (SourceChapter chapter in title.ChapterList)
+ {
+ string chapterName = !string.IsNullOrEmpty(chapter.Name) ? chapter.Name : string.Empty;
+ converted.Chapters.Add(new Chapter(currentTrack, chapterName, new TimeSpan(chapter.Duration.Hours, chapter.Duration.Minutes, chapter.Duration.Seconds)));
currentTrack++;\r
- }\r
-\r
- int currentAudioTrack = 1;\r
- foreach (AudioTrack track in title.AudioList)\r
- {\r
- converted.AudioTracks.Add(new Audio(currentAudioTrack, track.Language, track.LanguageCode, track.Description, string.Empty, track.SampleRate, track.BitRate));\r
- currentAudioTrack++;\r
- }\r
-\r
- int currentSubtitleTrack = 1;\r
- foreach (SubtitleTrack track in title.SubtitleList)\r
- {\r
- SubtitleType convertedType = new SubtitleType();\r
-\r
+ }
+
+ int currentAudioTrack = 1;
+ foreach (SourceAudioTrack track in title.AudioList)
+ {
+ converted.AudioTracks.Add(new Audio(currentAudioTrack, track.Language, track.LanguageCode, track.Description, string.Empty, track.SampleRate, track.BitRate));
+ currentAudioTrack++;
+ }
+
+ int currentSubtitleTrack = 1;
+ foreach (SourceSubtitleTrack track in title.SubtitleList)
+ {
+ SubtitleType convertedType = new SubtitleType();
+
switch (track.Source)\r
{\r
case 0:\r
/// <param name="ssw">\r
/// The scan service wrapper.\r
/// </param>\r
- public CancelScanCommand(IScan ssw)\r
- {\r
- this.scanServiceWrapper = ssw;\r
- this.scanServiceWrapper.ScanStared += this.ScanServiceWrapperScanStared;\r
- this.scanServiceWrapper.ScanCompleted += this.ScanServiceWrapperScanCompleted;\r
- }\r
-\r
+ public CancelScanCommand(IScan ssw)
+ {
+ this.scanServiceWrapper = ssw;
+ this.scanServiceWrapper.ScanStarted += this.ScanServiceWrapperScanStared;
+ this.scanServiceWrapper.ScanCompleted += this.ScanServiceWrapperScanCompleted;
+ }
+
/// <summary>\r
/// The scan service Scan Completed Event Handler.\r
/// Fires CanExecuteChanged\r
protected override void OnActivate()\r
{\r
this.scanService.ScanCompleted += ScanServiceScanCompleted;\r
- this.encodeService.EncodeCompleted += EncodeServiceEncodeCompleted;\r
- this.encodeService.EncodeStatusChanged += this.EncodeServiceEncodeStatusChanged;\r
- this.scanService.ScanStatusChanged += this.ScanServiceScanStatusChanged;\r
- this.scanService.ScanStared += this.scanService_ScanStared;\r
- this.encodeService.EncodeStarted += this.encodeService_EncodeStarted;\r
- base.OnActivate();\r
-\r
+ this.encodeService.EncodeCompleted += EncodeServiceEncodeCompleted;
+ this.encodeService.EncodeStatusChanged += this.EncodeServiceEncodeStatusChanged;
+ this.scanService.ScanStatusChanged += this.ScanServiceScanStatusChanged;
+ this.scanService.ScanStarted += this.scanService_ScanStared;
+ this.encodeService.EncodeStarted += this.encodeService_EncodeStarted;
+ base.OnActivate();
+
this.NotifyOfPropertyChange(() => this.ScanLog);\r
this.NotifyOfPropertyChange(() => this.EncodeLog);\r
}\r
protected override void OnDeactivate(bool close)\r
{\r
this.scanService.ScanCompleted -= ScanServiceScanCompleted;\r
- this.encodeService.EncodeCompleted -= EncodeServiceEncodeCompleted;\r
- this.encodeService.EncodeStatusChanged -= this.EncodeServiceEncodeStatusChanged;\r
- this.scanService.ScanStatusChanged -= this.ScanServiceScanStatusChanged;\r
- this.scanService.ScanStared -= this.scanService_ScanStared;\r
- this.encodeService.EncodeStarted -= this.encodeService_EncodeStarted;\r
-\r
- base.OnDeactivate(close);\r
+ this.encodeService.EncodeCompleted -= EncodeServiceEncodeCompleted;
+ this.encodeService.EncodeStatusChanged -= this.EncodeServiceEncodeStatusChanged;
+ this.scanService.ScanStatusChanged -= this.ScanServiceScanStatusChanged;
+ this.scanService.ScanStarted -= this.scanService_ScanStared;
+ this.encodeService.EncodeStarted -= this.encodeService_EncodeStarted;
+
+ base.OnDeactivate(close);
}\r
\r
/// <summary>\r
this.CurrentTask = new EncodeTask();\r
this.CurrentTask.PropertyChanged += this.CurrentTask_PropertyChanged;\r
this.ScannedSource = new Source();\r
- this.HasSource = false;\r
-\r
- // Setup Events\r
- this.scanService.ScanStared += this.ScanStared;\r
- this.scanService.ScanCompleted += this.ScanCompleted;\r
- this.scanService.ScanStatusChanged += this.ScanStatusChanged;\r
- this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;\r
+ this.HasSource = false;
+
+ // Setup Events
+ this.scanService.ScanStarted += this.ScanStared;
+ this.scanService.ScanCompleted += this.ScanCompleted;
+ this.scanService.ScanStatusChanged += this.ScanStatusChanged;
+ this.queueProcessor.JobProcessingStarted += this.QueueProcessorJobProcessingStarted;
this.queueProcessor.QueueCompleted += this.QueueCompleted;\r
this.queueProcessor.QueueChanged += this.QueueChanged;\r
this.queueProcessor.EncodeService.EncodeStatusChanged += this.EncodeStatusChanged;\r
public void Shutdown()\r
{\r
// Shutdown Service\r
- this.encodeService.Stop();\r
-\r
- // Unsubscribe from Events.\r
- this.scanService.ScanStared -= this.ScanStared;\r
- this.scanService.ScanCompleted -= this.ScanCompleted;\r
- this.scanService.ScanStatusChanged -= this.ScanStatusChanged;\r
-\r
+ this.encodeService.Stop();
+
+ // Unsubscribe from Events.
+ this.scanService.ScanStarted -= this.ScanStared;
+ this.scanService.ScanCompleted -= this.ScanCompleted;
+ this.scanService.ScanStatusChanged -= this.ScanStatusChanged;
+
this.queueProcessor.QueueCompleted -= this.QueueCompleted;\r
this.queueProcessor.QueueChanged -= this.QueueChanged;\r
this.queueProcessor.JobProcessingStarted -= this.QueueProcessorJobProcessingStarted;\r