Exemplo n.º 1
0
        private void videoProfile_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.videoProfile.SelectedIndex != -1) // if it's -1 it's bogus
            {
                if (!dontEncodeAudio.Checked)
                {
                    containerFormat.Enabled = true;
                }
                GenericProfile <VideoCodecSettings> prof = (GenericProfile <VideoCodecSettings>) this.mainForm.Profiles.VideoProfiles[this.videoProfile.SelectedItem.ToString()];
#warning fix selected index selection

/*                if (prof.Settings is lavcSettings)
 *              {
 *                  videoCodec.SelectedIndex = (int)VideoCodec.ASP;
 *              }
 *              if (prof.Settings is x264Settings)
 *              {
 *                  videoCodec.SelectedIndex = (int)VideoCodec.AVC;
 *              }
 *              if (prof.Settings is snowSettings)
 *              {
 *                  videoCodec.SelectedIndex = (int)VideoCodec.SNOW;
 *                  if (!dontEncodeAudio.Checked)
 *                  {
 *                      containerFormat.SelectedIndex = 0;
 *                      containerFormat_SelectedIndexChanged(null, null);
 *                      containerFormat.Enabled = false;
 *                  }
 *              }
 *              if (prof.Settings is xvidSettings)
 *              {
 *                  videoCodec.SelectedIndex = (int)VideoCodec.ASP;
 *              }*/
            }
        }
Exemplo n.º 2
0
        private void newProfileButton_Click(object sender, EventArgs e)
        {
            string profileName = Microsoft.VisualBasic.Interaction.InputBox("Please give the profile a name", "Please give the profile a name", "", -1, -1);

            if (profileName == null)
            {
                return;
            }
            profileName = profileName.Trim();
            if (profileName.Length == 0)
            {
                return;
            }
            GenericProfile <OneClickSettings> prof = new GenericProfile <OneClickSettings>(profileName, this.Settings);

            if (this.mainForm.Profiles.AddProfile(prof))
            {
                this.playbackMethod.Items.Add(prof.Name);
                this.playbackMethod.SelectedIndex = this.playbackMethod.Items.IndexOf(prof.Name);
                this.oldOneClickProfileIndex      = this.playbackMethod.SelectedIndex;
            }
            else
            {
                MessageBox.Show("Sorry, profiles must have unique names", "Duplicate name detected", MessageBoxButtons.OK);
            }
        }
Exemplo n.º 3
0
 public static void FixFileNames(Profile profile, Dictionary <string, string> substitutionTable)
 {
     if (profile is GenericProfile <VideoCodecSettings> )
     {
         GenericProfile <VideoCodecSettings> vProf = profile as GenericProfile <VideoCodecSettings>;
         if (vProf.Settings is x264Settings)
         {
             x264Settings xSettings = vProf.Settings as x264Settings;
             if (xSettings.QuantizerMatrixType == 2) // CQM
             {
                 if (substitutionTable.ContainsKey(xSettings.QuantizerMatrix))
                 {
                     xSettings.QuantizerMatrix = substitutionTable[xSettings.QuantizerMatrix];
                 }
             }
         }
         if (vProf.Settings is xvidSettings)
         {
             xvidSettings xSettings = vProf.Settings as xvidSettings;
             if (xSettings.QuantType == 2) // CQM
             {
                 if (substitutionTable.ContainsKey(xSettings.CustomQuantizerMatrix))
                 {
                     xSettings.CustomQuantizerMatrix = substitutionTable[xSettings.CustomQuantizerMatrix];
                 }
             }
         }
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// updates the currently selected settings with what's currently being shown in the GUI
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void updateButton_Click(object sender, EventArgs e)
 {
     if (this.avsProfile.SelectedIndex != -1) // if it's -1 it's bogus
     {
         GenericProfile <AviSynthSettings> prof = (GenericProfile <AviSynthSettings>) this.profileManager.AvsProfiles[this.avsProfile.SelectedItem.ToString()];
         prof.Settings = this.Settings;
     }
     else
     {
         MessageBox.Show("You must select a profile to update!", "No profile selected", MessageBoxButtons.OK, MessageBoxIcon.Error);
         return;
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// handles the selection of a profile from the list
        /// the profile is looked up from the profiles Hashtable (it uses the name as unique key), then
        /// the settings from the new profile are displayed in the GUI
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void avsProfile_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            if (this.avsProfile.SelectedIndex != -1)             // if it's -1 it's bogus
            {
                GenericProfile <AviSynthSettings> prof = (GenericProfile <AviSynthSettings>) this.profileManager.AvsProfiles[this.avsProfile.SelectedItem.ToString()];
                this.Settings = prof.Settings;

                /*if (this.oldAviSynthProfileIndex != -1 && !this.newProfile) // -1 means it's never been touched
                 *  this.profileManager.AvsProfiles[this.avsProfile.Items[this.oldAviSynthProfileIndex].ToString()].Settings = this.Settings;
                 * newProfile = false;
                 * this.Settings = prof.Settings;
                 * this.oldAviSynthProfileIndex = this.avsProfile.SelectedIndex;
                 * this.avsProfile.SelectAll();*/
            }
        }
Exemplo n.º 6
0
        private void playbackMethod_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (playbackMethod.SelectedIndex != -1) // if it's -1 it's bogus
            {
                GenericProfile <OneClickSettings> prof = (GenericProfile <OneClickSettings>) this.mainForm.Profiles.OneClickProfiles[this.playbackMethod.SelectedItem.ToString()];
                this.Settings = prof.Settings;

                /*
                 * if (this.oldOneClickProfileIndex != -1 && !newProfile) // -1 means it's never been touched
                 *  this.mainForm.Profiles.OneClickProfiles[this.playbackMethod.Items[this.oldOneClickProfileIndex].ToString()].Settings = this.Settings;
                 * newProfile = false;
                 * this.Settings = prof.Settings;
                 * this.oldOneClickProfileIndex = this.playbackMethod.SelectedIndex;
                 * this.playbackMethod.SelectAll();*/
            }
        }
Exemplo n.º 7
0
 public Profile[] AllDependantProfiles(string formattedName)
 {
     try
     {
         if (formattedName.StartsWith("Video: "))
         {
             return(new Profile[] { VideoProfiles[formattedName.Substring(7)].baseClone() });
         }
         else if (formattedName.StartsWith("Audio: "))
         {
             return(new Profile[] { AudioProfiles[formattedName.Substring(7)] });
         }
         else if (formattedName.StartsWith("AviSynth: "))
         {
             return(new Profile[] { AvsProfiles[formattedName.Substring(10)] });
         }
         else if (formattedName.StartsWith("OneClick: "))
         {
             GenericProfile <OneClickSettings> profile = (GenericProfile <OneClickSettings>)OneClickProfiles[formattedName.Substring(10)];
             if (profile.Settings.DontEncodeAudio)
             {
                 return new Profile[] { profile, VideoProfiles[profile.Settings.VideoProfileName].baseClone() }
             }
             ;
             else
             {
                 return new Profile[] { profile,
                                        VideoProfiles[profile.Settings.VideoProfileName].baseClone(),
                                        AudioProfiles[profile.Settings.AudioProfileName] }
             };
         }
         else
         {
             return(null);
         }
     }
     catch (KeyNotFoundException) // In this case the profile name is not valid for some reason.
     {
         return(null);
     }
 }
Exemplo n.º 8
0
        private void updateButton_Click(object sender, EventArgs e)
        {
            if (playbackMethod.SelectedIndex != -1) // if it's -1 it's bogus
            {
                GenericProfile <OneClickSettings> prof = (GenericProfile <OneClickSettings>) this.mainForm.Profiles.OneClickProfiles[this.playbackMethod.SelectedItem.ToString()];
                prof.Settings = this.Settings;

                /*
                 * if (this.oldOneClickProfileIndex != -1 && !newProfile) // -1 means it's never been touched
                 *  this.mainForm.Profiles.OneClickProfiles[this.playbackMethod.Items[this.oldOneClickProfileIndex].ToString()].Settings = this.Settings;
                 * newProfile = false;
                 * this.Settings = prof.Settings;
                 * this.oldOneClickProfileIndex = this.playbackMethod.SelectedIndex;
                 * this.playbackMethod.SelectAll();*/
            }
            else
            {
                MessageBox.Show("You must select a profile to update!", "No profile selected", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
        }
Exemplo n.º 9
0
 public string[] RequiredFiles(Profile profile)
 {
     if (profile is GenericProfile <VideoCodecSettings> )
     {
         GenericProfile <VideoCodecSettings> vProfile = profile as GenericProfile <VideoCodecSettings>;
         if (vProfile.Settings is x264Settings)
         {
             if ((vProfile.Settings as x264Settings).QuantizerMatrixType == 2) // Custom profile
             {
                 return new string[] { (vProfile.Settings as x264Settings).QuantizerMatrix }
             }
             ;
         }
         if (vProfile.Settings is xvidSettings)
         {
             if ((vProfile.Settings as xvidSettings).QuantType == 2) // CQM
             {
                 return new string[] { (vProfile.Settings as xvidSettings).CustomQuantizerMatrix }
             }
             ;
         }
     }
     return(new string[] { });
 }
Exemplo n.º 10
0
 public bool AddVideoProfile(GenericProfile <VideoCodecSettings> prof)
 {
     return(AddProfile(prof, prof.BaseSettings.getSettingsType()));
 }