コード例 #1
0
ファイル: OneClickWindow.cs プロジェクト: huannguyenfit/MeGUI
        public OneClickWindow(MainForm mainForm, JobUtil jobUtil, VideoEncoderProvider vProv, AudioEncoderProvider aProv)
        {
            this.mainForm            = mainForm;
            vUtil                    = new VideoUtil(mainForm);
            this.muxProvider         = mainForm.MuxProvider;
            acceptableContainerTypes = muxProvider.GetSupportedContainers().ToArray();

            InitializeComponent();

            initTabs();

            videoProfile.Manager = mainForm.Profiles;
            initAudioHandler();
            avsProfile.Manager = mainForm.Profiles;
            initOneClickHandler();

            audioTrack1.StandardItems = audioTrack2.StandardItems = new object[] { "None" };
            audioTrack1.SelectedIndex = audioTrack2.SelectedIndex = 0;

            //if containerFormat has not yet been set by the oneclick profile, add supported containers
            if (containerFormat.Items.Count == 0)
            {
                containerFormat.Items.AddRange(muxProvider.GetSupportedContainers().ToArray());
                this.containerFormat.SelectedIndex = 0;
            }

            showAdvancedOptions_CheckedChanged(null, null);
        }
コード例 #2
0
        public AdaptiveMuxWindow(MainForm mainForm)
        {
            InitializeComponent();
            jobUtil     = new JobUtil(mainForm);
            muxProvider = mainForm.MuxProvider;

            audioTracks[0].Filter    = VideoUtil.GenerateCombinedFilter(ContainerManager.AudioTypes.ValuesArray);
            subtitleTracks[0].Filter = VideoUtil.GenerateCombinedFilter(ContainerManager.SubtitleTypes.ValuesArray);
            vInput.Filter            = VideoUtil.GenerateCombinedFilter(ContainerManager.VideoTypes.ValuesArray);
        }
コード例 #3
0
ファイル: baseMuxWindow.cs プロジェクト: pphh77/MeGui
        public baseMuxWindow(MainForm mainForm, IMuxing muxer) : this()
        {
            this.mainForm = mainForm;
            this.settings = mainForm.Settings;
            this.muxer    = muxer;

            muxProvider = mainForm.MuxProvider;
            cbType.Items.Add("Standard");
            cbType.Items.AddRange(muxProvider.GetSupportedDevices((ContainerType)cbContainer.SelectedItem).ToArray());
            cbType.SelectedIndex = 0;
        }
コード例 #4
0
        public AdaptiveMuxWindow() : base(MainForm.Instance, null)
        {
            InitializeComponent();
            muxProvider = mainForm.MuxProvider;

            audioTracks[0].Filter    = VideoUtil.GenerateCombinedFilter(ContainerManager.AudioTypes.ValuesArray);
            subtitleTracks[0].Filter = VideoUtil.GenerateCombinedFilter(ContainerManager.SubtitleTypes.ValuesArray);
            vInput.Filter            = VideoUtil.GenerateCombinedFilter(ContainerManager.VideoTypes.ValuesArray);
            chapters.Filter          = VideoUtil.GenerateCombinedFilter(ContainerManager.ChapterTypes.ValuesArray);
            cbContainer.Visible      = true;
            lbContainer.Visible      = true;

            subtitleTracks[0].chkDefaultStream.CheckedChanged += new System.EventHandler(base.chkDefaultStream_CheckedChanged);
            base.muxButton.Click += new System.EventHandler(this.muxButton_Click);
        }
コード例 #5
0
 public AutoEncodeWindow(VideoStream videoStream, List <AudioJob> audioStreams, MainForm mainForm, bool prerender, VideoInfo vInfo)
     : this()
 {
     this.vInfo = vInfo;
     mainForm.Log.Add(log);
     this.videoStream  = videoStream;
     this.audioStreams = audioStreams;
     this.prerender    = prerender;
     this.mainForm     = mainForm;
     jobUtil           = new JobUtil(mainForm);
     vUtil             = new VideoUtil(mainForm);
     muxProvider       = mainForm.MuxProvider;
     container.Items.AddRange(muxProvider.GetSupportedContainers().ToArray());
     splitting.MinimumFileSize = new FileSize(Unit.MB, 1);
 }
コード例 #6
0
ファイル: AdaptiveMuxWindow.cs プロジェクト: paulyc/megui
        public AdaptiveMuxWindow(MainForm mainForm)
            : base(mainForm, null)
        {
            InitializeComponent();
            jobUtil     = new JobUtil(mainForm);
            muxProvider = mainForm.MuxProvider;

            audioTracks[0].Filter    = VideoUtil.GenerateCombinedFilter(ContainerManager.AudioTypes.ValuesArray);
            subtitleTracks[0].Filter = VideoUtil.GenerateCombinedFilter(ContainerManager.SubtitleTypes.ValuesArray);
            vInput.Filter            = VideoUtil.GenerateCombinedFilter(ContainerManager.VideoTypes.ValuesArray);
            chapters.Filter          = VideoUtil.GenerateCombinedFilter(ContainerManager.ChapterTypes.ValuesArray);
            cbContainer.Visible      = true;
            lbContainer.Visible      = true;

            subtitleTracks[0].chkDefaultStream.CheckedChanged += new System.EventHandler(base.chkDefaultStream_CheckedChanged);
            this.cbContainer.SelectedIndexChanged             += new System.EventHandler(this.cbContainer_SelectedIndexChanged);
        }
コード例 #7
0
 public AutoEncodeWindow(VideoStream videoStream, AudioStream[] audioStreams, MainForm mainForm, bool prerender)
     : this()
 {
     if (videoStream.Settings.EncodingMode == 1 || videoStream.Settings.EncodingMode == 9) // CQ and CRF -- no bitrate possible
     {
         averageBitrateRadio.Enabled = false;
         FileSizeRadio.Enabled       = false;
         noTargetRadio.Checked       = true;
     }
     this.videoStream  = videoStream;
     this.audioStreams = audioStreams;
     this.prerender    = prerender;
     this.mainForm     = mainForm;
     jobUtil           = new JobUtil(mainForm);
     vUtil             = new VideoUtil(mainForm);
     muxProvider       = mainForm.MuxProvider;
     container.Items.AddRange(muxProvider.GetSupportedContainers().ToArray());
 }
コード例 #8
0
ファイル: Calculator.cs プロジェクト: huannguyenfit/MeGUI
        public Calculator(MainForm mainForm) : this()
        {
            this.mainForm    = mainForm;
            this.muxProvider = mainForm.MuxProvider;
            this.videoCodec.Items.AddRange(CodecManager.VideoEncoderTypes.ValuesArray);
            videoCodec.SelectedItem = CodecManager.VideoEncoderTypes["x264"];
            this.containerFormat.Items.AddRange(muxProvider.GetSupportedContainers().ToArray());
            containerFormat.SelectedItem = ContainerType.MKV;

            // set complexity from settings
            this.complexity.Minimum = 0;
            this.complexity.Maximum = 100;
            this.complexity.Value   = (mainForm.Settings.MinComplexity + mainForm.Settings.MaxComplexity) / 2;
            this.complexity.Minimum = mainForm.Settings.MinComplexity;
            this.complexity.Maximum = mainForm.Settings.MaxComplexity;

            // wire the input boxes to auto-select text on focus
            AddAutoSelectHandler(this);

            // set focus of calculate by
            this.averageBitrateRadio.Click += (s, args) => projectedBitrate.Focus();
            this.bppRadio.Click            += (s, args) => bpp.Focus();
            this.qEstRadio.Click           += (s, args) => qest.Focus();
            this.fileSizeRadio.Click       += (s, args) => targetSize.Focus();

            // smart focus for audio and extras (try to fix render bug w/ scrollbar)
            this.audioExtraFlow.ControlRemoved += (s, args) =>
            {
                int idx = (int)args.Control.Tag;
                if (idx > 0)
                {
                    audioExtraFlow.Controls[idx - 1].Focus();
                }
                TagIndexes();
            };
            this.audioExtraFlow.ControlAdded += (s, args) =>
            {
                args.Control.Focus();
                TagIndexes();
            };
        }
コード例 #9
0
 public AutoEncodeWindow(VideoStream videoStream, List <AudioJob> audioStreams, MainForm mainForm, bool prerender, VideoInfo vInfo)
     : this()
 {
     this.vInfo = vInfo;
     mainForm.Log.Add(log);
     if (videoStream.Settings.EncodingMode == 1 || videoStream.Settings.EncodingMode == 9) // CQ and CRF -- no bitrate possible
     {
         averageBitrateRadio.Enabled = false;
         FileSizeRadio.Enabled       = false;
         noTargetRadio.Checked       = true;
     }
     this.videoStream  = videoStream;
     this.audioStreams = audioStreams;
     this.prerender    = prerender;
     this.mainForm     = mainForm;
     jobUtil           = new JobUtil(mainForm);
     vUtil             = new VideoUtil(mainForm);
     muxProvider       = mainForm.MuxProvider;
     container.Items.AddRange(muxProvider.GetSupportedContainers().ToArray());
     splitting.MinimumFileSize = new FileSize(Unit.MB, 1);
 }
コード例 #10
0
        public JobChain GenerateMuxJobs(VideoStream video, decimal?framerate, MuxStream[] audioStreamsArray,
                                        MuxableType[] audioTypes, MuxStream[] subtitleStreamsArray, MuxableType[] subTypes,
                                        string chapterFile, MuxableType chapterInputType, ContainerType container, string output,
                                        FileSize?splitSize, List <string> inputsToDelete, string deviceType, MuxableType deviceOutputType, bool alwaysMuxOutput)
        {
            Debug.Assert(splitSize == null || splitSize.Value != FileSize.Empty);

            MuxProvider        prov           = mainForm.MuxProvider;
            List <MuxableType> allTypes       = new List <MuxableType>();
            List <MuxableType> tempTypes      = new List <MuxableType>();
            List <MuxableType> duplicateTypes = new List <MuxableType>();

            tempTypes.AddRange(audioTypes);
            tempTypes.AddRange(subTypes);
            allTypes.Add(video.VideoType);

            // remove duplicate entries to speed up the process
            foreach (MuxableType oType in tempTypes)
            {
                bool bFound = false;
                foreach (MuxableType oAllType in allTypes)
                {
                    if (oType.outputType.ID.Equals(oAllType.outputType.ID))
                    {
                        bFound = true;
                        break;
                    }
                }
                if (!bFound)
                {
                    allTypes.Add(oType);
                }
                else
                {
                    duplicateTypes.Add(oType);
                }
            }
            if (chapterInputType != null)
            {
                allTypes.Add(chapterInputType);
            }
            if (deviceOutputType != null)
            {
                allTypes.Add(deviceOutputType);
            }

            // get mux path
            MuxPath muxPath = prov.GetMuxPath(container, alwaysMuxOutput || splitSize.HasValue, allTypes.ToArray());

            // add duplicate entries back into the mux path
            muxPath.InitialInputTypes.AddRange(duplicateTypes);
            while (duplicateTypes.Count > 0)
            {
                int iPath = 0;
                for (int i = 0; i < muxPath.Length; i++)
                {
                    foreach (MuxableType oType in muxPath[i].handledInputTypes)
                    {
                        if (oType.outputType.ID.Equals(duplicateTypes[0].outputType.ID))
                        {
                            iPath = i;
                        }
                    }
                }
                muxPath[iPath].handledInputTypes.Add(duplicateTypes[0]);
                duplicateTypes.RemoveAt(0);
            }

            List <MuxJob>    jobs            = new List <MuxJob>();
            List <MuxStream> subtitleStreams = new List <MuxStream>(subtitleStreamsArray);
            List <MuxStream> audioStreams    = new List <MuxStream>(audioStreamsArray);
            int    index          = 0;
            int    tempNumber     = 1;
            string previousOutput = null;

            foreach (MuxPathLeg mpl in muxPath)
            {
                List <string> filesToDeleteThisJob = new List <string>();

                MuxJob mjob = new MuxJob();

                if (previousOutput != null)
                {
                    mjob.Settings.MuxedInput = previousOutput;
                    filesToDeleteThisJob.Add(previousOutput);
                }

                if (video.Settings != null)
                {
                    mjob.NbOfBFrames        = video.Settings.NbBframes;
                    mjob.Codec              = video.Settings.Codec.ToString();
                    mjob.Settings.VideoName = video.Settings.VideoName;
                }
                mjob.NbOfFrames = video.NumberOfFrames;
                string fpsFormated = String.Format("{0:##.###}", framerate); // this formating is required for mkvmerge at least to avoid fps rounding error
                mjob.Settings.Framerate = Convert.ToDecimal(fpsFormated);

                string tempOutputName = Path.Combine(Path.GetDirectoryName(output),
                                                     Path.GetFileNameWithoutExtension(output) + tempNumber + ".");
                tempNumber++;
                foreach (MuxableType o in mpl.handledInputTypes)
                {
                    if (o.outputType is VideoType)
                    {
                        mjob.Settings.VideoInput = video.Output;
                        if (inputsToDelete.Contains(video.Output))
                        {
                            filesToDeleteThisJob.Add(video.Output);
                        }
                        mjob.Settings.DAR = video.DAR;
                    }
                    else if (o.outputType is AudioType)
                    {
                        MuxStream stream = audioStreams.Find(delegate(MuxStream m)
                        {
                            return(VideoUtil.guessAudioType(m.path) == o.outputType);
                        });

                        if (stream != null)
                        {
                            mjob.Settings.AudioStreams.Add(stream);
                            audioStreams.Remove(stream);

                            if (inputsToDelete.Contains(stream.path))
                            {
                                filesToDeleteThisJob.Add(stream.path);
                            }
                        }
                    }
                    else if (o.outputType is SubtitleType)
                    {
                        MuxStream stream = subtitleStreams.Find(delegate(MuxStream m)
                        {
                            return(VideoUtil.guessSubtitleType(m.path) == o.outputType);
                        });

                        if (stream != null)
                        {
                            mjob.Settings.SubtitleStreams.Add(stream);
                            subtitleStreams.Remove(stream);

                            if (inputsToDelete.Contains(stream.path))
                            {
                                filesToDeleteThisJob.Add(stream.path);
                            }
                        }
                    }
                    else if (o.outputType is ChapterType)
                    {
                        if ((VideoUtil.guessChapterType(chapterFile) == o.outputType))
                        {
                            mjob.Settings.ChapterFile = chapterFile;
                        }
                        if (inputsToDelete.Contains(chapterFile))
                        {
                            filesToDeleteThisJob.Add(chapterFile);
                        }
                    }
                    else if (o.outputType is DeviceType)
                    {
                        if ((VideoUtil.guessDeviceType(deviceType) == o.outputType))
                        {
                            mjob.Settings.DeviceType = deviceType;
                        }
                    }
                }
                foreach (MuxStream s in mjob.Settings.AudioStreams)
                {
                    audioStreams.Remove(s);
                }
                foreach (MuxStream s in mjob.Settings.SubtitleStreams)
                {
                    subtitleStreams.Remove(s);
                }
                mjob.FilesToDelete.AddRange(filesToDeleteThisJob);
                if (index == muxPath.Length - 1)
                {
                    mjob.Settings.MuxedOutput = output;
                    mjob.Settings.SplitSize   = splitSize;
                    mjob.Settings.DAR         = video.DAR;
                    mjob.ContainerType        = container;
                }
                else
                {
                    ContainerType cot = mpl.muxerInterface.GetContainersInCommon(muxPath[index + 1].muxerInterface)[0];
                    mjob.Settings.MuxedOutput = tempOutputName + cot.Extension;
                    mjob.ContainerType        = cot;
                }
                previousOutput = mjob.Settings.MuxedOutput;
                index++;
                jobs.Add(mjob);
                if (string.IsNullOrEmpty(mjob.Settings.VideoInput))
                {
                    mjob.Input = mjob.Settings.MuxedInput;
                }
                else
                {
                    mjob.Input = mjob.Settings.VideoInput;
                }
                mjob.Output  = mjob.Settings.MuxedOutput;
                mjob.MuxType = mpl.muxerInterface.MuxerType;
            }

            return(new SequentialChain(jobs.ToArray()));
        }
コード例 #11
0
        public JobChain GenerateMuxJobs(VideoStream video, decimal?framerate, MuxStream[] audioStreamsArray, MuxableType[] audioTypes,
                                        MuxStream[] subtitleStreamsArray, MuxableType[] subTypes,
                                        string chapterFile, MuxableType chapterInputType, ContainerType container, string output, FileSize?splitSize, List <string> inputsToDelete)
        {
            Debug.Assert(splitSize == null || splitSize.Value != FileSize.Empty);

            MuxProvider        prov     = mainForm.MuxProvider;
            List <MuxableType> allTypes = new List <MuxableType>();

            allTypes.Add(video.VideoType);
            allTypes.AddRange(audioTypes);
            allTypes.AddRange(subTypes);
            if (chapterInputType != null)
            {
                allTypes.Add(chapterInputType);
            }
            MuxPath          muxPath         = prov.GetMuxPath(container, allTypes.ToArray());
            List <MuxJob>    jobs            = new List <MuxJob>();
            List <MuxStream> subtitleStreams = new List <MuxStream>(subtitleStreamsArray);
            List <MuxStream> audioStreams    = new List <MuxStream>(audioStreamsArray);
            int    index          = 0;
            int    tempNumber     = 1;
            string previousOutput = null;

            foreach (MuxPathLeg mpl in muxPath)
            {
                List <string> filesToDeleteThisJob = new List <string>();

                MuxJob mjob = new MuxJob();


                if (previousOutput != null)
                {
                    mjob.Settings.MuxedInput = previousOutput;
                    filesToDeleteThisJob.Add(previousOutput);
                }

                mjob.NbOfFrames         = video.NumberOfFrames;
                mjob.NbOfBFrames        = video.Settings.NbBframes;
                mjob.Codec              = video.Settings.Codec.ToString();
                mjob.Settings.Framerate = framerate;

                string tempOutputName = Path.Combine(Path.GetDirectoryName(output),
                                                     Path.GetFileNameWithoutExtension(output) + tempNumber + ".");
                tempNumber++;
                foreach (MuxableType o in mpl.handledInputTypes)
                {
                    if (o.outputType is VideoType)
                    {
                        mjob.Settings.VideoInput = video.Output;
                        if (inputsToDelete.Contains(video.Output))
                        {
                            filesToDeleteThisJob.Add(video.Output);
                        }
                        mjob.Settings.DAR = video.DAR;
                    }
                    else if (o.outputType is AudioType)
                    {
                        MuxStream stream = audioStreams.Find(delegate(MuxStream m)
                        {
                            return(VideoUtil.guessAudioType(m.path) == o.outputType);
                        });

                        if (stream != null)
                        {
                            mjob.Settings.AudioStreams.Add(stream);
                            audioStreams.Remove(stream);

                            if (inputsToDelete.Contains(stream.path))
                            {
                                filesToDeleteThisJob.Add(stream.path);
                            }
                        }
                    }
                    else if (o.outputType is SubtitleType)
                    {
                        MuxStream stream = subtitleStreams.Find(delegate(MuxStream m)
                        {
                            return(VideoUtil.guessSubtitleType(m.path) == o.outputType);
                        });

                        if (stream != null)
                        {
                            mjob.Settings.SubtitleStreams.Add(stream);
                            subtitleStreams.Remove(stream);

                            if (inputsToDelete.Contains(stream.path))
                            {
                                filesToDeleteThisJob.Add(stream.path);
                            }
                        }
                    }
                    else if (o.outputType is ChapterType)
                    {
                        if ((VideoUtil.guessChapterType(chapterFile) == o.outputType))
                        {
                            mjob.Settings.ChapterFile = chapterFile;
                        }
                        if (inputsToDelete.Contains(chapterFile))
                        {
                            filesToDeleteThisJob.Add(chapterFile);
                        }
                    }
                }
                foreach (MuxStream s in mjob.Settings.AudioStreams)
                {
                    audioStreams.Remove(s);
                }
                foreach (MuxStream s in mjob.Settings.SubtitleStreams)
                {
                    subtitleStreams.Remove(s);
                }
                mjob.FilesToDelete.AddRange(filesToDeleteThisJob);
                if (index == muxPath.Length - 1)
                {
                    mjob.Settings.MuxedOutput = output;
                    mjob.Settings.SplitSize   = splitSize;
                    mjob.Settings.DAR         = video.DAR;
                    mjob.ContainerType        = container;
                }
                else
                {
                    ContainerType cot = mpl.muxerInterface.GetContainersInCommon(muxPath[index + 1].muxerInterface)[0];
                    mjob.Settings.MuxedOutput = tempOutputName + cot.Extension;
                    mjob.ContainerType        = cot;
                }
                previousOutput = mjob.Settings.MuxedOutput;
                index++;
                jobs.Add(mjob);
                if (string.IsNullOrEmpty(mjob.Settings.VideoInput))
                {
                    mjob.Input = mjob.Settings.MuxedInput;
                }
                else
                {
                    mjob.Input = mjob.Settings.VideoInput;
                }
                mjob.Output  = mjob.Settings.MuxedOutput;
                mjob.MuxType = mpl.muxerInterface.MuxerType;
            }

            return(new SequentialChain(jobs.ToArray()));
        }
コード例 #12
0
ファイル: AdaptiveMuxWindow.cs プロジェクト: paulyc/megui
 public AdaptiveMuxWindow(MainForm mainForm)
 {
     InitializeComponent();
     jobUtil     = new JobUtil(mainForm);
     muxProvider = mainForm.MuxProvider;
 }