Compare commits

..

No commits in common. "483c52677272208ba3620a6607333d96d93d74b3" and "9f6249cb5f324291abfd08b47c0e0f05fc210db8" have entirely different histories.

3 changed files with 11 additions and 7 deletions

View file

@ -30,21 +30,21 @@ public class FFMpegDownloader
// download ffmpeg if selected
if (binaries.HasFlag(FFMpegBinaries.FFMpeg) && downloadInfo.FFMpeg is not null)
{
await using var zipStream = await FFbinariesService.DownloadFileAsSteam(new Uri(downloadInfo.FFMpeg));
var zipStream = FFbinariesService.DownloadFileAsSteam(new Uri(downloadInfo.FFMpeg));
successList.AddRange(FFbinariesService.ExtractZipAndSave(zipStream));
}
// download ffprobe if selected
if (binaries.HasFlag(FFMpegBinaries.FFProbe) && downloadInfo.FFProbe is not null)
{
await using var zipStream = await FFbinariesService.DownloadFileAsSteam(new Uri(downloadInfo.FFProbe));
var zipStream = FFbinariesService.DownloadFileAsSteam(new Uri(downloadInfo.FFProbe));
successList.AddRange(FFbinariesService.ExtractZipAndSave(zipStream));
}
// download ffplay if selected
if (binaries.HasFlag(FFMpegBinaries.FFPlay) && downloadInfo.FFPlay is not null)
{
await using var zipStream = await FFbinariesService.DownloadFileAsSteam(new Uri(downloadInfo.FFPlay));
var zipStream = FFbinariesService.DownloadFileAsSteam(new Uri(downloadInfo.FFPlay));
successList.AddRange(FFbinariesService.ExtractZipAndSave(zipStream));
}

View file

@ -1,4 +1,5 @@
using System.IO.Compression;
using System.Net;
using System.Text.Json;
using FFMpegCore.Extensions.Downloader.Enums;
using FFMpegCore.Extensions.Downloader.Exceptions;
@ -42,10 +43,13 @@ internal class FFbinariesService
/// </summary>
/// <param name="address">uri of the file</param>
/// <returns></returns>
internal static async Task<Stream> DownloadFileAsSteam(Uri address)
internal static MemoryStream DownloadFileAsSteam(Uri address)
{
var client = new HttpClient();
return await client.GetStreamAsync(address);
var client = new WebClient();
var fileStream = new MemoryStream(client.DownloadData(address));
fileStream.Position = 0;
return fileStream;
}
/// <summary>

View file

@ -11,7 +11,7 @@ public class DownloaderTests
public void GetSpecificVersionTest()
{
var binaries = FFMpegDownloader.DownloadFFMpegSuite(FFMpegVersions.V6_1).Result;
Assert.IsTrue(binaries.Count == 2);
Assert.IsTrue(binaries.Count == 1);
}
[TestMethod]