Пример #1
0
        public int AVSCreatorOpen(string videoInput)
        {
            int           iResult = -1;
            MediaInfoFile iFile   = new MediaInfoFile(videoInput);

            FileIndexerWindow.IndexType oIndexer;

            if (!iFile.recommendIndexer(out oIndexer, true))
            {
                return(iResult);
            }

            if (oIndexer != FileIndexerWindow.IndexType.D2V && oIndexer != FileIndexerWindow.IndexType.DGA &&
                oIndexer != FileIndexerWindow.IndexType.DGI && oIndexer != FileIndexerWindow.IndexType.FFMS &&
                oIndexer != FileIndexerWindow.IndexType.LSMASH)
            {
                return(iResult);
            }

            if (iFile.ContainerFileTypeString.ToUpperInvariant().Equals("AVI"))
            {
                iResult = askAbout3("Do you want to open this file with\r\n" +
                                    "- One Click Encoder (fully automated, easy to use) or\r\n" +
                                    "- File Indexer (manual, advanced) or \r\n" +
                                    "- AviSource (manual, expert, may cause problems)?", "Please choose your prefered way to open this file",
                                    "One Click Encoder", "File Indexer", "AviSource", MessageBoxIcon.Question);
            }
            else
            {
                iResult = askAbout3("Do you want to open this file with\r\n" +
                                    "- One Click Encoder (fully automated, easy to use) or\r\n" +
                                    "- File Indexer (manual, advanced) or \r\n" +
                                    "- DirectShowSource (manual, expert, may cause problems)?", "Please choose your prefered way to open this file",
                                    "One Click Encoder", "File Indexer", "DirectShowSource", MessageBoxIcon.Question);
            }
            return(iResult);
        }
Пример #2
0
        /// <summary>
        /// Gets the information how the file can be opened
        /// </summary>
        /// <param name="videoInput"></param>
        /// <returns>
        /// -1 file cannot be opened
        ///  0 OneClick Encoder
        ///  1 File Indexer
        ///  2 AviSource
        ///  3 DirectShowSource
        /// </returns>
        public int AVSCreatorOpen(string videoInput)
        {
            int           iResult = -1;
            MediaInfoFile iFile   = new MediaInfoFile(videoInput);

            FileIndexerWindow.IndexType oIndexer = FileIndexerWindow.IndexType.NONE;

            // check if OCE or FileIndexer can be used
            if (!iFile.recommendIndexer(out oIndexer))
            {
                // they cannot be used
                if (iFile.isAVISourceIndexable(false))
                {
                    iResult = 2;
                }
                else if (iFile.isDirectShowSourceIndexable())
                {
                    iResult = 3;
                }
                return(iResult);
            }

            // OCE or File Indexer can be used - should DirectShowSource/AVISource be tried as well?

            if (MainForm.Instance.Settings.EnableDirectShowSource)
            {
                if (iFile.isAVISourceIndexable(false))
                {
                    iResult = askAbout3("Do you want to open this file with\r\n" +
                                        "- One Click Encoder (fully automated, easy to use) or\r\n" +
                                        "- File Indexer (manual, advanced) or \r\n" +
                                        "- AviSource (manual, expert, may cause problems)?", "Please choose your prefered way to open this file",
                                        "One Click Encoder", "File Indexer", "AviSource", MessageBoxIcon.Question);
                    return(iResult);
                }
                else if (iFile.isDirectShowSourceIndexable())
                {
                    iResult = askAbout3("Do you want to open this file with\r\n" +
                                        "- One Click Encoder (fully automated, easy to use) or\r\n" +
                                        "- File Indexer (manual, advanced) or \r\n" +
                                        "- DirectShowSource (manual, expert, may cause problems)?", "Please choose your prefered way to open this file",
                                        "One Click Encoder", "File Indexer", "DirectShowSource", MessageBoxIcon.Question);
                    if (iResult == 2)
                    {
                        iResult = 3;
                    }
                    return(iResult);
                }
            }

            string strText = string.Empty;

            if (MainForm.Instance.Settings.EnableDirectShowSource)
            {
                strText = "\r\n\r\nDirectShowSource or AVISource is not supported.";
            }
            else
            {
                strText = "\r\n\r\nDirectShowSource or AVISource is not recommended\r\nand has to be enabled in the settings if required.";
            }

            iResult = askAbout2("Do you want to open this file with\r\n" +
                                "- One Click Encoder (fully automated, easy to use) or\r\n" +
                                "- File Indexer (manual, advanced)?" + strText, "Please choose your preferred tool",
                                "One Click Encoder", "File Indexer", MessageBoxIcon.Question);
            return(iResult);
        }
Пример #3
0
        private void openVideo(string fileName)
        {
            setControlState(true);

            this._oLog = MainForm.Instance.FileIndexerLog;
            if (_oLog == null)
            {
                _oLog = MainForm.Instance.Log.Info("FileIndexer");
                MainForm.Instance.FileIndexerLog = _oLog;
            }

            gbFileInformation.Text = " File Information ";
            iFile = null;
            if (GetDVDorBluraySource(fileName, ref iFile))
            {
                if (iFile != null)
                {
                    fileName = iFile.FileName;
                    string strText = (iFile.VideoInfo.PGCNumber > 1 ? " - PGC " + iFile.VideoInfo.PGCNumber.ToString("D2") : string.Empty) + (iFile.VideoInfo.AngleNumber > 0 ? " - Angle " + iFile.VideoInfo.AngleNumber + " " : string.Empty);
                    if (strText.Trim().Length > 0)
                    {
                        gbFileInformation.Text += strText.Trim() + " ";
                    }
                }
            }
            else
            {
                iFile = new MediaInfoFile(fileName, ref _oLog);
            }

            if (iFile != null && iFile.HasVideo)
            {
                strVideoCodec      = iFile.VideoInfo.Track.Codec;
                strVideoScanType   = iFile.VideoInfo.ScanType;
                strContainerFormat = iFile.ContainerFileTypeString;
            }
            else
            {
                strVideoCodec = strVideoScanType = strContainerFormat = string.Empty;
            }

            if (String.IsNullOrEmpty(strVideoCodec))
            {
                txtCodecInformation.Text = " unknown";
            }
            else
            {
                txtCodecInformation.Text = " " + strVideoCodec;
            }
            if (String.IsNullOrEmpty(strContainerFormat))
            {
                txtContainerInformation.Text = " unknown";
            }
            else
            {
                txtContainerInformation.Text = " " + strContainerFormat;
            }
            if (String.IsNullOrEmpty(strVideoScanType))
            {
                txtScanTypeInformation.Text = " unknown";
            }
            else
            {
                txtScanTypeInformation.Text = " " + strVideoScanType;
            }

            if (iFile != null && iFile.HasAudio)
            {
                audioTracks = iFile.AudioInfo.Tracks;
            }
            else
            {
                audioTracks = new List <AudioTrackInfo>();
            }

            if (input.Filename != fileName)
            {
                input.Filename = fileName;
            }

            generateAudioList();

            if (iFile != null)
            {
                IndexType newType = IndexType.NONE;
                iFile.recommendIndexer(out newType);
                if (newType == IndexType.D2V || newType == IndexType.DGM ||
                    newType == IndexType.DGI || newType == IndexType.FFMS ||
                    newType == IndexType.LSMASH)
                {
                    btnD2V.Enabled    = iFile.isD2VIndexable();
                    btnDGM.Enabled    = iFile.isDGMIndexable();
                    btnDGI.Enabled    = iFile.isDGIIndexable();
                    btnFFMS.Enabled   = iFile.isFFMSIndexable();
                    btnLSMASH.Enabled = iFile.isLSMASHIndexable();

                    gbIndexer.Enabled = gbAudio.Enabled = gbOutput.Enabled = true;
                    changeIndexer(newType);
                    setControlState(false);
                    return;
                }
            }

            // source file not supported
            btnD2V.Enabled             = btnDGM.Enabled = btnDGI.Enabled = btnFFMS.Enabled = btnLSMASH.Enabled = false;
            gbIndexer.Enabled          = gbAudio.Enabled = gbOutput.Enabled = false;
            btnFFMS.Checked            = btnD2V.Checked = btnDGM.Checked = btnDGI.Checked = btnLSMASH.Checked = false;
            output.Filename            = "";
            demuxNoAudiotracks.Checked = true;
            setControlState(false);
            MessageBox.Show("No indexer for this file found!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }
Пример #4
0
        private void openVideo(string fileName)
        {
            MediaInfoFile iFile = new MediaInfoFile(fileName, ref _oLog);

            strVideoCodec      = iFile.VideoInfo.Track.Codec;
            strVideoScanType   = iFile.VideoInfo.ScanType;
            strContainerFormat = iFile.ContainerFileTypeString;
            audioTracks        = iFile.AudioInfo.Tracks;

            if (String.IsNullOrEmpty(strVideoCodec))
            {
                txtCodecInformation.Text = " unknown";
            }
            else
            {
                txtCodecInformation.Text = " " + strVideoCodec;
            }
            if (String.IsNullOrEmpty(strContainerFormat))
            {
                txtContainerInformation.Text = " unknown";
            }
            else
            {
                txtContainerInformation.Text = " " + strContainerFormat;
            }
            if (String.IsNullOrEmpty(strVideoScanType))
            {
                txtScanTypeInformation.Text = " unknown";
            }
            else
            {
                txtScanTypeInformation.Text = " " + strVideoScanType;
            }

            cbPGC.Items.Clear();
            if (iFile.VideoInfo.PGCCount <= 0)
            {
                cbPGC.Items.Add("none");
            }
            else if (iFile.VideoInfo.PGCCount == 1)
            {
                cbPGC.Items.Add("all");
            }
            else
            {
                cbPGC.Items.Add("all");
                for (int i = 1; i < iFile.VideoInfo.PGCCount; i++)
                {
                    cbPGC.Items.Add(i.ToString());
                }
            }
            cbPGC.SelectedIndex = 0;
            cbPGC.Enabled       = iFile.VideoInfo.PGCCount > 1;

            if (input.Filename != fileName)
            {
                input.Filename = fileName;
            }

            generateAudioList();

            btnD2V.Enabled  = iFile.isD2VIndexable();
            btnDGA.Enabled  = iFile.isDGAIndexable();
            btnDGI.Enabled  = iFile.isDGIIndexable();
            btnFFMS.Enabled = iFile.isFFMSIndexable();

            IndexType newType = IndexType.NONE;

            if (iFile.recommendIndexer(out newType))
            {
                gbIndexer.Enabled = gbAudio.Enabled = gbOutput.Enabled = true;
                changeIndexer(newType);
            }
            else
            {
                gbIndexer.Enabled          = gbAudio.Enabled = gbOutput.Enabled = false;
                btnFFMS.Checked            = btnD2V.Checked = btnDGA.Checked = btnDGI.Checked = false;
                output.Text                = "";
                demuxNoAudiotracks.Checked = true;
                MessageBox.Show("No indexer for this file found. Please try open it directly in the AVS Script Creator", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }