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 (FFmpeg)";
\r
900 videoEncoderConvertion = "MPEG-4 (XviD)";
\r
903 videoEncoderConvertion = "H.264 (x264)";
\r
906 videoEncoderConvertion = "VP3 (Theora)";
\r
909 videoEncoderConvertion = "MPEG-4 (FFmpeg)";
\r
912 thisQuery.q_videoEncoder = videoEncoderConvertion;
\r
916 #region Picture Tab
\r
918 if (width.Success != false)
\r
919 thisQuery.q_videoWidth = int.Parse(width.ToString().Replace("-w ", ""));
\r
921 if (height.Success != false)
\r
922 thisQuery.q_videoHeight = int.Parse(height.ToString().Replace("-l ", ""));
\r
925 if (crop.Success != false)
\r
927 thisQuery.q_cropValues = crop.ToString().Replace("--crop ", "");
\r
928 string[] actCropValues = new string[3];
\r
929 actCropValues = thisQuery.q_cropValues.Split(':');
\r
930 thisQuery.q_croptop = actCropValues[0];
\r
931 thisQuery.q_cropbottom = actCropValues[1];
\r
932 thisQuery.q_cropLeft = actCropValues[2];
\r
933 thisQuery.q_cropRight = actCropValues[3];
\r
936 thisQuery.q_detelecine = detelecine.Success;
\r
937 thisQuery.q_deBlock = deblock.Success;
\r
939 thisQuery.q_deinterlace = "None";
\r
940 if (deinterlace.Success != false)
\r
942 switch (deinterlace.ToString().Replace("--deinterlace=", "").Replace("\"",""))
\r
945 thisQuery.q_deinterlace = "Fast";
\r
948 thisQuery.q_deinterlace = "Slow";
\r
951 thisQuery.q_deinterlace = "Slower";
\r
954 thisQuery.q_deinterlace = "Slowest";
\r
957 thisQuery.q_deinterlace = "None";
\r
962 thisQuery.q_denoise = "None";
\r
963 if (denoise.Success != false)
\r
965 switch (denoise.ToString().Replace("--denoise=", ""))
\r
968 thisQuery.q_denoise = "Weak";
\r
971 thisQuery.q_denoise = "Medium";
\r
974 thisQuery.q_denoise = "Strong";
\r
977 thisQuery.q_denoise = "None";
\r
982 thisQuery.q_anamorphic = anamorphic.Success;
\r
983 thisQuery.q_chapterMarkers = chapterMarkers.Success;
\r
984 thisQuery.q_vfr = vfr.Success;
\r
985 thisQuery.q_looseAnamorphic = lanamorphic.Success;
\r
989 #region Video Settings Tab
\r
990 thisQuery.q_grayscale = grayscale.Success;
\r
991 thisQuery.q_twoPass = twoPass.Success;
\r
992 thisQuery.q_turboFirst = turboFirstPass.Success;
\r
993 thisQuery.q_largeMp4 = largerMp4.Success;
\r
994 if (videoFramerate.Success != false)
\r
995 thisQuery.q_videoFramerate = videoFramerate.ToString().Replace("-r ", "");
\r
997 thisQuery.q_videoFramerate = "Same as source";
\r
999 if (videoBitrate.Success != false)
\r
1000 thisQuery.q_avgBitrate = videoBitrate.ToString().Replace("-b ", "");
\r
1001 if (videoFilesize.Success != false)
\r
1002 thisQuery.q_videoTargetSize = videoFilesize.ToString().Replace("-S ", "");
\r
1004 double qConvert = 0;
\r
1005 if (videoQuality.Success != false)
\r
1007 qConvert = double.Parse(videoQuality.ToString().Replace("-q ", ""), Functions.CLI.Culture) * 100;
\r
1008 qConvert = System.Math.Ceiling(qConvert);
\r
1009 thisQuery.q_videoQuality = int.Parse(qConvert.ToString());
\r
1011 thisQuery.q_ipodAtom = ipodAtom.Success;
\r
1012 thisQuery.q_optimizeMp4 = optimizeMP4.Success;
\r
1019 if (audioTrack1.Success != false)
\r
1020 thisQuery.q_audioTrack1 = audioTrack1.ToString().Replace("-a ", "");
\r
1022 thisQuery.q_audioTrack1 = "Automatic";
\r
1024 if (audioTrack2.Success != false)
\r
1026 string[] audioChan = audioTrack2.ToString().Split(',');
\r
1027 thisQuery.q_audioTrack2 = audioChan[1];
\r
1030 thisQuery.q_audioTrack2 = "None";
\r
1032 if (audioTrack3.Success != false)
\r
1034 string[] audioChan = audioTrack3.ToString().Split(',');
\r
1035 thisQuery.q_audioTrack3 = audioChan[2];
\r
1038 thisQuery.q_audioTrack3 = "None";
\r
1040 if (audioTrack4.Success != false)
\r
1042 string[] audioChan = audioTrack4.ToString().Split(',');
\r
1043 thisQuery.q_audioTrack4 = audioChan[3];
\r
1046 thisQuery.q_audioTrack4 = "None";
\r
1050 thisQuery.q_audioTrackMix1 = "Automatic";
\r
1051 if (audioTrack1Mix.Success != false)
\r
1053 thisQuery.q_audioTrackMix1 = getMixDown(audioTrack1Mix.ToString().Replace("-6 ", "").Replace(" ", ""));
\r
1056 thisQuery.q_audioTrackMix2 = "Automatic";
\r
1057 if (audioTrack2Mix.Success != false)
\r
1059 string[] audio2mix = audioTrack2Mix.ToString().Split(',');
\r
1060 audio2mix[1] = audio2mix[1].Trim();
\r
1061 thisQuery.q_audioTrackMix2 = getMixDown(audio2mix[1]);
\r
1064 thisQuery.q_audioTrackMix3 = "Automatic";
\r
1065 if (audioTrack3Mix.Success != false)
\r
1067 string[] audio3mix = audioTrack3Mix.ToString().Split(',');
\r
1068 audio3mix[1] = audio3mix[2].Trim();
\r
1069 thisQuery.q_audioTrackMix3 = getMixDown(audio3mix[1]);
\r
1072 thisQuery.q_audioTrackMix4 = "Automatic";
\r
1073 if (audioTrack4Mix.Success != false)
\r
1075 string[] audio4mix = audioTrack4Mix.ToString().Split(',');
\r
1076 audio4mix[1] = audio4mix[3].Trim();
\r
1077 thisQuery.q_audioTrackMix4 = getMixDown(audio4mix[1]);
\r
1082 if (audioEncoder1.Success != false)
\r
1083 thisQuery.q_audioEncoder1 = getAudioEncoder(audioEncoder1.ToString().Replace("-E ", ""));
\r
1085 if (audioEncoder2.Success != false)
\r
1087 string[] audio2enc = audioEncoder2.ToString().Split(',');
\r
1088 thisQuery.q_audioEncoder2 = getAudioEncoder(audio2enc[1].Trim());
\r
1091 if (audioEncoder3.Success != false)
\r
1093 string[] audio3enc = audioEncoder3.ToString().Split(',');
\r
1094 thisQuery.q_audioEncoder3 = getAudioEncoder(audio3enc[2].Trim());
\r
1097 if (audioEncoder4.Success != false)
\r
1099 string[] audio4enc = audioEncoder4.ToString().Split(',');
\r
1100 thisQuery.q_audioEncoder4 = getAudioEncoder(audio4enc[3].Trim());
\r
1105 if (audioBitrate1.Success != false)
\r
1106 thisQuery.q_audioBitrate1 = audioBitrate1.ToString().Replace("-B ", "").Trim();
\r
1108 thisQuery.q_audioBitrate1 = "";
\r
1110 if (audioBitrate2.Success != false)
\r
1112 string[] audioBitrateSelect = audioBitrate2.ToString().Split(',');
\r
1113 thisQuery.q_audioBitrate2 = audioBitrateSelect[1].Trim();
\r
1116 thisQuery.q_audioBitrate2 = "";
\r
1118 if (audioBitrate3.Success != false)
\r
1120 string[] audioBitrateSelect = audioBitrate3.ToString().Split(',');
\r
1121 thisQuery.q_audioBitrate3 = audioBitrateSelect[2].Trim();
\r
1124 thisQuery.q_audioBitrate3 = "";
\r
1126 if (audioBitrate4.Success != false)
\r
1128 string[] audioBitrateSelect = audioBitrate4.ToString().Split(',');
\r
1129 thisQuery.q_audioBitrate4 = audioBitrateSelect[3].Trim();
\r
1132 thisQuery.q_audioBitrate4 = "";
\r
1135 // Audio Sample Rate
\r
1136 if (audioSampleRate1.Success != false)
\r
1137 thisQuery.q_audioSamplerate1 = audioSampleRate1.ToString().Replace("-R ", "").Trim();
\r
1139 if (audioSampleRate2.Success != false)
\r
1141 string[] audioSRSelect = audioSampleRate2.ToString().Split(',');
\r
1142 thisQuery.q_audioSamplerate2 = audioSRSelect[1].Trim();
\r
1145 if (audioSampleRate3.Success != false)
\r
1147 string[] audioSRSelect = audioSampleRate3.ToString().Split(',');
\r
1148 thisQuery.q_audioSamplerate3 = audioSRSelect[2].Trim();
\r
1151 if (audioSampleRate4.Success != false)
\r
1153 string[] audioSRSelect = audioSampleRate4.ToString().Split(',');
\r
1154 thisQuery.q_audioSamplerate4 = audioSRSelect[3].Trim();
\r
1158 if (drc1.Success != false)
\r
1160 string value = drc1.ToString().Replace("-D ", "");
\r
1161 float drcValue = float.Parse(value);
\r
1162 drcValue = drcValue * 10;
\r
1163 thisQuery.q_drc1 = drcValue;
\r
1166 thisQuery.q_drc1 = 0;
\r
1168 if (drc2.Success != false)
\r
1170 string[] drcPoint = drc2.ToString().Split(',');
\r
1171 string value = drcPoint[1];
\r
1172 float drcValue = float.Parse(value);
\r
1173 drcValue = drcValue * 10;
\r
1174 thisQuery.q_drc2 = drcValue;
\r
1177 thisQuery.q_drc2 = 0;
\r
1179 if (drc3.Success != false)
\r
1181 string[] drcPoint = drc3.ToString().Split(',');
\r
1182 string value = drcPoint[2];
\r
1183 float drcValue = float.Parse(value);
\r
1184 drcValue = drcValue * 10;
\r
1185 thisQuery.q_drc3 = drcValue;
\r
1188 thisQuery.q_drc3 = 0;
\r
1190 if (drc4.Success != false)
\r
1192 string[] drcPoint = drc4.ToString().Split(',');
\r
1193 string value = drcPoint[3];
\r
1194 float drcValue = float.Parse(value);
\r
1195 drcValue = drcValue * 10;
\r
1196 thisQuery.q_drc4 = drcValue;
\r
1199 thisQuery.q_drc4 = 0;
\r
1203 if (subtitles.Success != false)
\r
1204 thisQuery.q_subtitles = subtitles.ToString().Replace("-s ", "");
\r
1207 if (subScan.Success)
\r
1208 thisQuery.q_subtitles = "Autoselect";
\r
1210 thisQuery.q_subtitles = "None";
\r
1213 thisQuery.q_forcedSubs = forcedSubtitles.Success;
\r
1217 #region H.264 and other
\r
1221 if (x264.Success != false)
\r
1223 thisQuery.q_h264 = x264.ToString().Replace("-x ", "");
\r
1229 thisQuery.q_verbose = verbose.Success;
\r
1232 catch (Exception exc)
\r
1234 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
1242 private static string getMixDown(string mixdown)
\r
1251 return "Dolby Surround";
\r
1253 return "Dolby Pro Logic II";
\r
1255 return "6 Channel Discrete";
\r
1257 return "Automatic";
\r
1261 private static string getAudioEncoder(string audioEnc)
\r