// -------------------------------------------------------------------------------------------------------------------- // // This file is part of the HandBrake source code - It may be used under the terms of the GNU General Public License. // // // Defines the Utilities type. // // -------------------------------------------------------------------------------------------------------------------- namespace HandBrake.Interop { using HandBrake.Interop.Model.Encoding; public static class Utilities { /// /// Get the Greatest Common Factor /// /// /// The a. /// /// /// The b. /// /// /// public static int GreatestCommonFactor(int a, int b) { if (a == 0) { return b; } if (b == 0) { return a; } if (a > b) { return GreatestCommonFactor(a % b, b); } else { return GreatestCommonFactor(a, b % a); } } /// /// Determines if the given audio encoder is a passthrough encoder choice. /// /// The audio encoder to examine. /// True if the encoder is passthrough. public static bool IsPassthrough(AudioEncoder encoder) { return encoder == AudioEncoder.Ac3Passthrough || encoder == AudioEncoder.DtsHDPassthrough || encoder == AudioEncoder.DtsPassthrough || encoder == AudioEncoder.Mp3Passthru || encoder == AudioEncoder.AacPassthru || encoder == AudioEncoder.Passthrough; } } }