1 // -------------------------------------------------------------------------------------------------------------------- 2 // <copyright file="EncodeTask.cs" company="HandBrake Project (http://handbrake.fr)"> 3 // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. 4 // </copyright> 5 // <summary> 6 // An Encode Task 7 // </summary> 8 // -------------------------------------------------------------------------------------------------------------------- 9 10 namespace HandBrakeWPF.Services.Encode.Model 11 { 12 using System.Collections.Generic; 13 using System.Collections.ObjectModel; 14 using System.Threading; 15 16 using HandBrake.Interop.Interop.Interfaces.Model.Filters; 17 using HandBrake.Interop.Interop.Interfaces.Model.Picture; 18 19 using HandBrakeWPF.Model.Filters; 20 using HandBrakeWPF.Services.Encode.Model.Models; 21 22 using AllowedPassthru = Models.AllowedPassthru; 23 using AudioTrack = Models.AudioTrack; 24 using ChapterMarker = Models.ChapterMarker; 25 using DenoisePreset = Models.DenoisePreset; 26 using DenoiseTune = Models.DenoiseTune; 27 using FramerateMode = Models.FramerateMode; 28 using OutputFormat = Models.OutputFormat; 29 using PointToPointMode = Models.PointToPointMode; 30 using SubtitleTrack = Models.SubtitleTrack; 31 using VideoEncoder = HandBrakeWPF.Model.Video.VideoEncoder; 32 using VideoEncodeRateType = HandBrakeWPF.Model.Video.VideoEncodeRateType; 33 using VideoLevel = Models.Video.VideoLevel; 34 using VideoPreset = Models.Video.VideoPreset; 35 using VideoProfile = Models.Video.VideoProfile; 36 using VideoTune = Models.Video.VideoTune; 37 38 public class EncodeTask 39 { EncodeTask()40 public EncodeTask() 41 { 42 this.Cropping = new Cropping(); 43 this.AudioTracks = new ObservableCollection<AudioTrack>(); 44 this.SubtitleTracks = new ObservableCollection<SubtitleTrack>(); 45 this.ChapterNames = new ObservableCollection<ChapterMarker>(); 46 this.AudioPassthruOptions = new AllowedPassthru(); 47 this.MetaData = new MetaData(); 48 this.Padding = new PaddingFilter(); 49 this.VideoTunes = new List<VideoTune>(); 50 } 51 EncodeTask(EncodeTask task)52 public EncodeTask(EncodeTask task) 53 { 54 /* Source */ 55 this.Source = task.Source; 56 this.StartPoint = task.StartPoint; 57 this.Title = task.Title; 58 this.Angle = task.Angle; 59 this.EndPoint = task.EndPoint; 60 this.PointToPointMode = task.PointToPointMode; 61 62 /* Audio */ 63 this.AudioPassthruOptions = new AllowedPassthru(task.AudioPassthruOptions); 64 this.AudioTracks = new ObservableCollection<AudioTrack>(); 65 foreach (AudioTrack track in task.AudioTracks) 66 { 67 this.AudioTracks.Add(new AudioTrack(track, true)); 68 } 69 70 /* Chapters */ 71 this.ChapterNames = new ObservableCollection<ChapterMarker>(); 72 foreach (ChapterMarker track in task.ChapterNames) 73 { 74 this.ChapterNames.Add(new ChapterMarker(track)); 75 } 76 77 this.IncludeChapterMarkers = task.IncludeChapterMarkers; 78 this.ChapterMarkersFilePath = task.ChapterMarkersFilePath; 79 80 /* Subtitles */ 81 this.SubtitleTracks = new ObservableCollection<SubtitleTrack>(); 82 foreach (SubtitleTrack subtitleTrack in task.SubtitleTracks) 83 { 84 this.SubtitleTracks.Add(new SubtitleTrack(subtitleTrack)); 85 } 86 87 /* Filter Settings */ 88 this.CustomDeinterlaceSettings = task.CustomDeinterlaceSettings; 89 this.CustomDenoise = task.CustomDenoise; 90 this.CustomDetelecine = task.CustomDetelecine; 91 this.CustomCombDetect = task.CustomCombDetect; 92 this.CombDetect = task.CombDetect; 93 this.DeblockPreset = task.DeblockPreset; 94 this.DeblockTune = task.DeblockTune; 95 this.CustomDeblock = task.CustomDeblock; 96 this.DeinterlacePreset = task.DeinterlacePreset; 97 this.DeinterlaceFilter = task.DeinterlaceFilter; 98 this.Denoise = task.Denoise; 99 this.DenoisePreset = task.DenoisePreset; 100 this.DenoiseTune = task.DenoiseTune; 101 this.Destination = task.Destination; 102 this.Detelecine = task.Detelecine; 103 this.Sharpen = task.Sharpen; 104 this.SharpenPreset = task.SharpenPreset; 105 this.SharpenTune = task.SharpenTune; 106 this.SharpenCustom = task.SharpenCustom; 107 this.Colourspace = task.Colourspace; 108 this.CustomColourspace = task.CustomColourspace; 109 this.ChromaSmooth = task.ChromaSmooth; 110 this.ChromaSmoothTune = task.ChromaSmoothTune; 111 this.CustomChromaSmooth = task.CustomChromaSmooth; 112 this.Grayscale = task.Grayscale; 113 114 /* Picture Settings*/ 115 this.DisplayWidth = task.DisplayWidth; 116 this.MaxHeight = task.MaxHeight; 117 this.MaxWidth = task.MaxWidth; 118 this.Width = task.Width; 119 this.Height = task.Height; 120 this.AllowUpscaling = task.AllowUpscaling; 121 this.OptimalSize = task.OptimalSize; 122 this.HasCropping = task.HasCropping; 123 this.PixelAspectX = task.PixelAspectX; 124 this.PixelAspectY = task.PixelAspectY; 125 this.Cropping = new Cropping(task.Cropping); 126 this.Padding = task.Padding; 127 this.FlipVideo = task.FlipVideo; 128 this.Rotation = task.Rotation; 129 this.Anamorphic = task.Anamorphic; 130 this.KeepDisplayAspect = task.KeepDisplayAspect; 131 132 /* Video */ 133 this.Quality = task.Quality; 134 this.Framerate = task.Framerate; 135 this.FramerateMode = task.FramerateMode; 136 this.TurboFirstPass = task.TurboFirstPass; 137 this.TwoPass = task.TwoPass; 138 this.VideoBitrate = task.VideoBitrate; 139 this.VideoEncoder = task.VideoEncoder; 140 this.VideoEncodeRateType = task.VideoEncodeRateType; 141 this.VideoLevel = task.VideoLevel; 142 this.VideoProfile = task.VideoProfile; 143 this.VideoPreset = task.VideoPreset; 144 this.VideoTunes = new List<VideoTune>(task.VideoTunes); 145 this.ExtraAdvancedArguments = task.ExtraAdvancedArguments; 146 147 /* Container */ 148 this.IPod5GSupport = task.IPod5GSupport; 149 this.OutputFormat = task.OutputFormat; 150 this.OptimizeMP4 = task.OptimizeMP4; 151 this.AlignAVStart = task.AlignAVStart; 152 153 /* Other */ 154 this.MetaData = new MetaData(task.MetaData); 155 } 156 157 /* Source */ 158 159 public string Source { get; set; } 160 161 public int Title { get; set; } 162 163 public int Angle { get; set; } 164 165 public PointToPointMode PointToPointMode { get; set; } 166 167 public long StartPoint { get; set; } 168 169 public long EndPoint { get; set; } 170 171 /* Destination */ 172 173 public string Destination { get; set; } 174 175 /* Output Settings */ 176 177 public OutputFormat OutputFormat { get; set; } 178 179 public bool OptimizeMP4 { get; set; } 180 181 public bool IPod5GSupport { get; set; } 182 183 public bool AlignAVStart { get; set; } 184 185 /* Picture Settings */ 186 187 public int? Width { get; set; } 188 189 public int? Height { get; set; } 190 191 public int? MaxWidth { get; set; } 192 193 public int? MaxHeight { get; set; } 194 195 public Cropping Cropping { get; set; } 196 197 public bool HasCropping { get; set; } 198 199 public Anamorphic Anamorphic { get; set; } 200 201 public double? DisplayWidth { get; set; } 202 203 public bool KeepDisplayAspect { get; set; } 204 205 public int PixelAspectX { get; set; } 206 207 public int PixelAspectY { get; set; } 208 209 public bool AllowUpscaling { get; set; } 210 211 public bool OptimalSize { get; set; } 212 213 /* Filters */ 214 215 public DeinterlaceFilter DeinterlaceFilter { get; set; } 216 217 public HBPresetTune DeinterlacePreset { get; set; } 218 219 public CombDetect CombDetect { get; set; } 220 221 public string CustomDeinterlaceSettings { get; set; } 222 223 public string CustomCombDetect { get; set; } 224 225 public Detelecine Detelecine { get; set; } 226 227 public string CustomDetelecine { get; set; } 228 229 public Denoise Denoise { get; set; } 230 231 public DenoisePreset DenoisePreset { get; set; } 232 233 public DenoiseTune DenoiseTune { get; set; } 234 235 public string CustomDenoise { get; set; } 236 237 public bool Grayscale { get; set; } 238 239 public int Rotation { get; set; } 240 241 public bool FlipVideo { get; set; } 242 243 public Sharpen Sharpen { get; set; } 244 245 public FilterPreset SharpenPreset { get; set; } 246 247 public FilterTune SharpenTune { get; set; } 248 249 public string SharpenCustom { get; set; } 250 251 public FilterPreset DeblockPreset { get; set; } 252 253 public FilterTune DeblockTune { get; set; } 254 255 public string CustomDeblock { get; set; } 256 257 public PaddingFilter Padding { get; set; } 258 259 public FilterPreset Colourspace { get; set; } 260 261 public string CustomColourspace { get; set; } 262 263 public FilterPreset ChromaSmooth { get; set; } 264 265 public FilterTune ChromaSmoothTune { get; set; } 266 267 public string CustomChromaSmooth { get; set; } 268 269 /* Video */ 270 271 public VideoEncodeRateType VideoEncodeRateType { get; set; } 272 273 public VideoEncoder VideoEncoder { get; set; } 274 275 public VideoProfile VideoProfile { get; set; } 276 277 public VideoLevel VideoLevel { get; set; } 278 279 public VideoPreset VideoPreset { get; set; } 280 281 public List<VideoTune> VideoTunes { get; set; } 282 283 public string ExtraAdvancedArguments { get; set; } 284 285 public FramerateMode FramerateMode { get; set; } 286 287 public double? Quality { get; set; } 288 289 public int? VideoBitrate { get; set; } 290 291 public bool TwoPass { get; set; } 292 293 public bool TurboFirstPass { get; set; } 294 295 public double? Framerate { get; set; } 296 297 298 /* Audio */ 299 300 public ObservableCollection<AudioTrack> AudioTracks { get; set; } 301 302 public AllowedPassthru AudioPassthruOptions { get; set; } 303 304 /* Subtitles */ 305 306 public ObservableCollection<SubtitleTrack> SubtitleTracks { get; set; } 307 308 /* Chapters */ 309 310 public bool IncludeChapterMarkers { get; set; } 311 312 public string ChapterMarkersFilePath { get; set; } 313 314 public ObservableCollection<ChapterMarker> ChapterNames { get; set; } 315 316 317 /* Metadata */ 318 319 public MetaData MetaData { get; set; } 320 321 /* Previews */ 322 323 public bool IsPreviewEncode { get; set; } 324 325 public int? PreviewEncodeDuration { get; set; } 326 327 public int? PreviewEncodeStartAt { get; set; } 328 } 329 } 330