private void RefreshCodecProfileWindow() { AudioStream outstream = (AudioStream)m.outaudiostreams[m.outaudiostream]; if (combo_profile.SelectedItem.ToString() == "Copy" || combo_profile.SelectedItem.ToString() == "Disabled") { combo_codec.SelectedItem = combo_profile.SelectedItem.ToString(); } if (outstream.codec != "Copy" && combo_profile.SelectedItem.ToString() == "Copy" || outstream.codec != "Disabled" && combo_profile.SelectedItem.ToString() == "Disabled") { UnLoadCodecWindow(); outstream.codec = combo_profile.SelectedItem.ToString(); combo_codec.SelectedItem = outstream.codec; outstream.encoding = outstream.codec; LoadCodecWindow(); } else { string codec = outstream.codec; outstream.encoding = combo_profile.SelectedItem.ToString(); string newcodec = PresetLoader.GetACodec(m.format, outstream.encoding); if (codec != newcodec) { UnLoadCodecWindow(); outstream.codec = newcodec; LoadCodecWindow(); } LoadProfileToCodec(); combo_codec.SelectedItem = outstream.codec; } }
private void RefreshCodecProfileWindow() { if (combo_profile.SelectedItem.ToString() == "Copy") { combo_codec.SelectedItem = combo_profile.SelectedItem.ToString(); } if (m.outvcodec != "Copy" && combo_profile.SelectedItem.ToString() == "Copy") { UnLoadCodecWindow(); m.outvcodec = combo_profile.SelectedItem.ToString(); combo_codec.SelectedItem = m.outvcodec; m.vencoding = m.outvcodec; LoadCodecWindow(); } else { string codec = m.outvcodec; m.vencoding = combo_profile.SelectedItem.ToString(); string newcodec = PresetLoader.GetVCodec(m); if (codec != newcodec) { UnLoadCodecWindow(); m.outvcodec = newcodec; LoadCodecWindow(); } LoadProfileToCodec(); combo_codec.SelectedItem = m.outvcodec; } }
public void UpdateManualProfile() { try { UpdateMassive(); //Клонирует массивы и пересоздает vpasses[x] m.vencoding = "Custom"; PresetLoader.CreateVProfile(m); LoadProfiles(); //Пересоздание списка пресетов, выбор текущего UpdateCodecMassive(); //Копирует m отсюда в m.кодека } catch (Exception ex) { new Message(this).ShowMessage(ex.Message, Languages.Translate("Error"), Message.MessageStyle.Ok); } }
public void UpdateManualProfile() { try { AudioStream outstream = (AudioStream)m.outaudiostreams[m.outaudiostream]; UpdateMassive(); outstream.encoding = "Custom"; PresetLoader.CreateAProfile(m); LoadProfiles(); UpdateCodecMassive(); } catch (Exception ex) { new Message(this).ShowMessage(ex.Message, Languages.Translate("Error"), Message.MessageStyle.Ok); } }
private void AddExternalTrack(string infilepath) { //получаем медиа информацию MediaInfoWrapper mi = null; FFInfo ff = null; try { AudioStream stream = null; int old_stream = 0; string ext = Path.GetExtension(infilepath).ToLower(); if (ext != ".avs" && ext != ".grf") { mi = new MediaInfoWrapper(); stream = mi.GetAudioInfoFromAFile(infilepath, false); stream.mi_order = mi.ATrackOrder(0); stream.mi_id = mi.ATrackID(0); ff = new FFInfo(); ff.Open(infilepath); //Аналогично тому, как сделано в Informer'е if (ff.AudioStreams().Count > 0) { stream.ff_order = ff.FirstAudioStreamID(); stream.ff_order_filtered = ff.FilteredStreamOrder(stream.ff_order); if (stream.mi_order < 0) { stream.mi_order = stream.ff_order; } if (stream.bitrate == 0) { stream.bitrate = ff.AudioBitrate(stream.ff_order); } if (stream.channels == 0) { stream.channels = ff.StreamChannels(stream.ff_order); } if (stream.samplerate == null) { stream.samplerate = ff.StreamSamplerate(stream.ff_order); } if (stream.language == "Unknown") { stream.language = ff.StreamLanguage(stream.ff_order); } stream.ff_bits = ff.StreamBits(stream.ff_order); //if (stream.bits == 0) stream.bits = stream.ff_bits; stream.ff_codec = ff.StreamCodec(stream.ff_order); if (stream.codec == "A_MS/ACM" || stream.codec == "") { stream.codec = stream.ff_codec; stream.codecshort = ff.StreamCodecShort(stream.ff_order); } } } else { stream = new AudioStream(); stream.audiopath = infilepath; stream.audiofiles = new string[] { stream.audiopath }; stream.codec = stream.codecshort = "PCM"; stream.language = "Unknown"; } //Добавляем этот трек old_stream = m.inaudiostream; stream = Format.GetValidADecoder(stream); m.inaudiostream = m.inaudiostreams.Count; m.inaudiostreams.Add(stream.Clone()); //Оставшаяся инфа + ошибки Caching cach = new Caching(m, true); if (cach.m == null) { //Удаляем этот трек m.inaudiostream = old_stream; m.inaudiostreams.RemoveAt(m.inaudiostreams.Count - 1); return; } m = cach.m.Clone(); textbox_apath.Text = infilepath; //разрешаем формы group_channels.IsEnabled = true; group_delay.IsEnabled = true; group_samplerate.IsEnabled = true; group_volume.IsEnabled = true; //прописываем в список внешний трек ComboBoxItem item = new ComboBoxItem(); stream = (AudioStream)m.inaudiostreams[m.inaudiostream]; //Переопределяем с новыми параметрами item.Content = (combo_atracks.Items.Count + 1).ToString("00") + ". " + stream.language + " " + stream.codecshort + " " + stream.channels + "ch"; item.ToolTip = item.Content + " " + stream.samplerate + "Hz " + stream.bitrate + "kbps " + stream.delay + "ms"; combo_atracks.Items.Add(item); combo_atracks.SelectedIndex = combo_atracks.Items.Count - 1; } catch (Exception ex) { ErrorException("AddExternalTrack: " + ex.Message, ex.StackTrace); return; } finally { if (mi != null) { mi.Close(); mi = null; } if (ff != null) { ff.Close(); ff = null; } } AudioStream newstream = new AudioStream(); m.outaudiostreams.Clear(); m.outaudiostreams.Add(newstream); AudioStream outstream = (AudioStream)m.outaudiostreams[m.outaudiostream]; //забиваем аудио настройки outstream.encoding = Settings.GetAEncodingPreset(Settings.FormatOut); outstream.codec = PresetLoader.GetACodec(m.format, outstream.encoding); outstream.passes = PresetLoader.GetACodecPasses(m); m = Format.GetValidSamplerate(m); //определяем битность m = Format.GetValidBits(m); //определяем колличество каналов m = Format.GetValidChannelsConverter(m); m = Format.GetValidChannels(m); //проверяем можно ли копировать данный формат if (outstream.codec == "Copy") { AudioStream instream = (AudioStream)m.inaudiostreams[m.inaudiostream]; outstream.audiopath = instream.audiopath; outstream.bitrate = instream.bitrate; string CopyProblems = Format.ValidateCopyAudio(m); if (CopyProblems != null) { Message mess = new Message(this); mess.ShowMessage(Languages.Translate("The stream contains parameters incompatible with this format") + " " + Format.EnumToString(m.format) + ": " + CopyProblems + "." + Environment.NewLine + Languages.Translate("(You see this message because audio encoder = Copy)"), Languages.Translate("Warning")); } } else { string aext = Format.GetValidRAWAudioEXT(outstream.codec); outstream.audiopath = Settings.TempPath + "\\" + m.key + aext; } SetAudioOptions(); SetInfo(); }
private void combo_atracks_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (combo_atracks.IsDropDownOpen || combo_atracks.IsSelectionBoxHighlighted) { m.inaudiostream = combo_atracks.SelectedIndex; //передаём активный трек на выход AudioStream instream = (AudioStream)m.inaudiostreams[m.inaudiostream]; //Требуется извлечение звука if (instream.audiopath == null && instream.decoder == 0 && m.inaudiostream > 0) { //FFMS2 и LSMASH умеют переключать треки, для них их можно не извлекать if (!(m.vdecoder == AviSynthScripting.Decoders.FFmpegSource2 && Settings.FFMS_Enable_Audio || ((m.vdecoder == AviSynthScripting.Decoders.LSMASHVideoSource || m.vdecoder == AviSynthScripting.Decoders.LWLibavVideoSource) && Settings.LSMASH_Enable_Audio))) { string outext = Format.GetValidRAWAudioEXT(instream.codecshort); instream.audiopath = Settings.TempPath + "\\" + m.key + "_" + m.inaudiostream + outext; instream.audiofiles = new string[] { instream.audiopath }; instream = Format.GetValidADecoder(instream); } } textbox_apath.Text = instream.audiopath; //перезабиваем поток на выход AudioStream stream = new AudioStream(); m.outaudiostreams.Clear(); if (Settings.ApplyDelay) { stream.delay = instream.delay; } m.outaudiostreams.Add(stream); AudioStream outstream = (AudioStream)m.outaudiostreams[m.outaudiostream]; //забиваем аудио настройки outstream.encoding = Settings.GetAEncodingPreset(Settings.FormatOut); outstream.codec = PresetLoader.GetACodec(m.format, outstream.encoding); outstream.passes = PresetLoader.GetACodecPasses(m); m = Format.GetValidSamplerate(m); //определяем битность m = Format.GetValidBits(m); //определяем колличество каналов m = Format.GetValidChannelsConverter(m); m = Format.GetValidChannels(m); //проверяем можно ли копировать данный формат if (outstream.codec == "Copy") { //AudioStream instream = (AudioStream)m.inaudiostreams[m.inaudiostream]; outstream.audiopath = instream.audiopath; outstream.bitrate = instream.bitrate; string CopyProblems = Format.ValidateCopyAudio(m); if (CopyProblems != null) { Message mess = new Message(this); mess.ShowMessage(Languages.Translate("The stream contains parameters incompatible with this format") + " " + Format.EnumToString(m.format) + ": " + CopyProblems + "." + Environment.NewLine + Languages.Translate("(You see this message because audio encoder = Copy)"), Languages.Translate("Warning")); } } else { string aext = Format.GetValidRAWAudioEXT(outstream.codec); outstream.audiopath = Settings.TempPath + "\\" + m.key + aext; } SetAudioOptions(); SetInfo(); } }
private void button_add_Click(object sender, System.Windows.RoutedEventArgs e) { if (m.outvcodec == "Copy") { return; } if (x265c == null && x264c == null && x262c == null && xvid == null && mpeg4 == null && mpeg2 == null && mpeg1 == null && flv == null) { UpdateMassive(); //CustomCLI } string auto_name = m.outvcodec + " "; if (m.outvcodec == "HUFF" || m.outvcodec == "FFV1") { auto_name += "LossLess"; } else if (m.outvcodec == "DV") { auto_name += "Custom"; } else { if (m.outvbitrate == 0 || m.outvcodec == "x265" && m.x265options.lossless) { auto_name += "LL"; } else { if (m.encodingmode == Settings.EncodingModes.Quality || m.encodingmode == Settings.EncodingModes.Quantizer || m.encodingmode == Settings.EncodingModes.TwoPassQuality || m.encodingmode == Settings.EncodingModes.ThreePassQuality) { auto_name += "Q" + m.outvbitrate; } else if (m.encodingmode == Settings.EncodingModes.OnePass || m.encodingmode == Settings.EncodingModes.TwoPass || m.encodingmode == Settings.EncodingModes.ThreePass) { auto_name += m.outvbitrate + "k"; } else { auto_name += m.outvbitrate + "MB"; } } if (m.outvcodec != "MJPEG") { if (m.encodingmode == Settings.EncodingModes.TwoPass || m.encodingmode == Settings.EncodingModes.TwoPassSize || m.encodingmode == Settings.EncodingModes.TwoPassQuality) { auto_name += " 2P"; } else if (m.encodingmode == Settings.EncodingModes.ThreePass || m.encodingmode == Settings.EncodingModes.ThreePassSize || m.encodingmode == Settings.EncodingModes.ThreePassQuality) { auto_name = " 3P"; } } auto_name += " Custom"; } NewProfile newp = new NewProfile(auto_name, Format.EnumToString(m.format), NewProfile.ProfileType.VEncoding, this); if (newp.profile != null) { string old_encoding = m.vencoding; m.vencoding = newp.profile; //Название для нового пресета try { PresetLoader.CreateVProfile(m); //Пресет записывается в файл LoadProfiles(); //Обновляется содержимое комбобокса с пресетами, выбирается текущий пресет } catch (Exception ex) { new Message(this).ShowMessage(Languages.Translate("Can`t save profile") + ": " + ex.Message, Languages.Translate("Error"), Message.MessageStyle.Ok); m.vencoding = old_encoding; } } //Не совсем понятно, зачем нужно перезагружаться с пресета, который мы только что сохранили.. if (x265c == null && x264c == null && x262c == null && xvid == null && mpeg4 == null && mpeg2 == null && mpeg1 == null && flv == null) //CustomCLI { LoadProfileToCodec(); UpdateOutSize(); UpdateCodecMassive(); } }
private void LoadProfileToCodec() { //записываем профиль в реестр Settings.SetVEncodingPreset(m.format, combo_profile.SelectedItem.ToString()); if (x265c != null) { //забиваем настройки из профиля x265c.m.vencoding = combo_profile.SelectedItem.ToString(); x265c.m.outvcodec = PresetLoader.GetVCodec(x265c.m); x265c.m.vpasses = PresetLoader.GetVCodecPasses(x265c.m); x265c.m = PresetLoader.DecodePresets(x265c.m); x265c.LoadFromProfile(); } else if (x264c != null) { //забиваем настройки из профиля x264c.m.vencoding = combo_profile.SelectedItem.ToString(); x264c.m.outvcodec = PresetLoader.GetVCodec(x264c.m); x264c.m.vpasses = PresetLoader.GetVCodecPasses(x264c.m); x264c.m = PresetLoader.DecodePresets(x264c.m); x264c.LoadFromProfile(); } else if (x262c != null) { //забиваем настройки из профиля x262c.m.vencoding = combo_profile.SelectedItem.ToString(); x262c.m.outvcodec = PresetLoader.GetVCodec(x262c.m); x262c.m.vpasses = PresetLoader.GetVCodecPasses(x262c.m); x262c.m = PresetLoader.DecodePresets(x262c.m); x262c.LoadFromProfile(); } else if (xvid != null) { //забиваем настройки из профиля xvid.m.vencoding = combo_profile.SelectedItem.ToString(); xvid.m.outvcodec = PresetLoader.GetVCodec(xvid.m); xvid.m.vpasses = PresetLoader.GetVCodecPasses(xvid.m); xvid.m = PresetLoader.DecodePresets(xvid.m); xvid.LoadFromProfile(); } else if (mpeg1 != null) { //забиваем настройки из профиля mpeg1.m.vencoding = combo_profile.SelectedItem.ToString(); mpeg1.m.outvcodec = PresetLoader.GetVCodec(mpeg1.m); mpeg1.m.vpasses = PresetLoader.GetVCodecPasses(mpeg1.m); mpeg1.m = PresetLoader.DecodePresets(mpeg1.m); mpeg1.LoadFromProfile(); } else if (mpeg2 != null) { //забиваем настройки из профиля mpeg2.m.vencoding = combo_profile.SelectedItem.ToString(); mpeg2.m.outvcodec = PresetLoader.GetVCodec(mpeg2.m); mpeg2.m.vpasses = PresetLoader.GetVCodecPasses(mpeg2.m); mpeg2.m = PresetLoader.DecodePresets(mpeg2.m); mpeg2.LoadFromProfile(); } else if (mpeg4 != null) { //забиваем настройки из профиля mpeg4.m.vencoding = combo_profile.SelectedItem.ToString(); mpeg4.m.outvcodec = PresetLoader.GetVCodec(mpeg4.m); mpeg4.m.vpasses = PresetLoader.GetVCodecPasses(mpeg4.m); mpeg4.m = PresetLoader.DecodePresets(mpeg4.m); mpeg4.LoadFromProfile(); } else if (dv != null) { //забиваем настройки из профиля dv.m.vencoding = combo_profile.SelectedItem.ToString(); dv.m.outvcodec = PresetLoader.GetVCodec(dv.m); dv.m.vpasses = PresetLoader.GetVCodecPasses(dv.m); dv.m = PresetLoader.DecodePresets(dv.m); dv.LoadFromProfile(); } else if (huff != null) { //забиваем настройки из профиля huff.m.vencoding = combo_profile.SelectedItem.ToString(); huff.m.outvcodec = PresetLoader.GetVCodec(huff.m); huff.m.vpasses = PresetLoader.GetVCodecPasses(huff.m); huff.m = PresetLoader.DecodePresets(huff.m); huff.LoadFromProfile(); } else if (ffv1 != null) { //забиваем настройки из профиля ffv1.m.vencoding = combo_profile.SelectedItem.ToString(); ffv1.m.outvcodec = PresetLoader.GetVCodec(ffv1.m); ffv1.m.vpasses = PresetLoader.GetVCodecPasses(ffv1.m); ffv1.m = PresetLoader.DecodePresets(ffv1.m); ffv1.LoadFromProfile(); } else if (flv != null) { //забиваем настройки из профиля flv.m.vencoding = combo_profile.SelectedItem.ToString(); flv.m.outvcodec = PresetLoader.GetVCodec(flv.m); flv.m.vpasses = PresetLoader.GetVCodecPasses(flv.m); flv.m = PresetLoader.DecodePresets(flv.m); flv.LoadFromProfile(); } else if (mjpeg != null) { //забиваем настройки из профиля mjpeg.m.vencoding = combo_profile.SelectedItem.ToString(); mjpeg.m.outvcodec = PresetLoader.GetVCodec(mjpeg.m); mjpeg.m.vpasses = PresetLoader.GetVCodecPasses(mjpeg.m); mjpeg.m = PresetLoader.DecodePresets(mjpeg.m); mjpeg.LoadFromProfile(); } }
public VideoEncoding(Massive mass, MainWindow parent) { this.InitializeComponent(); if (mass != null) { this.m = mass.Clone(); this.oldm = mass.Clone(); } else { //Заполняем массив m = new Massive(); m.format = Settings.FormatOut; m.vencoding = old_vencoding = Settings.GetVEncodingPreset(m.format); m.outvcodec = PresetLoader.GetVCodec(m); m.vpasses = PresetLoader.GetVCodecPasses(m); m = PresetLoader.DecodePresets(m); m.infilepath = "C:\\file.mkv"; m.invcodecshort = "NOINPUT"; m.inresw = m.outresw = 640; m.inresh = m.outresh = 480; m.induration = m.outduration = TimeSpan.FromMinutes(1); m.inframerate = m.outframerate = "25.000"; m.inframes = m.outframes = 1000; m.infilesizeint = 1000; m.invbitrate = 1000; //Убираем лишнее, т.к. всё-равно показывать там нечего text_insize_value.Visibility = text_outsize_value.Visibility = Visibility.Collapsed; text_inquality_value.Visibility = text_outquality_value.Visibility = Visibility.Collapsed; text_codec.Margin = text_incodec_value.Margin = combo_codec.Margin = new Thickness(16, 8, 16, 8); row2.Height = row3.Height = new GridLength(0); } this.Owner = this.p = parent; //загружаем список кодеков соответвующий формату foreach (string codec in Format.GetVCodecsList(m.format)) { combo_codec.Items.Add(codec); } combo_codec.Items.Add("Copy"); if (!combo_codec.Items.Contains(m.outvcodec)) { combo_codec.Items.Add(m.outvcodec); } combo_codec.SelectedItem = m.outvcodec; text_incodec_value.Content = m.invcodecshort; text_insize_value.Content = m.infilesize; text_outsize_value.Content = m.outfilesize = Calculate.GetEncodingSize(m); //загружаем правильную страницу LoadCodecWindow(); //переводим Title = Languages.Translate("Video encoding settings"); text_size.Content = Languages.Translate("Size") + ":"; text_codec.Content = Languages.Translate("Codec") + ":"; text_quality.Content = Languages.Translate("Quality") + ":"; text_profile.Content = Languages.Translate("Profile:"); button_cancel.Content = Languages.Translate("Cancel"); button_ok.Content = Languages.Translate("OK"); button_add.ToolTip = Languages.Translate("Add profile"); button_remove.ToolTip = Languages.Translate("Remove profile"); //bit-pixels calculation text_inquality_value.Content = Calculate.GetQualityIn(m); text_outquality_value.Content = Calculate.GetQualityOut(m, true); LoadProfiles(); ShowDialog(); }
private void button_add_Click(object sender, System.Windows.RoutedEventArgs e) { AudioStream outstream = (AudioStream)m.outaudiostreams[m.outaudiostream]; if (outstream.codec == "Copy" || outstream.codec == "Disabled") { return; } UpdateMassive(); string auto_name = outstream.codec; if (outstream.codec == "AAC") { if (m.aac_options.aacprofile == "AAC-LC") { auto_name += "-LC"; } else if (m.aac_options.aacprofile == "AAC-HE") { auto_name += "-HE"; } else if (m.aac_options.aacprofile == "AAC-HEv2") { auto_name += "-HEv2"; } auto_name += " " + m.aac_options.encodingmode.ToString(); if (m.aac_options.encodingmode == Settings.AudioEncodingModes.VBR) { auto_name += " Q" + m.aac_options.quality; } else { auto_name += " " + outstream.bitrate + "k"; } } else if (outstream.codec == "QAAC") { if (m.qaac_options.encodingmode != Settings.AudioEncodingModes.ALAC) { if (m.qaac_options.aacprofile == "AAC-LC") { auto_name += "-LC"; } else if (m.qaac_options.aacprofile == "AAC-HE") { auto_name += "-HE"; } auto_name += " " + m.qaac_options.encodingmode.ToString(); if (m.qaac_options.encodingmode == Settings.AudioEncodingModes.VBR) { auto_name += " Q" + m.qaac_options.quality; } else { auto_name += " " + outstream.bitrate + "k"; } } else { auto_name += " " + m.qaac_options.encodingmode.ToString(); } } else if (outstream.codec == "MP3") { auto_name += " " + m.mp3_options.encodingmode.ToString().ToUpper(); if (m.mp3_options.encodingmode == Settings.AudioEncodingModes.VBR) { auto_name += " Q" + m.mp3_options.quality; } else { auto_name += " " + outstream.bitrate + "k"; } } else if (outstream.codec == "PCM" || outstream.codec == "LPCM") { auto_name += " " + outstream.bits + "bit"; } else if (outstream.codec == "AC3" || outstream.codec == "MP2") { auto_name += " " + outstream.bitrate + "k"; } else if (outstream.codec == "FLAC") { auto_name += " Q" + m.flac_options.level; } auto_name += " Custom"; NewProfile newp = new NewProfile(auto_name, Format.EnumToString(m.format), NewProfile.ProfileType.AEncoding, this); if (newp.profile != null) { string old_encoding = outstream.encoding; outstream.encoding = newp.profile; try { PresetLoader.CreateAProfile(m); LoadProfiles(); } catch (Exception ex) { new Message(this).ShowMessage(Languages.Translate("Can`t save profile") + ": " + ex.Message, Languages.Translate("Error"), Message.MessageStyle.Ok); outstream.encoding = old_encoding; } } LoadProfileToCodec(); UpdateOutSize(); UpdateCodecMassive(); }
private void LoadProfileToCodec() { //записываем профиль в реестр Settings.SetAEncodingPreset(m.format, combo_profile.SelectedItem.ToString()); m = Format.GetValidChannelsConverter(m); m = Format.GetValidChannels(m); m = Format.GetValidSamplerate(m); m = Format.GetValidBits(m); if (aac != null) { AudioStream outstream = (AudioStream)aac.m.outaudiostreams[aac.m.outaudiostream]; //забиваем настройки из профиля outstream.encoding = combo_profile.SelectedItem.ToString(); outstream.codec = PresetLoader.GetACodec(aac.m.format, outstream.encoding); outstream.passes = PresetLoader.GetACodecPasses(aac.m); aac.m = PresetLoader.DecodePresets(aac.m); aac.LoadFromProfile(); } else if (qaac != null) { AudioStream outstream = (AudioStream)qaac.m.outaudiostreams[qaac.m.outaudiostream]; //забиваем настройки из профиля outstream.encoding = combo_profile.SelectedItem.ToString(); outstream.codec = PresetLoader.GetACodec(qaac.m.format, outstream.encoding); outstream.passes = PresetLoader.GetACodecPasses(qaac.m); qaac.m = PresetLoader.DecodePresets(qaac.m); qaac.LoadFromProfile(); } else if (mp3 != null) { AudioStream outstream = (AudioStream)mp3.m.outaudiostreams[mp3.m.outaudiostream]; //забиваем настройки из профиля outstream.encoding = combo_profile.SelectedItem.ToString(); outstream.codec = PresetLoader.GetACodec(mp3.m.format, outstream.encoding); outstream.passes = PresetLoader.GetACodecPasses(mp3.m); mp3.m = PresetLoader.DecodePresets(mp3.m); mp3.LoadFromProfile(); } else if (ac3 != null) { AudioStream outstream = (AudioStream)ac3.m.outaudiostreams[ac3.m.outaudiostream]; //забиваем настройки из профиля outstream.encoding = combo_profile.SelectedItem.ToString(); outstream.codec = PresetLoader.GetACodec(ac3.m.format, outstream.encoding); outstream.passes = PresetLoader.GetACodecPasses(ac3.m); ac3.m = PresetLoader.DecodePresets(ac3.m); ac3.LoadFromProfile(); } else if (fmp2 != null) { AudioStream outstream = (AudioStream)fmp2.m.outaudiostreams[fmp2.m.outaudiostream]; //забиваем настройки из профиля outstream.encoding = combo_profile.SelectedItem.ToString(); outstream.codec = PresetLoader.GetACodec(fmp2.m.format, outstream.encoding); outstream.passes = PresetLoader.GetACodecPasses(fmp2.m); fmp2.m = PresetLoader.DecodePresets(fmp2.m); fmp2.LoadFromProfile(); } else if (fpcm != null) { AudioStream outstream = (AudioStream)fpcm.m.outaudiostreams[fpcm.m.outaudiostream]; //забиваем настройки из профиля outstream.encoding = combo_profile.SelectedItem.ToString(); outstream.codec = PresetLoader.GetACodec(fpcm.m.format, outstream.encoding); outstream.passes = PresetLoader.GetACodecPasses(fpcm.m); fpcm.m = PresetLoader.DecodePresets(fpcm.m); fpcm.LoadFromProfile(); } else if (flpcm != null) { AudioStream outstream = (AudioStream)flpcm.m.outaudiostreams[flpcm.m.outaudiostream]; //забиваем настройки из профиля outstream.encoding = combo_profile.SelectedItem.ToString(); outstream.codec = PresetLoader.GetACodec(flpcm.m.format, outstream.encoding); outstream.passes = PresetLoader.GetACodecPasses(flpcm.m); flpcm.m = PresetLoader.DecodePresets(flpcm.m); flpcm.LoadFromProfile(); } else if (fflac != null) { AudioStream outstream = (AudioStream)fflac.m.outaudiostreams[fflac.m.outaudiostream]; //забиваем настройки из профиля outstream.encoding = combo_profile.SelectedItem.ToString(); outstream.codec = PresetLoader.GetACodec(fflac.m.format, outstream.encoding); outstream.passes = PresetLoader.GetACodecPasses(fflac.m); fflac.m = PresetLoader.DecodePresets(fflac.m); fflac.LoadFromProfile(); } }
public AudioEncoding(Massive mass, MainWindow parent) { this.InitializeComponent(); if (mass != null) { this.m = mass.Clone(); this.oldm = mass.Clone(); } else { //Заполняем массив m = new Massive(); m.format = Settings.FormatOut; m.infilepath = "C:\\file.mkv"; //Добавляем звук m.inaudiostreams.Add(new AudioStream()); m.outaudiostreams.Add(new AudioStream()); m.inaudiostream = m.outaudiostream = 0; //Убираем лишнее, т.к. всё-равно показывать там нечего text_insize_value.Visibility = text_outsize_value.Visibility = Visibility.Collapsed; text_codec.Margin = text_incodec_value.Margin = combo_codec.Margin = new Thickness(16, 8, 16, 8); row2.Height = new GridLength(0); } this.Owner = parent; //определяем аудио потоки AudioStream instream = (AudioStream)m.inaudiostreams[m.inaudiostream]; AudioStream outstream = (AudioStream)m.outaudiostreams[m.outaudiostream]; if (oldm == null) { //Заполняем параметры треков outstream.encoding = old_aencoding = Settings.GetAEncodingPreset(m.format); outstream.codec = PresetLoader.GetACodec(m.format, outstream.encoding); outstream.passes = PresetLoader.GetACodecPasses(m); instream.audiopath = "C:\\file.mp3"; instream.codecshort = "NOINPUT"; instream.bitrate = 128; instream.bits = outstream.bits = 16; instream.channels = outstream.channels = 2; instream.samplerate = outstream.samplerate = "44100"; m = PresetLoader.DecodePresets(m); } //загружаем список кодеков соответвующий формату foreach (string codec in Format.GetACodecsList(m.format)) { combo_codec.Items.Add(codec); } if (oldm != null) { combo_codec.Items.Add("Disabled"); } combo_codec.Items.Add("Copy"); if (!combo_codec.Items.Contains(outstream.codec)) { combo_codec.Items.Add(outstream.codec); } combo_codec.SelectedItem = outstream.codec; text_incodec_value.Content = instream.codecshort; text_insize_value.Content = m.infilesize; text_outsize_value.Content = m.outfilesize = Calculate.GetEncodingSize(m); //загружаем правильную страницу LoadCodecWindow(); //переводим Title = Languages.Translate("Audio encoding settings"); text_size.Content = Languages.Translate("Size") + ":"; text_codec.Content = Languages.Translate("Codec") + ":"; text_profile.Content = Languages.Translate("Profile:"); button_cancel.Content = Languages.Translate("Cancel"); button_ok.Content = Languages.Translate("OK"); button_add.ToolTip = Languages.Translate("Add profile"); button_remove.ToolTip = Languages.Translate("Remove profile"); LoadProfiles(); ShowDialog(); }