コード例 #1
0
        /// <summary>
        ///     Download latest FFmpeg version for current operating system to "." directory. Works best with FFmpeg.ExecutablesPath as path
        /// <param name="version">Determine which version of FFmpeg should be downloaded</param>
        /// <param name="path">FFmpeg executables destination directory</param>
        /// <param name="progress">Progress of download</param>
        /// </summary>
        public static async Task GetLatestVersion(FFmpegVersion version, string path, IProgress <ProgressInfo> progress = null)
        {
            IFFmpegDownloader downloader;

            switch (version)
            {
            case FFmpegVersion.Official:
                downloader = new OfficialFFmpegDownloader();
                break;

            case FFmpegVersion.Full:
                downloader = new FullFFmpegDownloader();
                break;

            case FFmpegVersion.Shared:
                downloader = new SharedFFmpegDownloader();
                break;

            case FFmpegVersion.Android:
                downloader = new AndroidFFmpegDownloader();
                break;

            default:
                throw new NotImplementedException();
            }
            await downloader.GetLatestVersion(path, progress);
        }
コード例 #2
0
        public async Task <IActionResult> Versions()
        {
            FFmpegTask ffmpeg = new FFmpegTask();

            ffmpeg.Start();

            FFmpegVersion version = await ffmpeg.GetOutputAsync() as FFmpegVersion;

            return(Ok(version));
        }
コード例 #3
0
        public static void Save()
        {
            XmlDocument document        = new XmlDocument();
            XmlElement  settingsElement = document.AppendNewChildElement("YaffmiSettings");

            settingsElement.AppendNewChildElement("ShowAdvancedTab",
                                                  ShowAdvancedTab.ToString().ToLower());
            settingsElement.AppendNewChildElement("ShowFullInputFilePath",
                                                  ShowFullInputFilePath.ToString().ToLower());
            settingsElement.AppendNewChildElement("NeverAbortOnError",
                                                  NeverAbortOnError.ToString().ToLower());

            settingsElement.AppendNewChildElement("DefaultOutputFolder", DefaultOutputFolder);
            settingsElement.AppendNewChildElement("DefaultSaveLog",
                                                  DefaultSaveLog.ToString().ToLower());

            settingsElement.AppendNewChildElement("FFmpegPath32", FFmpegPath32);
            settingsElement.AppendNewChildElement("FFmpegPath64", FFmpegPath64);
            settingsElement.AppendNewChildElement("FFmpegVersion",
                                                  FFmpegVersion.ToString(CultureInfo.InvariantCulture));

            XmlWriterSettings settings = new XmlWriterSettings
            {
                Indent      = true,
                CloseOutput = true,
            };

            try
            {
                if (File.Exists(SettingsFile))
                {
                    File.Delete(SettingsFile);
                }

                using (XmlWriter writer = XmlWriter.Create(SettingsFile, settings))
                    document.WriteTo(writer);
            }
            catch (Exception e)
            {
                throw new SettingsException(
                          SettingsException.OperationValue.Save, e);
            }
        }
コード例 #4
0
 /// <summary>
 ///     Download latest FFmpeg version for current operating system to "." directory.
 /// <param name="version">Determine which version of FFmpeg should be downloaded</param>
 /// <param name="progress">Progress of download</param>
 /// </summary>
 public static async Task GetLatestVersion(FFmpegVersion version, IProgress <ProgressInfo> progress = null)
 {
     await GetLatestVersion(version, null, progress);
 }
コード例 #5
0
 /// <summary>
 ///     Download latest FFmpeg version for current operating system to FFmpeg.ExecutablePath. If it is not set download to ".".
 /// <param id="version">Determine which version of FFmpeg should be downloaded</param>
 /// </summary>
 public static async Task GetLatestVersion(FFmpegVersion version)
 {
     await GetLatestVersion(version, null);
 }