From 16bbb89ba213297636c2cbf463cb37e3442a0da2 Mon Sep 17 00:00:00 2001 From: sr55 Date: Mon, 13 Apr 2009 17:15:46 +0000 Subject: [PATCH] WinGui: - Cut the Query Parser code down by 509 lines of code. - Fixed issue in Preview window, (mkv files were not playing back) git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2321 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- win/C#/Functions/QueryParser.cs | 843 +++++++------------------------- win/C#/frmMain.cs | 4 +- win/C#/frmMain/PresetLoader.cs | 2 +- win/C#/frmPreview.cs | 2 +- 4 files changed, 171 insertions(+), 680 deletions(-) diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs index 4d40ef880..2e1f470d3 100644 --- a/win/C#/Functions/QueryParser.cs +++ b/win/C#/Functions/QueryParser.cs @@ -18,592 +18,87 @@ namespace Handbrake.Functions #region Varibles #region Source - - private int q_chaptersFinish; - private int q_chaptersStart; - private int q_dvdTitle; - - /// - /// Returns an Integer - /// DVD Title number. - /// - public int DVDTitle - { - get { return q_dvdTitle; } - } - - /// - /// Returns an Int - /// DVD Chapter number or chapter range. - /// - public int DVDChapterStart - { - get { return q_chaptersStart; } - } - - /// - /// Returns an Int - /// DVD Chapter number or chapter range. - /// - public int DVDChapterFinish - { - get { return q_chaptersFinish; } - } - + public int DVDTitle { get; private set; } + public int DVDChapterStart { get; private set; } + public int DVDChapterFinish { get; private set; } #endregion - #region Destination - - private string q_format; - private string q_videoEncoder; - - /// - /// Returns a String - /// Full path of the destination. - /// - public string Format - { - get { return q_format; } - } - - /// - /// Returns an String - /// The Video Encoder used. - /// - public string VideoEncoder - { - get { return q_videoEncoder; } - } - + #region Output Settings + public string Format { get; private set; } + public Boolean LargeMP4 { get; private set; } + public Boolean IpodAtom { get; private set; } + public Boolean OptimizeMP4 { get; private set; } #endregion #region Picture Settings - - private Boolean q_anamorphic; - private Boolean q_chapterMarkers; - private string q_cropbottom; - private string q_cropLeft; - private string q_cropRight; - private string q_croptop; - private string q_cropValues; - private int q_deBlock; - private string q_decomb; - private string q_deinterlace; - private string q_denoise; - private string q_detelecine; - private Boolean q_looseAnamorphic; - private int q_maxHeight; - private int q_maxWidth; - private int q_videoHeight; - private int q_videoWidth; - - /// - /// Returns an Int - /// The selected Width for the encoding. - /// - public int Width - { - get { return q_videoWidth; } - } - - /// - /// Returns an Int - /// The selected Height for the encoding. - /// - public int Height - { - get { return q_videoHeight; } - } - - /// - /// Returns an Int - /// The selected Width for the encoding. - /// - public int MaxWidth - { - get { return q_maxWidth; } - } - - /// - /// Returns an Int - /// The selected Height for the encoding. - /// - public int MaxHeight - { - get { return q_maxHeight; } - } - - /// - /// Returns an String - /// Cropping values. - /// - public string CropValues - { - get { return q_cropValues; } - } - - /// - /// Returns an String - /// Cropping values. - /// - public string CropTop - { - get { return q_croptop; } - } - - /// - /// Returns an String - /// Cropping values. - /// - public string CropBottom - { - get { return q_cropbottom; } - } - - /// - /// Returns an String - /// Cropping values. - /// - public string CropLeft - { - get { return q_cropLeft; } - } - - /// - /// Returns an String - /// Cropping values. - /// - public string CropRight - { - get { return q_cropRight; } - } - - /// - /// Returns a boolean to indicate wither DeTelecine is on or off - /// - public string DeTelecine - { - get { return q_detelecine; } - } - - /// - /// Returns a boolean to indicate wither DeBlock is on or off. - /// - public int DeBlock - { - get { return q_deBlock; } - } - - /// - /// Returns a string with the De-Interlace option used. - /// - public string DeInterlace - { - get { return q_deinterlace; } - } - - /// - /// Returns a string with the DeNoise option used. - /// - public string DeNoise - { - get { return q_denoise; } - } - - /// - /// Returns a string with the DeNoise option used. - /// - public string Decomb - { - get { return q_decomb; } - } - - /// - /// Returns a boolean to indicate wither Anamorphic is on or off. - /// - public Boolean Anamorphic - { - get { return q_anamorphic; } - } - - /// - /// Returns a boolean to indicate wither Anamorphic is on or off. - /// - public Boolean LooseAnamorphic - { - get { return q_looseAnamorphic; } - } - - /// - /// Returns a boolean to indicate wither Chapter Markers is on or off. - /// - public Boolean ChapterMarkers - { - get { return q_chapterMarkers; } - } - + public int Width { get; private set; } + public int Height { get; private set; } + public int MaxWidth { get; private set; } + public int MaxHeight { get; private set; } + public string CropValues { get; private set; } + public string CropTop { get; private set; } + public string CropBottom { get; private set; } + public string CropLeft { get; private set; } + public string CropRight { get; private set; } + public Boolean Anamorphic { get; private set; } + public Boolean LooseAnamorphic { get; private set; } #endregion - #region Video Settings - - private string q_avgBitrate; - private Boolean q_grayscale; - private Boolean q_ipodAtom; - private Boolean q_largeMp4; - private Boolean q_optimizeMp4; - private Boolean q_turboFirst; - - private Boolean q_twoPass; - private string q_videoFramerate; - private float q_videoQuality; - private string q_videoTargetSize; - - /// - /// Returns a boolean to indicate wither Grayscale is on or off. - /// - public Boolean Grayscale - { - get { return q_grayscale; } - } - - /// - /// Returns a boolean to indicate wither Two Pass Encoding is on or off. - /// - public Boolean TwoPass - { - get { return q_twoPass; } - } - - /// - /// Returns a boolean to indicate wither Chapter Markers is on or off. - /// - public Boolean TurboFirstPass - { - get { return q_turboFirst; } - } - - /// - /// Returns a boolean to indicate wither Larger MP4 files is on or off. - /// - public Boolean LargeMP4 - { - get { return q_largeMp4; } - } - - /// - /// Returns a boolean to indicate wither Larger MP4 files is on or off. - /// - public Boolean IpodAtom - { - get { return q_ipodAtom; } - } - - /// - /// Returns a boolean to indicate wither Larger MP4 files is on or off. - /// - public Boolean OptimizeMP4 - { - get { return q_optimizeMp4; } - } - - /// - /// Returns a string with the video Framerate - /// - public string VideoFramerate - { - get { return q_videoFramerate; } - } - - /// - /// Returns a string with the average video bitrate - /// - public string AverageVideoBitrate - { - get { return q_avgBitrate; } - } - - /// - /// Returns a string with the video target size - /// - public string VideoTargetSize - { - get { return q_videoTargetSize; } - } - - /// - /// Returns a int with the video quality value - /// - public float VideoQuality - { - get { return q_videoQuality; } - } + #region Video Filters + public string DeTelecine { get; private set; } + public int DeBlock { get; private set; } + public string DeInterlace { get; private set; } + public string DeNoise { get; private set; } + public string Decomb { get; private set; } + #endregion + #region Video Settings + public string VideoEncoder { get; private set; } + public Boolean Grayscale { get; private set; } + public Boolean TwoPass { get; private set; } + public Boolean TurboFirstPass { get; private set; } + public string VideoFramerate { get; private set; } + public string AverageVideoBitrate { get; private set; } + public string VideoTargetSize { get; private set; } + public float VideoQuality { get; private set; } #endregion #region Audio Settings + public string AudioTrack1 { get; private set; } + public string AudioTrack2 { get; private set; } + public string AudioTrack3 { get; private set; } + public string AudioTrack4 { get; private set; } + public string AudioTrackMix1 { get; private set; } + public string AudioTrackMix2 { get; private set; } + public string AudioTrackMix3 { get; private set; } + public string AudioTrackMix4 { get; private set; } + public string AudioEncoder1 { get; private set; } + public string AudioEncoder2 { get; private set; } + public string AudioEncoder3 { get; private set; } + public string AudioEncoder4 { get; private set; } + public string AudioBitrate1 { get; private set; } + public string AudioBitrate2 { get; private set; } + public string AudioBitrate3 { get; private set; } + public string AudioBitrate4 { get; private set; } + public string AudioSamplerate1 { get; private set; } + public string AudioSamplerate2 { get; private set; } + public string AudioSamplerate3 { get; private set; } + public string AudioSamplerate4 { get; private set; } + public double DRC1 { get; private set; } + public double DRC2 { get; private set; } + public double DRC3 { get; private set; } + public double DRC4 { get; private set; } + public string Subtitles { get; private set; } + public Boolean ForcedSubtitles { get; private set; } + #endregion - private string q_audioBitrate1; - private string q_audioBitrate2; - private string q_audioBitrate3; - private string q_audioBitrate4; - private string q_audioEncoder1; - private string q_audioEncoder2; - private string q_audioEncoder3; - private string q_audioEncoder4; - private string q_audioSamplerate1; - private string q_audioSamplerate2; - private string q_audioSamplerate3; - private string q_audioSamplerate4; - private string q_audioTrack1; - private string q_audioTrack2; - private string q_audioTrack3; - private string q_audioTrack4; - private string q_audioTrackMix1; - private string q_audioTrackMix2; - private string q_audioTrackMix3; - private string q_audioTrackMix4; - private double q_drc1; - private double q_drc2; - private double q_drc3; - private double q_drc4; - private Boolean q_forcedSubs; - private string q_subtitles; - - /// - /// Returns a string with the selected Audio track - /// - public string AudioTrack1 - { - get { return q_audioTrack1; } - } - - /// - /// Returns a string with the selected Audio track - /// - public string AudioTrack2 - { - get { return q_audioTrack2; } - } - - /// - /// Returns a string with the selected Audio track - /// - public string AudioTrack3 - { - get { return q_audioTrack3; } - } - - /// - /// Returns a string with the selected Audio track - /// - public string AudioTrack4 - { - get { return q_audioTrack4; } - } - - /// - /// Returns a string with the First selected Audio track Mix - /// - public string AudioTrackMix1 - { - get { return q_audioTrackMix1; } - } - - /// - /// Returns a string with the First selected Audio track Mix - /// - public string AudioTrackMix2 - { - get { return q_audioTrackMix2; } - } - - /// - /// Returns a string with the First selected Audio track Mix - /// - public string AudioTrackMix3 - { - get { return q_audioTrackMix3; } - } - - /// - /// Returns a string with the First selected Audio track Mix - /// - public string AudioTrackMix4 - { - get { return q_audioTrackMix4; } - } - - /// - /// Returns an String - /// The Audio Encoder used. - /// - public string AudioEncoder1 - { - get { return q_audioEncoder1; } - } - - /// - /// Returns an String - /// The Audio Encoder used. - /// - public string AudioEncoder2 - { - get { return q_audioEncoder2; } - } - - /// - /// Returns an String - /// The Audio Encoder used. - /// - public string AudioEncoder3 - { - get { return q_audioEncoder3; } - } - - /// - /// Returns an String - /// The Audio Encoder used. - /// - public string AudioEncoder4 - { - get { return q_audioEncoder4; } - } - - /// - /// Returns a string with the audio bitrate - /// - public string AudioBitrate1 - { - get { return q_audioBitrate1; } - } - - /// - /// Returns a string with the audio bitrate - /// - public string AudioBitrate2 - { - get { return q_audioBitrate2; } - } - - /// - /// Returns a string with the audio bitrate - /// - public string AudioBitrate3 - { - get { return q_audioBitrate3; } - } - - /// - /// Returns a string with the audio bitrate - /// - public string AudioBitrate4 - { - get { return q_audioBitrate4; } - } - - /// - /// Returns a string with the audio sample rate - /// - public string AudioSamplerate1 - { - get { return q_audioSamplerate1; } - } - - /// - /// Returns a string with the audio sample rate - /// - public string AudioSamplerate2 - { - get { return q_audioSamplerate2; } - } - - /// - /// Returns a string with the audio sample rate - /// - public string AudioSamplerate3 - { - get { return q_audioSamplerate3; } - } - - /// - /// Returns a string with the audio sample rate - /// - public string AudioSamplerate4 - { - get { return q_audioSamplerate4; } - } - - /// - /// Returns a string with the selected subtitle track - /// - public double DRC1 - { - get { return q_drc1; } - } - - /// - /// Returns a string with the selected subtitle track - /// - public double DRC2 - { - get { return q_drc2; } - } - - /// - /// Returns a string with the selected subtitle track - /// - public double DRC3 - { - get { return q_drc3; } - } - - /// - /// Returns a string with the selected subtitle track - /// - public double DRC4 - { - get { return q_drc4; } - } - - /// - /// Returns a string with the selected subtitle track - /// - public string Subtitles - { - get { return q_subtitles; } - } - - /// - /// Returns a string with the selected subtitle track - /// - public Boolean ForcedSubtitles - { - get { return q_forcedSubs; } - } - + #region Chapter Markers + public Boolean ChapterMarkers { get; private set; } #endregion #region Other - - private string q_h264; - private Boolean q_verbose; - - /// - /// Returns a string with the Advanced H264 query string - /// - public string H264Query - { - get { return q_h264; } - } - - /// - /// Returns a string with the Advanced H264 query string - /// - public Boolean Verbose - { - get { return q_verbose; } - } - + public string H264Query { get; private set; } + public Boolean Verbose { get; private set; } #endregion #endregion @@ -670,10 +165,10 @@ namespace Handbrake.Functions Match audioTrack3 = Regex.Match(input, @"-a ([0-9]*),([0-9]*),([0-9]*)"); Match audioTrack4 = Regex.Match(input, @"-a ([0-9]*),([0-9]*),([0-9]*),([0-9]*)"); - Match audioTrack1Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*)"); - Match audioTrack2Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*)"); - Match audioTrack3Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*)"); - Match audioTrack4Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*)"); + Match audioTrack1Mix = Regex.Match(input, @"-6 ([0-9a-z]*)"); + Match audioTrack2Mix = Regex.Match(input, @"-6 ([0-9a-z]*),([0-9a-z]*)"); + Match audioTrack3Mix = Regex.Match(input, @"-6 ([0-9a-z]*),([0-9a-z]*),([0-9a-z]*)"); + Match audioTrack4Mix = Regex.Match(input, @"-6 ([0-9a-z]*),([0-9a-z]*),([0-9a-z]*),([0-9a-z]*)"); Match audioEncoder1 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*)"); Match audioEncoder2 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)"); @@ -718,99 +213,102 @@ namespace Handbrake.Functions #region Source Tab if (title.Success) - thisQuery.q_dvdTitle = int.Parse(title.ToString().Replace("-t ", "")); + thisQuery.DVDTitle = int.Parse(title.ToString().Replace("-t ", "")); if (chapters.Success) { string[] actTitles = chapters.ToString().Replace("-c ", "").Split('-'); - thisQuery.q_chaptersStart = int.Parse(actTitles[0]); + thisQuery.DVDChapterStart = int.Parse(actTitles[0]); if (actTitles.Length > 1) { - thisQuery.q_chaptersFinish = int.Parse(actTitles[1]); + thisQuery.DVDChapterFinish = int.Parse(actTitles[1]); } - if ((thisQuery.q_chaptersStart == 1) && (thisQuery.q_chaptersFinish == 0)) - thisQuery.q_chaptersFinish = thisQuery.q_chaptersStart; + if ((thisQuery.DVDChapterStart == 1) && (thisQuery.DVDChapterFinish == 0)) + thisQuery.DVDChapterFinish = thisQuery.DVDChapterStart; } #endregion #region Output Settings if (format.Success) - thisQuery.q_format = format.ToString().Replace("-f ", ""); - thisQuery.q_largeMp4 = largerMp4.Success; - thisQuery.q_ipodAtom = ipodAtom.Success; - thisQuery.q_optimizeMp4 = optimizeMP4.Success; + thisQuery.Format = format.ToString().Replace("-f ", ""); + thisQuery.LargeMP4 = largerMp4.Success; + thisQuery.IpodAtom = ipodAtom.Success; + thisQuery.OptimizeMP4 = optimizeMP4.Success; #endregion #region Picture Tab if (width.Success) - thisQuery.q_videoWidth = int.Parse(width.ToString().Replace("-w ", "")); + thisQuery.Width = int.Parse(width.ToString().Replace("-w ", "")); if (height.Success) - thisQuery.q_videoHeight = int.Parse(height.ToString().Replace("-l ", "")); + thisQuery.Height = int.Parse(height.ToString().Replace("-l ", "")); if (maxWidth.Success) - thisQuery.q_maxWidth = int.Parse(maxWidth.ToString().Replace("-X ", "")); + thisQuery.MaxWidth = int.Parse(maxWidth.ToString().Replace("-X ", "")); if (maxHeight.Success) - thisQuery.q_maxHeight = int.Parse(maxHeight.ToString().Replace("-Y ", "")); + thisQuery.MaxHeight = int.Parse(maxHeight.ToString().Replace("-Y ", "")); if (crop.Success) { - thisQuery.q_cropValues = crop.ToString().Replace("--crop ", ""); - string[] actCropValues = thisQuery.q_cropValues.Split(':'); - thisQuery.q_croptop = actCropValues[0]; - thisQuery.q_cropbottom = actCropValues[1]; - thisQuery.q_cropLeft = actCropValues[2]; - thisQuery.q_cropRight = actCropValues[3]; + thisQuery.CropValues = crop.ToString().Replace("--crop ", ""); + string[] actCropValues = thisQuery.CropValues.Split(':'); + thisQuery.CropTop = actCropValues[0]; + thisQuery.CropBottom = actCropValues[1]; + thisQuery.CropLeft = actCropValues[2]; + thisQuery.CropRight = actCropValues[3]; } - thisQuery.q_anamorphic = anamorphic.Success; - thisQuery.q_looseAnamorphic = lanamorphic.Success; + thisQuery.Anamorphic = anamorphic.Success; + thisQuery.LooseAnamorphic = lanamorphic.Success; #endregion #region Filters - thisQuery.q_decomb = "Off"; + thisQuery.Decomb = "Off"; if (decomb.Success) { - thisQuery.q_decomb = "Default"; + thisQuery.Decomb = "Default"; if (decombValue.Success) - thisQuery.q_decomb = decombValue.ToString().Replace("--decomb=", "").Replace("\"", ""); + thisQuery.Decomb = decombValue.ToString().Replace("--decomb=", "").Replace("\"", ""); } - thisQuery.q_deinterlace = "None"; + thisQuery.DeInterlace = "None"; if (deinterlace.Success) { - thisQuery.q_deinterlace = deinterlace.ToString().Replace("--deinterlace=", "").Replace("\"", ""); - thisQuery.q_deinterlace = thisQuery.q_deinterlace.Replace("fast", "Fast").Replace("slow", "Slow").Replace("slower", "Slower"); - thisQuery.q_deinterlace = thisQuery.q_deinterlace.Replace("slowest", "Slowest"); + thisQuery.DeInterlace = deinterlace.ToString().Replace("--deinterlace=", "").Replace("\"", ""); + thisQuery.DeInterlace = thisQuery.DeInterlace.Replace("fast", "Fast").Replace("slow", "Slow").Replace("slower", "Slower"); + thisQuery.DeInterlace = thisQuery.DeInterlace.Replace("slowest", "Slowest"); } - thisQuery.q_denoise = "None"; + thisQuery.DeNoise = "None"; if (denoise.Success) { - thisQuery.q_denoise = denoise.ToString().Replace("--denoise=", "").Replace("\"", ""); - thisQuery.q_denoise = thisQuery.q_denoise.Replace("weak", "Weak").Replace("medium", "Medium").Replace("strong", "Strong"); + thisQuery.DeNoise = denoise.ToString().Replace("--denoise=", "").Replace("\"", ""); + thisQuery.DeNoise = thisQuery.DeNoise.Replace("weak", "Weak").Replace("medium", "Medium").Replace("strong", "Strong"); } string deblockValue = ""; - thisQuery.q_deBlock = 0; + thisQuery.DeBlock = 0; if (deblock.Success) deblockValue = deblock.ToString().Replace("--deblock=", ""); + + int dval = 0; if (deblockValue != "") - int.TryParse(deblockValue, out thisQuery.q_deBlock); + int.TryParse(deblockValue, out dval); + thisQuery.DeBlock = dval; - thisQuery.q_detelecine = "Off"; + thisQuery.DeTelecine = "Off"; if (detelecine.Success) { - thisQuery.q_detelecine = "Default"; + thisQuery.DeTelecine = "Default"; if (detelecineValue.Success) - thisQuery.q_detelecine = detelecineValue.ToString().Replace("--detelecine=", "").Replace("\"", ""); + thisQuery.DeTelecine = detelecineValue.ToString().Replace("--detelecine=", "").Replace("\"", ""); } #endregion @@ -833,22 +331,22 @@ namespace Handbrake.Functions videoEncoderConvertion = "MPEG-4 (FFmpeg)"; break; } - thisQuery.q_videoEncoder = videoEncoderConvertion; - thisQuery.q_videoFramerate = videoFramerate.Success ? videoFramerate.ToString().Replace("-r ", "") : "Same as source"; - thisQuery.q_grayscale = grayscale.Success; - thisQuery.q_twoPass = twoPass.Success; - thisQuery.q_turboFirst = turboFirstPass.Success; + thisQuery.VideoEncoder = videoEncoderConvertion; + thisQuery.VideoFramerate = videoFramerate.Success ? videoFramerate.ToString().Replace("-r ", "") : "Same as source"; + thisQuery.Grayscale = grayscale.Success; + thisQuery.TwoPass = twoPass.Success; + thisQuery.TurboFirstPass = turboFirstPass.Success; if (videoBitrate.Success) - thisQuery.q_avgBitrate = videoBitrate.ToString().Replace("-b ", ""); + thisQuery.AverageVideoBitrate = videoBitrate.ToString().Replace("-b ", ""); if (videoFilesize.Success) - thisQuery.q_videoTargetSize = videoFilesize.ToString().Replace("-S ", ""); + thisQuery.VideoTargetSize = videoFilesize.ToString().Replace("-S ", ""); if (videoQuality.Success) { float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", ""), Culture); //qConvert = Math.Ceiling(qConvert); - thisQuery.q_videoQuality = qConvert; + thisQuery.VideoQuality = qConvert; } #endregion @@ -856,126 +354,126 @@ namespace Handbrake.Functions // Tracks if (noAudio.Success) - thisQuery.q_audioTrack1 = "None"; + thisQuery.AudioTrack1 = "None"; else if (audioTrack1.Success) - thisQuery.q_audioTrack1 = "Automatic"; + thisQuery.AudioTrack1 = "Automatic"; if (audioTrack2.Success) { string[] audioChan = audioTrack2.ToString().Split(','); - thisQuery.q_audioTrack2 = audioChan[1]; + thisQuery.AudioTrack2 = audioChan[1]; } else - thisQuery.q_audioTrack2 = "None"; + thisQuery.AudioTrack2 = "None"; if (audioTrack3.Success) { string[] audioChan = audioTrack3.ToString().Split(','); - thisQuery.q_audioTrack3 = audioChan[2]; + thisQuery.AudioTrack3 = audioChan[2]; } else - thisQuery.q_audioTrack3 = "None"; + thisQuery.AudioTrack3 = "None"; if (audioTrack4.Success) { string[] audioChan = audioTrack4.ToString().Split(','); - thisQuery.q_audioTrack4 = audioChan[3]; + thisQuery.AudioTrack4 = audioChan[3]; } else - thisQuery.q_audioTrack4 = "None"; + thisQuery.AudioTrack4 = "None"; // Mixdowns - thisQuery.q_audioTrackMix1 = "Automatic"; + thisQuery.AudioTrackMix1 = "Automatic"; if (audioTrack1Mix.Success) - thisQuery.q_audioTrackMix1 = + thisQuery.AudioTrackMix1 = getMixDown(audioTrack1Mix.ToString().Replace("-6 ", "").Replace(" ", "")); - thisQuery.q_audioTrackMix2 = "Automatic"; + thisQuery.AudioTrackMix2 = "Automatic"; if (audioTrack2Mix.Success) { string[] audio2mix = audioTrack2Mix.ToString().Split(','); - thisQuery.q_audioTrackMix2 = getMixDown(audio2mix[1].Trim()); + thisQuery.AudioTrackMix2 = getMixDown(audio2mix[1].Trim()); } - thisQuery.q_audioTrackMix3 = "Automatic"; + thisQuery.AudioTrackMix3 = "Automatic"; if (audioTrack3Mix.Success) { string[] audio3mix = audioTrack3Mix.ToString().Split(','); - thisQuery.q_audioTrackMix3 = getMixDown(audio3mix[2].Trim()); + thisQuery.AudioTrackMix3 = getMixDown(audio3mix[2].Trim()); } - thisQuery.q_audioTrackMix4 = "Automatic"; + thisQuery.AudioTrackMix4 = "Automatic"; if (audioTrack4Mix.Success) { string[] audio4mix = audioTrack4Mix.ToString().Split(','); - thisQuery.q_audioTrackMix4 = getMixDown(audio4mix[3].Trim()); + thisQuery.AudioTrackMix4 = getMixDown(audio4mix[3].Trim()); } // Audio Encoders if (audioEncoder1.Success) - thisQuery.q_audioEncoder1 = getAudioEncoder(audioEncoder1.ToString().Replace("-E ", "")); + thisQuery.AudioEncoder1 = getAudioEncoder(audioEncoder1.ToString().Replace("-E ", "")); if (audioEncoder2.Success) { string[] audio2enc = audioEncoder2.ToString().Split(','); - thisQuery.q_audioEncoder2 = getAudioEncoder(audio2enc[1].Trim()); + thisQuery.AudioEncoder2 = getAudioEncoder(audio2enc[1].Trim()); } if (audioEncoder3.Success) { string[] audio3enc = audioEncoder3.ToString().Split(','); - thisQuery.q_audioEncoder3 = getAudioEncoder(audio3enc[2].Trim()); + thisQuery.AudioEncoder3 = getAudioEncoder(audio3enc[2].Trim()); } if (audioEncoder4.Success) { string[] audio4enc = audioEncoder4.ToString().Split(','); - thisQuery.q_audioEncoder4 = getAudioEncoder(audio4enc[3].Trim()); + thisQuery.AudioEncoder4 = getAudioEncoder(audio4enc[3].Trim()); } // Audio Bitrate - thisQuery.q_audioBitrate1 = ""; + thisQuery.AudioBitrate1 = ""; if (audioBitrate1.Success) { - thisQuery.q_audioBitrate1 = audioBitrate1.ToString().Replace("-B ", "").Trim(); - if (audioBitrate1.ToString().Replace("-B ", "").Trim() == "0") thisQuery.q_audioBitrate1 = "Auto"; + thisQuery.AudioBitrate1 = audioBitrate1.ToString().Replace("-B ", "").Trim(); + if (audioBitrate1.ToString().Replace("-B ", "").Trim() == "0") thisQuery.AudioBitrate1 = "Auto"; } - thisQuery.q_audioBitrate2 = ""; + thisQuery.AudioBitrate2 = ""; if (audioBitrate2.Success && audioTrack2.Success) { string[] audioBitrateSelect = audioBitrate2.ToString().Split(','); if (audioBitrateSelect[1].Trim() == "0") audioBitrateSelect[1] = "Auto"; - thisQuery.q_audioBitrate2 = audioBitrateSelect[1].Trim(); + thisQuery.AudioBitrate2 = audioBitrateSelect[1].Trim(); } - thisQuery.q_audioBitrate3 = ""; + thisQuery.AudioBitrate3 = ""; if (audioBitrate3.Success && audioTrack3.Success) { string[] audioBitrateSelect = audioBitrate3.ToString().Split(','); if (audioBitrateSelect[2].Trim() == "0") audioBitrateSelect[2] = "Auto"; - thisQuery.q_audioBitrate3 = audioBitrateSelect[2].Trim(); + thisQuery.AudioBitrate3 = audioBitrateSelect[2].Trim(); } - thisQuery.q_audioBitrate4 = ""; + thisQuery.AudioBitrate4 = ""; if (audioBitrate4.Success) { string[] audioBitrateSelect = audioBitrate4.ToString().Split(','); if (audioBitrateSelect[3].Trim() == "0") audioBitrateSelect[3] = "Auto"; - thisQuery.q_audioBitrate4 = audioBitrateSelect[3].Trim(); + thisQuery.AudioBitrate4 = audioBitrateSelect[3].Trim(); } // Audio Sample Rate // Make sure to change 0 to Auto - thisQuery.q_audioSamplerate1 = "Auto"; + thisQuery.AudioSamplerate1 = "Auto"; if (audioSampleRate1.Success) { - thisQuery.q_audioSamplerate1 = audioSampleRate1.ToString().Replace("-R ", "").Trim(); - if (thisQuery.q_audioSamplerate1 == "0") thisQuery.q_audioSamplerate1 = "Auto"; + thisQuery.AudioSamplerate1 = audioSampleRate1.ToString().Replace("-R ", "").Trim(); + if (thisQuery.AudioSamplerate1 == "0") thisQuery.AudioSamplerate1 = "Auto"; } @@ -983,85 +481,79 @@ namespace Handbrake.Functions { string[] audioSRSelect = audioSampleRate2.ToString().Split(','); if (audioSRSelect[1] == "0") audioSRSelect[1] = "Auto"; - thisQuery.q_audioSamplerate2 = audioSRSelect[1].Trim(); + thisQuery.AudioSamplerate2 = audioSRSelect[1].Trim(); } if (audioSampleRate3.Success) { string[] audioSRSelect = audioSampleRate3.ToString().Split(','); if (audioSRSelect[2] == "0") audioSRSelect[2] = "Auto"; - thisQuery.q_audioSamplerate3 = audioSRSelect[2].Trim(); + thisQuery.AudioSamplerate3 = audioSRSelect[2].Trim(); } if (audioSampleRate4.Success) { string[] audioSRSelect = audioSampleRate4.ToString().Split(','); if (audioSRSelect[3] == "0") audioSRSelect[3] = "Auto"; - thisQuery.q_audioSamplerate4 = audioSRSelect[3].Trim(); + thisQuery.AudioSamplerate4 = audioSRSelect[3].Trim(); } // DRC float drcValue; - thisQuery.q_drc1 = 1; + thisQuery.DRC1 = 1; if (drc1.Success) { string value = drc1.ToString().Replace("-D ", ""); float.TryParse(value, out drcValue); - thisQuery.q_drc1 = drcValue; + thisQuery.DRC1 = drcValue; } - thisQuery.q_drc2 = 1; + thisQuery.DRC2 = 1; if (drc2.Success) { string[] drcPoint = drc2.ToString().Split(','); float.TryParse(drcPoint[1], out drcValue); - thisQuery.q_drc2 = drcValue; + thisQuery.DRC2 = drcValue; } - thisQuery.q_drc3 = 1; + thisQuery.DRC3 = 1; if (drc3.Success) { string[] drcPoint = drc3.ToString().Split(','); float.TryParse(drcPoint[2], out drcValue); - thisQuery.q_drc3 = drcValue; + thisQuery.DRC3 = drcValue; } - thisQuery.q_drc4 = 1; + thisQuery.DRC4 = 1; if (drc4.Success) { string[] drcPoint = drc4.ToString().Split(','); float.TryParse(drcPoint[3], out drcValue); - thisQuery.q_drc4 = drcValue; + thisQuery.DRC4 = drcValue; } // Subtitle Stuff if (subtitles.Success) - thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", ""); + thisQuery.Subtitles = subtitles.ToString().Replace("-s ", ""); else - thisQuery.q_subtitles = subScan.Success ? "Autoselect" : "None"; + thisQuery.Subtitles = subScan.Success ? "Autoselect" : "None"; - thisQuery.q_forcedSubs = forcedSubtitles.Success; + thisQuery.ForcedSubtitles = forcedSubtitles.Success; #endregion #region Chapters Tab if (chapterMarkersFileMode.Success || chapterMarkers.Success) - thisQuery.q_chapterMarkers = true; + thisQuery.ChapterMarkers = true; #endregion #region H.264 and other - // - //H264 Tab - // if (x264.Success) - thisQuery.q_h264 = x264.ToString().Replace("-x ", ""); + thisQuery.H264Query = x264.ToString().Replace("-x ", ""); - // - //Progam Options - // - thisQuery.q_verbose = verbose.Success; + thisQuery.Verbose = verbose.Success; #endregion } @@ -1079,7 +571,7 @@ namespace Handbrake.Functions private static string getMixDown(string mixdown) { - switch (mixdown) + switch (mixdown.Trim()) { case "mono": return "Mono"; @@ -1095,7 +587,6 @@ namespace Handbrake.Functions return "Automatic"; } } - private static string getAudioEncoder(string audioEnc) { switch (audioEnc) diff --git a/win/C#/frmMain.cs b/win/C#/frmMain.cs index ba7134645..887effb89 100644 --- a/win/C#/frmMain.cs +++ b/win/C#/frmMain.cs @@ -106,7 +106,7 @@ namespace Handbrake // Send the query from the file to the Query Parser class, then load the preset QueryParser presetQuery = QueryParser.Parse(query); - presetLoader.presetLoader(this, presetQuery, Properties.Settings.Default.defaultPreset, loadPictureSettings); + PresetLoader.presetLoader(this, presetQuery, Properties.Settings.Default.defaultPreset, loadPictureSettings); // The x264 widgets will need updated, so do this now: x264Panel.X264_StandardizeOptString(); @@ -501,7 +501,7 @@ namespace Handbrake QueryParser presetQuery = QueryParser.Parse(query); // Now load the preset - presetLoader.presetLoader(this, presetQuery, presetName, loadPictureSettings); + PresetLoader.presetLoader(this, presetQuery, presetName, loadPictureSettings); // The x264 widgets will need updated, so do this now: x264Panel.X264_StandardizeOptString(); diff --git a/win/C#/frmMain/PresetLoader.cs b/win/C#/frmMain/PresetLoader.cs index b616b2566..bb22f2394 100644 --- a/win/C#/frmMain/PresetLoader.cs +++ b/win/C#/frmMain/PresetLoader.cs @@ -14,7 +14,7 @@ namespace Handbrake /// The Parsed CLI Query /// Name of the preset /// Save picture settings in the preset - public void presetLoader(frmMain mainWindow, Functions.QueryParser presetQuery, string name, Boolean pictureSettings) + public static void presetLoader(frmMain mainWindow, Functions.QueryParser presetQuery, string name, Boolean pictureSettings) { // --------------------------- // Setup the GUI diff --git a/win/C#/frmPreview.cs b/win/C#/frmPreview.cs index 4591b3d6d..37407c8ae 100644 --- a/win/C#/frmPreview.cs +++ b/win/C#/frmPreview.cs @@ -113,7 +113,7 @@ namespace Handbrake // Get the sample filename if (mainWindow.text_destination.Text != "") - currently_playing = mainWindow.text_destination.Text.Replace(".mp4", "_sample.mp4").Replace(".m4v", "_sample.m4v"); + currently_playing = mainWindow.text_destination.Text.Replace(".mp4", "_sample.mp4").Replace(".m4v", "_sample.m4v").Replace(".mkv", "_sample.mkv");; // Play back in QT or VLC if (playerSelection == "QT") -- 2.40.0