]> granicus.if.org Git - handbrake/commitdiff
WinGui: Add support for the rotate and flip filter.
authorsr55.hb@outlook.com <sr55>
Fri, 29 Jan 2016 20:55:10 +0000 (20:55 +0000)
committersr55.hb@outlook.com <sr55>
Fri, 29 Jan 2016 20:55:10 +0000 (20:55 +0000)
win/CS/HandBrake.ApplicationServices/Interop/Json/Presets/HBPreset.cs
win/CS/HandBrakeWPF/Properties/ResourcesUI.Designer.cs
win/CS/HandBrakeWPF/Properties/ResourcesUI.resx
win/CS/HandBrakeWPF/Services/Encode/Factories/EncodeFactory.cs
win/CS/HandBrakeWPF/Services/Encode/Model/EncodeTask.cs
win/CS/HandBrakeWPF/Services/Presets/Factories/JsonPresetFactory.cs
win/CS/HandBrakeWPF/ViewModels/FiltersViewModel.cs
win/CS/HandBrakeWPF/Views/FiltersView.xaml

index f84ad33100ab781bc7849e74bc085044d1b835a0..260b559604efa96449ab5c606d2997f3eacf04d3 100644 (file)
@@ -204,7 +204,7 @@ namespace HandBrake.ApplicationServices.Interop.Json.Presets
         /// <summary>\r
         /// Gets or sets the picture rotate.\r
         /// </summary>\r
-        public int PictureRotate { get; set; }\r
+        public string PictureRotate { get; set; }\r
 \r
         /// <summary>\r
         /// Gets or sets the picture width.\r
index defb16f34708fdd0301cf5c0d3d3e5a9eb68dd86..7682123381460ddb72f55e832a32943087686532 100644 (file)
@@ -447,6 +447,15 @@ namespace HandBrakeWPF.Properties {
             }\r
         }\r
         \r
+        /// <summary>\r
+        ///   Looks up a localized string similar to Flip.\r
+        /// </summary>\r
+        public static string FiltersView_FlipVideo {\r
+            get {\r
+                return ResourceManager.GetString("FiltersView_FlipVideo", resourceCulture);\r
+            }\r
+        }\r
+        \r
         /// <summary>\r
         ///   Looks up a localized string similar to Grayscale.\r
         /// </summary>\r
@@ -465,6 +474,15 @@ namespace HandBrakeWPF.Properties {
             }\r
         }\r
         \r
+        /// <summary>\r
+        ///   Looks up a localized string similar to Rotate:.\r
+        /// </summary>\r
+        public static string FiltersView_Rotate {\r
+            get {\r
+                return ResourceManager.GetString("FiltersView_Rotate", resourceCulture);\r
+            }\r
+        }\r
+        \r
         /// <summary>\r
         ///   Looks up a localized string similar to Tune:.\r
         /// </summary>\r
index 7520641708b63219b94c968bdded3316bd0b917d..79ef0cf6bb1c9300af07d86959c52b11badd569a 100644 (file)
   <data name="Options_PauseQueueOnLowDiskSpace" xml:space="preserve">\r
     <value>Pause queue if disk space is low before starting a job.</value>\r
   </data>\r
+  <data name="FiltersView_FlipVideo" xml:space="preserve">\r
+    <value>Flip</value>\r
+  </data>\r
+  <data name="FiltersView_Rotate" xml:space="preserve">\r
+    <value>Rotate:</value>\r
+  </data>\r
 </root>
\ No newline at end of file
index 3415f1ee74fb6c393781f5b95c13076082bcf2bc..62a3faf815f80a53bb70045993d44ca2a828b2cd 100644 (file)
@@ -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;
         }
index 03cea74f5fa2a739d015d4639089818fbfd9f90b..0ae588bc7ecb2787aee88b9357fc2a0eee0ea62e 100644 (file)
@@ -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
index 9cdb554d1d115ce4766b2355cdff080c499098cc..dbb702a777ecedcbc53b6a7b64c1d9a0fc753f34 100644 (file)
@@ -13,6 +13,7 @@ namespace HandBrakeWPF.Services.Presets.Factories
     using System.Collections.ObjectModel;\r
     using System.Globalization;\r
     using System.Linq;\r
+    using System.Windows.Forms.VisualStyles;\r
 \r
     using HandBrake.ApplicationServices.Interop.Json.Presets;\r
     using HandBrake.ApplicationServices.Interop.Model;\r
@@ -61,7 +62,7 @@ namespace HandBrakeWPF.Services.Presets.Factories
             preset.Task = new EncodeTask();\r
             preset.IsDefault = importedPreset.Default;\r
             preset.IsBuildIn = importedPreset.Type == 0;\r
-           \r
+\r
             // Step 1, Create the EncodeTask Object that can be loaded into the UI.\r
 \r
             /* Output Settings */\r
@@ -77,7 +78,7 @@ namespace HandBrakeWPF.Services.Presets.Factories
             preset.Task.HasCropping = !importedPreset.PictureAutoCrop;\r
             preset.Task.Modulus = importedPreset.PictureModulus;\r
             preset.Task.KeepDisplayAspect = importedPreset.PictureKeepRatio;\r
-            \r
+\r
             switch (importedPreset.PicturePAR)\r
             {\r
                 case "custom":\r
@@ -247,6 +248,21 @@ namespace HandBrakeWPF.Services.Presets.Factories
                     break;\r
             }\r
 \r
+            // Rotation and Flip\r
+            if (!string.IsNullOrEmpty(importedPreset.PictureRotate))\r
+            {\r
+                string[] rotation = importedPreset.PictureRotate.Split(':');\r
+                if (rotation.Length == 2)\r
+                {\r
+                    int rotate;\r
+                    if (int.TryParse(rotation[0], out rotate))\r
+                    {\r
+                        preset.Task.Rotation = int.Parse(rotation[0]);\r
+                        preset.Task.FlipVideo = rotation[1] == "1";\r
+                    }\r
+                }\r
+            }\r
+\r
             /* Video Settings */\r
             preset.Task.VideoEncoder = EnumHelper<VideoEncoder>.GetValue(importedPreset.VideoEncoder);\r
             preset.Task.VideoBitrate = importedPreset.VideoAvgBitrate;\r
@@ -284,7 +300,7 @@ namespace HandBrakeWPF.Services.Presets.Factories
                     break;\r
             }\r
 \r
-            /* Audio Settings */ \r
+            /* Audio Settings */\r
             preset.AudioTrackBehaviours = new AudioBehaviours();\r
             preset.Task.AllowedPassthruOptions.AudioEncoderFallback = EnumHelper<AudioEncoder>.GetValue(importedPreset.AudioEncoderFallback);\r
             preset.AudioTrackBehaviours.SelectedBehaviour = importedPreset.AudioTrackSelectionBehavior == "all"\r
@@ -353,8 +369,8 @@ namespace HandBrakeWPF.Services.Presets.Factories
 \r
                     // track.CompressionLevel = audioTrack.AudioCompressionLevel;\r
                     // track.AudioDitherMethod = audioTrack.AudioDitherMethod;\r
-                    track.Encoder = EnumHelper<AudioEncoder>.GetValue(audioTrack.AudioEncoder);  \r
-                    track.MixDown = EnumHelper<Mixdown>.GetValue(audioTrack.AudioMixdown); \r
+                    track.Encoder = EnumHelper<AudioEncoder>.GetValue(audioTrack.AudioEncoder);\r
+                    track.MixDown = EnumHelper<Mixdown>.GetValue(audioTrack.AudioMixdown);\r
 \r
                     // track.AudioNormalizeMixLevel = audioTrack.AudioNormalizeMixLevel;\r
                     track.SampleRate = audioTrack.AudioSamplerate == "auto" ? 0 : double.Parse(audioTrack.AudioSamplerate);\r
@@ -368,7 +384,7 @@ namespace HandBrakeWPF.Services.Presets.Factories
                 }\r
             }\r
 \r
-            /* Subtitle Settings */ \r
+            /* Subtitle Settings */\r
             preset.SubtitleTrackBehaviours = new SubtitleBehaviours();\r
             preset.SubtitleTrackBehaviours.SelectedBehaviour = EnumHelper<SubtitleBehaviourModes>.GetValue(importedPreset.SubtitleTrackSelectionBehavior);\r
             preset.SubtitleTrackBehaviours.SelectedBurnInBehaviour = EnumHelper<SubtitleBurnInBehaviourModes>.GetValue(importedPreset.SubtitleBurnBehavior);\r
@@ -387,11 +403,11 @@ namespace HandBrakeWPF.Services.Presets.Factories
             /* Chapter Marker Settings */\r
             preset.Task.IncludeChapterMarkers = importedPreset.ChapterMarkers;\r
 \r
-            /* Advanced Settings */ \r
+            /* Advanced Settings */\r
             preset.Task.ShowAdvancedTab = importedPreset.x264UseAdvancedOptions;\r
             preset.Task.AdvancedEncoderOptions = importedPreset.x264Option;\r
 \r
-            /* Not Supported Yet */ \r
+            /* Not Supported Yet */\r
             // public int VideoColorMatrixCode { get; set; }\r
             // public bool VideoHWDecode { get; set; }\r
             // public string VideoScaler { get; set; }\r
@@ -404,7 +420,6 @@ namespace HandBrakeWPF.Services.Presets.Factories
             // public bool PictureLooseCrop { get; set; }\r
             // public int PicturePARWidth { get; set; }\r
             // public int PicturePARHeight { get; set; }\r
-            // public int PictureRotate { get; set; }\r
             // public int PictureForceHeight { get; set; }\r
             // public int PictureForceWidth { get; set; }\r
             // public List<object> ChildrenArray { get; set; }\r
@@ -491,23 +506,23 @@ namespace HandBrakeWPF.Services.Presets.Factories
             foreach (var item in export.Task.AudioTracks)\r
             {\r
                 AudioList track = new AudioList\r
-                                      {\r
-                                          AudioBitrate = item.Bitrate,\r
-                                          AudioCompressionLevel = 0, // TODO\r
-                                          AudioDitherMethod = null,  // TODO\r
-                                          AudioEncoder = EnumHelper<AudioEncoder>.GetShortName(item.Encoder),\r
-                                          AudioMixdown = EnumHelper<Mixdown>.GetShortName(item.MixDown),\r
-                                          AudioNormalizeMixLevel = false, // TODO\r
-                                          AudioSamplerate = item.SampleRate == 0 ? "auto" : item.SampleRate.ToString(),  // TODO check formatting.\r
-                                          AudioTrackDRCSlider = item.DRC,\r
-                                          AudioTrackGainSlider = item.Gain,\r
-                                          AudioTrackQuality = item.Quality ?? 0,\r
-                                          AudioTrackQualityEnable = item.Quality.HasValue && item.IsQualityVisible\r
-                                      };\r
-               \r
+                {\r
+                    AudioBitrate = item.Bitrate,\r
+                    AudioCompressionLevel = 0, // TODO\r
+                    AudioDitherMethod = null,  // TODO\r
+                    AudioEncoder = EnumHelper<AudioEncoder>.GetShortName(item.Encoder),\r
+                    AudioMixdown = EnumHelper<Mixdown>.GetShortName(item.MixDown),\r
+                    AudioNormalizeMixLevel = false, // TODO\r
+                    AudioSamplerate = item.SampleRate == 0 ? "auto" : item.SampleRate.ToString(),  // TODO check formatting.\r
+                    AudioTrackDRCSlider = item.DRC,\r
+                    AudioTrackGainSlider = item.Gain,\r
+                    AudioTrackQuality = item.Quality ?? 0,\r
+                    AudioTrackQualityEnable = item.Quality.HasValue && item.IsQualityVisible\r
+                };\r
+\r
                 preset.AudioList.Add(track);\r
             }\r
-            \r
+\r
             // Subtitles\r
             preset.SubtitleAddCC = export.SubtitleTrackBehaviours.AddClosedCaptions;\r
             preset.SubtitleAddForeignAudioSearch = export.SubtitleTrackBehaviours.AddForeignAudioScanTrack;\r
@@ -536,9 +551,9 @@ namespace HandBrakeWPF.Services.Presets.Factories
             preset.PictureModulus = export.Task.Modulus ?? 16;\r
             preset.PicturePAR = EnumHelper<Anamorphic>.GetShortName(export.Task.Anamorphic);\r
             preset.PicturePARHeight = export.Task.PixelAspectY;\r
-            preset.PicturePARWidth = export.Task.PixelAspectX; \r
+            preset.PicturePARWidth = export.Task.PixelAspectX;\r
             preset.PictureRightCrop = export.Task.Cropping.Right;\r
-            preset.PictureRotate = 0; // TODO Not supported yet.\r
+            preset.PictureRotate = string.Format("{0}:{1}", export.Task.Rotation, export.Task.FlipVideo ? "1" : "0");\r
             preset.PictureTopCrop = export.Task.Cropping.Top;\r
             preset.PictureWidth = preset.UsesPictureSettings >= 1 ? export.Task.MaxWidth : 0; // TODO\r
             preset.PictureDARWidth = export.Task.DisplayWidth.HasValue ? (int)export.Task.DisplayWidth.Value : 0;\r
@@ -547,20 +562,20 @@ namespace HandBrakeWPF.Services.Presets.Factories
 \r
             // Filters\r
             preset.PictureDeblock = export.Task.Deblock;\r
-            preset.PictureDeinterlaceFilter = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb \r
-                ? "decomb" \r
-                : export.Task.DeinterlaceFilter == DeinterlaceFilter.Deinterlace ? "deinterlace" : "off";  \r
-            preset.PictureDeinterlacePreset = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb \r
-                ? EnumHelper<Decomb>.GetShortName(export.Task.Decomb) \r
+            preset.PictureDeinterlaceFilter = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb\r
+                ? "decomb"\r
+                : export.Task.DeinterlaceFilter == DeinterlaceFilter.Deinterlace ? "deinterlace" : "off";\r
+            preset.PictureDeinterlacePreset = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb\r
+                ? EnumHelper<Decomb>.GetShortName(export.Task.Decomb)\r
                 : export.Task.DeinterlaceFilter == DeinterlaceFilter.Deinterlace ? EnumHelper<Deinterlace>.GetShortName(export.Task.Deinterlace) : string.Empty;\r
-            preset.PictureDeinterlaceCustom = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb \r
-                ? export.Task.CustomDecomb \r
+            preset.PictureDeinterlaceCustom = export.Task.DeinterlaceFilter == DeinterlaceFilter.Decomb\r
+                ? export.Task.CustomDecomb\r
                 : export.Task.DeinterlaceFilter == DeinterlaceFilter.Deinterlace ? export.Task.CustomDeinterlace : string.Empty;\r
             preset.PictureDeinterlaceCustom = export.Task.CustomDeinterlace;\r
             preset.PictureDenoiseCustom = export.Task.CustomDenoise;\r
             preset.PictureDenoiseFilter = EnumHelper<Denoise>.GetShortName(export.Task.Denoise);\r
             preset.PictureDenoisePreset = EnumHelper<DenoisePreset>.GetShortName(export.Task.DenoisePreset);\r
-            preset.PictureDenoiseTune = EnumHelper<DenoiseTune>.GetShortName(export.Task.DenoiseTune); \r
+            preset.PictureDenoiseTune = EnumHelper<DenoiseTune>.GetShortName(export.Task.DenoiseTune);\r
             preset.PictureDetelecine = EnumHelper<Detelecine>.GetShortName(export.Task.Detelecine);\r
             preset.PictureDetelecineCustom = export.Task.CustomDetelecine;\r
 \r
index f136035abb54794cb5147a80afd41d3cafb23b53..79718e2f274ff337d7fe0e8e26ff6e3d926d371e 100644 (file)
 namespace HandBrakeWPF.ViewModels\r
 {\r
     using System.Collections.Generic;\r
+    using System.ComponentModel;\r
     using System.Globalization;\r
 \r
     using Caliburn.Micro;\r
 \r
-    using HandBrake.ApplicationServices.Utilities;\r
     using HandBrake.ApplicationServices.Interop.Model.Encoding;\r
 \r
     using HandBrakeWPF.Services.Interfaces;\r
@@ -496,6 +496,42 @@ namespace HandBrakeWPF.ViewModels
             }\r
         }\r
 \r
+        public BindingList<int> RotationOptions => new BindingList<int> { 0, 90, 180, 270 };\r
+\r
+        /// <summary>\r
+        /// Selected Rotation.\r
+        /// </summary>\r
+        public int SelectedRotation\r
+        {\r
+            get\r
+            {\r
+                return this.CurrentTask.Rotation;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.CurrentTask.Rotation = value;\r
+                this.NotifyOfPropertyChange(() => this.SelectedRotation);\r
+            }\r
+        }\r
+\r
+        /// <summary>\r
+        /// Flip the Video\r
+        /// </summary>\r
+        public bool FlipVideo\r
+        {\r
+            get\r
+            {\r
+                return this.CurrentTask.FlipVideo;\r
+            }\r
+\r
+            set\r
+            {\r
+                this.CurrentTask.FlipVideo = value;\r
+                this.NotifyOfPropertyChange(() => this.FlipVideo);\r
+            }\r
+        }\r
+\r
         #endregion\r
 \r
         #region Implemented Interfaces\r
@@ -531,7 +567,7 @@ namespace HandBrakeWPF.ViewModels
                 {\r
                     this.SelectedDeinterlaceFilter = DeinterlaceFilter.Decomb;\r
                 }\r
-                else \r
+                else\r
                 {\r
                     this.SelectedDeinterlaceFilter = DeinterlaceFilter.Off;\r
                 }\r
@@ -547,6 +583,10 @@ namespace HandBrakeWPF.ViewModels
                 this.CustomDeinterlace = preset.Task.CustomDeinterlace;\r
                 this.CustomDetelecine = preset.Task.CustomDetelecine;\r
                 this.CustomDenoise = preset.Task.CustomDenoise;\r
+\r
+\r
+                this.SelectedRotation = preset.Task.Rotation;\r
+                this.FlipVideo = preset.Task.FlipVideo;\r
             }\r
             else\r
             {\r
@@ -557,6 +597,9 @@ namespace HandBrakeWPF.ViewModels
                 this.SelectedDetelecine = Detelecine.Off;\r
                 this.Grayscale = false;\r
                 this.DeblockValue = 0;\r
+\r
+                this.SelectedRotation = 0;\r
+                this.FlipVideo = false;\r
             }\r
         }\r
 \r
@@ -586,6 +629,9 @@ namespace HandBrakeWPF.ViewModels
             this.NotifyOfPropertyChange(() => this.IsDecombMode);\r
             this.NotifyOfPropertyChange(() => this.IsDeinterlaceDecomb);\r
 \r
+            this.NotifyOfPropertyChange(() => this.FlipVideo);\r
+            this.NotifyOfPropertyChange(() => this.SelectedRotation);\r
+\r
         }\r
 \r
         /// <summary>\r
index edacca2050226ba7d2e1bcabce12536b5c69abbc..494adae51f0a3aef8e362d1856ef8cc001c409b9 100644 (file)
@@ -37,6 +37,7 @@
                     <RowDefinition Height="Auto" />\r
                     <RowDefinition Height="Auto" />\r
                     <RowDefinition Height="Auto" />\r
+                    <RowDefinition Height="Auto" />\r
                 </Grid.RowDefinitions>\r
 \r
                 <Grid.ColumnDefinitions>\r
 \r
                 <CheckBox Content="{x:Static Properties:ResourcesUI.FiltersView_Grayscale}" IsChecked="{Binding Grayscale}" Grid.Row="5" Grid.Column="1" Margin="0,0,0,10"\r
                           ToolTip="{x:Static Properties:ResourcesTooltips.FilterView_Grayscale}" />\r
+\r
+                <!-- Rotation -->\r
+                <TextBlock Text="{x:Static Properties:ResourcesUI.FiltersView_Rotate}" Grid.Row="6" Grid.Column="0" Margin="0,0,0,0"/>\r
+                <ComboBox Width="120" ItemsSource="{Binding RotationOptions}" Grid.Row="6" Grid.Column="1"\r
+                              SelectedItem="{Binding SelectedRotation}"\r
+                              HorizontalAlignment="Left" VerticalAlignment="Center" />\r
+\r
+                <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}" />\r
             </Grid>\r
 \r
         </StackPanel>\r