OSDN Git Service

WinGui:
[handbrake-jp/handbrake-jp-git.git] / win / C# / Functions / QueryParser.cs
index b297ed6..8523fc1 100644 (file)
 /*  QueryParser.cs $\r
-       \r
-          This file is part of the HandBrake source code.\r
-          Homepage: <http://handbrake.fr>.\r
-          It may be used under the terms of the GNU General Public License. */\r
-\r
-using System;\r
-using System.Globalization;\r
-using System.Text.RegularExpressions;\r
-using System.Windows.Forms;\r
-using System.Collections;\r
+    This file is part of the HandBrake source code.\r
+    Homepage: <http://handbrake.fr>.\r
+    It may be used under the terms of the GNU General Public License. */\r
 \r
 namespace Handbrake.Functions\r
 {\r
-    internal class QueryParser\r
+    using System;\r
+    using System.Collections;\r
+    using System.Globalization;\r
+    using System.Text.RegularExpressions;\r
+    using System.Windows.Forms;\r
+    using Model;\r
+\r
+    /// <summary>\r
+    /// Parse a CLI Query\r
+    /// </summary>\r
+    public class QueryParser\r
     {\r
+        /// <summary>\r
+        /// The Culture\r
+        /// </summary>\r
         private static readonly CultureInfo Culture = new CultureInfo("en-US", false);\r
 \r
         #region Varibles\r
 \r
-        #region Source\r
-\r
-        private int q_chaptersFinish;\r
-        private int q_chaptersStart;\r
-        private int q_dvdTitle;\r
-\r
+        #region Source Title / Chapters\r
         /// <summary>\r
-        /// Returns an Integer\r
-        /// DVD Title number.\r
+        /// Gets or sets Title.\r
         /// </summary>\r
-        public int DVDTitle\r
-        {\r
-            get { return q_dvdTitle; }\r
-        }\r
+        public int Title { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns an Int\r
-        /// DVD Chapter number or chapter range.\r
+        /// Gets or sets ChapterStart.\r
         /// </summary>\r
-        public int DVDChapterStart\r
-        {\r
-            get { return q_chaptersStart; }\r
-        }\r
+        public int ChapterStart { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns an Int\r
-        /// DVD Chapter number or chapter range.\r
+        /// Gets or sets ChapterFinish.\r
         /// </summary>\r
-        public int DVDChapterFinish\r
-        {\r
-            get { return q_chaptersFinish; }\r
-        }\r
-\r
+        public int ChapterFinish { get; set; }\r
         #endregion\r
 \r
-        #region Destination\r
-\r
-        private string q_format;\r
-        private string q_videoEncoder;\r
-\r
-        /// <summary>\r
-        /// Returns a String \r
-        /// Full path of the destination.\r
-        /// </summary>\r
-        public string Format\r
-        {\r
-            get { return q_format; }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Returns an String\r
-        /// The Video Encoder used.\r
-        /// </summary>\r
-        public string VideoEncoder\r
-        {\r
-            get { return q_videoEncoder; }\r
-        }\r
-\r
-        #endregion\r
-\r
-        #region Picture Settings\r
-\r
-        private Boolean q_anamorphic;\r
-        private Boolean q_chapterMarkers;\r
-        private string q_cropbottom;\r
-        private string q_cropLeft;\r
-        private string q_cropRight;\r
-        private string q_croptop;\r
-        private string q_cropValues;\r
-        private int q_deBlock;\r
-        private string q_decomb;\r
-        private string q_deinterlace;\r
-        private string q_denoise;\r
-        private string q_detelecine;\r
-        private Boolean q_looseAnamorphic;\r
-        private int q_maxHeight;\r
-        private int q_maxWidth;\r
-        private int q_videoHeight;\r
-        private int q_videoWidth;\r
-\r
-        /// <summary>\r
-        /// Returns an Int\r
-        /// The selected Width for the encoding.\r
-        /// </summary>\r
-        public int Width\r
-        {\r
-            get { return q_videoWidth; }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Returns an Int\r
-        /// The selected Height for the encoding.\r
-        /// </summary>\r
-        public int Height\r
-        {\r
-            get { return q_videoHeight; }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Returns an Int\r
-        /// The selected Width for the encoding.\r
-        /// </summary>\r
-        public int MaxWidth\r
-        {\r
-            get { return q_maxWidth; }\r
-        }\r
-\r
+        #region Output Settings\r
         /// <summary>\r
-        /// Returns an Int\r
-        /// The selected Height for the encoding.\r
+        /// Gets or sets the file Format. e.g mkv or mp4\r
         /// </summary>\r
-        public int MaxHeight\r
-        {\r
-            get { return q_maxHeight; }\r
-        }\r
+        public string Format { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns an String\r
-        /// Cropping values.\r
+        /// Gets or sets a value indicating whether LargeMP4 support is enabled.\r
+        /// This is the 64bit MP4 file that allows >4GB files\r
         /// </summary>\r
-        public string CropValues\r
-        {\r
-            get { return q_cropValues; }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Returns an String\r
-        /// Cropping values.\r
-        /// </summary>\r
-        public string CropTop\r
-        {\r
-            get { return q_croptop; }\r
-        }\r
+        public bool LargeMP4 { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns an String\r
-        /// Cropping values.\r
+        /// Gets or sets a value indicating whether IpodAtom is inserted\r
         /// </summary>\r
-        public string CropBottom\r
-        {\r
-            get { return q_cropbottom; }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Returns an String\r
-        /// Cropping values.\r
-        /// </summary>\r
-        public string CropLeft\r
-        {\r
-            get { return q_cropLeft; }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Returns an String\r
-        /// Cropping values.\r
-        /// </summary>\r
-        public string CropRight\r
-        {\r
-            get { return q_cropRight; }\r
-        }\r
-\r
-        /// <summary>\r
-        /// Returns a boolean to indicate wither DeTelecine is on or off\r
-        /// </summary>\r
-        public string DeTelecine\r
-        {\r
-            get { return q_detelecine; }\r
-        }\r
+        public bool IpodAtom { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a boolean to indicate wither DeBlock is on or off.\r
+        /// Gets or sets a value indicating whether OptimizeMP4 is enabed for web streaming\r
         /// </summary>\r
-        public int DeBlock\r
-        {\r
-            get { return q_deBlock; }\r
-        }\r
+        public bool OptimizeMP4 { get; set; }\r
+        #endregion\r
 \r
-        /// <summary>\r
-        /// Returns a string with the De-Interlace option used.\r
-        /// </summary>\r
-        public string DeInterlace\r
-        {\r
-            get { return q_deinterlace; }\r
-        }\r
+        #region Picture Settings\r
 \r
         /// <summary>\r
-        /// Returns a string with the DeNoise option used.\r
+        /// Gets or sets Width.\r
         /// </summary>\r
-        public string DeNoise\r
-        {\r
-            get { return q_denoise; }\r
-        }\r
+        public int Width { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the DeNoise option used.\r
+        /// Gets or sets Height.\r
         /// </summary>\r
-        public string Decomb\r
-        {\r
-            get { return q_decomb; }\r
-        }\r
+        public int Height { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a boolean to indicate wither Anamorphic is on or off.\r
+        /// Gets or sets MaxWidth.\r
         /// </summary>\r
-        public Boolean Anamorphic\r
-        {\r
-            get { return q_anamorphic; }\r
-        }\r
+        public int MaxWidth { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a boolean to indicate wither Anamorphic is on or off.\r
+        /// Gets or sets MaxHeight.\r
         /// </summary>\r
-        public Boolean LooseAnamorphic\r
-        {\r
-            get { return q_looseAnamorphic; }\r
-        }\r
+        public int MaxHeight { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a boolean to indicate wither Chapter Markers is on or off.\r
+        /// Gets or sets CropValues.\r
         /// </summary>\r
-        public Boolean ChapterMarkers\r
-        {\r
-            get { return q_chapterMarkers; }\r
-        }\r
-\r
-        #endregion\r
-\r
-        #region Video Settings\r
-\r
-        private string q_avgBitrate;\r
-        private Boolean q_grayscale;\r
-        private Boolean q_ipodAtom;\r
-        private Boolean q_largeMp4;\r
-        private Boolean q_optimizeMp4;\r
-        private Boolean q_turboFirst;\r
-\r
-        private Boolean q_twoPass;\r
-        private string q_videoFramerate;\r
-        private float q_videoQuality;\r
-        private string q_videoTargetSize;\r
+        public string CropValues { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a boolean to indicate wither Grayscale is on or off.\r
+        /// Gets or sets CropTop.\r
         /// </summary>\r
-        public Boolean Grayscale\r
-        {\r
-            get { return q_grayscale; }\r
-        }\r
+        public string CropTop { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a boolean to indicate wither Two Pass Encoding is on or off.\r
+        /// Gets or sets CropBottom.\r
         /// </summary>\r
-        public Boolean TwoPass\r
-        {\r
-            get { return q_twoPass; }\r
-        }\r
+        public string CropBottom { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a boolean to indicate wither Chapter Markers is on or off.\r
+        /// Gets or sets CropLeft.\r
         /// </summary>\r
-        public Boolean TurboFirstPass\r
-        {\r
-            get { return q_turboFirst; }\r
-        }\r
+        public string CropLeft { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a boolean to indicate wither Larger MP4 files is on or off.\r
+        /// Gets or sets CropRight.\r
         /// </summary>\r
-        public Boolean LargeMP4\r
-        {\r
-            get { return q_largeMp4; }\r
-        }\r
+        public string CropRight { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a boolean to indicate wither Larger MP4 files is on or off.\r
+        /// Gets or sets AnamorphicMode.\r
         /// </summary>\r
-        public Boolean IpodAtom\r
-        {\r
-            get { return q_ipodAtom; }\r
-        }\r
+        public int AnamorphicMode { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a boolean to indicate wither Larger MP4 files is on or off.\r
+        /// Gets or sets a value indicating whether KeepDisplayAsect.\r
         /// </summary>\r
-        public Boolean OptimizeMP4\r
-        {\r
-            get { return q_optimizeMp4; }\r
-        }\r
+        public bool KeepDisplayAsect { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the video Framerate\r
+        /// Gets or sets DisplayWidthValue.\r
         /// </summary>\r
-        public string VideoFramerate\r
-        {\r
-            get { return q_videoFramerate; }\r
-        }\r
+        public double DisplayWidthValue { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the average video bitrate\r
+        /// Gets or sets PixelAspectWidth.\r
         /// </summary>\r
-        public string AverageVideoBitrate\r
-        {\r
-            get { return q_avgBitrate; }\r
-        }\r
+        public int PixelAspectWidth { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the video target size\r
+        /// Gets or sets PixelAspectHeight.\r
         /// </summary>\r
-        public string VideoTargetSize\r
-        {\r
-            get { return q_videoTargetSize; }\r
-        }\r
+        public int PixelAspectHeight { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a int with the video quality value\r
+        /// Gets or sets AnamorphicModulus.\r
         /// </summary>\r
-        public float VideoQuality\r
-        {\r
-            get { return q_videoQuality; }\r
-        }\r
-\r
+        public int AnamorphicModulus { get; set; }\r
         #endregion\r
 \r
-        #region Audio Settings\r
-\r
-        private string q_audioBitrate1;\r
-        private string q_audioBitrate2;\r
-        private string q_audioBitrate3;\r
-        private string q_audioBitrate4;\r
-        private string q_audioEncoder1;\r
-        private string q_audioEncoder2;\r
-        private string q_audioEncoder3;\r
-        private string q_audioEncoder4;\r
-        private string q_audioSamplerate1;\r
-        private string q_audioSamplerate2;\r
-        private string q_audioSamplerate3;\r
-        private string q_audioSamplerate4;\r
-        private string q_audioTrack1;\r
-        private string q_audioTrack2;\r
-        private string q_audioTrack3;\r
-        private string q_audioTrack4;\r
-        private string q_audioTrackMix1;\r
-        private string q_audioTrackMix2;\r
-        private string q_audioTrackMix3;\r
-        private string q_audioTrackMix4;\r
-        private double q_drc1;\r
-        private double q_drc2;\r
-        private double q_drc3;\r
-        private double q_drc4;\r
-        private Boolean q_forcedSubs;\r
-        private string q_subtitles;\r
+        #region Video Filters\r
 \r
         /// <summary>\r
-        /// Returns a string with the selected Audio track\r
+        /// Gets or sets DeTelecine.\r
         /// </summary>\r
-        public string AudioTrack1\r
-        {\r
-            get { return q_audioTrack1; }\r
-        }\r
+        public string DeTelecine { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the selected Audio track\r
+        /// Gets or sets DeBlock.\r
         /// </summary>\r
-        public string AudioTrack2\r
-        {\r
-            get { return q_audioTrack2; }\r
-        }\r
+        public int DeBlock { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the selected Audio track\r
+        /// Gets or sets DeInterlace.\r
         /// </summary>\r
-        public string AudioTrack3\r
-        {\r
-            get { return q_audioTrack3; }\r
-        }\r
+        public string DeInterlace { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the selected Audio track\r
+        /// Gets or sets DeNoise.\r
         /// </summary>\r
-        public string AudioTrack4\r
-        {\r
-            get { return q_audioTrack4; }\r
-        }\r
+        public string DeNoise { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the First selected Audio track Mix\r
+        /// Gets or sets Decomb.\r
         /// </summary>\r
-        public string AudioTrackMix1\r
-        {\r
-            get { return q_audioTrackMix1; }\r
-        }\r
+        public string Decomb { get; set; }\r
+        #endregion\r
 \r
+        #region Video Settings\r
         /// <summary>\r
-        /// Returns a string with the First selected Audio track Mix\r
+        /// Gets or sets VideoEncoder.\r
         /// </summary>\r
-        public string AudioTrackMix2\r
-        {\r
-            get { return q_audioTrackMix2; }\r
-        }\r
+        public string VideoEncoder { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the First selected Audio track Mix\r
+        /// Gets or sets a value indicating whether Grayscale.\r
         /// </summary>\r
-        public string AudioTrackMix3\r
-        {\r
-            get { return q_audioTrackMix3; }\r
-        }\r
+        public bool Grayscale { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the First selected Audio track Mix\r
+        /// Gets or sets a value indicating whether TwoPass.\r
         /// </summary>\r
-        public string AudioTrackMix4\r
-        {\r
-            get { return q_audioTrackMix4; }\r
-        }\r
+        public bool TwoPass { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns an String\r
-        /// The Audio Encoder used.\r
+        /// Gets or sets a value indicating whether TurboFirstPass.\r
         /// </summary>\r
-        public string AudioEncoder1\r
-        {\r
-            get { return q_audioEncoder1; }\r
-        }\r
+        public bool TurboFirstPass { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns an String\r
-        /// The Audio Encoder used.\r
+        /// Gets or sets VideoFramerate.\r
         /// </summary>\r
-        public string AudioEncoder2\r
-        {\r
-            get { return q_audioEncoder2; }\r
-        }\r
+        public string VideoFramerate { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns an String\r
-        /// The Audio Encoder used.\r
+        /// Gets or sets AverageVideoBitrate.\r
         /// </summary>\r
-        public string AudioEncoder3\r
-        {\r
-            get { return q_audioEncoder3; }\r
-        }\r
+        public string AverageVideoBitrate { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns an String\r
-        /// The Audio Encoder used.\r
+        /// Gets or sets VideoTargetSize.\r
         /// </summary>\r
-        public string AudioEncoder4\r
-        {\r
-            get { return q_audioEncoder4; }\r
-        }\r
+        public string VideoTargetSize { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the audio bitrate\r
+        /// Gets or sets VideoQuality.\r
         /// </summary>\r
-        public string AudioBitrate1\r
-        {\r
-            get { return q_audioBitrate1; }\r
-        }\r
+        public float VideoQuality { get; set; }\r
+        #endregion\r
 \r
-        /// <summary>\r
-        /// Returns a string with the audio bitrate\r
-        /// </summary>\r
-        public string AudioBitrate2\r
-        {\r
-            get { return q_audioBitrate2; }\r
-        }\r
+        #region Audio Settings\r
 \r
         /// <summary>\r
-        /// Returns a string with the audio bitrate\r
+        /// Gets or sets AudioInformation.\r
         /// </summary>\r
-        public string AudioBitrate3\r
-        {\r
-            get { return q_audioBitrate3; }\r
-        }\r
+        public ArrayList AudioInformation { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the audio bitrate\r
+        /// Gets or sets Subtitles.\r
         /// </summary>\r
-        public string AudioBitrate4\r
-        {\r
-            get { return q_audioBitrate4; }\r
-        }\r
+        public string Subtitles { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the audio sample rate\r
+        /// Gets or sets a value indicating whether ForcedSubtitles.\r
         /// </summary>\r
-        public string AudioSamplerate1\r
-        {\r
-            get { return q_audioSamplerate1; }\r
-        }\r
+        public bool ForcedSubtitles { get; set; }\r
+        #endregion\r
 \r
+        #region Other\r
         /// <summary>\r
-        /// Returns a string with the audio sample rate\r
+        /// Gets or sets a value indicating whether ChapterMarkers.\r
         /// </summary>\r
-        public string AudioSamplerate2\r
-        {\r
-            get { return q_audioSamplerate2; }\r
-        }\r
+        public bool ChapterMarkers { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the audio sample rate\r
+        /// Gets or sets H264Query.\r
         /// </summary>\r
-        public string AudioSamplerate3\r
-        {\r
-            get { return q_audioSamplerate3; }\r
-        }\r
+        public string H264Query { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the audio sample rate\r
+        /// Gets or sets a value indicating whether Verbose.\r
         /// </summary>\r
-        public string AudioSamplerate4\r
-        {\r
-            get { return q_audioSamplerate4; }\r
-        }\r
+        public bool Verbose { get; set; }\r
+        #endregion\r
 \r
-        /// <summary>\r
-        /// Returns a string with the selected subtitle track\r
-        /// </summary>\r
-        public double DRC1\r
-        {\r
-            get { return q_drc1; }\r
-        }\r
+        #region Preset Information\r
 \r
         /// <summary>\r
-        /// Returns a string with the selected subtitle track\r
+        /// Gets or sets PresetBuildNumber.\r
         /// </summary>\r
-        public double DRC2\r
-        {\r
-            get { return q_drc2; }\r
-        }\r
+        public int PresetBuildNumber { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the selected subtitle track\r
+        /// Gets or sets PresetDescription.\r
         /// </summary>\r
-        public double DRC3\r
-        {\r
-            get { return q_drc3; }\r
-        }\r
+        public string PresetDescription { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the selected subtitle track\r
+        /// Gets or sets PresetName.\r
         /// </summary>\r
-        public double DRC4\r
-        {\r
-            get { return q_drc4; }\r
-        }\r
+        public string PresetName { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the selected subtitle track\r
+        /// Gets or sets Type.\r
         /// </summary>\r
-        public string Subtitles\r
-        {\r
-            get { return q_subtitles; }\r
-        }\r
+        public string Type { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the selected subtitle track\r
+        /// Gets or sets a value indicating whether UsesMaxPictureSettings.\r
         /// </summary>\r
-        public Boolean ForcedSubtitles\r
-        {\r
-            get { return q_forcedSubs; }\r
-        }\r
-\r
-        #endregion\r
-\r
-        #region Other\r
-\r
-        private string q_h264;\r
-        private Boolean q_verbose;\r
+        public bool UsesMaxPictureSettings { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the Advanced H264 query string\r
+        /// Gets or sets a value indicating whether UsesPictureFilters.\r
         /// </summary>\r
-        public string H264Query\r
-        {\r
-            get { return q_h264; }\r
-        }\r
+        public bool UsesPictureFilters { get; set; }\r
 \r
         /// <summary>\r
-        /// Returns a string with the Advanced H264 query string\r
+        /// Gets or sets a value indicating whether UsesPictureSettings.\r
         /// </summary>\r
-        public Boolean Verbose\r
-        {\r
-            get { return q_verbose; }\r
-        }\r
-\r
+        public bool UsesPictureSettings { get; set; }\r
         #endregion\r
 \r
         #endregion\r
 \r
-        // All the Main Window GUI options\r
         /// <summary>\r
         /// Takes in a query which can be in any order and parses it. \r
         /// All varibles are then set so they can be used elsewhere.\r
         /// </summary>\r
         /// <param name="input">A ClI Query</param>\r
         /// <returns>A Parsed Query</returns>\r
-        public static QueryParser Parse(String input)\r
+        public static QueryParser Parse(string input)\r
         {\r
             var thisQuery = new QueryParser();\r
 \r
             #region Regular Expressions\r
 \r
-            // Useful Destination Finder\r
-            //Regex r1 = new Regex(@"(-i)(?:\s\"")([a-zA-Z0-9?';!^%&*()_\-:\\\s\.]+)(?:\"")");\r
-            //Match source = r1.Match(input.Replace('"', '\"'));\r
-\r
-            //Source\r
+            // Source\r
             Match title = Regex.Match(input, @"-t ([0-9]*)");\r
             Match chapters = Regex.Match(input, @"-c ([0-9-]*)");\r
-           \r
-            //Output Settings\r
+\r
+            // Output Settings\r
             Match format = Regex.Match(input, @"-f ([a-z0-9a-z0-9a-z0-9]*)");\r
             Match grayscale = Regex.Match(input, @" -g");\r
             Match largerMp4 = Regex.Match(input, @" -4");\r
             Match ipodAtom = Regex.Match(input, @" -I");\r
 \r
-            //Picture Settings Tab\r
+            // Picture Settings Tab\r
             Match width = Regex.Match(input, @"-w ([0-9]*)");\r
             Match height = Regex.Match(input, @"-l ([0-9]*)");\r
             Match maxWidth = Regex.Match(input, @"-X ([0-9]*)");\r
             Match maxHeight = Regex.Match(input, @"-Y ([0-9]*)");\r
             Match crop = Regex.Match(input, @"--crop ([0-9]*):([0-9]*):([0-9]*):([0-9]*)");\r
-            Match lanamorphic = Regex.Match(input, @" -P");\r
-            Match anamorphic = Regex.Match(input, @" -p ");\r
+\r
+            Match looseAnamorphic = Regex.Match(input, @"--loose-anamorphic");\r
+            Match strictAnamorphic = Regex.Match(input, @"--strict-anamorphic");\r
+            Match customAnamorphic = Regex.Match(input, @"--custom-anamorphic");\r
+\r
+            Match keepDisplayAsect = Regex.Match(input, @"--keep-display-aspect");\r
+            Match displayWidth = Regex.Match(input, @"--display-width ([0-9]*)");\r
+            Match pixelAspect = Regex.Match(input, @"--pixel-aspect ([0-9]*):([0-9]*)");\r
+            Match modulus = Regex.Match(input, @"--modulus ([0-9]*)");\r
 \r
             // Picture Settings - Filters\r
             Match decomb = Regex.Match(input, @" --decomb");\r
@@ -654,9 +334,9 @@ namespace Handbrake.Functions
             Match detelecine = Regex.Match(input, @"--detelecine");\r
             Match detelecineValue = Regex.Match(input, @" --detelecine=\""([a-zA-Z0-9.:]*)\""");\r
 \r
-            //Video Settings Tab\r
+            // Video Settings Tab\r
             Match videoEncoder = Regex.Match(input, @"-e ([a-zA-Z0-9]*)");\r
-            Match videoFramerate = Regex.Match(input, @"-r ([0-9]*)");\r
+            Match videoFramerate = Regex.Match(input, @"-r ([0-9.]*)");\r
             Match videoBitrate = Regex.Match(input, @"-b ([0-9]*)");\r
             Match videoQuality = Regex.Match(input, @"-q ([0-9.]*)");\r
             Match videoFilesize = Regex.Match(input, @"-S ([0-9.]*)");\r
@@ -664,37 +344,14 @@ namespace Handbrake.Functions
             Match turboFirstPass = Regex.Match(input, @" -T");\r
             Match optimizeMP4 = Regex.Match(input, @" -O");\r
 \r
-            //Audio Settings Tab\r
+            // Audio Settings Tab\r
             Match noAudio = Regex.Match(input, @"-a none");\r
-            Match audioTrack1 = Regex.Match(input, @"-a ([0-9]*)");\r
-            Match audioTrack2 = Regex.Match(input, @"-a ([0-9]*),([0-9]*)");\r
-            Match audioTrack3 = Regex.Match(input, @"-a ([0-9]*),([0-9]*),([0-9]*)");\r
-            Match audioTrack4 = Regex.Match(input, @"-a ([0-9]*),([0-9]*),([0-9]*),([0-9]*)");\r
-\r
-            Match audioTrack1Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*)");\r
-            Match audioTrack2Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*)");\r
-            Match audioTrack3Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*)");\r
-            Match audioTrack4Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*)");\r
-\r
-            Match audioEncoder1 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*)");\r
-            Match audioEncoder2 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");\r
-            Match audioEncoder3 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");\r
-            Match audioEncoder4 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");\r
-\r
-            Match audioBitrate1 = Regex.Match(input, @"-B ([0-9auto]*)");\r
-            Match audioBitrate2 = Regex.Match(input, @"-B ([0-9auto]*),([0-9auto]*)");\r
-            Match audioBitrate3 = Regex.Match(input, @"-B ([0-9auto]*),([0-9auto]*),([0-9auto]*)");\r
-            Match audioBitrate4 = Regex.Match(input, @"-B ([0-9auto]*),([0-9auto]*),([0-9auto]*),([0-9auto]*)");\r
-\r
-            Match audioSampleRate1 = Regex.Match(input, @"-R ([0-9Auto.]*)");\r
-            Match audioSampleRate2 = Regex.Match(input, @"-R ([0-9Auto.]*),([0-9Auto.]*)");\r
-            Match audioSampleRate3 = Regex.Match(input, @"-R ([0-9Auto.]*),([0-9Auto.]*),([0-9Auto.]*)");\r
-            Match audioSampleRate4 = Regex.Match(input, @"-R ([0-9Auto.]*),([0-9Auto.]*),([0-9Auto.]*),([0-9Auto.]*)");\r
-\r
-            Match drc1 = Regex.Match(input, @"-D ([0-9.]*)");\r
-            Match drc2 = Regex.Match(input, @"-D ([0-9.]*),([0-9.]*)");\r
-            Match drc3 = Regex.Match(input, @"-D ([0-9.]*),([0-9.]*),([0-9.]*)");\r
-            Match drc4 = Regex.Match(input, @"-D ([0-9.]*),([0-9.]*),([0-9.]*),([0-9.]*)");\r
+            Match audioTracks = Regex.Match(input, @"-a ([0-9,]*)");\r
+            Match audioTrackMixes = Regex.Match(input, @"-6 ([0-9a-zA-Z,]*)");\r
+            Match audioEncoders = Regex.Match(input, @"-E ([a-zA-Z0-9+,]*)");\r
+            Match audioBitrates = Regex.Match(input, @"-B ([0-9a-zA-Z,]*)"); // Auto = a-z\r
+            Match audioSampleRates = Regex.Match(input, @"-R ([0-9a-zA-Z.,]*)"); // Auto = a-z\r
+            Match drcValues = Regex.Match(input, @"-D ([0-9.,]*)");\r
 \r
             Match subtitles = Regex.Match(input, @"-s ([0-9a-zA-Z]*)");\r
             Match subScan = Regex.Match(input, @" -U");\r
@@ -704,10 +361,10 @@ namespace Handbrake.Functions
             Match chapterMarkers = Regex.Match(input, @" -m");\r
             Match chapterMarkersFileMode = Regex.Match(input, @"--markers");\r
 \r
-            //H264 Tab\r
+            // H264 Tab\r
             Match x264 = Regex.Match(input, @"-x ([.,/a-zA-Z0-9=:-]*)");\r
 \r
-            //Program Options\r
+            // Program Options\r
             Match verbose = Regex.Match(input, @" -v");\r
 \r
             #endregion\r
@@ -719,114 +376,138 @@ namespace Handbrake.Functions
                 #region Source Tab\r
 \r
                 if (title.Success)\r
-                    thisQuery.q_dvdTitle = int.Parse(title.ToString().Replace("-t ", ""));\r
+                    thisQuery.Title = int.Parse(title.ToString().Replace("-t ", string.Empty));\r
 \r
                 if (chapters.Success)\r
                 {\r
-                    string[] actTitles = chapters.ToString().Replace("-c ", "").Split('-');\r
-                    thisQuery.q_chaptersStart = int.Parse(actTitles[0]);\r
+                    string[] actTitles = chapters.ToString().Replace("-c ", string.Empty).Split('-');\r
+                    thisQuery.ChapterStart = int.Parse(actTitles[0]);\r
                     if (actTitles.Length > 1)\r
                     {\r
-                        thisQuery.q_chaptersFinish = int.Parse(actTitles[1]);\r
+                        thisQuery.ChapterFinish = int.Parse(actTitles[1]);\r
                     }\r
 \r
-                    if ((thisQuery.q_chaptersStart == 1) && (thisQuery.q_chaptersFinish == 0))\r
-                        thisQuery.q_chaptersFinish = thisQuery.q_chaptersStart;\r
+                    if ((thisQuery.ChapterStart == 1) && (thisQuery.ChapterFinish == 0))\r
+                        thisQuery.ChapterFinish = thisQuery.ChapterStart;\r
                 }\r
+\r
                 #endregion\r
 \r
                 #region Output Settings\r
 \r
                 if (format.Success)\r
-                    thisQuery.q_format = format.ToString().Replace("-f ", "");\r
-                thisQuery.q_largeMp4 = largerMp4.Success;\r
-                thisQuery.q_ipodAtom = ipodAtom.Success;\r
-                thisQuery.q_optimizeMp4 = optimizeMP4.Success;\r
+                    thisQuery.Format = format.ToString().Replace("-f ", string.Empty);\r
+                thisQuery.LargeMP4 = largerMp4.Success;\r
+                thisQuery.IpodAtom = ipodAtom.Success;\r
+                thisQuery.OptimizeMP4 = optimizeMP4.Success;\r
 \r
                 #endregion\r
 \r
                 #region Picture Tab\r
 \r
                 if (width.Success)\r
-                    thisQuery.q_videoWidth = int.Parse(width.ToString().Replace("-w ", ""));\r
+                    thisQuery.Width = int.Parse(width.Groups[0].Value.Replace("-w ", string.Empty));\r
 \r
                 if (height.Success)\r
-                    thisQuery.q_videoHeight = int.Parse(height.ToString().Replace("-l ", ""));\r
+                    thisQuery.Height = int.Parse(height.Groups[0].Value.Replace("-l ", string.Empty));\r
 \r
                 if (maxWidth.Success)\r
-                    thisQuery.q_maxWidth = int.Parse(maxWidth.ToString().Replace("-X ", ""));\r
+                    thisQuery.MaxWidth = int.Parse(maxWidth.Groups[0].Value.Replace("-X ", string.Empty));\r
 \r
                 if (maxHeight.Success)\r
-                    thisQuery.q_maxHeight = int.Parse(maxHeight.ToString().Replace("-Y ", ""));\r
+                    thisQuery.MaxHeight = int.Parse(maxHeight.Groups[0].Value.Replace("-Y ", string.Empty));\r
 \r
                 if (crop.Success)\r
                 {\r
-                    thisQuery.q_cropValues = crop.ToString().Replace("--crop ", "");\r
-                    string[] actCropValues = thisQuery.q_cropValues.Split(':');\r
-                    thisQuery.q_croptop = actCropValues[0];\r
-                    thisQuery.q_cropbottom = actCropValues[1];\r
-                    thisQuery.q_cropLeft = actCropValues[2];\r
-                    thisQuery.q_cropRight = actCropValues[3];\r
+                    thisQuery.CropValues = crop.ToString().Replace("--crop ", string.Empty);\r
+                    string[] actCropValues = thisQuery.CropValues.Split(':');\r
+                    thisQuery.CropTop = actCropValues[0];\r
+                    thisQuery.CropBottom = actCropValues[1];\r
+                    thisQuery.CropLeft = actCropValues[2];\r
+                    thisQuery.CropRight = actCropValues[3];\r
                 }\r
-                \r
-                thisQuery.q_anamorphic = anamorphic.Success;\r
-                thisQuery.q_looseAnamorphic = lanamorphic.Success;\r
+\r
+                if (strictAnamorphic.Success)\r
+                    thisQuery.AnamorphicMode = 1;\r
+                else if (looseAnamorphic.Success)\r
+                    thisQuery.AnamorphicMode = 2;\r
+                else if (customAnamorphic.Success)\r
+                    thisQuery.AnamorphicMode = 3;\r
+                else\r
+                    thisQuery.AnamorphicMode = 0;\r
+\r
+                thisQuery.KeepDisplayAsect = keepDisplayAsect.Success;\r
+\r
+                if (displayWidth.Success)\r
+                    thisQuery.DisplayWidthValue =\r
+                        double.Parse(displayWidth.Groups[0].Value.Replace("--display-width ", string.Empty));\r
+\r
+                if (pixelAspect.Success)\r
+                    thisQuery.PixelAspectWidth = int.Parse(pixelAspect.Groups[1].Value.Replace("--pixel-aspect ", string.Empty));\r
+\r
+                if (pixelAspect.Success && pixelAspect.Groups.Count >= 3)\r
+                    thisQuery.PixelAspectHeight = int.Parse(pixelAspect.Groups[2].Value.Replace("--pixel-aspect ", string.Empty));\r
+\r
+                if (modulus.Success)\r
+                    thisQuery.AnamorphicModulus = int.Parse(modulus.Groups[0].Value.Replace("--modulus ", string.Empty));\r
 \r
                 #endregion\r
 \r
                 #region Filters\r
 \r
-                thisQuery.q_decomb = "Off";\r
+                thisQuery.Decomb = "Off";\r
                 if (decomb.Success)\r
                 {\r
-                    thisQuery.q_decomb = "Default";\r
+                    thisQuery.Decomb = "Default";\r
                     if (decombValue.Success)\r
-                        thisQuery.q_decomb = decombValue.ToString().Replace("--decomb=", "").Replace("\"", "");\r
+                        thisQuery.Decomb = decombValue.ToString().Replace("--decomb=", string.Empty).Replace("\"", string.Empty);\r
                 }\r
 \r
-                thisQuery.q_deinterlace = "None";\r
+                thisQuery.DeInterlace = "Off";\r
                 if (deinterlace.Success)\r
                 {\r
-                    thisQuery.q_deinterlace = deinterlace.ToString().Replace("--deinterlace=", "").Replace("\"", "");\r
-                    thisQuery.q_deinterlace = thisQuery.q_deinterlace.Replace("fast", "Fast").Replace("slow", "Slow").Replace("slower", "Slower");\r
-                    thisQuery.q_deinterlace = thisQuery.q_deinterlace.Replace("slowest", "Slowest");\r
+                    thisQuery.DeInterlace = deinterlace.ToString().Replace("--deinterlace=", string.Empty).Replace("\"", string.Empty);\r
+                    thisQuery.DeInterlace =\r
+                        thisQuery.DeInterlace.Replace("fast", "Fast").Replace("slow", "Slow").Replace("slower", "Slower");\r
+                    thisQuery.DeInterlace = thisQuery.DeInterlace.Replace("slowest", "Slowest");\r
                 }\r
 \r
-                thisQuery.q_denoise = "None";\r
+                thisQuery.DeNoise = "Off";\r
                 if (denoise.Success)\r
                 {\r
-                    thisQuery.q_denoise = denoise.ToString().Replace("--denoise=", "").Replace("\"", "");\r
-                    thisQuery.q_denoise = thisQuery.q_denoise.Replace("weak", "Weak").Replace("medium", "Medium").Replace("strong", "Strong");\r
+                    thisQuery.DeNoise = denoise.ToString().Replace("--denoise=", string.Empty).Replace("\"", string.Empty);\r
+                    thisQuery.DeNoise =\r
+                        thisQuery.DeNoise.Replace("weak", "Weak").Replace("medium", "Medium").Replace("strong", "Strong");\r
                 }\r
 \r
-                string deblockValue = "";\r
-                thisQuery.q_deBlock = 0;\r
+                string deblockValue = string.Empty;\r
+                thisQuery.DeBlock = 0;\r
                 if (deblock.Success)\r
-                    deblockValue = deblock.ToString().Replace("--deblock=", "");\r
-                if (deblockValue != "")\r
-                    int.TryParse(deblockValue, out thisQuery.q_deBlock);\r
+                    deblockValue = deblock.ToString().Replace("--deblock=", string.Empty);\r
+\r
+                int dval = 0;\r
+                if (deblockValue != string.Empty)\r
+                    int.TryParse(deblockValue, out dval);\r
+                thisQuery.DeBlock = dval;\r
 \r
-                thisQuery.q_detelecine = "Off";\r
+                thisQuery.DeTelecine = "Off";\r
                 if (detelecine.Success)\r
                 {\r
-                    thisQuery.q_detelecine = "Default";\r
+                    thisQuery.DeTelecine = "Default";\r
                     if (detelecineValue.Success)\r
-                        thisQuery.q_detelecine = detelecineValue.ToString().Replace("--detelecine=", "").Replace("\"", "");\r
+                        thisQuery.DeTelecine = detelecineValue.ToString().Replace("--detelecine=", string.Empty).Replace("\"", string.Empty);\r
                 }\r
 \r
                 #endregion\r
 \r
                 #region Video Settings Tab\r
 \r
-                string videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", "");\r
+                string videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", string.Empty);\r
                 switch (videoEncoderConvertion)\r
                 {\r
                     case "ffmpeg":\r
                         videoEncoderConvertion = "MPEG-4 (FFmpeg)";\r
                         break;\r
-                    case "xvid":\r
-                        videoEncoderConvertion = "MPEG-4 (XviD)";\r
-                        break;\r
                     case "x264":\r
                         videoEncoderConvertion = "H.264 (x264)";\r
                         break;\r
@@ -837,248 +518,124 @@ namespace Handbrake.Functions
                         videoEncoderConvertion = "MPEG-4 (FFmpeg)";\r
                         break;\r
                 }\r
-                thisQuery.q_videoEncoder = videoEncoderConvertion;\r
-                thisQuery.q_videoFramerate = videoFramerate.Success ? videoFramerate.ToString().Replace("-r ", "") : "Same as source";\r
-                thisQuery.q_grayscale = grayscale.Success;\r
-                thisQuery.q_twoPass = twoPass.Success;\r
-                thisQuery.q_turboFirst = turboFirstPass.Success;\r
-                \r
+                thisQuery.VideoEncoder = videoEncoderConvertion;\r
+                thisQuery.VideoFramerate = videoFramerate.Success\r
+                                               ? videoFramerate.ToString().Replace("-r ", string.Empty)\r
+                                               : "Same as source";\r
+                thisQuery.Grayscale = grayscale.Success;\r
+                thisQuery.TwoPass = twoPass.Success;\r
+                thisQuery.TurboFirstPass = turboFirstPass.Success;\r
+\r
                 if (videoBitrate.Success)\r
-                    thisQuery.q_avgBitrate = videoBitrate.ToString().Replace("-b ", "");\r
+                    thisQuery.AverageVideoBitrate = videoBitrate.ToString().Replace("-b ", string.Empty);\r
                 if (videoFilesize.Success)\r
-                    thisQuery.q_videoTargetSize = videoFilesize.ToString().Replace("-S ", "");\r
+                    thisQuery.VideoTargetSize = videoFilesize.ToString().Replace("-S ", string.Empty);\r
 \r
                 if (videoQuality.Success)\r
                 {\r
-                   float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", ""), Culture);\r
-                    //qConvert = Math.Ceiling(qConvert);\r
-                    thisQuery.q_videoQuality = qConvert;\r
-                }\r
-                #endregion\r
-\r
-                #region Audio Tab\r
-\r
-                // Tracks\r
-                if (noAudio.Success)\r
-                    thisQuery.q_audioTrack1 = "None";\r
-                else if (audioTrack1.Success)\r
-                    thisQuery.q_audioTrack1 = "Automatic";\r
-\r
-                if (audioTrack2.Success)\r
-                {\r
-                    string[] audioChan = audioTrack2.ToString().Split(',');\r
-                    thisQuery.q_audioTrack2 = audioChan[1];\r
-                }\r
-                else\r
-                    thisQuery.q_audioTrack2 = "None";\r
-\r
-                if (audioTrack3.Success)\r
-                {\r
-                    string[] audioChan = audioTrack3.ToString().Split(',');\r
-                    thisQuery.q_audioTrack3 = audioChan[2];\r
-                }\r
-                else\r
-                    thisQuery.q_audioTrack3 = "None";\r
-\r
-                if (audioTrack4.Success)\r
-                {\r
-                    string[] audioChan = audioTrack4.ToString().Split(',');\r
-                    thisQuery.q_audioTrack4 = audioChan[3];\r
+                    float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", string.Empty), Culture);\r
+                    thisQuery.VideoQuality = qConvert;\r
                 }\r
                 else\r
-                    thisQuery.q_audioTrack4 = "None";\r
-\r
+                    thisQuery.VideoQuality = -1;\r
 \r
-                // Mixdowns\r
-                thisQuery.q_audioTrackMix1 = "Automatic";\r
-                if (audioTrack1Mix.Success)\r
-                    thisQuery.q_audioTrackMix1 =\r
-                        getMixDown(audioTrack1Mix.ToString().Replace("-6 ", "").Replace(" ", ""));\r
-\r
-                thisQuery.q_audioTrackMix2 = "Automatic";\r
-                if (audioTrack2Mix.Success)\r
-                {\r
-                    string[] audio2mix = audioTrack2Mix.ToString().Split(',');\r
-                    thisQuery.q_audioTrackMix2 = getMixDown(audio2mix[1].Trim());\r
-                }\r
-\r
-                thisQuery.q_audioTrackMix3 = "Automatic";\r
-                if (audioTrack3Mix.Success)\r
-                {\r
-                    string[] audio3mix = audioTrack3Mix.ToString().Split(',');\r
-                    thisQuery.q_audioTrackMix3 = getMixDown(audio3mix[2].Trim());\r
-                }\r
-\r
-                thisQuery.q_audioTrackMix4 = "Automatic";\r
-                if (audioTrack4Mix.Success)\r
-                {\r
-                    string[] audio4mix = audioTrack4Mix.ToString().Split(',');\r
-                    thisQuery.q_audioTrackMix4 = getMixDown(audio4mix[3].Trim());\r
-                }\r
-\r
-\r
-                // Audio Encoders\r
-                if (audioEncoder1.Success)\r
-                    thisQuery.q_audioEncoder1 = getAudioEncoder(audioEncoder1.ToString().Replace("-E ", ""));\r
-\r
-                if (audioEncoder2.Success)\r
-                {\r
-                    string[] audio2enc = audioEncoder2.ToString().Split(',');\r
-                    thisQuery.q_audioEncoder2 = getAudioEncoder(audio2enc[1].Trim());\r
-                }\r
-\r
-                if (audioEncoder3.Success)\r
-                {\r
-                    string[] audio3enc = audioEncoder3.ToString().Split(',');\r
-                    thisQuery.q_audioEncoder3 = getAudioEncoder(audio3enc[2].Trim());\r
-                }\r
-\r
-                if (audioEncoder4.Success)\r
-                {\r
-                    string[] audio4enc = audioEncoder4.ToString().Split(',');\r
-                    thisQuery.q_audioEncoder4 = getAudioEncoder(audio4enc[3].Trim());\r
-                }\r
-\r
-\r
-                // Audio Bitrate\r
-                thisQuery.q_audioBitrate1 = "";\r
-                if (audioBitrate1.Success)\r
-                {\r
-                    thisQuery.q_audioBitrate1 = audioBitrate1.ToString().Replace("-B ", "").Trim();\r
-                    if (audioBitrate1.ToString().Replace("-B ", "").Trim() == "0") thisQuery.q_audioBitrate1 = "Auto";\r
-                }\r
-\r
-                thisQuery.q_audioBitrate2 = "";\r
-                if (audioBitrate2.Success && audioTrack2.Success)\r
-                {\r
-                    string[] audioBitrateSelect = audioBitrate2.ToString().Split(',');\r
-                    if (audioBitrateSelect[1].Trim() == "0") audioBitrateSelect[1] = "Auto";\r
-                    thisQuery.q_audioBitrate2 = audioBitrateSelect[1].Trim();\r
-                }\r
-\r
-                thisQuery.q_audioBitrate3 = "";\r
-                if (audioBitrate3.Success && audioTrack3.Success)\r
-                {\r
-                    string[] audioBitrateSelect = audioBitrate3.ToString().Split(',');\r
-                    if (audioBitrateSelect[2].Trim() == "0") audioBitrateSelect[2] = "Auto";\r
-                    thisQuery.q_audioBitrate3 = audioBitrateSelect[2].Trim();\r
-                }\r
-\r
-                thisQuery.q_audioBitrate4 = "";\r
-                if (audioBitrate4.Success)\r
-                {\r
-                    string[] audioBitrateSelect = audioBitrate4.ToString().Split(',');\r
-                    if (audioBitrateSelect[3].Trim() == "0") audioBitrateSelect[3] = "Auto";\r
-                    thisQuery.q_audioBitrate4 = audioBitrateSelect[3].Trim();\r
-                }\r
-\r
-\r
-                // Audio Sample Rate\r
-                // Make sure to change 0 to Auto\r
-                thisQuery.q_audioSamplerate1 = "Auto";\r
-                if (audioSampleRate1.Success)\r
-                {\r
-                    thisQuery.q_audioSamplerate1 = audioSampleRate1.ToString().Replace("-R ", "").Trim();\r
-                    if (thisQuery.q_audioSamplerate1 == "0") thisQuery.q_audioSamplerate1 = "Auto";\r
-                }\r
+                #endregion\r
 \r
+                #region Audio Tab\r
 \r
-                if (audioSampleRate2.Success)\r
+                // Find out how many tracks we need to add by checking how many encoders or audio tracks are selected.\r
+                int encoderCount = 0;\r
+                if (audioEncoders.Success)\r
                 {\r
-                    string[] audioSRSelect = audioSampleRate2.ToString().Split(',');\r
-                    if (audioSRSelect[1] == "0") audioSRSelect[1] = "Auto";\r
-                    thisQuery.q_audioSamplerate2 = audioSRSelect[1].Trim();\r
+                    string[] audioDataCounters = audioEncoders.ToString().Replace("-E ", string.Empty).Split(',');\r
+                    encoderCount = audioDataCounters.Length;\r
                 }\r
 \r
-                if (audioSampleRate3.Success)\r
+                // Get the data from the regular expression results\r
+                string[] trackData = null;\r
+                string[] trackMixes = null;\r
+                string[] trackEncoders = null;\r
+                string[] trackBitrates = null;\r
+                string[] trackSamplerates = null;\r
+                string[] trackDRCvalues = null;\r
+\r
+                if (audioTracks.Success)\r
+                    trackData = audioTracks.ToString().Replace("-a ", string.Empty).Split(',');\r
+                if (audioTrackMixes.Success)\r
+                    trackMixes = audioTrackMixes.ToString().Replace("-6 ", string.Empty).Split(',');\r
+                if (audioEncoders.Success)\r
+                    trackEncoders = audioEncoders.ToString().Replace("-E ", string.Empty).Split(',');\r
+                if (audioBitrates.Success)\r
+                    trackBitrates = audioBitrates.ToString().Replace("-B ", string.Empty).Split(',');\r
+                if (audioSampleRates.Success)\r
+                    trackSamplerates = audioSampleRates.ToString().Replace("-R ", string.Empty).Split(',');\r
+                if (drcValues.Success)\r
+                    trackDRCvalues = drcValues.ToString().Replace("-D ", string.Empty).Split(',');\r
+\r
+                // Create new Audio Track Classes and store them in the ArrayList\r
+                ArrayList allAudioTrackInfo = new ArrayList();\r
+                for (int x = 0; x < encoderCount; x++)\r
                 {\r
-                    string[] audioSRSelect = audioSampleRate3.ToString().Split(',');\r
-                    if (audioSRSelect[2] == "0") audioSRSelect[2] = "Auto";\r
-                    thisQuery.q_audioSamplerate3 = audioSRSelect[2].Trim();\r
-                }\r
+                    AudioTrack track = new AudioTrack();\r
+                    if (trackData != null)\r
+                        if (trackData.Length >= (x + 1)) // Audio Track\r
+                            track.Track = trackData[x].Trim();\r
 \r
-                if (audioSampleRate4.Success)\r
-                {\r
-                    string[] audioSRSelect = audioSampleRate4.ToString().Split(',');\r
-                    if (audioSRSelect[3] == "0") audioSRSelect[3] = "Auto";\r
-                    thisQuery.q_audioSamplerate4 = audioSRSelect[3].Trim();\r
-                }\r
+                    if (trackMixes != null)\r
+                        if (trackMixes.Length >= (x + 1)) // Audio Mix\r
+                            track.MixDown = GetMixDown(trackMixes[x].Trim());\r
 \r
-                // DRC\r
-                float drcValue;\r
+                    if (trackEncoders != null)\r
+                        if (trackEncoders.Length >= (x + 1)) // Audio Mix\r
+                            track.Encoder = GetAudioEncoder(trackEncoders[x].Trim());\r
 \r
-                thisQuery.q_drc1 = 1;\r
-                if (drc1.Success)\r
-                {\r
-                    string value = drc1.ToString().Replace("-D ", "");\r
-                    float.TryParse(value, out drcValue);\r
-                    thisQuery.q_drc1 = drcValue;\r
-                }\r
+                    if (trackBitrates != null)\r
+                        if (trackBitrates.Length >= (x + 1)) // Audio Encoder\r
+                            track.Bitrate = trackBitrates[x].Trim() == "auto" ? "Auto" : trackBitrates[x].Trim();\r
 \r
-                thisQuery.q_drc2 = 1;\r
-                if (drc2.Success)\r
-                {\r
-                    string[] drcPoint = drc2.ToString().Split(',');\r
-                    float.TryParse(drcPoint[1], out drcValue);\r
-                    thisQuery.q_drc2 = drcValue;\r
-                }\r
+                    if (trackSamplerates != null)\r
+                        if (trackSamplerates.Length >= (x + 1)) // Audio SampleRate\r
+                            track.SampleRate = trackSamplerates[x].Trim() == "0" ? "Auto" : trackSamplerates[x].Trim();\r
 \r
-                thisQuery.q_drc3 = 1;\r
-                if (drc3.Success)\r
-                {\r
-                    string[] drcPoint = drc3.ToString().Split(',');\r
-                    float.TryParse(drcPoint[2], out drcValue);\r
-                    thisQuery.q_drc3 = drcValue;\r
-                }\r
+                    if (trackDRCvalues != null)\r
+                        if (trackDRCvalues.Length >= (x + 1)) // Audio DRC Values\r
+                            track.DRC = trackDRCvalues[x].Trim();\r
 \r
-                thisQuery.q_drc4 = 1;\r
-                if (drc4.Success)\r
-                {\r
-                    string[] drcPoint = drc4.ToString().Split(',');\r
-                    float.TryParse(drcPoint[3], out drcValue);\r
-                    thisQuery.q_drc4 = drcValue;\r
+                    allAudioTrackInfo.Add(track);\r
                 }\r
+                thisQuery.AudioInformation = allAudioTrackInfo;\r
 \r
                 // Subtitle Stuff\r
                 if (subtitles.Success)\r
-                    thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", "");\r
+                    thisQuery.Subtitles = subtitles.ToString().Replace("-s ", string.Empty);\r
                 else\r
-                {\r
-                    if (subScan.Success)\r
-                        thisQuery.q_subtitles = "Autoselect";\r
-                    else\r
-                        thisQuery.q_subtitles = "None";\r
-                }\r
+                    thisQuery.Subtitles = subScan.Success ? "Autoselect" : "None";\r
 \r
-                thisQuery.q_forcedSubs = forcedSubtitles.Success;\r
+                thisQuery.ForcedSubtitles = forcedSubtitles.Success;\r
 \r
                 #endregion\r
 \r
                 #region Chapters Tab\r
+\r
                 if (chapterMarkersFileMode.Success || chapterMarkers.Success)\r
-                    thisQuery.q_chapterMarkers = true;\r
+                    thisQuery.ChapterMarkers = true;\r
+\r
                 #endregion\r
 \r
                 #region H.264 and other\r
 \r
-                //\r
-                //H264 Tab\r
-                //\r
                 if (x264.Success)\r
-                    thisQuery.q_h264 = x264.ToString().Replace("-x ", "");\r
+                    thisQuery.H264Query = x264.ToString().Replace("-x ", string.Empty);\r
 \r
-                //\r
-                //Progam Options\r
-                //\r
-                thisQuery.q_verbose = verbose.Success;\r
+                thisQuery.Verbose = verbose.Success;\r
 \r
                 #endregion\r
             }\r
             catch (Exception exc)\r
             {\r
-                MessageBox.Show(\r
-                    "An error has occured in the Query Parser. Please report this error on the forum in the 'Windows' support section. \n\n" +\r
-                    exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);\r
+                frmExceptionWindow exceptionWindow = new frmExceptionWindow();\r
+                exceptionWindow.Setup("An error has occured in the Query Parser.", exc.ToString());\r
+                exceptionWindow.ShowDialog();\r
             }\r
 \r
             #endregion\r
@@ -1086,9 +643,14 @@ namespace Handbrake.Functions
             return thisQuery;\r
         }\r
 \r
-        private static string getMixDown(string mixdown)\r
+        /// <summary>\r
+        /// Get the GUI equiv to a CLI mixdown\r
+        /// </summary>\r
+        /// <param name="mixdown">The Audio Mixdown</param>\r
+        /// <returns>The GUI representation of the mixdown</returns>\r
+        private static string GetMixDown(string mixdown)\r
         {\r
-            switch (mixdown)\r
+            switch (mixdown.Trim())\r
             {\r
                 case "mono":\r
                     return "Mono";\r
@@ -1105,20 +667,27 @@ namespace Handbrake.Functions
             }\r
         }\r
 \r
-        private static string getAudioEncoder(string audioEnc)\r
+        /// <summary>\r
+        /// Get the GUI equiv to a CLI audio encoder\r
+        /// </summary>\r
+        /// <param name="audioEnc">The Audio Encoder</param>\r
+        /// <returns>The GUI representation of that audio encoder</returns>\r
+        private static string GetAudioEncoder(string audioEnc)\r
         {\r
             switch (audioEnc)\r
             {\r
                 case "faac":\r
-                    return "AAC";\r
+                    return "AAC (faac)";\r
                 case "lame":\r
-                    return "MP3";\r
+                    return "MP3 (lame)";\r
                 case "vorbis":\r
-                    return "Vorbis";\r
+                    return "Vorbis (vorbis)";\r
                 case "ac3":\r
-                    return "AC3";\r
+                    return "AC3 Passthru";\r
+                case "dts":\r
+                    return "DTS Passthru";\r
                 default:\r
-                    return "AAC";\r
+                    return "AAC (faac)";\r
             }\r
         }\r
     }\r