FFMpegDownloadInfo.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. using System;
  2. namespace MediaBrowser.ServerApplication.FFMpeg
  3. {
  4. public static class FFMpegDownloadInfo
  5. {
  6. // Windows builds: http://ffmpeg.zeranoe.com/builds/
  7. // Linux builds: http://ffmpeg.gusari.org/static/
  8. public static string Version = ffmpegOsType("Version");
  9. public static string[] FfMpegUrls = GetDownloadUrls();
  10. public static string FFMpegFilename = ffmpegOsType("FFMpegFilename");
  11. public static string FFProbeFilename = ffmpegOsType("FFProbeFilename");
  12. public static string ArchiveType = ffmpegOsType("ArchiveType");
  13. private static string ffmpegOsType(string arg)
  14. {
  15. OperatingSystem os = Environment.OSVersion;
  16. PlatformID pid = os.Platform;
  17. switch (pid)
  18. {
  19. case PlatformID.Win32NT:
  20. switch (arg)
  21. {
  22. case "Version":
  23. return "20140105";
  24. case "FFMpegFilename":
  25. return "ffmpeg.exe";
  26. case "FFProbeFilename":
  27. return "ffprobe.exe";
  28. case "ArchiveType":
  29. return "7z";
  30. }
  31. break;
  32. case PlatformID.Unix:
  33. case PlatformID.MacOSX:
  34. switch (arg)
  35. {
  36. case "Version":
  37. return "20140104";
  38. case "FFMpegFilename":
  39. return "ffmpeg";
  40. case "FFProbeFilename":
  41. return "ffprobe";
  42. case "ArchiveType":
  43. return "gz";
  44. }
  45. break;
  46. }
  47. return "";
  48. }
  49. private static string[] GetDownloadUrls()
  50. {
  51. var pid = Environment.OSVersion.Platform;
  52. switch (pid)
  53. {
  54. case PlatformID.Win32NT:
  55. return new[]
  56. {
  57. "http://ffmpeg.zeranoe.com/builds/win32/static/ffmpeg-20140105-git-70937d9-win32-static.7z",
  58. "https://www.dropbox.com/s/oghurnp5zh292ry/ffmpeg-20140105-git-70937d9-win32-static.7z?dl=1"
  59. };
  60. case PlatformID.Unix:
  61. case PlatformID.MacOSX:
  62. return new[]
  63. {
  64. "http://ffmpeg.gusari.org/static/32bit/ffmpeg.static.32bit.2014-01-04.tar.gz",
  65. "https://www.dropbox.com/s/b7nkg71sil812hp/ffmpeg.static.32bit.2014-01-04.tar.gz?dl=1"
  66. };
  67. }
  68. return new string[] {};
  69. }
  70. }
  71. }