Skip to content

Commit

Permalink
Major Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Nov 5, 2024
1 parent 4a89ae3 commit 710c43c
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 4 deletions.
5 changes: 5 additions & 0 deletions src/Library/Sucrose.Mpv.NET/API/MpvFunctions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ private void LoadDll(string dllPath)
{
Guard.AgainstNullOrEmptyOrWhiteSpaceString(dllPath, nameof(dllPath));

if (!File.Exists(dllPath))
{
throw new DllNotFoundException($"Failed to load Mpv DLL. File not found: {dllPath}");
}

dllHandle = PlatformDll.Utils.LoadLibrary(dllPath);

if (dllHandle == IntPtr.Zero)
Expand Down
3 changes: 3 additions & 0 deletions src/Live/Sucrose.Live.MpvPlayer/Sucrose.Live.MpvPlayer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@
</ItemGroup>

<ItemGroup>
<None Update="lib\Mpv.conf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="lib\libmpv-x86.dll" Condition="'$(PlatformTarget)' == 'x86'">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
Expand Down
25 changes: 25 additions & 0 deletions src/Live/Sucrose.Live.MpvPlayer/lib/mpv.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Video Settings
vo=gpu
hwdec=auto
hwdec-codecs=all
profile=low-latency
interpolation=no
framedrop=decoder
fullscreen=yes
scale-antiring=0
temporal-dither=no

# Audio Settings
audio-buffer=0.2
audio-channels=stereo
volume-max=100
audio-samplerate=48000

# General Performance Settings
cache=no
gpu-context=win
video-sync=display-desync
demuxer-seekable-cache=no
demuxer-max-bytes=64M
demuxer-max-back-bytes=16M
keep-open=no
6 changes: 6 additions & 0 deletions src/Portal/Sucrose.Portal/Extension/ImageLoader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,20 @@ public void Dispose()
{
Clear();

GC.Collect();
GC.SuppressFinalize(this);
GC.SuppressFinalize(SPMI.Images);
GC.SuppressFinalize(SPMI.ImageStream);
}

public async ValueTask DisposeAsync()
{
await ClearAsync();

GC.Collect();
GC.SuppressFinalize(this);
GC.SuppressFinalize(SPMI.Images);
GC.SuppressFinalize(SPMI.ImageStream);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using MediaEngine = Sucrose.Mpv.NET.Player.MpvPlayer;
using System.IO;
using MediaEngine = Sucrose.Mpv.NET.Player.MpvPlayer;
using SSSMI = Sucrose.Shared.Space.Manage.Internal;

namespace Sucrose.Shared.Engine.MpvPlayer.Manage
{
Expand All @@ -8,12 +10,16 @@ internal static class Internal

public static MediaEngine MediaEngine;

public static readonly string LibPath = Path.Combine(SSSMI.This, "lib");

public static readonly string MpvConfig = Path.Combine(LibPath, "mpv.conf");

#if X86
public static readonly string MediaPath = @"lib\libmpv-x86.dll";
public static readonly string MediaPath = Path.Combine(LibPath, "libmpv-x86.dll");
#elif X64
public static readonly string MediaPath = @"lib\libmpv-x64.dll";
public static readonly string MediaPath = Path.Combine(LibPath, "libmpv-x64.dll");
#else
public static readonly string MediaPath = @"lib\libmpv-ARM64.dll";
public static readonly string MediaPath = Path.Combine(LibPath, "libmpv-ARM64.dll");
#endif

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public Gif()
Loop = SSEHD.GetLoop()
};

SSEMPMI.MediaEngine.LoadConfig(SSEMPMI.MpvConfig);

SSEMPMI.MediaEngine.Load(SSEMPMI.Source);

SSEMI.GeneralTimer.Tick += new EventHandler(GeneralTimer_Tick);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ public Video()
Volume = SSEHD.GetVolume()
};

SSEMPMI.MediaEngine.LoadConfig(SSEMPMI.MpvConfig);

SSEMPMI.MediaEngine.Load(SSEMPMI.Source);

SSEMI.GeneralTimer.Tick += new EventHandler(GeneralTimer_Tick);
Expand Down

0 comments on commit 710c43c

Please sign in to comment.