private void RegisterProfileProperties() { this.RegisterProfileProperty(nameof(this.Profile.VideoEncoder)); this.RegisterProfileProperty(nameof(this.Profile.Framerate)); this.RegisterProfileProperty(nameof(this.Profile.ConstantFramerate)); this.RegisterProfileProperty(nameof(this.Profile.TwoPass), () => { if (!this.TwoPass && this.TurboFirstPass) { this.TurboFirstPass = false; } }); this.RegisterProfileProperty(nameof(this.Profile.TurboFirstPass)); this.RegisterProfileProperty(nameof(this.VideoEncodeRateType), oldValue => { VCVideoEncodeRateType oldRateType = (VCVideoEncodeRateType)oldValue; if (this.VideoEncodeRateType == VCVideoEncodeRateType.ConstantQuality) { this.SetDefaultQuality(); // Disable two-pass options this.TwoPass = false; this.TurboFirstPass = false; } if (this.VideoEncodeRateType == VCVideoEncodeRateType.AverageBitrate) { if (oldRateType == VCVideoEncodeRateType.ConstantQuality) { if (this.Profile.VideoBitrate == 0) { this.VideoBitrate = DefaultVideoBitrateKbps; } } else if (oldRateType == VCVideoEncodeRateType.TargetSize) { if (this.displayVideoBitrate == 0) { this.VideoBitrate = DefaultVideoBitrateKbps; } else { this.VideoBitrate = this.displayVideoBitrate; } } } if (this.VideoEncodeRateType == VCVideoEncodeRateType.TargetSize) { if (oldRateType == VCVideoEncodeRateType.ConstantQuality) { if (this.Profile.TargetSize == 0) { this.TargetSize = DefaultTargetSizeMB; } } else if (oldRateType == VCVideoEncodeRateType.AverageBitrate) { if (this.displayTargetSize == 0) { this.TargetSize = DefaultTargetSizeMB; } else { this.TargetSize = this.displayTargetSize; } } } this.outputPathService.GenerateOutputFileName(); }); this.RegisterProfileProperty(nameof(this.Profile.Quality), () => { this.outputPathService.GenerateOutputFileName(); }); this.RegisterProfileProperty(nameof(this.Profile.UseAdvancedTab), () => { if (this.UseAdvancedTab) { int width, height; if (this.MainViewModel.HasVideoSource && this.MainViewModel.SelectedTitle != null) { width = this.MainViewModel.SelectedTitle.Geometry.Width; height = this.MainViewModel.SelectedTitle.Geometry.Height; } else { width = 640; height = 480; } this.Profile.VideoOptions = HandBrakeUtils.CreateX264OptionsString( this.Profile.VideoPreset, this.Profile.VideoTunes, this.Profile.VideoOptions, this.Profile.VideoProfile, this.Profile.VideoLevel, width, height); this.EncodingWindowViewModel.SelectedTabIndex = EncodingWindowViewModel.AdvancedVideoTabIndex; } else { this.Profile.VideoOptions = string.Empty; } }); this.RegisterProfileProperty(nameof(this.Profile.VideoProfile)); this.RegisterProfileProperty(nameof(this.Profile.VideoLevel)); this.RegisterProfileProperty(nameof(this.Profile.VideoPreset)); this.RegisterProfileProperty(nameof(this.Profile.VideoOptions)); this.RegisterProfileProperty(nameof(this.Profile.QsvDecode)); this.RegisterProfileProperty(nameof(this.Profile.TargetSize), () => { this.RaisePropertyChanged(nameof(this.VideoBitrate)); this.outputPathService.GenerateOutputFileName(); }); this.RegisterProfileProperty(nameof(this.Profile.VideoBitrate), () => { this.RaisePropertyChanged(nameof(this.TargetSize)); this.outputPathService.GenerateOutputFileName(); }); this.RegisterProfileProperty(nameof(this.Profile.VideoTunes)); }
private void RegisterProfileProperties() { this.RegisterProfileProperty(nameof(this.Profile.VideoEncoder), () => { if (!EncoderSupportsTwoPass(this.Profile.VideoEncoder)) { this.TwoPass = false; this.TurboFirstPass = false; } }); this.RegisterProfileProperty(nameof(this.Profile.Framerate)); this.RegisterProfileProperty(nameof(this.Profile.ConstantFramerate)); this.RegisterProfileProperty(nameof(this.Profile.TwoPass), () => { if (!this.TwoPass && this.TurboFirstPass) { this.TurboFirstPass = false; } }); this.RegisterProfileProperty(nameof(this.Profile.TurboFirstPass)); this.RegisterProfileProperty(nameof(this.VideoEncodeRateType), oldValue => { VCVideoEncodeRateType oldRateType = (VCVideoEncodeRateType)oldValue; if (this.VideoEncodeRateType == VCVideoEncodeRateType.ConstantQuality) { this.SetDefaultQuality(); // Disable two-pass options this.TwoPass = false; this.TurboFirstPass = false; } if (this.VideoEncodeRateType == VCVideoEncodeRateType.AverageBitrate) { if (oldRateType == VCVideoEncodeRateType.ConstantQuality) { if (this.Profile.VideoBitrate == 0) { this.VideoBitrate = DefaultVideoBitrateKbps; } else { // If we already have a bitrate, update the UI this.RaisePropertyChanged(nameof(this.VideoBitrate)); } } else if (oldRateType == VCVideoEncodeRateType.TargetSize) { if (this.displayVideoBitrate == 0) { this.VideoBitrate = DefaultVideoBitrateKbps; } else { this.VideoBitrate = this.displayVideoBitrate; } } } if (this.VideoEncodeRateType == VCVideoEncodeRateType.TargetSize) { if (oldRateType == VCVideoEncodeRateType.ConstantQuality) { if (this.Profile.TargetSize == 0) { this.TargetSize = DefaultTargetSizeMB; } } else if (oldRateType == VCVideoEncodeRateType.AverageBitrate) { if (this.displayTargetSize == 0) { this.TargetSize = DefaultTargetSizeMB; } else { this.TargetSize = this.displayTargetSize; } } } this.outputPathService.GenerateOutputFileName(); }); this.RegisterProfileProperty(nameof(this.Profile.Quality), () => { this.outputPathService.GenerateOutputFileName(); }); this.RegisterProfileProperty(nameof(this.Profile.VideoProfile)); this.RegisterProfileProperty(nameof(this.Profile.VideoLevel)); this.RegisterProfileProperty(nameof(this.Profile.VideoPreset)); this.RegisterProfileProperty(nameof(this.Profile.VideoOptions)); this.RegisterProfileProperty(nameof(this.Profile.QsvDecode)); this.RegisterProfileProperty(nameof(this.Profile.TargetSize), () => { this.RaisePropertyChanged(nameof(this.VideoBitrate)); this.outputPathService.GenerateOutputFileName(); }); this.RegisterProfileProperty(nameof(this.Profile.VideoBitrate), () => { this.RaisePropertyChanged(nameof(this.TargetSize)); this.outputPathService.GenerateOutputFileName(); }); this.RegisterProfileProperty(nameof(this.Profile.VideoTunes)); }