3 This file is part of the HandBrake source code.
\r
4 Homepage: <http://handbrake.fr>.
\r
5 It may be used under the terms of the GNU General Public License. */
\r
8 using System.Collections.Generic;
\r
10 using System.Text.RegularExpressions;
\r
11 using System.Windows.Forms;
\r
13 namespace Handbrake.Functions
\r
18 // All the Main Window GUI options
\r
22 private string q_source;
\r
24 /// Returns a String
\r
25 /// Full path of the source.
\r
27 public string Source
\r
31 return this.q_source;
\r
34 private int q_dvdTitle;
\r
36 /// Returns an Integer
\r
37 /// DVD Title number.
\r
43 return this.q_dvdTitle;
\r
47 private int q_chaptersStart;
\r
50 /// DVD Chapter number or chapter range.
\r
52 public int DVDChapterStart
\r
56 return this.q_chaptersStart;
\r
60 private int q_chaptersFinish;
\r
63 /// DVD Chapter number or chapter range.
\r
65 public int DVDChapterFinish
\r
69 return this.q_chaptersFinish;
\r
76 private string q_destination;
\r
78 /// Returns a String
\r
79 /// Full path of the destination.
\r
81 public string Destination
\r
85 return this.q_destination;
\r
89 private string q_format;
\r
91 /// Returns a String
\r
92 /// Full path of the destination.
\r
94 public string Format
\r
98 return this.q_format;
\r
102 private string q_videoEncoder;
\r
104 /// Returns an String
\r
105 /// The Video Encoder used.
\r
107 public string VideoEncoder
\r
111 return this.q_videoEncoder;
\r
116 #region Picture Settings
\r
117 private int q_videoWidth;
\r
120 /// The selected Width for the encoding.
\r
126 return this.q_videoWidth;
\r
130 private int q_videoHeight;
\r
133 /// The selected Height for the encoding.
\r
139 return this.q_videoHeight;
\r
143 private string q_cropValues;
\r
145 /// Returns an String
\r
146 /// Cropping values.
\r
148 public string CropValues
\r
152 return this.q_cropValues;
\r
156 private string q_croptop;
\r
158 /// Returns an String
\r
159 /// Cropping values.
\r
161 public string CropTop
\r
165 return this.q_croptop;
\r
169 private string q_cropbottom;
\r
171 /// Returns an String
\r
172 /// Cropping values.
\r
174 public string CropBottom
\r
178 return this.q_cropbottom;
\r
182 private string q_cropLeft;
\r
184 /// Returns an String
\r
185 /// Cropping values.
\r
187 public string CropLeft
\r
191 return this.q_cropLeft;
\r
195 private string q_cropRight;
\r
197 /// Returns an String
\r
198 /// Cropping values.
\r
200 public string CropRight
\r
204 return this.q_cropRight;
\r
208 private Boolean q_detelecine;
\r
210 /// Returns a boolean to indicate wither DeTelecine is on or off
\r
212 public Boolean DeTelecine
\r
216 return this.q_detelecine;
\r
220 private Boolean q_vfr;
\r
222 /// Returns a boolean to indicate wither DeTelecine is on or off
\r
232 private Boolean q_deBlock;
\r
234 /// Returns a boolean to indicate wither DeBlock is on or off.
\r
236 public Boolean DeBlock
\r
240 return this.q_deBlock;
\r
244 private string q_deinterlace;
\r
246 /// Returns a string with the De-Interlace option used.
\r
248 public string DeInterlace
\r
252 return this.q_deinterlace;
\r
256 private string q_denoise;
\r
258 /// Returns a string with the DeNoise option used.
\r
260 public string DeNoise
\r
264 return this.q_denoise;
\r
268 private Boolean q_anamorphic;
\r
270 /// Returns a boolean to indicate wither Anamorphic is on or off.
\r
272 public Boolean Anamorphic
\r
276 return this.q_anamorphic;
\r
280 private Boolean q_looseAnamorphic;
\r
282 /// Returns a boolean to indicate wither Anamorphic is on or off.
\r
284 public Boolean LooseAnamorphic
\r
288 return this.q_looseAnamorphic;
\r
292 private Boolean q_chapterMarkers;
\r
294 /// Returns a boolean to indicate wither Chapter Markers is on or off.
\r
296 public Boolean ChapterMarkers
\r
300 return this.q_chapterMarkers;
\r
305 #region Video Settings
\r
306 private Boolean q_grayscale;
\r
308 /// Returns a boolean to indicate wither Grayscale is on or off.
\r
310 public Boolean Grayscale
\r
314 return this.q_grayscale;
\r
318 private Boolean q_twoPass;
\r
320 /// Returns a boolean to indicate wither Two Pass Encoding is on or off.
\r
322 public Boolean TwoPass
\r
326 return this.q_twoPass;
\r
330 private Boolean q_turboFirst;
\r
332 /// Returns a boolean to indicate wither Chapter Markers is on or off.
\r
334 public Boolean TurboFirstPass
\r
338 return this.q_turboFirst;
\r
342 private Boolean q_largeMp4;
\r
344 /// Returns a boolean to indicate wither Larger MP4 files is on or off.
\r
346 public Boolean LargeMP4
\r
350 return this.q_largeMp4;
\r
354 private Boolean q_ipodAtom;
\r
356 /// Returns a boolean to indicate wither Larger MP4 files is on or off.
\r
358 public Boolean IpodAtom
\r
362 return this.q_ipodAtom;
\r
366 private Boolean q_optimizeMp4;
\r
368 /// Returns a boolean to indicate wither Larger MP4 files is on or off.
\r
370 public Boolean OptimizeMP4
\r
374 return this.q_optimizeMp4;
\r
378 private string q_videoFramerate;
\r
380 /// Returns a string with the video Framerate
\r
382 public string VideoFramerate
\r
386 return this.q_videoFramerate;
\r
390 private string q_avgBitrate;
\r
392 /// Returns a string with the average video bitrate
\r
394 public string AverageVideoBitrate
\r
398 return this.q_avgBitrate;
\r
402 private string q_videoTargetSize;
\r
404 /// Returns a string with the video target size
\r
406 public string VideoTargetSize
\r
410 return this.q_videoTargetSize;
\r
414 private int q_videoQuality;
\r
416 /// Returns a int with the video quality value
\r
418 public int VideoQuality
\r
422 return this.q_videoQuality;
\r
428 #region Audio Settings
\r
429 private string q_audioTrack1;
\r
431 /// Returns a string with the selected Audio track
\r
433 public string AudioTrack1
\r
437 return this.q_audioTrack1;
\r
441 private string q_audioTrack2;
\r
443 /// Returns a string with the selected Audio track
\r
445 public string AudioTrack2
\r
449 return this.q_audioTrack2;
\r
453 private string q_audioTrack3;
\r
455 /// Returns a string with the selected Audio track
\r
457 public string AudioTrack3
\r
461 return this.q_audioTrack3;
\r
465 private string q_audioTrack4;
\r
467 /// Returns a string with the selected Audio track
\r
469 public string AudioTrack4
\r
473 return this.q_audioTrack4;
\r
477 private string q_audioTrackMix1;
\r
479 /// Returns a string with the First selected Audio track Mix
\r
481 public string AudioTrackMix1
\r
485 return this.q_audioTrackMix1;
\r
489 private string q_audioTrackMix2;
\r
491 /// Returns a string with the First selected Audio track Mix
\r
493 public string AudioTrackMix2
\r
497 return this.q_audioTrackMix2;
\r
501 private string q_audioTrackMix3;
\r
503 /// Returns a string with the First selected Audio track Mix
\r
505 public string AudioTrackMix3
\r
509 return this.q_audioTrackMix3;
\r
513 private string q_audioTrackMix4;
\r
515 /// Returns a string with the First selected Audio track Mix
\r
517 public string AudioTrackMix4
\r
521 return this.q_audioTrackMix4;
\r
525 private string q_audioEncoder1;
\r
527 /// Returns an String
\r
528 /// The Audio Encoder used.
\r
530 public string AudioEncoder1
\r
534 return this.q_audioEncoder1;
\r
538 private string q_audioEncoder2;
\r
540 /// Returns an String
\r
541 /// The Audio Encoder used.
\r
543 public string AudioEncoder2
\r
547 return this.q_audioEncoder2;
\r
551 private string q_audioEncoder3;
\r
553 /// Returns an String
\r
554 /// The Audio Encoder used.
\r
556 public string AudioEncoder3
\r
560 return this.q_audioEncoder3;
\r
564 private string q_audioEncoder4;
\r
566 /// Returns an String
\r
567 /// The Audio Encoder used.
\r
569 public string AudioEncoder4
\r
573 return this.q_audioEncoder4;
\r
577 private string q_audioBitrate1;
\r
579 /// Returns a string with the audio bitrate
\r
581 public string AudioBitrate1
\r
585 return this.q_audioBitrate1;
\r
589 private string q_audioBitrate2;
\r
591 /// Returns a string with the audio bitrate
\r
593 public string AudioBitrate2
\r
597 return this.q_audioBitrate2;
\r
601 private string q_audioBitrate3;
\r
603 /// Returns a string with the audio bitrate
\r
605 public string AudioBitrate3
\r
609 return this.q_audioBitrate3;
\r
613 private string q_audioBitrate4;
\r
615 /// Returns a string with the audio bitrate
\r
617 public string AudioBitrate4
\r
621 return this.q_audioBitrate4;
\r
625 private string q_audioSamplerate1;
\r
627 /// Returns a string with the audio sample rate
\r
629 public string AudioSamplerate1
\r
633 return this.q_audioSamplerate1;
\r
637 private string q_audioSamplerate2;
\r
639 /// Returns a string with the audio sample rate
\r
641 public string AudioSamplerate2
\r
645 return this.q_audioSamplerate2;
\r
649 private string q_audioSamplerate3;
\r
651 /// Returns a string with the audio sample rate
\r
653 public string AudioSamplerate3
\r
657 return this.q_audioSamplerate3;
\r
661 private string q_audioSamplerate4;
\r
663 /// Returns a string with the audio sample rate
\r
665 public string AudioSamplerate4
\r
669 return this.q_audioSamplerate4;
\r
673 private double q_drc1;
\r
675 /// Returns a string with the selected subtitle track
\r
681 return this.q_drc1;
\r
685 private double q_drc2;
\r
687 /// Returns a string with the selected subtitle track
\r
693 return this.q_drc2;
\r
697 private double q_drc3;
\r
699 /// Returns a string with the selected subtitle track
\r
705 return this.q_drc3;
\r
709 private double q_drc4;
\r
711 /// Returns a string with the selected subtitle track
\r
717 return this.q_drc4;
\r
721 private string q_subtitles;
\r
723 /// Returns a string with the selected subtitle track
\r
725 public string Subtitles
\r
729 return this.q_subtitles;
\r
733 private Boolean q_forcedSubs;
\r
735 /// Returns a string with the selected subtitle track
\r
737 public Boolean ForcedSubtitles
\r
741 return this.q_forcedSubs;
\r
748 private string q_h264;
\r
750 /// Returns a string with the Advanced H264 query string
\r
752 public string H264Query
\r
756 return this.q_h264;
\r
759 private Boolean q_verbose;
\r
761 /// Returns a string with the Advanced H264 query string
\r
763 public Boolean Verbose
\r
767 return this.q_verbose;
\r
774 // Takes in a query which can be in any order and parses it. All varibles are then set so they can be used elsewhere.
\r
775 public static QueryParser Parse(String input)
\r
777 QueryParser thisQuery = new QueryParser();
\r
779 #region Regular Expressions
\r
781 Regex r1 = new Regex(@"(-i)(?:\s\"")([a-zA-Z0-9:\\\s\.]+)(?:\"")");
\r
782 Match source = r1.Match(input.Replace('"', '\"'));
\r
783 Match title = Regex.Match(input, @"-t ([0-9]*)");
\r
784 Match chapters = Regex.Match(input, @"-c ([0-9-]*)");
\r
785 Match format = Regex.Match(input, @"-f ([a-z0-9a-z0-9a-z0-9]*)");
\r
788 Regex r2 = new Regex(@"(-o)(?:\s\"")([a-zA-Z0-9_\-:\\\s\.]+)(?:\"")");
\r
789 Match destination = r2.Match(input.Replace('"', '\"'));
\r
790 Match videoEncoder = Regex.Match(input, @"-e ([a-zA-Z0-9]*)");
\r
792 //Picture Settings Tab
\r
793 Match width = Regex.Match(input, @"-w ([0-9]*)");
\r
794 Match height = Regex.Match(input, @"-l ([0-9]*)");
\r
795 Match deinterlace = Regex.Match(input, @"--deinterlace=\""([a-zA-Z]*)\""");
\r
796 Match denoise = Regex.Match(input, @"--denoise=\""([a-zA-Z]*)\""");
\r
797 Match deblock = Regex.Match(input, @"--deblock");
\r
798 Match detelecine = Regex.Match(input, @"--detelecine");
\r
799 Match anamorphic = Regex.Match(input, @"-p ");
\r
800 Match chapterMarkers = Regex.Match(input, @"-m");
\r
801 Match crop = Regex.Match(input, @"--crop ([0-9]):([0-9]):([0-9]):([0-9])");
\r
802 Match vfr = Regex.Match(input, @"-V");
\r
803 Match lanamorphic = Regex.Match(input, @"-P");
\r
805 //Video Settings Tab
\r
806 Match videoFramerate = Regex.Match(input, @"-r ([0-9]*)");
\r
807 Match videoBitrate = Regex.Match(input, @"-b ([0-9]*)");
\r
808 Match videoQuality = Regex.Match(input, @"-q ([0-9.]*)");
\r
809 Match videoFilesize = Regex.Match(input, @"-S ([0-9.]*)");
\r
810 Match twoPass = Regex.Match(input, @"-2");
\r
811 Match turboFirstPass = Regex.Match(input, @"-T");
\r
812 Match grayscale = Regex.Match(input, @"-g");
\r
813 Match largerMp4 = Regex.Match(input, @"-4");
\r
814 Match ipodAtom = Regex.Match(input, @"-I");
\r
815 Match optimizeMP4 = Regex.Match(input, @"-O");
\r
817 //Audio Settings Tab
\r
818 Match audioTrack1 = Regex.Match(input, @"-a ([0-9]*)");
\r
819 Match audioTrack2 = Regex.Match(input, @"-a ([0-9]*),([0-9]*)");
\r
820 Match audioTrack3 = Regex.Match(input, @"-a ([0-9]*),([0-9]*),([0-9]*)");
\r
821 Match audioTrack4 = Regex.Match(input, @"-a ([0-9]*),([0-9]*),([0-9]*),([0-9]*)");
\r
823 Match audioTrack1Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*)");
\r
824 Match audioTrack2Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*)");
\r
825 Match audioTrack3Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*)");
\r
826 Match audioTrack4Mix = Regex.Match(input, @"-6 ([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*),([0-9a-z0-9]*)");
\r
828 Match audioEncoder1 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*)");
\r
829 Match audioEncoder2 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");
\r
830 Match audioEncoder3 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");
\r
831 Match audioEncoder4 = Regex.Match(input, @"-E ([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*),([a-zA-Z0-9+]*)");
\r
833 Match audioBitrate1 = Regex.Match(input, @"-B ([0-9]*)");
\r
834 Match audioBitrate2 = Regex.Match(input, @"-B ([0-9]*),([0-9]*)");
\r
835 Match audioBitrate3 = Regex.Match(input, @"-B ([0-9]*),([0-9]*),([0-9]*)");
\r
836 Match audioBitrate4 = Regex.Match(input, @"-B ([0-9]*),([0-9]*),([0-9]*),([0-9]*)");
\r
838 Match audioSampleRate1 = Regex.Match(input, @"-R ([0-9.]*)");
\r
839 Match audioSampleRate2 = Regex.Match(input, @"-R ([0-9.]*),([0-9.]*)");
\r
840 Match audioSampleRate3 = Regex.Match(input, @"-R ([0-9.]*),([0-9.]*),([0-9.]*)");
\r
841 Match audioSampleRate4 = Regex.Match(input, @"-R ([0-9.]*),([0-9.]*),([0-9.]*),([0-9.]*)");
\r
843 Match drc1 = Regex.Match(input, @"-D ([0-9.]*)");
\r
844 Match drc2 = Regex.Match(input, @"-D ([0-9.]*),([0-9.]*)");
\r
845 Match drc3 = Regex.Match(input, @"-D ([0-9.]*),([0-9.]*),([0-9.]*)");
\r
846 Match drc4 = Regex.Match(input, @"-D ([0-9.]*),([0-9.]*),([0-9.]*),([0-9.]*)");
\r
848 Match subtitles = Regex.Match(input, @"-s ([0-9a-zA-Z]*)");
\r
849 Match subScan = Regex.Match(input, @"-U");
\r
850 Match forcedSubtitles = Regex.Match(input, @"-F");
\r
853 Match x264 = Regex.Match(input, @"-x ([,a-zA-Z0-9=:-]*)");
\r
856 Match verbose = Regex.Match(input, @"-v");
\r
859 #region Set Varibles
\r
865 thisQuery.q_source = source.ToString().Replace("-i ", "").Replace("\"", "");
\r
866 if (title.Success != false)
\r
867 thisQuery.q_dvdTitle = int.Parse(title.ToString().Replace("-t ", ""));
\r
869 if (chapters.Success != false)
\r
871 string[] actTitles = new string[2];
\r
872 actTitles = chapters.ToString().Replace("-c ", "").Split('-');
\r
873 thisQuery.q_chaptersStart = int.Parse(actTitles[0]);
\r
874 if (actTitles.Length > 1)
\r
876 thisQuery.q_chaptersFinish = int.Parse(actTitles[1]);
\r
879 if ((thisQuery.q_chaptersStart == 1) && (thisQuery.q_chaptersFinish == 0))
\r
880 thisQuery.q_chaptersFinish = thisQuery.q_chaptersStart;
\r
883 if (format.Success != false)
\r
884 thisQuery.q_format = format.ToString().Replace("-f ", "");
\r
888 #region Destination
\r
889 thisQuery.q_destination = destination.ToString().Replace("-o ", "").Replace("\"", "");
\r
891 string videoEncoderConvertion;
\r
893 videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", "");
\r
894 switch (videoEncoderConvertion)
\r
897 videoEncoderConvertion = "Mpeg 4";
\r
900 videoEncoderConvertion = "Xvid";
\r
903 videoEncoderConvertion = "H.264";
\r
906 videoEncoderConvertion = "H.264 Baseline 1.3";
\r
909 videoEncoderConvertion = "H.264 (iPod)";
\r
912 videoEncoderConvertion = "Mpeg 4";
\r
915 thisQuery.q_videoEncoder = videoEncoderConvertion;
\r
919 #region Picture Tab
\r
921 if (width.Success != false)
\r
922 thisQuery.q_videoWidth = int.Parse(width.ToString().Replace("-w ", ""));
\r
924 if (height.Success != false)
\r
925 thisQuery.q_videoHeight = int.Parse(height.ToString().Replace("-l ", ""));
\r
928 if (crop.Success != false)
\r
930 thisQuery.q_cropValues = crop.ToString().Replace("--crop ", "");
\r
931 string[] actCropValues = new string[3];
\r
932 actCropValues = thisQuery.q_cropValues.Split(':');
\r
933 thisQuery.q_croptop = actCropValues[0];
\r
934 thisQuery.q_cropbottom = actCropValues[1];
\r
935 thisQuery.q_cropLeft = actCropValues[2];
\r
936 thisQuery.q_cropRight = actCropValues[3];
\r
939 thisQuery.q_detelecine = detelecine.Success;
\r
940 thisQuery.q_deBlock = deblock.Success;
\r
942 thisQuery.q_deinterlace = "None";
\r
943 if (deinterlace.Success != false)
\r
945 switch (deinterlace.ToString().Replace("--deinterlace=", "").Replace("\"",""))
\r
948 thisQuery.q_deinterlace = "Fast";
\r
951 thisQuery.q_deinterlace = "Slow";
\r
954 thisQuery.q_deinterlace = "Slower";
\r
957 thisQuery.q_deinterlace = "Slowest";
\r
960 thisQuery.q_deinterlace = "None";
\r
965 thisQuery.q_denoise = "None";
\r
966 if (denoise.Success != false)
\r
968 switch (denoise.ToString().Replace("--denoise=", ""))
\r
971 thisQuery.q_denoise = "Weak";
\r
974 thisQuery.q_denoise = "Medium";
\r
977 thisQuery.q_denoise = "Strong";
\r
980 thisQuery.q_denoise = "None";
\r
985 thisQuery.q_anamorphic = anamorphic.Success;
\r
986 thisQuery.q_chapterMarkers = chapterMarkers.Success;
\r
987 thisQuery.q_vfr = vfr.Success;
\r
988 thisQuery.q_looseAnamorphic = lanamorphic.Success;
\r
992 #region Video Settings Tab
\r
993 thisQuery.q_grayscale = grayscale.Success;
\r
994 thisQuery.q_twoPass = twoPass.Success;
\r
995 thisQuery.q_turboFirst = turboFirstPass.Success;
\r
996 thisQuery.q_largeMp4 = largerMp4.Success;
\r
997 if (videoFramerate.Success != false)
\r
998 thisQuery.q_videoFramerate = videoFramerate.ToString().Replace("-r ", "");
\r
1000 thisQuery.q_videoFramerate = "Same as source";
\r
1002 if (videoBitrate.Success != false)
\r
1003 thisQuery.q_avgBitrate = videoBitrate.ToString().Replace("-b ", "");
\r
1004 if (videoFilesize.Success != false)
\r
1005 thisQuery.q_videoTargetSize = videoFilesize.ToString().Replace("-S ", "");
\r
1007 double qConvert = 0;
\r
1008 if (videoQuality.Success != false)
\r
1010 qConvert = double.Parse(videoQuality.ToString().Replace("-q ", ""), Functions.CLI.Culture) * 100;
\r
1011 qConvert = System.Math.Ceiling(qConvert);
\r
1012 thisQuery.q_videoQuality = int.Parse(qConvert.ToString());
\r
1014 thisQuery.q_ipodAtom = ipodAtom.Success;
\r
1015 thisQuery.q_optimizeMp4 = optimizeMP4.Success;
\r
1022 if (audioTrack1.Success != false)
\r
1023 thisQuery.q_audioTrack1 = audioTrack1.ToString().Replace("-a ", "");
\r
1025 thisQuery.q_audioTrack1 = "Automatic";
\r
1027 if (audioTrack2.Success != false)
\r
1029 string[] audioChan = audioTrack2.ToString().Split(',');
\r
1030 thisQuery.q_audioTrack2 = audioChan[1];
\r
1033 thisQuery.q_audioTrack2 = "None";
\r
1035 if (audioTrack3.Success != false)
\r
1037 string[] audioChan = audioTrack3.ToString().Split(',');
\r
1038 thisQuery.q_audioTrack3 = audioChan[2];
\r
1041 thisQuery.q_audioTrack3 = "None";
\r
1043 if (audioTrack4.Success != false)
\r
1045 string[] audioChan = audioTrack4.ToString().Split(',');
\r
1046 thisQuery.q_audioTrack4 = audioChan[3];
\r
1049 thisQuery.q_audioTrack4 = "None";
\r
1053 thisQuery.q_audioTrackMix1 = "Automatic";
\r
1054 if (audioTrack1Mix.Success != false)
\r
1056 thisQuery.q_audioTrackMix1 = getMixDown(audioTrack1Mix.ToString().Replace("-6 ", "").Replace(" ", ""));
\r
1059 thisQuery.q_audioTrackMix2 = "Automatic";
\r
1060 if (audioTrack2Mix.Success != false)
\r
1062 string[] audio2mix = audioTrack2Mix.ToString().Split(',');
\r
1063 audio2mix[1] = audio2mix[1].Trim();
\r
1064 thisQuery.q_audioTrackMix2 = getMixDown(audio2mix[1]);
\r
1067 thisQuery.q_audioTrackMix3 = "Automatic";
\r
1068 if (audioTrack3Mix.Success != false)
\r
1070 string[] audio3mix = audioTrack3Mix.ToString().Split(',');
\r
1071 audio3mix[1] = audio3mix[2].Trim();
\r
1072 thisQuery.q_audioTrackMix3 = getMixDown(audio3mix[1]);
\r
1075 thisQuery.q_audioTrackMix4 = "Automatic";
\r
1076 if (audioTrack4Mix.Success != false)
\r
1078 string[] audio4mix = audioTrack4Mix.ToString().Split(',');
\r
1079 audio4mix[1] = audio4mix[3].Trim();
\r
1080 thisQuery.q_audioTrackMix4 = getMixDown(audio4mix[1]);
\r
1085 if (audioEncoder1.Success != false)
\r
1086 thisQuery.q_audioEncoder1 = getAudioEncoder(audioEncoder1.ToString().Replace("-E ", ""));
\r
1088 if (audioEncoder2.Success != false)
\r
1090 string[] audio2enc = audioEncoder2.ToString().Split(',');
\r
1091 thisQuery.q_audioEncoder2 = getAudioEncoder(audio2enc[1].Trim());
\r
1094 if (audioEncoder3.Success != false)
\r
1096 string[] audio3enc = audioEncoder3.ToString().Split(',');
\r
1097 thisQuery.q_audioEncoder3 = getAudioEncoder(audio3enc[2].Trim());
\r
1100 if (audioEncoder4.Success != false)
\r
1102 string[] audio4enc = audioEncoder4.ToString().Split(',');
\r
1103 thisQuery.q_audioEncoder4 = getAudioEncoder(audio4enc[3].Trim());
\r
1108 if (audioBitrate1.Success != false)
\r
1109 thisQuery.q_audioBitrate1 = audioBitrate1.ToString().Replace("-B ", "").Trim();
\r
1111 thisQuery.q_audioBitrate1 = "";
\r
1113 if (audioBitrate2.Success != false)
\r
1115 string[] audioBitrateSelect = audioBitrate2.ToString().Split(',');
\r
1116 thisQuery.q_audioBitrate2 = audioBitrateSelect[1].Trim();
\r
1119 thisQuery.q_audioBitrate2 = "";
\r
1121 if (audioBitrate3.Success != false)
\r
1123 string[] audioBitrateSelect = audioBitrate3.ToString().Split(',');
\r
1124 thisQuery.q_audioBitrate3 = audioBitrateSelect[2].Trim();
\r
1127 thisQuery.q_audioBitrate3 = "";
\r
1129 if (audioBitrate4.Success != false)
\r
1131 string[] audioBitrateSelect = audioBitrate4.ToString().Split(',');
\r
1132 thisQuery.q_audioBitrate4 = audioBitrateSelect[3].Trim();
\r
1135 thisQuery.q_audioBitrate4 = "";
\r
1138 // Audio Sample Rate
\r
1139 if (audioSampleRate1.Success != false)
\r
1140 thisQuery.q_audioSamplerate1 = audioSampleRate1.ToString().Replace("-R ", "").Trim();
\r
1142 if (audioSampleRate2.Success != false)
\r
1144 string[] audioSRSelect = audioSampleRate2.ToString().Split(',');
\r
1145 thisQuery.q_audioSamplerate2 = audioSRSelect[1].Trim();
\r
1148 if (audioSampleRate3.Success != false)
\r
1150 string[] audioSRSelect = audioSampleRate3.ToString().Split(',');
\r
1151 thisQuery.q_audioSamplerate3 = audioSRSelect[2].Trim();
\r
1154 if (audioSampleRate4.Success != false)
\r
1156 string[] audioSRSelect = audioSampleRate4.ToString().Split(',');
\r
1157 thisQuery.q_audioSamplerate4 = audioSRSelect[3].Trim();
\r
1161 if (drc1.Success != false)
\r
1163 string value = drc1.ToString().Replace("-D ", "");
\r
1164 float drcValue = float.Parse(value);
\r
1165 drcValue = drcValue * 10;
\r
1166 thisQuery.q_drc1 = drcValue;
\r
1169 thisQuery.q_drc1 = 0;
\r
1171 if (drc2.Success != false)
\r
1173 string[] drcPoint = drc2.ToString().Split(',');
\r
1174 string value = drcPoint[1];
\r
1175 float drcValue = float.Parse(value);
\r
1176 drcValue = drcValue * 10;
\r
1177 thisQuery.q_drc2 = drcValue;
\r
1180 thisQuery.q_drc2 = 0;
\r
1182 if (drc3.Success != false)
\r
1184 string[] drcPoint = drc3.ToString().Split(',');
\r
1185 string value = drcPoint[2];
\r
1186 float drcValue = float.Parse(value);
\r
1187 drcValue = drcValue * 10;
\r
1188 thisQuery.q_drc3 = drcValue;
\r
1191 thisQuery.q_drc3 = 0;
\r
1193 if (drc4.Success != false)
\r
1195 string[] drcPoint = drc4.ToString().Split(',');
\r
1196 string value = drcPoint[3];
\r
1197 float drcValue = float.Parse(value);
\r
1198 drcValue = drcValue * 10;
\r
1199 thisQuery.q_drc4 = drcValue;
\r
1202 thisQuery.q_drc4 = 0;
\r
1206 if (subtitles.Success != false)
\r
1207 thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", "");
\r
1210 if (subScan.Success)
\r
1211 thisQuery.q_subtitles = "Autoselect";
\r
1213 thisQuery.q_subtitles = "None";
\r
1216 thisQuery.q_forcedSubs = forcedSubtitles.Success;
\r
1220 #region H.264 and other
\r
1224 if (x264.Success != false)
\r
1226 thisQuery.q_h264 = x264.ToString().Replace("-x ", "");
\r
1232 thisQuery.q_verbose = verbose.Success;
\r
1235 catch (Exception exc)
\r
1237 MessageBox.Show("An error has occured in the Query Parser. Please report this error on the forum in the 'Windows' support section. \n\n" + exc.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
1245 private static string getMixDown(string mixdown)
\r
1254 return "Dolby Surround";
\r
1256 return "Dolby Pro Logic II";
\r
1258 return "6 Channel Discrete";
\r
1260 return "Automatic";
\r
1264 private static string getAudioEncoder(string audioEnc)
\r