private BaseEncoder SetEncoderSettings(int stream) { BaseEncoder encoder = null; switch (_encoder) { case "mp3": EncoderLAME encLame = new EncoderLAME(stream); if (Options.MainSettings.RipLameExpert.Length > 0) { encLame.LAME_CustomOptions = Options.MainSettings.RipLameExpert; encLame.LAME_UseCustomOptionsOnly = true; } else { if (Options.MainSettings.RipLamePreset == (int)Options.LamePreset.ABR) encLame.LAME_PresetName = Options.MainSettings.RipLameABRBitRate.ToString(); else encLame.LAME_PresetName = Enum.GetName(typeof (Options.LamePreset), Options.MainSettings.RipLamePreset).ToLower(); } encoder = encLame; break; case "ogg": EncoderOGG encOgg = new EncoderOGG(stream); if (Options.MainSettings.RipOggExpert.Length > 0) { encOgg.OGG_CustomOptions = Options.MainSettings.RipOggExpert; encOgg.OGG_UseCustomOptionsOnly = true; } else { encOgg.OGG_Quality = Convert.ToInt32(Options.MainSettings.RipOggQuality); } encoder = encOgg; break; case "flac": EncoderFLAC encFlac = new EncoderFLAC(stream); if (Options.MainSettings.RipFlacExpert.Length > 0) { encFlac.FLAC_CustomOptions = Options.MainSettings.RipFlacExpert; encFlac.FLAC_UseCustomOptionsOnly = true; } else { encFlac.FLAC_CompressionLevel = Options.MainSettings.RipFlacQuality; } // put a 1k padding block for Tagging in front encFlac.FLAC_Padding = 1024; encoder = encFlac; break; case "m4a": EncoderFAAC encAAC = new EncoderFAAC(stream); int bitrate = Convert.ToInt32(Options.MainSettings.RipEncoderAACBitRate.Substring(0, Options.MainSettings. RipEncoderAACBitRate.IndexOf(' '))); encAAC.FAAC_Bitrate = bitrate; encAAC.FAAC_Quality = 100; encAAC.FAAC_UseQualityMode = true; encAAC.FAAC_WrapMP4 = true; encoder = encAAC; break; case "wav": EncoderWAV encWav = new EncoderWAV(stream); encoder = encWav; break; case "wma": EncoderWMA encWma = new EncoderWMA(stream); string[] sampleFormat = Options.MainSettings.RipEncoderWMASample.Split(','); string encoderFormat = Options.MainSettings.RipEncoderWMA; if (encoderFormat == "wmapro" || encoderFormat == "wmalossless") encWma.WMA_UsePro = true; else encWma.WMA_ForceStandard = true; if (Options.MainSettings.RipEncoderWMACbrVbr == "Vbr") { encWma.WMA_UseVBR = true; encWma.WMA_VBRQuality = Convert.ToInt32(Options.MainSettings.RipEncoderWMABitRate); } else encWma.WMA_Bitrate = Convert.ToInt32(Options.MainSettings.RipEncoderWMABitRate) / 1000; if (sampleFormat[0] == "24") encWma.WMA_Use24Bit = true; encoder = encWma; break; case "mpc": EncoderMPC encMpc = new EncoderMPC(stream); if (Options.MainSettings.RipEncoderMPCExpert.Length > 0) { encMpc.MPC_CustomOptions = Options.MainSettings.RipEncoderMPCExpert; encMpc.MPC_UseCustomOptionsOnly = true; } else { encMpc.MPC_Preset = (EncoderMPC.MPCPreset)Enum.Parse(typeof (EncoderMPC.MPCPreset), Options.MainSettings.RipEncoderMPCPreset); } encoder = encMpc; break; case "wv": EncoderWavPack encWv = new EncoderWavPack(stream); if (Options.MainSettings.RipEncoderWVExpert.Length > 0) { encWv.WV_CustomOptions = Options.MainSettings.RipEncoderWVExpert; encWv.WV_UseCustomOptionsOnly = true; } else { if (Options.MainSettings.RipEncoderWVPreset == "-f") encWv.WV_FastMode = true; else encWv.WV_HighQuality = true; } encoder = encWv; break; } return encoder; }
private BaseEncoder SetEncoderSettings(int stream) { BaseEncoder encoder = null; switch (_encoder) { case "mp3": EncoderLAME encLame = new EncoderLAME(stream); if (Options.MainSettings.RipLameExpert.Length > 0) { encLame.LAME_CustomOptions = Options.MainSettings.RipLameExpert; encLame.LAME_UseCustomOptionsOnly = true; } else { if (Options.MainSettings.RipLamePreset == (int)Options.LamePreset.ABR) { encLame.LAME_PresetName = Options.MainSettings.RipLameABRBitRate.ToString(); } else { encLame.LAME_PresetName = Enum.GetName(typeof(Options.LamePreset), Options.MainSettings.RipLamePreset).ToLower(); } } encoder = encLame; break; case "ogg": EncoderOGG encOgg = new EncoderOGG(stream); if (Options.MainSettings.RipOggExpert.Length > 0) { encOgg.OGG_CustomOptions = Options.MainSettings.RipOggExpert; encOgg.OGG_UseCustomOptionsOnly = true; } else { encOgg.OGG_Quality = Convert.ToInt32(Options.MainSettings.RipOggQuality); } encoder = encOgg; break; case "flac": EncoderFLAC encFlac = new EncoderFLAC(stream); if (Options.MainSettings.RipFlacExpert.Length > 0) { encFlac.FLAC_CustomOptions = Options.MainSettings.RipFlacExpert; encFlac.FLAC_UseCustomOptionsOnly = true; } else { encFlac.FLAC_CompressionLevel = Options.MainSettings.RipFlacQuality; } // put a 1k padding block for Tagging in front encFlac.FLAC_Padding = 1024; encoder = encFlac; break; case "m4a": EncoderFAAC encAAC = new EncoderFAAC(stream); int bitrate = Convert.ToInt32(Options.MainSettings.RipEncoderAACBitRate.Substring(0, Options.MainSettings. RipEncoderAACBitRate.IndexOf(' '))); encAAC.FAAC_Bitrate = bitrate; encAAC.FAAC_Quality = 100; encAAC.FAAC_UseQualityMode = true; encAAC.FAAC_WrapMP4 = true; encoder = encAAC; break; case "wav": EncoderWAV encWav = new EncoderWAV(stream); encoder = encWav; break; case "wma": EncoderWMA encWma = new EncoderWMA(stream); string[] sampleFormat = Options.MainSettings.RipEncoderWMASample.Split(','); string encoderFormat = Options.MainSettings.RipEncoderWMA; if (encoderFormat == "wmapro" || encoderFormat == "wmalossless") { encWma.WMA_UsePro = true; } else { encWma.WMA_ForceStandard = true; } if (Options.MainSettings.RipEncoderWMACbrVbr == "Vbr") { encWma.WMA_UseVBR = true; encWma.WMA_VBRQuality = Convert.ToInt32(Options.MainSettings.RipEncoderWMABitRate); } else { encWma.WMA_Bitrate = Convert.ToInt32(Options.MainSettings.RipEncoderWMABitRate) / 1000; } if (sampleFormat[0] == "24") { encWma.WMA_Use24Bit = true; } encoder = encWma; break; case "mpc": EncoderMPC encMpc = new EncoderMPC(stream); if (Options.MainSettings.RipEncoderMPCExpert.Length > 0) { encMpc.MPC_CustomOptions = Options.MainSettings.RipEncoderMPCExpert; encMpc.MPC_UseCustomOptionsOnly = true; } else { encMpc.MPC_Preset = (EncoderMPC.MPCPreset)Enum.Parse(typeof(EncoderMPC.MPCPreset), Options.MainSettings.RipEncoderMPCPreset); } encoder = encMpc; break; case "wv": EncoderWavPack encWv = new EncoderWavPack(stream); if (Options.MainSettings.RipEncoderWVExpert.Length > 0) { encWv.WV_CustomOptions = Options.MainSettings.RipEncoderWVExpert; encWv.WV_UseCustomOptionsOnly = true; } else { if (Options.MainSettings.RipEncoderWVPreset == "-f") { encWv.WV_FastMode = true; } else { encWv.WV_HighQuality = true; } } encoder = encWv; break; } return(encoder); }