1 diff --git a/win/C#/Functions/QueryParser.cs b/win/C#/Functions/QueryParser.cs
2 index a856a8b..01344c8 100644
3 --- a/win/C#/Functions/QueryParser.cs
4 +++ b/win/C#/Functions/QueryParser.cs
8 - This file is part of the HandBrake source code.
\r
9 - Homepage: <http://handbrake.fr>.
\r
10 - It may be used under the terms of the GNU General Public License. */
\r
13 - * This file come from HandBrake source code by http://handbrake.fr/ ,
\r
14 - * and modified by hylom <hylomm@gmail.com> for HandBrake Japanese version.
\r
15 - * It may be used under the terms of the GNU General Public License.
\r
16 - * last modified date: $Format:%cd$
\r
21 -using System.Globalization;
\r
22 -using System.Text.RegularExpressions;
\r
23 -using System.Windows.Forms;
\r
24 -using System.Collections;
\r
25 + This file is part of the HandBrake source code.
\r
26 + Homepage: <http://handbrake.fr>.
\r
27 + It may be used under the terms of the GNU General Public License. */
\r
29 namespace Handbrake.Functions
\r
31 - internal class QueryParser
\r
33 + using System.Collections;
\r
34 + using System.Globalization;
\r
35 + using System.Text.RegularExpressions;
\r
39 + /// Parse a CLI Query
\r
41 + public class QueryParser
\r
46 private static readonly CultureInfo Culture = new CultureInfo("en-US", false);
\r
51 - public int DVDTitle { get; set; }
\r
52 - public int DVDChapterStart { get; set; }
\r
53 - public int DVDChapterFinish { get; set; }
\r
54 + #region Source Title / Chapters
\r
56 + /// Gets or sets Title.
\r
58 + public int Title { get; set; }
\r
61 + /// Gets or sets ChapterStart.
\r
63 + public int ChapterStart { get; set; }
\r
66 + /// Gets or sets ChapterFinish.
\r
68 + public int ChapterFinish { get; set; }
\r
71 - // Output Settings
\r
72 + #region Output Settings
\r
74 + /// Gets or sets the file Format. e.g mkv or mp4
\r
76 public string Format { get; set; }
\r
77 - public Boolean LargeMP4 { get; set; }
\r
78 - public Boolean IpodAtom { get; set; }
\r
79 - public Boolean OptimizeMP4 { get; set; }
\r
81 - // Picture Settings
\r
83 + /// Gets or sets a value indicating whether LargeMP4 support is enabled.
\r
84 + /// This is the 64bit MP4 file that allows >4GB files
\r
86 + public bool LargeMP4 { get; set; }
\r
89 + /// Gets or sets a value indicating whether IpodAtom is inserted
\r
91 + public bool IpodAtom { get; set; }
\r
94 + /// Gets or sets a value indicating whether OptimizeMP4 is enabed for web streaming
\r
96 + public bool OptimizeMP4 { get; set; }
\r
99 + #region Picture Settings
\r
102 + /// Gets or sets Width.
\r
104 public int Width { get; set; }
\r
107 + /// Gets or sets Height.
\r
109 public int Height { get; set; }
\r
112 + /// Gets or sets MaxWidth.
\r
114 public int MaxWidth { get; set; }
\r
117 + /// Gets or sets MaxHeight.
\r
119 public int MaxHeight { get; set; }
\r
122 + /// Gets or sets CropValues.
\r
124 public string CropValues { get; set; }
\r
127 + /// Gets or sets CropTop.
\r
129 public string CropTop { get; set; }
\r
132 + /// Gets or sets CropBottom.
\r
134 public string CropBottom { get; set; }
\r
137 + /// Gets or sets CropLeft.
\r
139 public string CropLeft { get; set; }
\r
142 + /// Gets or sets CropRight.
\r
144 public string CropRight { get; set; }
\r
147 + /// Gets or sets AnamorphicMode.
\r
149 public int AnamorphicMode { get; set; }
\r
150 - public Boolean keepDisplayAsect { get; set; }
\r
151 - public double displayWidthValue { get; set; }
\r
152 - public int pixelAspectWidth { get; set; }
\r
153 - public int pixelAspectHeight { get; set; }
\r
156 + /// Gets or sets a value indicating whether KeepDisplayAsect.
\r
158 + public bool KeepDisplayAsect { get; set; }
\r
161 + /// Gets or sets DisplayWidthValue.
\r
163 + public double DisplayWidthValue { get; set; }
\r
166 + /// Gets or sets PixelAspectWidth.
\r
168 + public int PixelAspectWidth { get; set; }
\r
171 + /// Gets or sets PixelAspectHeight.
\r
173 + public int PixelAspectHeight { get; set; }
\r
176 + /// Gets or sets AnamorphicModulus.
\r
178 public int AnamorphicModulus { get; set; }
\r
182 + #region Video Filters
\r
185 + /// Gets or sets DeTelecine.
\r
187 public string DeTelecine { get; set; }
\r
190 + /// Gets or sets DeBlock.
\r
192 public int DeBlock { get; set; }
\r
195 + /// Gets or sets DeInterlace.
\r
197 public string DeInterlace { get; set; }
\r
200 + /// Gets or sets DeNoise.
\r
202 public string DeNoise { get; set; }
\r
205 + /// Gets or sets Decomb.
\r
207 public string Decomb { get; set; }
\r
210 - // Video Settings
\r
211 + #region Video Settings
\r
213 + /// Gets or sets VideoEncoder.
\r
215 public string VideoEncoder { get; set; }
\r
216 - public Boolean Grayscale { get; set; }
\r
217 - public Boolean TwoPass { get; set; }
\r
218 - public Boolean TurboFirstPass { get; set; }
\r
221 + /// Gets or sets a value indicating whether Grayscale.
\r
223 + public bool Grayscale { get; set; }
\r
226 + /// Gets or sets a value indicating whether TwoPass.
\r
228 + public bool TwoPass { get; set; }
\r
231 + /// Gets or sets a value indicating whether TurboFirstPass.
\r
233 + public bool TurboFirstPass { get; set; }
\r
236 + /// Gets or sets VideoFramerate.
\r
238 public string VideoFramerate { get; set; }
\r
241 + /// Gets or sets a value indicating whether Pfr.
\r
243 + public bool Pfr { get; set; }
\r
246 + /// Gets or sets AverageVideoBitrate.
\r
248 public string AverageVideoBitrate { get; set; }
\r
251 + /// Gets or sets VideoTargetSize.
\r
253 public string VideoTargetSize { get; set; }
\r
256 + /// Gets or sets VideoQuality.
\r
258 public float VideoQuality { get; set; }
\r
261 + #region Audio Settings
\r
263 - // Audio Settings
\r
265 + /// Gets or sets AudioInformation.
\r
267 public ArrayList AudioInformation { get; set; }
\r
270 + /// Gets or sets Subtitles.
\r
272 public string Subtitles { get; set; }
\r
273 - public Boolean ForcedSubtitles { get; set; }
\r
275 - // Chapter Markers
\r
276 - public Boolean ChapterMarkers { get; set; }
\r
278 + /// Gets or sets a value indicating whether ForcedSubtitles.
\r
280 + public bool ForcedSubtitles { get; set; }
\r
285 + /// Gets or sets a value indicating whether ChapterMarkers.
\r
287 + public bool ChapterMarkers { get; set; }
\r
291 + /// Gets or sets H264Query.
\r
293 public string H264Query { get; set; }
\r
294 - public Boolean Verbose { get; set; }
\r
296 - // Preset Information
\r
298 + /// Gets or sets a value indicating whether Verbose.
\r
300 + public bool Verbose { get; set; }
\r
303 + #region Preset Information
\r
306 + /// Gets or sets PresetBuildNumber.
\r
308 public int PresetBuildNumber { get; set; }
\r
311 + /// Gets or sets PresetDescription.
\r
313 public string PresetDescription { get; set; }
\r
316 + /// Gets or sets PresetName.
\r
318 public string PresetName { get; set; }
\r
321 + /// Gets or sets Type.
\r
323 public string Type { get; set; }
\r
324 - public Boolean UsesMaxPictureSettings { get; set; }
\r
325 - public Boolean UsesPictureFilters { get; set; }
\r
326 - public Boolean UsesPictureSettings { get; set; }
\r
329 + /// Gets or sets a value indicating whether UsesMaxPictureSettings.
\r
331 + public bool UsesMaxPictureSettings { get; set; }
\r
334 + /// Gets or sets a value indicating whether UsesPictureFilters.
\r
336 + public bool UsesPictureFilters { get; set; }
\r
339 + /// Gets or sets a value indicating whether UsesPictureSettings.
\r
341 + public bool UsesPictureSettings { get; set; }
\r
346 @@ -100,23 +297,23 @@ namespace Handbrake.Functions
348 /// <param name="input">A ClI Query</param>
\r
349 /// <returns>A Parsed Query</returns>
\r
350 - public static QueryParser Parse(String input)
\r
351 + public static QueryParser Parse(string input)
\r
353 var thisQuery = new QueryParser();
\r
355 #region Regular Expressions
\r
359 Match title = Regex.Match(input, @"-t ([0-9]*)");
\r
360 Match chapters = Regex.Match(input, @"-c ([0-9-]*)");
\r
362 - //Output Settings
\r
363 + // Output Settings
\r
364 Match format = Regex.Match(input, @"-f ([a-z0-9a-z0-9a-z0-9]*)");
\r
365 Match grayscale = Regex.Match(input, @" -g");
\r
366 Match largerMp4 = Regex.Match(input, @" -4");
\r
367 Match ipodAtom = Regex.Match(input, @" -I");
\r
369 - //Picture Settings Tab
\r
370 + // Picture Settings Tab
\r
371 Match width = Regex.Match(input, @"-w ([0-9]*)");
\r
372 Match height = Regex.Match(input, @"-l ([0-9]*)");
\r
373 Match maxWidth = Regex.Match(input, @"-X ([0-9]*)");
\r
374 @@ -141,7 +338,7 @@ namespace Handbrake.Functions
375 Match detelecine = Regex.Match(input, @"--detelecine");
\r
376 Match detelecineValue = Regex.Match(input, @" --detelecine=\""([a-zA-Z0-9.:]*)\""");
\r
378 - //Video Settings Tab
\r
379 + // Video Settings Tab
\r
380 Match videoEncoder = Regex.Match(input, @"-e ([a-zA-Z0-9]*)");
\r
381 Match videoFramerate = Regex.Match(input, @"-r ([0-9.]*)");
\r
382 Match videoBitrate = Regex.Match(input, @"-b ([0-9]*)");
\r
383 @@ -150,14 +347,15 @@ namespace Handbrake.Functions
384 Match twoPass = Regex.Match(input, @" -2");
\r
385 Match turboFirstPass = Regex.Match(input, @" -T");
\r
386 Match optimizeMP4 = Regex.Match(input, @" -O");
\r
387 + Match pfr = Regex.Match(input, @" --pfr");
\r
389 - //Audio Settings Tab
\r
390 + // Audio Settings Tab
\r
391 Match noAudio = Regex.Match(input, @"-a none");
\r
392 Match audioTracks = Regex.Match(input, @"-a ([0-9,]*)");
\r
393 Match audioTrackMixes = Regex.Match(input, @"-6 ([0-9a-zA-Z,]*)");
\r
394 - Match audioEncoders = Regex.Match(input, @"-E ([a-zA-Z0-9+,]*)");
\r
395 - Match audioBitrates = Regex.Match(input, @"-B ([0-9a-zA-Z,]*)"); // Auto = a-z
\r
396 - Match audioSampleRates = Regex.Match(input, @"-R ([0-9a-zA-Z.,]*)"); // Auto = a-z
\r
397 + Match audioEncoders = Regex.Match(input, @"-E ([a-zA-Z0-9+,:]*)");
\r
398 + Match audioBitrates = Regex.Match(input, @"-B ([0-9a-zA-Z,]*)"); // Auto = a-z
\r
399 + Match audioSampleRates = Regex.Match(input, @"-R ([0-9a-zA-Z.,]*)"); // Auto = a-z
\r
400 Match drcValues = Regex.Match(input, @"-D ([0-9.,]*)");
\r
402 Match subtitles = Regex.Match(input, @"-s ([0-9a-zA-Z]*)");
\r
403 @@ -168,10 +366,10 @@ namespace Handbrake.Functions
404 Match chapterMarkers = Regex.Match(input, @" -m");
\r
405 Match chapterMarkersFileMode = Regex.Match(input, @"--markers");
\r
409 Match x264 = Regex.Match(input, @"-x ([.,/a-zA-Z0-9=:-]*)");
\r
411 - //Program Options
\r
412 + // Program Options
\r
413 Match verbose = Regex.Match(input, @" -v");
\r
416 @@ -183,26 +381,27 @@ namespace Handbrake.Functions
420 - thisQuery.DVDTitle = int.Parse(title.ToString().Replace("-t ", ""));
\r
421 + thisQuery.Title = int.Parse(title.ToString().Replace("-t ", string.Empty));
\r
423 if (chapters.Success)
\r
425 - string[] actTitles = chapters.ToString().Replace("-c ", "").Split('-');
\r
426 - thisQuery.DVDChapterStart = int.Parse(actTitles[0]);
\r
427 + string[] actTitles = chapters.ToString().Replace("-c ", string.Empty).Split('-');
\r
428 + thisQuery.ChapterStart = int.Parse(actTitles[0]);
\r
429 if (actTitles.Length > 1)
\r
431 - thisQuery.DVDChapterFinish = int.Parse(actTitles[1]);
\r
432 + thisQuery.ChapterFinish = int.Parse(actTitles[1]);
\r
435 - if ((thisQuery.DVDChapterStart == 1) && (thisQuery.DVDChapterFinish == 0))
\r
436 - thisQuery.DVDChapterFinish = thisQuery.DVDChapterStart;
\r
437 + if ((thisQuery.ChapterStart == 1) && (thisQuery.ChapterFinish == 0))
\r
438 + thisQuery.ChapterFinish = thisQuery.ChapterStart;
\r
443 #region Output Settings
\r
445 if (format.Success)
\r
446 - thisQuery.Format = format.ToString().Replace("-f ", "");
\r
447 + thisQuery.Format = format.ToString().Replace("-f ", string.Empty);
\r
448 thisQuery.LargeMP4 = largerMp4.Success;
\r
449 thisQuery.IpodAtom = ipodAtom.Success;
\r
450 thisQuery.OptimizeMP4 = optimizeMP4.Success;
\r
451 @@ -212,20 +411,20 @@ namespace Handbrake.Functions
452 #region Picture Tab
\r
455 - thisQuery.Width = int.Parse(width.Groups[0].Value.Replace("-w ", ""));
\r
456 + thisQuery.Width = int.Parse(width.Groups[0].Value.Replace("-w ", string.Empty));
\r
458 if (height.Success)
\r
459 - thisQuery.Height = int.Parse(height.Groups[0].Value.Replace("-l ", ""));
\r
460 + thisQuery.Height = int.Parse(height.Groups[0].Value.Replace("-l ", string.Empty));
\r
462 if (maxWidth.Success)
\r
463 - thisQuery.MaxWidth = int.Parse(maxWidth.Groups[0].Value.Replace("-X ", ""));
\r
464 + thisQuery.MaxWidth = int.Parse(maxWidth.Groups[0].Value.Replace("-X ", string.Empty));
\r
466 if (maxHeight.Success)
\r
467 - thisQuery.MaxHeight = int.Parse(maxHeight.Groups[0].Value.Replace("-Y ", ""));
\r
468 + thisQuery.MaxHeight = int.Parse(maxHeight.Groups[0].Value.Replace("-Y ", string.Empty));
\r
472 - thisQuery.CropValues = crop.ToString().Replace("--crop ", "");
\r
473 + thisQuery.CropValues = crop.ToString().Replace("--crop ", string.Empty);
\r
474 string[] actCropValues = thisQuery.CropValues.Split(':');
\r
475 thisQuery.CropTop = actCropValues[0];
\r
476 thisQuery.CropBottom = actCropValues[1];
\r
477 @@ -242,20 +441,20 @@ namespace Handbrake.Functions
479 thisQuery.AnamorphicMode = 0;
\r
481 - thisQuery.keepDisplayAsect = keepDisplayAsect.Success;
\r
482 + thisQuery.KeepDisplayAsect = keepDisplayAsect.Success;
\r
484 if (displayWidth.Success)
\r
485 - thisQuery.displayWidthValue = double.Parse(displayWidth.Groups[0].Value.Replace("--display-width ", ""));
\r
486 + thisQuery.DisplayWidthValue =
\r
487 + double.Parse(displayWidth.Groups[0].Value.Replace("--display-width ", string.Empty));
\r
489 if (pixelAspect.Success)
\r
490 - thisQuery.pixelAspectWidth = int.Parse(pixelAspect.Groups[1].Value.Replace("--pixel-aspect ", ""));
\r
491 + thisQuery.PixelAspectWidth = int.Parse(pixelAspect.Groups[1].Value.Replace("--pixel-aspect ", string.Empty));
\r
493 - if (pixelAspect.Success && pixelAspect.Groups.Count >=3)
\r
494 - thisQuery.pixelAspectHeight = int.Parse(pixelAspect.Groups[2].Value.Replace("--pixel-aspect ", ""));
\r
495 + if (pixelAspect.Success && pixelAspect.Groups.Count >= 3)
\r
496 + thisQuery.PixelAspectHeight = int.Parse(pixelAspect.Groups[2].Value.Replace("--pixel-aspect ", string.Empty));
\r
498 if (modulus.Success)
\r
499 - thisQuery.AnamorphicModulus = int.Parse(modulus.Groups[0].Value.Replace("--modulus ", ""));
\r
501 + thisQuery.AnamorphicModulus = int.Parse(modulus.Groups[0].Value.Replace("--modulus ", string.Empty));
\r
505 @@ -266,31 +465,33 @@ namespace Handbrake.Functions
507 thisQuery.Decomb = "Default";
\r
508 if (decombValue.Success)
\r
509 - thisQuery.Decomb = decombValue.ToString().Replace("--decomb=", "").Replace("\"", "");
\r
510 + thisQuery.Decomb = decombValue.ToString().Replace("--decomb=", string.Empty).Replace("\"", string.Empty);
\r
513 thisQuery.DeInterlace = "Off";
\r
514 if (deinterlace.Success)
\r
516 - thisQuery.DeInterlace = deinterlace.ToString().Replace("--deinterlace=", "").Replace("\"", "");
\r
517 - thisQuery.DeInterlace = thisQuery.DeInterlace.Replace("fast", "Fast").Replace("slow", "Slow").Replace("slower", "Slower");
\r
518 + thisQuery.DeInterlace = deinterlace.ToString().Replace("--deinterlace=", string.Empty).Replace("\"", string.Empty);
\r
519 + thisQuery.DeInterlace =
\r
520 + thisQuery.DeInterlace.Replace("fast", "Fast").Replace("slow", "Slow").Replace("slower", "Slower");
\r
521 thisQuery.DeInterlace = thisQuery.DeInterlace.Replace("slowest", "Slowest");
\r
524 thisQuery.DeNoise = "Off";
\r
525 if (denoise.Success)
\r
527 - thisQuery.DeNoise = denoise.ToString().Replace("--denoise=", "").Replace("\"", "");
\r
528 - thisQuery.DeNoise = thisQuery.DeNoise.Replace("weak", "Weak").Replace("medium", "Medium").Replace("strong", "Strong");
\r
529 + thisQuery.DeNoise = denoise.ToString().Replace("--denoise=", string.Empty).Replace("\"", string.Empty);
\r
530 + thisQuery.DeNoise =
\r
531 + thisQuery.DeNoise.Replace("weak", "Weak").Replace("medium", "Medium").Replace("strong", "Strong");
\r
534 - string deblockValue = "";
\r
535 + string deblockValue = string.Empty;
\r
536 thisQuery.DeBlock = 0;
\r
537 if (deblock.Success)
\r
538 - deblockValue = deblock.ToString().Replace("--deblock=", "");
\r
539 + deblockValue = deblock.ToString().Replace("--deblock=", string.Empty);
\r
542 - if (deblockValue != "")
\r
543 + if (deblockValue != string.Empty)
\r
544 int.TryParse(deblockValue, out dval);
\r
545 thisQuery.DeBlock = dval;
\r
547 @@ -299,14 +500,14 @@ namespace Handbrake.Functions
549 thisQuery.DeTelecine = "Default";
\r
550 if (detelecineValue.Success)
\r
551 - thisQuery.DeTelecine = detelecineValue.ToString().Replace("--detelecine=", "").Replace("\"", "");
\r
552 + thisQuery.DeTelecine = detelecineValue.ToString().Replace("--detelecine=", string.Empty).Replace("\"", string.Empty);
\r
557 #region Video Settings Tab
\r
559 - string videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", "");
\r
560 + string videoEncoderConvertion = videoEncoder.ToString().Replace("-e ", string.Empty);
\r
561 switch (videoEncoderConvertion)
\r
564 @@ -323,29 +524,37 @@ namespace Handbrake.Functions
567 thisQuery.VideoEncoder = videoEncoderConvertion;
\r
568 - thisQuery.VideoFramerate = videoFramerate.Success ? videoFramerate.ToString().Replace("-r ", "") : "Same as source";
\r
569 + thisQuery.VideoFramerate = videoFramerate.Success
\r
570 + ? videoFramerate.ToString().Replace("-r ", string.Empty)
\r
571 + : "Same as source";
\r
573 + thisQuery.Pfr = pfr.Success;
\r
574 thisQuery.Grayscale = grayscale.Success;
\r
575 thisQuery.TwoPass = twoPass.Success;
\r
576 thisQuery.TurboFirstPass = turboFirstPass.Success;
\r
578 if (videoBitrate.Success)
\r
579 - thisQuery.AverageVideoBitrate = videoBitrate.ToString().Replace("-b ", "");
\r
580 + thisQuery.AverageVideoBitrate = videoBitrate.ToString().Replace("-b ", string.Empty);
\r
581 if (videoFilesize.Success)
\r
582 - thisQuery.VideoTargetSize = videoFilesize.ToString().Replace("-S ", "");
\r
583 + thisQuery.VideoTargetSize = videoFilesize.ToString().Replace("-S ", string.Empty);
\r
585 if (videoQuality.Success)
\r
587 - float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", ""), Culture);
\r
588 + float qConvert = float.Parse(videoQuality.ToString().Replace("-q ", string.Empty), Culture);
\r
589 thisQuery.VideoQuality = qConvert;
\r
592 + thisQuery.VideoQuality = -1;
\r
598 // Find out how many tracks we need to add by checking how many encoders or audio tracks are selected.
\r
599 int encoderCount = 0;
\r
600 if (audioEncoders.Success)
\r
602 - string[] audioDataCounters = audioEncoders.ToString().Replace("-E ", "").Split(',');
\r
603 + string[] audioDataCounters = audioEncoders.ToString().Replace("-E ", string.Empty).Split(',');
\r
604 encoderCount = audioDataCounters.Length;
\r
607 @@ -358,69 +567,72 @@ namespace Handbrake.Functions
608 string[] trackDRCvalues = null;
\r
610 if (audioTracks.Success)
\r
611 - trackData = audioTracks.ToString().Replace("-a ", "").Split(',');
\r
612 + trackData = audioTracks.ToString().Replace("-a ", string.Empty).Split(',');
\r
613 if (audioTrackMixes.Success)
\r
614 - trackMixes = audioTrackMixes.ToString().Replace("-6 ", "").Split(',');
\r
615 + trackMixes = audioTrackMixes.ToString().Replace("-6 ", string.Empty).Split(',');
\r
616 if (audioEncoders.Success)
\r
617 - trackEncoders = audioEncoders.ToString().Replace("-E ", "").Split(',');
\r
618 + trackEncoders = audioEncoders.ToString().Replace("-E ", string.Empty).Split(',');
\r
619 if (audioBitrates.Success)
\r
620 - trackBitrates = audioBitrates.ToString().Replace("-B ", "").Split(',');
\r
621 + trackBitrates = audioBitrates.ToString().Replace("-B ", string.Empty).Split(',');
\r
622 if (audioSampleRates.Success)
\r
623 - trackSamplerates = audioSampleRates.ToString().Replace("-R ", "").Split(',');
\r
624 + trackSamplerates = audioSampleRates.ToString().Replace("-R ", string.Empty).Split(',');
\r
625 if (drcValues.Success)
\r
626 - trackDRCvalues = drcValues.ToString().Replace("-D ", "").Split(',');
\r
627 + trackDRCvalues = drcValues.ToString().Replace("-D ", string.Empty).Split(',');
\r
629 // Create new Audio Track Classes and store them in the ArrayList
\r
630 - ArrayList AllAudioTrackInfo = new ArrayList();
\r
631 + ArrayList allAudioTrackInfo = new ArrayList();
\r
632 for (int x = 0; x < encoderCount; x++)
\r
634 AudioTrack track = new AudioTrack();
\r
635 if (trackData != null)
\r
636 - if (trackData.Length >= (x + 1)) // Audio Track
\r
637 + if (trackData.Length >= (x + 1)) // Audio Track
\r
638 track.Track = trackData[x].Trim();
\r
640 if (trackMixes != null)
\r
641 - if (trackMixes.Length >= (x + 1)) // Audio Mix
\r
642 - track.MixDown = getMixDown(trackMixes[x].Trim());
\r
643 + if (trackMixes.Length >= (x + 1)) // Audio Mix
\r
644 + track.MixDown = GetMixDown(trackMixes[x].Trim());
\r
646 if (trackEncoders != null)
\r
647 - if (trackEncoders.Length >= (x + 1)) // Audio Mix
\r
648 - track.Encoder = getAudioEncoder(trackEncoders[x].Trim());
\r
649 + if (trackEncoders.Length >= (x + 1)) // Audio Mix
\r
650 + track.Encoder = GetAudioEncoder(trackEncoders[x].Trim());
\r
652 if (trackBitrates != null)
\r
653 - if (trackBitrates.Length >= (x + 1)) // Audio Encoder
\r
654 - track.Bitrate = trackBitrates[x].Trim() == "auto" ? "
\8e©
\93®" : trackBitrates[x].Trim();
\r
655 + if (trackBitrates.Length >= (x + 1)) // Audio Encoder
\r
656 + track.Bitrate = trackBitrates[x].Trim() == "auto" ? "Auto" : trackBitrates[x].Trim();
\r
658 if (trackSamplerates != null)
\r
659 - if (trackSamplerates.Length >= (x + 1)) // Audio SampleRate
\r
660 - track.SampleRate = trackSamplerates[x].Trim() == "Auto" ? "
\8e©
\93®" : trackSamplerates[x].Trim();
\r
661 + if (trackSamplerates.Length >= (x + 1)) // Audio SampleRate
\r
662 + track.SampleRate = trackSamplerates[x].Trim() == "0" ? "Auto" : trackSamplerates[x].Trim();
\r
664 if (trackDRCvalues != null)
\r
665 - if (trackDRCvalues.Length >= (x + 1)) // Audio DRC Values
\r
666 + if (trackDRCvalues.Length >= (x + 1)) // Audio DRC Values
\r
667 track.DRC = trackDRCvalues[x].Trim();
\r
669 - AllAudioTrackInfo.Add(track);
\r
670 + allAudioTrackInfo.Add(track);
\r
672 - thisQuery.AudioInformation = AllAudioTrackInfo;
\r
673 + thisQuery.AudioInformation = allAudioTrackInfo;
\r
676 if (subtitles.Success)
\r
677 - thisQuery.Subtitles = subtitles.ToString().Replace("-s ", "");
\r
678 + thisQuery.Subtitles = subtitles.ToString().Replace("-s ", string.Empty);
\r
680 thisQuery.Subtitles = subScan.Success ? "Autoselect" : "None";
\r
682 thisQuery.ForcedSubtitles = forcedSubtitles.Success;
\r
686 #region Chapters Tab
\r
688 if (chapterMarkersFileMode.Success || chapterMarkers.Success)
\r
689 thisQuery.ChapterMarkers = true;
\r
693 #region H.264 and other
\r
696 - thisQuery.H264Query = x264.ToString().Replace("-x ", "");
\r
697 + thisQuery.H264Query = x264.ToString().Replace("-x ", string.Empty);
\r
699 thisQuery.Verbose = verbose.Success;
\r
701 @@ -428,34 +640,44 @@ namespace Handbrake.Functions
703 catch (Exception exc)
\r
706 - "An error has occured in the Query Parser. Please report this error on the forum in the 'Windows' support section. \n\n" +
\r
707 - exc, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
\r
708 + Main.ShowExceptiowWindow("An error has occured in the Query Parser.", exc.ToString());
\r
715 - private static string getMixDown(string mixdown)
\r
718 + /// Get the GUI equiv to a CLI mixdown
\r
720 + /// <param name="mixdown">The Audio Mixdown</param>
\r
721 + /// <returns>The GUI representation of the mixdown</returns>
\r
722 + private static string GetMixDown(string mixdown)
\r
724 switch (mixdown.Trim())
\r
727 - return "
\83\82\83m
\83\89\83\8b";
\r
730 - return "
\83X
\83e
\83\8c\83I";
\r
733 return "Dolby Surround";
\r
735 return "Dolby Pro Logic II";
\r
737 - return "5.1ch
\83T
\83\89\83E
\83\93\83h";
\r
738 + return "6 Channel Discrete";
\r
740 - return "
\8e©
\93®";
\r
741 + return "Automatic";
\r
744 - private static string getAudioEncoder(string audioEnc)
\r
747 + /// Get the GUI equiv to a CLI audio encoder
\r
749 + /// <param name="audioEnc">The Audio Encoder</param>
\r
750 + /// <returns>The GUI representation of that audio encoder</returns>
\r
751 + private static string GetAudioEncoder(string audioEnc)
\r
755 @@ -466,31 +688,14 @@ namespace Handbrake.Functions
757 return "Vorbis (vorbis)";
\r
759 - return "AC3
\83p
\83X
\83X
\83\8b\81[";
\r
761 - return "DTS
\83p
\83X
\83X
\83\8b\81[";
\r
762 + return "AC3 (ffmpeg)";
\r
764 + return "AC3 Passthru";
\r
766 + return "DTS Passthru";
\r
768 return "AAC (faac)";
\r
773 - public class AudioTrack
\r
775 - public AudioTrack()
\r
777 - // Default Values
\r
778 - Track = "
\8e©
\93®";
\r
779 - MixDown = "
\8e©
\93®";
\r
780 - SampleRate = "
\8e©
\93®";
\r
781 - Bitrate = "
\8e©
\93®";
\r
784 - public string Track { get; set; }
\r
785 - public string MixDown { get; set; }
\r
786 - public string Encoder { get; set; }
\r
787 - public string Bitrate { get; set; }
\r
788 - public string SampleRate { get; set; }
\r
789 - public string DRC { get; set; }
\r
792 \ No newline at end of file