diff options
author | [email protected] <sr55> | 2016-01-29 20:55:10 +0000 |
---|---|---|
committer | [email protected] <sr55> | 2016-01-29 20:55:10 +0000 |
commit | db29f87dc3bf3909d263491390d0f56418616e26 (patch) | |
tree | e0adda8c59fb4344fa8cff5ea6465afa130cc260 | |
parent | da7b1d29c60f740037883f44e07415580fc5d9a9 (diff) |
WinGui: Add support for the rotate and flip filter.
8 files changed, 237 insertions, 124 deletions
diff --git a/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs b/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs index f84ad3310..260b55960 100644 --- a/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs +++ b/win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs @@ -204,7 +204,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Presets /// <summary>
/// Gets or sets the picture rotate.
/// </summary>
- public int PictureRotate { get; set; }
+ public string PictureRotate { get; set; }
/// <summary>
/// Gets or sets the picture width.
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs index defb16f34..768212338 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs @@ -448,6 +448,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Flip.
+ /// </summary>
+ public static string FiltersView_FlipVideo {
+ get {
+ return ResourceManager.GetString("FiltersView_FlipVideo", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Grayscale.
/// </summary>
public static string FiltersView_Grayscale {
@@ -466,6 +475,15 @@ namespace HandBrakeWPF.Properties { }
/// <summary>
+ /// Looks up a localized string similar to Rotate:.
+ /// </summary>
+ public static string FiltersView_Rotate {
+ get {
+ return ResourceManager.GetString("FiltersView_Rotate", resourceCulture);
+ }
+ }
+
+ /// <summary>
/// Looks up a localized string similar to Tune:.
/// </summary>
public static string FiltersView_Tune {
diff --git a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx index 752064170..79ef0cf6b 100644 --- a/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx +++ b/win/CS/HandBrakeWPF/Properties/ResourcesUI.resx @@ -840,4 +840,10 @@ <data name="Options_PauseQueueOnLowDiskSpace" xml:space="preserve">
<value>Pause queue if disk space is low before starting a job.</value>
</data>
+ <data name="FiltersView_FlipVideo" xml:space="preserve">
+ <value>Flip</value>
+ </data>
+ <data name="FiltersView_Rotate" xml:space="preserve">
+ <value>Rotate:</value>
+ </data>
</root>
\ No newline at end of file diff --git a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs index 3415f1ee7..62a3faf81 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs @@ -65,17 +65,17 @@ namespace HandBrakeWPF.Services.Encode.Factories 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) - }; + { + 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) + }; return encode; } @@ -145,10 +145,10 @@ namespace HandBrakeWPF.Services.Encode.Factories { File = job.Destination, Mp4Options = new Mp4Options - { - IpodAtom = job.IPod5GSupport, - Mp4Optimize = job.OptimizeMP4 - }, + { + 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>() @@ -192,17 +192,17 @@ namespace HandBrakeWPF.Services.Encode.Factories private static Subtitle CreateSubtitle(EncodeTask job) { Subtitles subtitle = new Subtitles - { - Search = + { + Search = new SubtitleSearch - { - Enable = false, - Default = false, - Burn = false, - Forced = false - }, - SubtitleList = new List<HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack>() - }; + { + Enable = false, + Default = false, + Burn = false, + Forced = false + }, + SubtitleList = new List<HandBrake.ApplicationServices.Interop.Json.Encode.SubtitleTrack>() + }; foreach (SubtitleTrack item in job.SubtitleTracks) { @@ -352,28 +352,28 @@ namespace HandBrakeWPF.Services.Encode.Factories HBRate sampleRate = HandBrakeEncoderHelpers.AudioSampleRates.FirstOrDefault(s => s.Name == item.SampleRate.ToString(CultureInfo.InvariantCulture)); 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 = sampleRate != null ? sampleRate.Rate : 0, - Name = item.TrackName, - }; + { + Track = (item.Track.HasValue ? item.Track.Value : 0) - 1, + DRC = item.DRC, + Encoder = encoder.Id, + Gain = item.Gain, + Mixdown = mixdown.Id, + NormalizeMixLevel = false, + Samplerate = sampleRate != null ? sampleRate.Rate : 0, + Name = item.TrackName, + }; if (!item.IsPassthru) { - if (item.EncoderRateType == AudioEncoderRateType.Quality) - { + if (item.EncoderRateType == AudioEncoderRateType.Quality) + { audioTrack.Quality = item.Quality; - } + } - if (item.EncoderRateType == AudioEncoderRateType.Bitrate) - { + if (item.EncoderRateType == AudioEncoderRateType.Bitrate) + { audioTrack.Bitrate = item.Bitrate; - } + } } audio.AudioList.Add(audioTrack); @@ -394,9 +394,11 @@ namespace HandBrakeWPF.Services.Encode.Factories private static Filters CreateFilters(EncodeTask job) { Filters filter = new Filters - { - FilterList = new List<Filter>(), - }; + { + FilterList = new List<Filter>(), + }; + + // Note, order is important. // Detelecine if (job.Detelecine != Detelecine.Off) @@ -405,27 +407,6 @@ namespace HandBrakeWPF.Services.Encode.Factories filter.FilterList.Add(filterItem); } - // Decomb - if (job.DeinterlaceFilter == DeinterlaceFilter.Decomb) - { - string options; - if (job.Decomb == Decomb.Fast) - { - options = "7:2:6:9:1:80"; - } - else if (job.Decomb == Decomb.Bob) - { - options = "455"; - } - else - { - options = job.CustomDecomb; - } - - Filter filterItem = new Filter { ID = (int)hb_filter_ids.HB_FILTER_DECOMB, Settings = options }; - filter.FilterList.Add(filterItem); - } - // Deinterlace if (job.DeinterlaceFilter == DeinterlaceFilter.Deinterlace) { @@ -455,29 +436,24 @@ namespace HandBrakeWPF.Services.Encode.Factories filter.FilterList.Add(filterItem); } - // VFR / CFR - int fm = job.FramerateMode == FramerateMode.CFR ? 1 : job.FramerateMode == FramerateMode.PFR ? 2 : 0; - int? num = null, den = null; - if (job.Framerate != null) + // Decomb + if (job.DeinterlaceFilter == DeinterlaceFilter.Decomb) { - IntPtr frameratePrt = Marshal.StringToHGlobalAnsi(job.Framerate.Value.ToString(CultureInfo.InvariantCulture)); - int vrate = HBFunctions.hb_video_framerate_get_from_name(frameratePrt); - - if (vrate > 0) + string options; + if (job.Decomb == Decomb.Fast) { - num = 27000000; - den = vrate; + options = "7:2:6:9:1:80"; + } + else if (job.Decomb == Decomb.Bob) + { + options = "455"; + } + else + { + options = job.CustomDecomb; } - } - - string framerateString = num.HasValue ? string.Format("{0}:{1}:{2}", fm, num, den) : string.Format("{0}", fm); // filter_cfr, filter_vrate.num, filter_vrate.den - Filter framerateShaper = new Filter { ID = (int)hb_filter_ids.HB_FILTER_VFR, Settings = framerateString }; - filter.FilterList.Add(framerateShaper); - // Deblock - if (job.Deblock >= 5) - { - Filter filterItem = new Filter { ID = (int)hb_filter_ids.HB_FILTER_DEBLOCK, Settings = job.Deblock.ToString() }; + Filter filterItem = new Filter { ID = (int)hb_filter_ids.HB_FILTER_DECOMB, Settings = options }; filter.FilterList.Add(filterItem); } @@ -503,9 +479,10 @@ namespace HandBrakeWPF.Services.Encode.Factories filter.FilterList.Add(filterItem); } - if (job.Grayscale) + // Deblock + if (job.Deblock >= 5) { - Filter filterItem = new Filter { ID = (int)hb_filter_ids.HB_FILTER_GRAYSCALE, Settings = null }; + Filter filterItem = new Filter { ID = (int)hb_filter_ids.HB_FILTER_DEBLOCK, Settings = job.Deblock.ToString() }; filter.FilterList.Add(filterItem); } @@ -525,8 +502,38 @@ namespace HandBrakeWPF.Services.Encode.Factories }; filter.FilterList.Add(cropScale); + // Grayscale + if (job.Grayscale) + { + Filter filterItem = new Filter { ID = (int)hb_filter_ids.HB_FILTER_GRAYSCALE, Settings = null }; + filter.FilterList.Add(filterItem); + } + // Rotate - /* TODO NOT SUPPORTED YET. */ + if (job.Rotation != 0 || job.FlipVideo) + { + Filter filterItem = new Filter { ID = (int)hb_filter_ids.HB_FILTER_ROTATE, Settings = string.Format("{0}:{1}", job.Rotation, job.FlipVideo ? "1" : "0") }; + filter.FilterList.Add(filterItem); + } + + // Framerate shaping filter + int fm = job.FramerateMode == FramerateMode.CFR ? 1 : job.FramerateMode == FramerateMode.PFR ? 2 : 0; + int? num = null, den = null; + if (job.Framerate != null) + { + IntPtr frameratePrt = Marshal.StringToHGlobalAnsi(job.Framerate.Value.ToString(CultureInfo.InvariantCulture)); + int vrate = HBFunctions.hb_video_framerate_get_from_name(frameratePrt); + + if (vrate > 0) + { + num = 27000000; + den = vrate; + } + } + + string framerateString = num.HasValue ? string.Format("{0}:{1}:{2}", fm, num, den) : string.Format("{0}", fm); // filter_cfr, filter_vrate.num, filter_vrate.den + Filter framerateShaper = new Filter { ID = (int)hb_filter_ids.HB_FILTER_VFR, Settings = framerateString }; + filter.FilterList.Add(framerateShaper); return filter; } diff --git a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs index 03cea74f5..0ae588bc7 100644 --- a/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs +++ b/win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs @@ -101,6 +101,9 @@ namespace HandBrakeWPF.Services.Encode.Model this.DenoiseTune = task.DenoiseTune; this.Destination = task.Destination; this.Detelecine = task.Detelecine; + this.FlipVideo = task.FlipVideo; + this.Rotation = task.Rotation; + this.DisplayWidth = task.DisplayWidth; this.EndPoint = task.EndPoint; this.Framerate = task.Framerate; @@ -339,6 +342,15 @@ namespace HandBrakeWPF.Services.Encode.Model /// </summary> public bool Grayscale { get; set; } + /// <summary> + /// Rotate the Video by x Degrees + /// </summary> + public int Rotation { get; set; } + + /// <summary> + /// Flip the video. + /// </summary> + public bool FlipVideo { get; set; } #endregion #region Video diff --git a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs index 9cdb554d1..dbb702a77 100644 --- a/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs +++ b/win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs @@ -13,6 +13,7 @@ namespace HandBrakeWPF.Services.Presets.Factories using System.Collections.ObjectModel;
using System.Globalization;
using System.Linq;
+ using System.Windows.Forms.VisualStyles;
using HandBrake.ApplicationServices.Interop.Json.Presets;
using HandBrake.ApplicationServices.Interop.Model;
@@ -61,7 +62,7 @@ namespace HandBrakeWPF.Services.Presets.Factories preset.Task = new EncodeTask();
preset.IsDefault = importedPreset.Default;
preset.IsBuildIn = importedPreset.Type == 0;
-
+
// Step 1, Create the EncodeTask Object that can be loaded into the UI.
/* Output Settings */
@@ -77,7 +78,7 @@ namespace HandBrakeWPF.Services.Presets.Factories preset.Task.HasCropping = !importedPreset.PictureAutoCrop;
preset.Task.Modulus = importedPreset.PictureModulus;
preset.Task.KeepDisplayAspect = importedPreset.PictureKeepRatio;
-
+
switch (importedPreset.PicturePAR)
{
case "custom":
@@ -247,6 +248,21 @@ namespace HandBrakeWPF.Services.Presets.Factories break;
}
+ // Rotation and Flip
+ if (!string.IsNullOrEmpty(importedPreset.PictureRotate))
+ {
+ string[] rotation = importedPreset.PictureRotate.Split(':');
+ if (rotation.Length == 2)
+ {
+ int rotate;
+ if (int.TryParse(rotation[0], out rotate))
+ {
+ preset.Task.Rotation = int.Parse(rotation[0]);
+ preset.Task.FlipVideo = rotation[1] == "1";
+ }
+ }
+ }
+
/* Video Settings */
preset.Task.VideoEncoder = EnumHelper<VideoEncoder>.GetValue(importedPreset.VideoEncoder);
preset.Task.VideoBitrate = importedPreset.VideoAvgBitrate;
@@ -284,7 +300,7 @@ namespace HandBrakeWPF.Services.Presets.Factories break;
}
- /* Audio Settings */
+ /* Audio Settings */
preset.AudioTrackBehaviours = new AudioBehaviours();
preset.Task.AllowedPassthruOptions.AudioEncoderFallback = EnumHelper<AudioEncoder>.GetValue(importedPreset.AudioEncoderFallback);
preset.AudioTrackBehaviours.SelectedBehaviour = importedPreset.AudioTrackSelectionBehavior == "all"
@@ -353,8 +369,8 @@ namespace HandBrakeWPF.Services.Presets.Factories // track.CompressionLevel = audioTrack.AudioCompressionLevel;
// track.AudioDitherMethod = audioTrack.AudioDitherMethod;
- track.Encoder = EnumHelper<AudioEncoder>.GetValue(audioTrack.AudioEncoder);
- track.MixDown = EnumHelper<Mixdown>.GetValue(audioTrack.AudioMixdown);
+ track.Encoder = EnumHelper<AudioEncoder>.GetValue(audioTrack.AudioEncoder);
+ track.MixDown = EnumHelper<Mixdown>.GetValue(audioTrack.AudioMixdown);
// track.AudioNormalizeMixLevel = audioTrack.AudioNormalizeMixLevel;
track.SampleRate = audioTrack.AudioSamplerate == "auto" ? 0 : double.Parse(audioTrack.AudioSamplerate);
@@ -368,7 +384,7 @@ namespace HandBrakeWPF.Services.Presets.Factories }
}
- /* Subtitle Settings */
+ /* Subtitle Settings */
preset.SubtitleTrackBehaviours = new SubtitleBehaviours();
preset.SubtitleTrackBehaviours.SelectedBehaviour = EnumHelper<SubtitleBehaviourModes>.GetValue(importedPreset.SubtitleTrackSelectionBehavior);
preset.SubtitleTrackBehaviours.SelectedBurnInBehaviour = EnumHelper<SubtitleBurnInBehaviourModes>.GetValue(importedPreset.SubtitleBurnBehavior);
@@ -387,11 +403,11 @@ namespace HandBrakeWPF.Services.Presets.Factories /* Chapter Marker Settings */
preset.Task.IncludeChapterMarkers = importedPreset.ChapterMarkers;
- /* Advanced Settings */
+ /* Advanced Settings */
preset.Task.ShowAdvancedTab = importedPreset.x264UseAdvancedOptions;
preset.Task.AdvancedEncoderOptions = importedPreset.x264Option;
- /* Not Supported Yet */
+ /* Not Supported Yet */
// public int VideoColorMatrixCode { get; set; }
// public bool VideoHWDecode { get; set; }
// public string VideoScaler { get; set; }
@@ -404,7 +420,6 @@ namespace HandBrakeWPF.Services.Presets.Factories // public bool PictureLooseCrop { get; set; }
// public int PicturePARWidth { get; set; }
// public int PicturePARHeight { get; set; }
- // public int PictureRotate { get; set; }
// public int PictureForceHeight { get; set; }
// public int PictureForceWidth { get; set; }
// public List<object> ChildrenArray { get; set; }
@@ -491,23 +506,23 @@ namespace HandBrakeWPF.Services.Presets.Factories foreach (var item in export.Task.AudioTracks)
{
AudioList track = new AudioList
- {
- AudioBitrate = item.Bitrate,
- AudioCompressionLevel = 0, // TODO
- AudioDitherMethod = null, // TODO
- AudioEncoder = EnumHelper<AudioEncoder>.GetShortName(item.Encoder),
- AudioMixdown = EnumHelper<Mixdown>.GetShortName(item.MixDown),
- AudioNormalizeMixLevel = false, // TODO
- AudioSamplerate = item.SampleRate == 0 ? "auto" : item.SampleRate.ToString(), // TODO check formatting.
- AudioTrackDRCSlider = item.DRC,
- AudioTrackGainSlider = item.Gain,
- AudioTrackQuality = item.Quality ?? 0,
- AudioTrackQualityEnable = item.Quality.HasValue && item.IsQualityVisible
- };
-
+ {
+ AudioBitrate = item.Bitrate,
+ AudioCompressionLevel = 0, // TODO
+ AudioDitherMethod = null, // TODO
+ AudioEncoder = EnumHelper<AudioEncoder>.GetShortName(item.Encoder),
+ AudioMixdown = EnumHelper<Mixdown>.GetShortName(item.MixDown),
+ AudioNormalizeMixLevel = false, // TODO
+ AudioSamplerate = item.SampleRate == 0 ? "auto" : item.SampleRate.ToString(), // TODO check formatting.
+ AudioTrackDRCSlider = item.DRC,
+ AudioTrackGainSlider = item.Gain,
+ AudioTrackQuality = item.Quality ?? 0,
+ AudioTrackQualityEnable = item.Quality.HasValue && item.IsQualityVisible
+ };
+
preset.AudioList.Add(track);
}
-
+
// Subtitles
preset.SubtitleAddCC = export.SubtitleTrackBehaviours.AddClosedCaptions;
preset.SubtitleAddForeignAudioSearch = export.SubtitleTrackBehaviours.AddForeignAudioScanTrack;
@@ -536,9 +551,9 @@ namespace HandBrakeWPF.Services.Presets.Factories preset.PictureModulus = export.Task.Modulus ?? 16;
preset.PicturePAR = EnumHelper<Anamorphic>.GetShortName(export.Task.Anamorphic);
preset.PicturePARHeight = export.Task.PixelAspectY;
- preset.PicturePARWidth = export.Task.PixelAspectX;
+ preset.PicturePARWidth = export.Task.PixelAspectX;
preset.PictureRightCrop = export.Task.Cropping.Right;
- preset.PictureRotate = 0; // TODO Not supported yet.
+ preset.PictureRotate = string.Format("{0}:{1}", export.Task.Rotation, export.Task.FlipVideo ? "1" : "0");
preset.PictureTopCrop = export.Task.Cropping.Top;
preset.PictureWidth = preset.UsesPictureSettings >= 1 ? export.Task.MaxWidth : 0; // TODO
preset.PictureDARWidth = export.Task.DisplayWidth.HasValue ? (int)export.Task.DisplayWidth.Value : 0;
@@ -547,20 +562,20 @@ namespace HandBrakeWPF.Services.Presets.Factories // Filters
preset.PictureDeblock = export.Task.Deblock;
- preset.PictureDeinterlaceFilter = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb
- ? "decomb"
- : export.Task.DeinterlaceFilter == DeinterlaceFilter.Deinterlace ? "deinterlace" : "off";
- preset.PictureDeinterlacePreset = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb
- ? EnumHelper<Decomb>.GetShortName(export.Task.Decomb)
+ preset.PictureDeinterlaceFilter = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb
+ ? "decomb"
+ : export.Task.DeinterlaceFilter == DeinterlaceFilter.Deinterlace ? "deinterlace" : "off";
+ preset.PictureDeinterlacePreset = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb
+ ? EnumHelper<Decomb>.GetShortName(export.Task.Decomb)
: export.Task.DeinterlaceFilter == DeinterlaceFilter.Deinterlace ? EnumHelper<Deinterlace>.GetShortName(export.Task.Deinterlace) : string.Empty;
- preset.PictureDeinterlaceCustom = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb
- ? export.Task.CustomDecomb
+ preset.PictureDeinterlaceCustom = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb
+ ? export.Task.CustomDecomb
: export.Task.DeinterlaceFilter == DeinterlaceFilter.Deinterlace ? export.Task.CustomDeinterlace : string.Empty;
preset.PictureDeinterlaceCustom = export.Task.CustomDeinterlace;
preset.PictureDenoiseCustom = export.Task.CustomDenoise;
preset.PictureDenoiseFilter = EnumHelper<Denoise>.GetShortName(export.Task.Denoise);
preset.PictureDenoisePreset = EnumHelper<DenoisePreset>.GetShortName(export.Task.DenoisePreset);
- preset.PictureDenoiseTune = EnumHelper<DenoiseTune>.GetShortName(export.Task.DenoiseTune);
+ preset.PictureDenoiseTune = EnumHelper<DenoiseTune>.GetShortName(export.Task.DenoiseTune);
preset.PictureDetelecine = EnumHelper<Detelecine>.GetShortName(export.Task.Detelecine);
preset.PictureDetelecineCustom = export.Task.CustomDetelecine;
diff --git a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs index f136035ab..79718e2f2 100644 --- a/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs +++ b/win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs @@ -10,11 +10,11 @@ namespace HandBrakeWPF.ViewModels
{
using System.Collections.Generic;
+ using System.ComponentModel;
using System.Globalization;
using Caliburn.Micro;
- using HandBrake.ApplicationServices.Utilities;
using HandBrake.ApplicationServices.Interop.Model.Encoding;
using HandBrakeWPF.Services.Interfaces;
@@ -496,6 +496,42 @@ namespace HandBrakeWPF.ViewModels }
}
+ public BindingList<int> RotationOptions => new BindingList<int> { 0, 90, 180, 270 };
+
+ /// <summary>
+ /// Selected Rotation.
+ /// </summary>
+ public int SelectedRotation
+ {
+ get
+ {
+ return this.CurrentTask.Rotation;
+ }
+
+ set
+ {
+ this.CurrentTask.Rotation = value;
+ this.NotifyOfPropertyChange(() => this.SelectedRotation);
+ }
+ }
+
+ /// <summary>
+ /// Flip the Video
+ /// </summary>
+ public bool FlipVideo
+ {
+ get
+ {
+ return this.CurrentTask.FlipVideo;
+ }
+
+ set
+ {
+ this.CurrentTask.FlipVideo = value;
+ this.NotifyOfPropertyChange(() => this.FlipVideo);
+ }
+ }
+
#endregion
#region Implemented Interfaces
@@ -531,7 +567,7 @@ namespace HandBrakeWPF.ViewModels {
this.SelectedDeinterlaceFilter = DeinterlaceFilter.Decomb;
}
- else
+ else
{
this.SelectedDeinterlaceFilter = DeinterlaceFilter.Off;
}
@@ -547,6 +583,10 @@ namespace HandBrakeWPF.ViewModels this.CustomDeinterlace = preset.Task.CustomDeinterlace;
this.CustomDetelecine = preset.Task.CustomDetelecine;
this.CustomDenoise = preset.Task.CustomDenoise;
+
+
+ this.SelectedRotation = preset.Task.Rotation;
+ this.FlipVideo = preset.Task.FlipVideo;
}
else
{
@@ -557,6 +597,9 @@ namespace HandBrakeWPF.ViewModels this.SelectedDetelecine = Detelecine.Off;
this.Grayscale = false;
this.DeblockValue = 0;
+
+ this.SelectedRotation = 0;
+ this.FlipVideo = false;
}
}
@@ -586,6 +629,9 @@ namespace HandBrakeWPF.ViewModels this.NotifyOfPropertyChange(() => this.IsDecombMode);
this.NotifyOfPropertyChange(() => this.IsDeinterlaceDecomb);
+ this.NotifyOfPropertyChange(() => this.FlipVideo);
+ this.NotifyOfPropertyChange(() => this.SelectedRotation);
+
}
/// <summary>
diff --git a/win/CS/HandBrakeWPF/Views/FiltersView.xaml b/win/CS/HandBrakeWPF/Views/FiltersView.xaml index edacca205..494adae51 100644 --- a/win/CS/HandBrakeWPF/Views/FiltersView.xaml +++ b/win/CS/HandBrakeWPF/Views/FiltersView.xaml @@ -37,6 +37,7 @@ <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
@@ -123,6 +124,14 @@ <CheckBox Content="{x:Static Properties:ResourcesUI.FiltersView_Grayscale}" IsChecked="{Binding Grayscale}" Grid.Row="5" Grid.Column="1" Margin="0,0,0,10"
ToolTip="{x:Static Properties:ResourcesTooltips.FilterView_Grayscale}" />
+
+ <!-- Rotation -->
+ <TextBlock Text="{x:Static Properties:ResourcesUI.FiltersView_Rotate}" Grid.Row="6" Grid.Column="0" Margin="0,0,0,0"/>
+ <ComboBox Width="120" ItemsSource="{Binding RotationOptions}" Grid.Row="6" Grid.Column="1"
+ SelectedItem="{Binding SelectedRotation}"
+ HorizontalAlignment="Left" VerticalAlignment="Center" />
+
+ <CheckBox Content="{x:Static Properties:ResourcesUI.FiltersView_FlipVideo}" Margin="5,0,0,0" VerticalAlignment="Center" Grid.Row="6" Grid.Column="2" IsChecked="{Binding FlipVideo, UpdateSourceTrigger=PropertyChanged}" />
</Grid>
</StackPanel>
|