Skip to content

Commit d1d93cd

Browse files
1 parent 72cb8fb commit d1d93cd

12 files changed

Lines changed: 109 additions & 78 deletions

File tree

MediaFileDuplicateFinder_Setup/MediaFileDuplicateFinder_Setup.vdproj

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
}
2222
"Entry"
2323
{
24-
"MsmKey" = "8:_2CCB9D70B14240BEBF3E6C1A77BAB773"
24+
"MsmKey" = "8:_59CBA6F383DD4D7EA2291A245BF1CA30"
2525
"OwnerKey" = "8:_UNDEFINED"
2626
"MsmSig" = "8:_UNDEFINED"
2727
}
@@ -33,73 +33,73 @@
3333
}
3434
"Entry"
3535
{
36-
"MsmKey" = "8:_6B5E3ED96B83429F9AF635E898776344"
36+
"MsmKey" = "8:_68438B99BEEC401F86FF818F18756792"
3737
"OwnerKey" = "8:_UNDEFINED"
3838
"MsmSig" = "8:_UNDEFINED"
3939
}
4040
"Entry"
4141
{
42-
"MsmKey" = "8:_7019814ED8144D7A94049F8034934301"
42+
"MsmKey" = "8:_6A66E259CC7048AFAFD3F04306A9C997"
4343
"OwnerKey" = "8:_UNDEFINED"
4444
"MsmSig" = "8:_UNDEFINED"
4545
}
4646
"Entry"
4747
{
48-
"MsmKey" = "8:_9711ED9ADB7349BAAF6695CBC12B73A3"
48+
"MsmKey" = "8:_7F50475E1BED452199C324A1884D29D0"
4949
"OwnerKey" = "8:_UNDEFINED"
5050
"MsmSig" = "8:_UNDEFINED"
5151
}
5252
"Entry"
5353
{
54-
"MsmKey" = "8:_97A2BF415A06452887EECFF1E12AE907"
54+
"MsmKey" = "8:_81C1D6CE901A4D79A5CC983668C6EEDA"
5555
"OwnerKey" = "8:_UNDEFINED"
5656
"MsmSig" = "8:_UNDEFINED"
5757
}
5858
"Entry"
5959
{
60-
"MsmKey" = "8:_9976721C40134108B759A741EF43AE6D"
60+
"MsmKey" = "8:_85FEECC21B6942F087DBFDDD56D50729"
6161
"OwnerKey" = "8:_UNDEFINED"
6262
"MsmSig" = "8:_UNDEFINED"
6363
}
6464
"Entry"
6565
{
66-
"MsmKey" = "8:_BD4AA2BEC02E4748AB1936A2FA47B8E5"
66+
"MsmKey" = "8:_9976721C40134108B759A741EF43AE6D"
6767
"OwnerKey" = "8:_UNDEFINED"
6868
"MsmSig" = "8:_UNDEFINED"
6969
}
7070
"Entry"
7171
{
72-
"MsmKey" = "8:_D33D4BB7F17C4C459194E55912EE6856"
72+
"MsmKey" = "8:_A55CC9567D564AD89D30525047914506"
7373
"OwnerKey" = "8:_UNDEFINED"
7474
"MsmSig" = "8:_UNDEFINED"
7575
}
7676
"Entry"
7777
{
78-
"MsmKey" = "8:_E2D3A34E6F0847FFA594263870CB702F"
78+
"MsmKey" = "8:_B555724733F24AE1917807E370F3EF3B"
7979
"OwnerKey" = "8:_UNDEFINED"
8080
"MsmSig" = "8:_UNDEFINED"
8181
}
8282
"Entry"
8383
{
84-
"MsmKey" = "8:_F1B5FF9958D346A2A1A84CA6C331BF1B"
84+
"MsmKey" = "8:_BB5F68387ECC46C894644FCE7C25E462"
8585
"OwnerKey" = "8:_UNDEFINED"
8686
"MsmSig" = "8:_UNDEFINED"
8787
}
8888
"Entry"
8989
{
90-
"MsmKey" = "8:_F64D08644F724F8A9A82CEA6ED86EC05"
90+
"MsmKey" = "8:_D33D4BB7F17C4C459194E55912EE6856"
9191
"OwnerKey" = "8:_UNDEFINED"
9292
"MsmSig" = "8:_UNDEFINED"
9393
}
9494
"Entry"
9595
{
96-
"MsmKey" = "8:_F70F2871042C4B6AAFE26E698FAC688B"
96+
"MsmKey" = "8:_E3F2A1745CE54D31859E531EB16E591D"
9797
"OwnerKey" = "8:_UNDEFINED"
9898
"MsmSig" = "8:_UNDEFINED"
9999
}
100100
"Entry"
101101
{
102-
"MsmKey" = "8:_FDB14C28727D4829A436F7124B4AB1B3"
102+
"MsmKey" = "8:_FBA38D9D2A064DD19B23F0FCCE1C7F46"
103103
"OwnerKey" = "8:_UNDEFINED"
104104
"MsmSig" = "8:_UNDEFINED"
105105
}
@@ -225,10 +225,10 @@
225225
"IsDependency" = "11:FALSE"
226226
"IsolateTo" = "8:"
227227
}
228-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_2CCB9D70B14240BEBF3E6C1A77BAB773"
228+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_59CBA6F383DD4D7EA2291A245BF1CA30"
229229
{
230-
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\ffmpeg.exe"
231-
"TargetName" = "8:ffmpeg.exe"
230+
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\bin\\avfilter-9.dll"
231+
"TargetName" = "8:avfilter-9.dll"
232232
"Tag" = "8:"
233233
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
234234
"Condition" = "8:"
@@ -245,10 +245,10 @@
245245
"IsDependency" = "11:FALSE"
246246
"IsolateTo" = "8:"
247247
}
248-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_6B5E3ED96B83429F9AF635E898776344"
248+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_68438B99BEEC401F86FF818F18756792"
249249
{
250-
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\avdevice-60.dll"
251-
"TargetName" = "8:avdevice-60.dll"
250+
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\bin\\postproc-57.dll"
251+
"TargetName" = "8:postproc-57.dll"
252252
"Tag" = "8:"
253253
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
254254
"Condition" = "8:"
@@ -265,10 +265,10 @@
265265
"IsDependency" = "11:FALSE"
266266
"IsolateTo" = "8:"
267267
}
268-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_7019814ED8144D7A94049F8034934301"
268+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_6A66E259CC7048AFAFD3F04306A9C997"
269269
{
270-
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\avutil-58.dll"
271-
"TargetName" = "8:avutil-58.dll"
270+
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\bin\\avformat-60.dll"
271+
"TargetName" = "8:avformat-60.dll"
272272
"Tag" = "8:"
273273
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
274274
"Condition" = "8:"
@@ -285,10 +285,10 @@
285285
"IsDependency" = "11:FALSE"
286286
"IsolateTo" = "8:"
287287
}
288-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9711ED9ADB7349BAAF6695CBC12B73A3"
288+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_7F50475E1BED452199C324A1884D29D0"
289289
{
290-
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\avformat-60.dll"
291-
"TargetName" = "8:avformat-60.dll"
290+
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\bin\\ffprobe.exe"
291+
"TargetName" = "8:ffprobe.exe"
292292
"Tag" = "8:"
293293
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
294294
"Condition" = "8:"
@@ -305,10 +305,10 @@
305305
"IsDependency" = "11:FALSE"
306306
"IsolateTo" = "8:"
307307
}
308-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_97A2BF415A06452887EECFF1E12AE907"
308+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_81C1D6CE901A4D79A5CC983668C6EEDA"
309309
{
310-
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\ffprobe.exe"
311-
"TargetName" = "8:ffprobe.exe"
310+
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\bin\\swresample-4.dll"
311+
"TargetName" = "8:swresample-4.dll"
312312
"Tag" = "8:"
313313
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
314314
"Condition" = "8:"
@@ -325,10 +325,10 @@
325325
"IsDependency" = "11:FALSE"
326326
"IsolateTo" = "8:"
327327
}
328-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9976721C40134108B759A741EF43AE6D"
328+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_85FEECC21B6942F087DBFDDD56D50729"
329329
{
330-
"SourcePath" = "8:..\\VDF.GUI\\Assets\\icon.ico"
331-
"TargetName" = "8:icon.ico"
330+
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\bin\\avdevice-60.dll"
331+
"TargetName" = "8:avdevice-60.dll"
332332
"Tag" = "8:"
333333
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
334334
"Condition" = "8:"
@@ -345,10 +345,10 @@
345345
"IsDependency" = "11:FALSE"
346346
"IsolateTo" = "8:"
347347
}
348-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_BD4AA2BEC02E4748AB1936A2FA47B8E5"
348+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_9976721C40134108B759A741EF43AE6D"
349349
{
350-
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\swresample-4.dll"
351-
"TargetName" = "8:swresample-4.dll"
350+
"SourcePath" = "8:..\\VDF.GUI\\Assets\\icon.ico"
351+
"TargetName" = "8:icon.ico"
352352
"Tag" = "8:"
353353
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
354354
"Condition" = "8:"
@@ -365,10 +365,10 @@
365365
"IsDependency" = "11:FALSE"
366366
"IsolateTo" = "8:"
367367
}
368-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_E2D3A34E6F0847FFA594263870CB702F"
368+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_A55CC9567D564AD89D30525047914506"
369369
{
370-
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\swscale-7.dll"
371-
"TargetName" = "8:swscale-7.dll"
370+
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\bin\\avcodec-60.dll"
371+
"TargetName" = "8:avcodec-60.dll"
372372
"Tag" = "8:"
373373
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
374374
"Condition" = "8:"
@@ -385,10 +385,10 @@
385385
"IsDependency" = "11:FALSE"
386386
"IsolateTo" = "8:"
387387
}
388-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_F1B5FF9958D346A2A1A84CA6C331BF1B"
388+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_B555724733F24AE1917807E370F3EF3B"
389389
{
390-
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\postproc-57.dll"
391-
"TargetName" = "8:postproc-57.dll"
390+
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\bin\\avutil-58.dll"
391+
"TargetName" = "8:avutil-58.dll"
392392
"Tag" = "8:"
393393
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
394394
"Condition" = "8:"
@@ -405,10 +405,10 @@
405405
"IsDependency" = "11:FALSE"
406406
"IsolateTo" = "8:"
407407
}
408-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_F64D08644F724F8A9A82CEA6ED86EC05"
408+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_BB5F68387ECC46C894644FCE7C25E462"
409409
{
410-
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\avcodec-60.dll"
411-
"TargetName" = "8:avcodec-60.dll"
410+
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\bin\\swscale-7.dll"
411+
"TargetName" = "8:swscale-7.dll"
412412
"Tag" = "8:"
413413
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
414414
"Condition" = "8:"
@@ -425,10 +425,10 @@
425425
"IsDependency" = "11:FALSE"
426426
"IsolateTo" = "8:"
427427
}
428-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_F70F2871042C4B6AAFE26E698FAC688B"
428+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_E3F2A1745CE54D31859E531EB16E591D"
429429
{
430-
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\avfilter-9.dll"
431-
"TargetName" = "8:avfilter-9.dll"
430+
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\bin\\ffmpeg.exe"
431+
"TargetName" = "8:ffmpeg.exe"
432432
"Tag" = "8:"
433433
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
434434
"Condition" = "8:"
@@ -445,9 +445,9 @@
445445
"IsDependency" = "11:FALSE"
446446
"IsolateTo" = "8:"
447447
}
448-
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_FDB14C28727D4829A436F7124B4AB1B3"
448+
"{1FB2D0AE-D3B9-43D4-B9DD-F88EC61E35DE}:_FBA38D9D2A064DD19B23F0FCCE1C7F46"
449449
{
450-
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\ffplay.exe"
450+
"SourcePath" = "8:..\\bin\\precompiledbinaries\\win-x64\\bin\\ffplay.exe"
451451
"TargetName" = "8:ffplay.exe"
452452
"Tag" = "8:"
453453
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
@@ -1027,7 +1027,7 @@
10271027
{
10281028
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_5ED6ABAC99D04B38AD65D9922193EFC7"
10291029
{
1030-
"SourcePath" = "8:..\\VDF.GUI\\obj\\Debug\\net7.0\\apphost.exe"
1030+
"SourcePath" = "8:..\\VDF.GUI\\obj\\Release\\net7.0\\apphost.exe"
10311031
"TargetName" = "8:"
10321032
"Tag" = "8:"
10331033
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"
@@ -1055,7 +1055,7 @@
10551055
}
10561056
"{5259A561-127C-4D43-A0A1-72F10C7B3BF8}:_D33D4BB7F17C4C459194E55912EE6856"
10571057
{
1058-
"SourcePath" = "8:..\\VDF.GUI\\obj\\Debug\\net7.0\\VDF.GUI.dll"
1058+
"SourcePath" = "8:..\\VDF.GUI\\obj\\Release\\net7.0\\VDF.GUI.dll"
10591059
"TargetName" = "8:"
10601060
"Tag" = "8:"
10611061
"Folder" = "8:_C7CB6E8A419E43BF9D8735A9E08A6F3E"

VDF.Core/FFTools/FFmpegNative/FFmpegHelper.cs

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,28 @@
1717
using System.Linq;
1818
using System.Runtime.InteropServices;
1919
using FFmpeg.AutoGen;
20+
using FFmpeg.AutoGen.Native;
2021

2122
namespace VDF.Core.FFTools.FFmpegNative {
2223
static class FFmpegHelper {
24+
static readonly LinuxFunctionResolver linuxFunctionResolver = new();
25+
static readonly WindowsFunctionResolver windowsFunctionResolver = new();
26+
static readonly MacFunctionResolver macFunctionResolver = new();
27+
2328
private static bool ffmpegLibraryFound;
24-
public static unsafe string? av_strerror(int error) {
29+
public static unsafe string? Av_strerror(int error) {
2530
const int bufferSize = 1024;
2631
byte* buffer = stackalloc byte[bufferSize];
2732
ffmpeg.av_strerror(error, buffer, bufferSize).ThrowExceptionIfError();
2833
string? message = Marshal.PtrToStringAnsi((IntPtr)buffer);
2934
return message;
3035
}
3136

32-
public static int ThrowExceptionIfError(this int error) => error < 0 ? throw new FFInvalidExitCodeException(av_strerror(error) ?? "Unknown error") : error;
37+
public static int ThrowExceptionIfError(this int error) {
38+
if (error < 0)
39+
throw new FFInvalidExitCodeException(Av_strerror(error) ?? "Unknown error");
40+
return error;
41+
}
3342

3443
private static bool FindFFmpegLibraryFiles() {
3544
try {
@@ -58,8 +67,14 @@ private static bool FindFFmpegLibraryFiles() {
5867
//Try fast lookup first, credits: @Maltragor
5968
try {
6069
ffmpeg.RootPath = string.Empty;
61-
foreach (KeyValuePair<string, int> item in ffmpeg.LibraryVersionMap)
62-
ffmpeg.GetOrLoadLibrary(item.Key);
70+
foreach (KeyValuePair<string, int> item in ffmpeg.LibraryVersionMap) {
71+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
72+
windowsFunctionResolver.GetOrLoadLibrary(item.Key, throwOnError: true);
73+
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
74+
linuxFunctionResolver.GetOrLoadLibrary(item.Key, throwOnError: true);
75+
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
76+
macFunctionResolver.GetOrLoadLibrary(item.Key, throwOnError: true);
77+
}
6378
return true;
6479
}
6580
catch { }

VDF.Core/ScanEngine.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ void ScanForDuplicates() {
426426
Parallel.For(0, ScanList.Count, new ParallelOptions { CancellationToken = cancelationTokenSource.Token, MaxDegreeOfParallelism = Settings.MaxDegreeOfParallelism }, i => {
427427
while (pauseTokenSource.IsPaused) Thread.Sleep(50);
428428

429-
FileEntry entry = ScanList[i];
429+
FileEntry? entry = ScanList[i];
430430
float difference = 0;
431431
DuplicateFlags flags = DuplicateFlags.None;
432432
bool isDuplicate;
@@ -436,7 +436,7 @@ void ScanForDuplicates() {
436436
flippedGrayBytes = CreateFlippedGrayBytes(entry);
437437

438438
for (int n = i + 1; n < ScanList.Count; n++) {
439-
FileEntry compItem = ScanList[n];
439+
FileEntry? compItem = ScanList[n];
440440
if (entry.IsImage != compItem.IsImage)
441441
continue;
442442
if (!entry.IsImage) {

VDF.Core/Utils/Extensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,6 @@ public static string BytesToString(this long byteCount) {
3636
var num = Math.Round(bytes / Math.Pow(1024, place), 1);
3737
return (Math.Sign(byteCount) * num).ToString(CultureInfo.InvariantCulture) + suf[place];
3838
}
39-
public static long BytesToMegaBytes(this long byteCount) => (long)(byteCount / 1024f / 1024f);
39+
public static long BytesToMegaBytes(this long byteCount) => (long)((byteCount / 1024f) / 1024f);
4040
}
4141
}

0 commit comments

Comments
 (0)