1 // -------------------------------------------------------------------------------------------------------------------- 2 // <copyright file="AllowedPassthru.cs" company="HandBrake Project (http://handbrake.fr)"> 3 // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. 4 // </copyright> 5 // <summary> 6 // Allowed Passthru Options 7 // </summary> 8 // -------------------------------------------------------------------------------------------------------------------- 9 10 namespace HandBrakeWPF.Services.Encode.Model.Models 11 { 12 using System.Collections.Generic; 13 14 public class AllowedPassthru 15 { AllowedPassthru()16 public AllowedPassthru() 17 { 18 this.AudioAllowAACPass = true; 19 this.AudioAllowAC3Pass = true; 20 this.AudioAllowDTSHDPass = true; 21 this.AudioAllowDTSPass = true; 22 this.AudioAllowMP3Pass = true; 23 this.AudioAllowEAC3Pass = true; 24 this.AudioAllowTrueHDPass = true; 25 this.AudioAllowFlacPass = true; 26 this.AudioAllowMP2Pass = true; 27 28 this.AudioEncoderFallback = AudioEncoder.Ac3; 29 } 30 AllowedPassthru(bool initialValue)31 public AllowedPassthru(bool initialValue) 32 { 33 this.AudioAllowAACPass = initialValue; 34 this.AudioAllowAC3Pass = initialValue; 35 this.AudioAllowDTSHDPass = initialValue; 36 this.AudioAllowDTSPass = initialValue; 37 this.AudioAllowMP3Pass = initialValue; 38 this.AudioAllowEAC3Pass = initialValue; 39 this.AudioAllowTrueHDPass = initialValue; 40 this.AudioAllowFlacPass = initialValue; 41 this.AudioAllowMP2Pass = initialValue; 42 43 this.AudioEncoderFallback = AudioEncoder.Ac3; 44 } 45 46 AllowedPassthru(AllowedPassthru initialValue)47 public AllowedPassthru(AllowedPassthru initialValue) 48 { 49 this.AudioAllowAACPass = initialValue.AudioAllowAACPass; 50 this.AudioAllowAC3Pass = initialValue.AudioAllowAC3Pass; 51 this.AudioAllowDTSHDPass = initialValue.AudioAllowDTSHDPass; 52 this.AudioAllowDTSPass = initialValue.AudioAllowDTSPass; 53 this.AudioAllowMP3Pass = initialValue.AudioAllowMP3Pass; 54 this.AudioAllowEAC3Pass = initialValue.AudioAllowEAC3Pass; 55 this.AudioAllowTrueHDPass = initialValue.AudioAllowTrueHDPass; 56 this.AudioAllowFlacPass = initialValue.AudioAllowFlacPass; 57 this.AudioAllowMP2Pass = initialValue.AudioAllowMP2Pass; 58 59 this.AudioEncoderFallback = initialValue.AudioEncoderFallback; 60 } 61 62 63 public bool AudioAllowAACPass { get; set; } 64 65 public bool AudioAllowAC3Pass { get; set; } 66 67 public bool AudioAllowDTSHDPass { get; set; } 68 69 public bool AudioAllowDTSPass { get; set; } 70 71 public bool AudioAllowMP3Pass { get; set; } 72 73 public bool AudioAllowTrueHDPass { get; set; } 74 75 public bool AudioAllowFlacPass { get; set; } 76 77 public bool AudioAllowEAC3Pass { get; set; } 78 79 public bool AudioAllowMP2Pass { get; set; } 80 81 public AudioEncoder AudioEncoderFallback { get; set; } 82 83 public IEnumerable<AudioEncoder> AllowedPassthruOptions 84 { 85 get 86 { 87 List<AudioEncoder> audioEncoders = new List<AudioEncoder>(); 88 if (this.AudioAllowAACPass) 89 { 90 audioEncoders.Add(AudioEncoder.AacPassthru); 91 } 92 if (this.AudioAllowAC3Pass) 93 { 94 audioEncoders.Add(AudioEncoder.Ac3Passthrough); 95 } 96 if (this.AudioAllowDTSHDPass) 97 { 98 audioEncoders.Add(AudioEncoder.DtsHDPassthrough); 99 } 100 if (this.AudioAllowDTSPass) 101 { 102 audioEncoders.Add(AudioEncoder.DtsPassthrough); 103 } 104 if (this.AudioAllowMP3Pass) 105 { 106 audioEncoders.Add(AudioEncoder.Mp3Passthru); 107 } 108 if (this.AudioAllowTrueHDPass) 109 { 110 audioEncoders.Add(AudioEncoder.TrueHDPassthrough); 111 } 112 if (this.AudioAllowFlacPass) 113 { 114 audioEncoders.Add(AudioEncoder.FlacPassthru); 115 } 116 if (this.AudioAllowEAC3Pass) 117 { 118 audioEncoders.Add(AudioEncoder.EAc3Passthrough); 119 } 120 if (this.AudioAllowMP2Pass) 121 { 122 audioEncoders.Add(AudioEncoder.Mp2Passthru); 123 } 124 125 return audioEncoders; 126 } 127 } 128 SetFalse()129 public void SetFalse() 130 { 131 this.AudioAllowAACPass = false; 132 this.AudioAllowAC3Pass = false; 133 this.AudioAllowDTSHDPass = false; 134 this.AudioAllowDTSPass = false; 135 this.AudioAllowMP3Pass = false; 136 this.AudioAllowEAC3Pass = false; 137 this.AudioAllowTrueHDPass = false; 138 this.AudioAllowFlacPass = false; 139 this.AudioAllowMP2Pass = false; 140 } 141 } 142 }