Esempio n. 1
0
        private void videoProfile_SelectedProfileChanged(object sender, EventArgs e)
        {
            updateIOConfig();

            if (CurrentSettings.EncoderType == lastCodec)
            {
                return;
            }

            lastCodec = CurrentSettings.EncoderType;

            VideoType[] vArray = videoEncoderProvider.GetSupportedOutput(lastCodec);
            if (lastCodec == VideoEncoderType.XVID)
            {
                Array.Resize(ref vArray, vArray.Length + 2);
                vArray[vArray.Length - 2] = VideoType.AVI;
                vArray[vArray.Length - 1] = VideoType.MKV;
            }
            else if (lastCodec == VideoEncoderType.X264)
            {
                Array.Resize(ref vArray, vArray.Length + 1);
                vArray[vArray.Length - 1] = VideoType.MP4;
            }
            else if (lastCodec == VideoEncoderType.X265)
            {
                Array.Resize(ref vArray, vArray.Length + 2);
                vArray[vArray.Length - 2] = VideoType.MKV;
                vArray[vArray.Length - 1] = VideoType.MP4;
            }

            Util.ChangeItemsKeepingSelectedSame(fileType, vArray);
        }
Esempio n. 2
0
        private void videoProfile_SelectedProfileChanged(object sender, EventArgs e)
        {
            if (CurrentSettings.EncoderType == lastCodec)
            {
                return;
            }

            lastCodec = CurrentSettings.EncoderType;
            Util.ChangeItemsKeepingSelectedSame(fileType, videoEncoderProvider.GetSupportedOutput(lastCodec));
        }
Esempio n. 3
0
        /// <summary>
        /// Finds the best mux path if some of the inputs have not yet been
        /// produced (they are yet to be encoded). When this is the case,
        /// there is more flexibility, as some encoders can produce outputs
        /// in multiple formats. This function suggests the output formats
        /// they should produce as well as the mux path.
        /// </summary>
        /// <param name="undecidedInputs">List of encoder types for the inputs which have not yet been encoded</param>
        /// <param name="decidedInputs">List of file types for the inputs which are already encoded</param>
        /// <param name="containerType">Target container type</param>
        /// <returns></returns>
        private MuxPath findBestMuxPathAndConfig(List <IEncoderType> undecidedInputs, List <MuxableType> decidedInputs, ContainerType containerType)
        {
            if (undecidedInputs.Count == 0)
            {
                return(getShortestMuxPath(new MuxPath(decidedInputs, containerType), decidedInputs, containerType));
            }
            else
            {
                List <MuxPath> allPaths       = new List <MuxPath>();
                IEncoderType   undecidedInput = undecidedInputs[0];
                undecidedInputs.RemoveAt(0);

                if (undecidedInput is VideoEncoderType)
                {
                    VideoType[] allTypes = vProvider.GetSupportedOutput((VideoEncoderType)undecidedInput);
                    foreach (VideoType v in allTypes)
                    {
                        MuxableType input = new MuxableType(v, undecidedInput.Codec);
                        decidedInputs.Add(input);
                        MuxPath path = findBestMuxPathAndConfig(undecidedInputs, decidedInputs, containerType);
                        if (path != null)
                        {
                            allPaths.Add(path);
                        }
                        decidedInputs.Remove(input);
                    }
                }
                if (undecidedInput is AudioEncoderType)
                {
                    AudioType[] allTypes = aProvider.GetSupportedOutput((AudioEncoderType)undecidedInput);
                    foreach (AudioType a in allTypes)
                    {
                        MuxableType input = new MuxableType(a, undecidedInput.Codec);
                        decidedInputs.Add(input);
                        MuxPath path = findBestMuxPathAndConfig(undecidedInputs, decidedInputs, containerType);
                        if (path != null)
                        {
                            allPaths.Add(path);
                        }
                        decidedInputs.Remove(input);
                    }
                }
                undecidedInputs.Insert(0, undecidedInput);
                return(comparer.GetBestMuxPath(allPaths));
            }
        }
Esempio n. 4
0
        public void InitializeDropdowns()
        {
            videoCodec.Items.Clear();
            videoCodec.Items.AddRange(mainForm.PackageSystem.VideoSettingsProviders.ValuesArray);
            try { videoCodec.SelectedItem = mainForm.PackageSystem.VideoSettingsProviders["x264"]; }
            catch (Exception)
            {
                try { videoCodec.SelectedIndex = 0; }
                catch (Exception) { MessageBox.Show("No valid video codecs are set up", "No valid video codecs", MessageBoxButtons.OK, MessageBoxIcon.Error); }
            }


            fileTypeHandler = new FileTypeHandler <VideoType>(fileType, videoCodec,
                                                              new FileTypeHandler <VideoType> .SupportedOutputGetter(delegate
            {
                return(videoEncoderProvider.GetSupportedOutput(codecHandler.CurrentSettingsProvider.EncoderType));
            }));

            fileTypeHandler.FileTypeChanged += new FileTypeHandler <VideoType> .FileTypeEvent(delegate
                                                                                              (object sender, VideoType currentType) {
                VideoCodecSettings settings = CurrentSettings;
                this.updateIOConfig();
                if (MainForm.verifyOutputFile(this.VideoOutput) == null)
                {
                    this.VideoOutput = Path.ChangeExtension(this.VideoOutput, currentType.Extension);
                }
            });

            codecHandler =
                new MultipleConfigurersHandler <VideoCodecSettings, VideoInfo, VideoCodec, VideoEncoderType>(videoCodec);

            profileHandler = new ProfilesControlHandler <VideoCodecSettings, VideoInfo>("Video", mainForm, profileControl1,
                                                                                        codecHandler.EditSettings, new InfoGetter <VideoInfo>(getInfo),
                                                                                        codecHandler.Getter, codecHandler.Setter);
            codecHandler.Register(profileHandler);
            fileTypeHandler.RefreshFiletypes();
        }