Esempio n. 1
0
        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;
            }
        }
Esempio n. 2
0
        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();
            }
        }
Esempio n. 3
0
        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();
        }