コード例 #1
0
ファイル: FFRebuilder.xaml.cs プロジェクト: BrunoReX/xvid4psp
 private void combo_vcodec_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if ((combo_vcodec.IsDropDownOpen || combo_vcodec.IsSelectionBoxHighlighted) && combo_vcodec.SelectedItem != null)
     {
         vcodec = (vcodecs)combo_vcodec.SelectedItem;
         UpdateCommandLine();
         SetCustomProfile();
         UpdateCombosIsEnabled();
     }
 }
コード例 #2
0
ファイル: FFRebuilder.xaml.cs プロジェクト: BrunoReX/xvid4psp
        private void LoadFromProfile()
        {
            try
            {
                //Сбрасываем на дефолты
                bool cli_loaded = false;
                format = "AUTO";
                vcodec = vcodecs.COPY;
                color = colorspace.YV12;
                aspect = "AUTO";
                framerate = "AUTO";
                acodec = acodecs.COPY;
                bits = "S16LE";
                //atrack = 0; //Не сохраняется в пресете
                srate = "AUTO";
                channels = "AUTO";

                if (profile != "Default")
                {
                    using (StreamReader sr = new StreamReader(Calculate.StartupPath + "\\presets\\ffrebuilder\\" + profile + ".txt", System.Text.Encoding.Default))
                    {
                        string line;
                        while (!sr.EndOfStream)
                        {
                            line = sr.ReadLine();
                            if (line == "[FORMAT]") format = sr.ReadLine().ToUpper();
                            else if (line == "[VCODEC]") vcodec = (vcodecs)Enum.Parse(typeof(vcodecs), sr.ReadLine(), true);
                            else if (line == "[COLORSPACE]") color = (colorspace)Enum.Parse(typeof(colorspace), sr.ReadLine(), true);
                            else if (line == "[ASPECT]") aspect = sr.ReadLine().ToUpper();
                            else if (line == "[FRAMERATE]") framerate = sr.ReadLine().ToUpper();
                            else if (line == "[ACODEC]") acodec = (acodecs)Enum.Parse(typeof(acodecs), sr.ReadLine(), true);
                            else if (line == "[PCM_BITS]") bits = sr.ReadLine().ToUpper();
                            else if (line == "[SAMPLERATE]") srate = sr.ReadLine().ToUpper();
                            else if (line == "[CHANNELS]") channels = sr.ReadLine().ToUpper();
                            else if (line == "[COMMAND_LINE]") { text_cli.Text = sr.ReadLine(); cli_loaded = true; }
                        }
                    }
                }

                //Выставляем значения
                if (!combo_format.Items.Contains(format))
                    combo_format.Items.Add(format);
                combo_format.SelectedItem = format;
                combo_vcodec.SelectedItem = vcodec;
                combo_colorspace.SelectedItem = color;
                if (!combo_aspect.Items.Contains(aspect))
                    combo_aspect.Items.Add(aspect);
                combo_aspect.SelectedItem = aspect;
                if (!combo_framerate.Items.Contains(framerate))
                    combo_framerate.Items.Add(framerate);
                combo_framerate.SelectedItem = framerate;
                combo_acodec.SelectedItem = acodec;
                combo_bits.SelectedItem = bits;
                //combo_atrack.SelectedIndex = atrack;
                if (!combo_srate.Items.Contains(srate))
                    combo_srate.Items.Add(srate);
                combo_srate.SelectedItem = srate;
                if (!combo_channels.Items.Contains(channels))
                    combo_channels.Items.Add(channels);
                combo_channels.SelectedItem = channels;
                if (!cli_loaded || text_cli.Text.Trim() == "")
                    UpdateCommandLine();
                UpdateTracksMapping();
            }
            catch (Exception ex)
            {
                //При ошибке загружаем дефолты
                if (profile != "Default")
                {
                    ErrorException(Languages.Translate("Error loading profile") + " \"" + profile + "\": " + ex.Message +
                        "\r\n" + Languages.Translate("Retrying with profile") + " \"Default\"...");
                    combo_profile.SelectedItem = profile = Settings.FFRebuilder_Profile = "Default";
                    LoadFromProfile();
                    return;
                }
                else
                    ErrorException(Languages.Translate("Error loading profile") + " \"Default\": " + ex.Message);
            }
        }
コード例 #3
0
ファイル: FFRebuilder.xaml.cs プロジェクト: BrunoReX/xvid4psp
        private void combo_format_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            if ((combo_format.IsDropDownOpen || combo_format.IsSelectionBoxHighlighted || combo_format.IsEditable) && combo_format.SelectedItem != null)
            {
                if (combo_format.SelectedIndex == 0)
                {
                    //Включаем редактирование
                    combo_format.IsEditable = true;
                    combo_format.ToolTip = Languages.Translate("Enter - apply, Esc - cancel.");
                    combo_format.ApplyTemplate();
                    return;
                }
                else
                {
                    //AUTO, AVI, DV, MP4, M4V, MOV, MKV, WEBM, MPG, TS, FLV, OGG, WMV,
                    //H264, VC1, AC3, FLAC, WAV, M4A, AAC, MKA, MP3, MP2, WMA, DTS, TRUEHD
                    format = combo_format.SelectedItem.ToString();
                    if (format == "WAV")
                    {
                        combo_vcodec.SelectedItem = vcodec = vcodecs.DISABLED;
                        if (acodec != acodecs.COPY && acodec != acodecs.PCM)
                            combo_acodec.SelectedItem = acodec = acodecs.PCM;
                    }
                    else if (format == "FLAC")
                    {
                        combo_vcodec.SelectedItem = vcodec = vcodecs.DISABLED;
                        if (acodec != acodecs.COPY && acodec != acodecs.FLAC)
                            combo_acodec.SelectedItem = acodec = acodecs.FLAC;
                    }
                    else if (format == "MKA")
                    {
                        combo_vcodec.SelectedItem = vcodec = vcodecs.DISABLED;
                        if (acodec == acodecs.DISABLED)
                            combo_acodec.SelectedItem = acodec = acodecs.COPY;
                    }
                    else if (format == "M4A" || format == "AAC" || format == "MP3" || format == "MP2" ||
                        format == "AC3" || format == "WMA" || format == "DTS" || format == "TRUEHD")
                    {
                        combo_vcodec.SelectedItem = vcodec = vcodecs.DISABLED;
                        combo_acodec.SelectedItem = acodec = acodecs.COPY;
                    }
                    else if (format == "H264" || format == "VC1")
                    {
                        combo_vcodec.SelectedItem = vcodec = vcodecs.COPY;
                        combo_acodec.SelectedItem = acodec = acodecs.DISABLED;
                    }
                    else
                    {
                        if (vcodec == vcodecs.DISABLED)
                            combo_vcodec.SelectedItem = vcodec = vcodecs.COPY;
                        if (acodec == acodecs.DISABLED)
                            combo_acodec.SelectedItem = acodec = acodecs.COPY;
                    }

                    UpdateCommandLine();
                    SetCustomProfile();
                    UpdateCombosIsEnabled();
                }
            }

            if (combo_format.IsEditable)
            {
                //Выключаем редактирование
                combo_format.IsEditable = false;
                combo_format.ToolTip = null;
            }

            if (!string.IsNullOrEmpty(textbox_infile.Text))
            {
                string ext = ((format == "AUTO") ? Path.GetExtension(textbox_infile.Text) : "." + format.ToString()).ToLower();
                if (ext == ".avs") ext = ".avi";

                if (textbox_outfile.Text == "")
                    textbox_outfile.Text = Calculate.RemoveExtention(textbox_infile.Text, true) + ".remuxed" + ext;
                else
                    textbox_outfile.Text = Calculate.RemoveExtention(textbox_outfile.Text, true) + ext;
            }
        }