libvlcsharp
libvlcsharp copied to clipboard
Winui 3.x
Description of Change
Add WinUI support to LVS 3
Issues Resolved
- fixes https://code.videolan.org/videolan/LibVLCSharp/-/issues/347
Platforms Affected
- UWP
PR Checklist
-
[x] Rebased on top of the target branch at time of PR
-
[x] Changes adhere to coding standard
-
[ ] Need to add some docs
-
[ ] Clean up commits.
-
[ ] 3.0.18 libvlc.windows on nuget.
-
[ ] test unpackaged mode
WinUI 3 only is supported. Minimal target is net6.0-windows10.0.17763.0
.
WinUI support requires a libvlc 3.0.18 build that needs to be pushed to NuGet before that PR.
UWP namespace for WinUI is suboptimal but there is no proper way to have it be .WinUI
due to the different Generic.xaml
.
Packaged mode has been tested. Unpackaged seems to have some loading issue (but likely my setup isn't right).
C:\hostedtoolcache\windows\dotnet\sdk\6.0.302\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(293,5): error NETSDK1095: Optimizing assemblies for performance is not supported for the selected target platform or architecture. Please verify you are using a supported runtime identifier, or set the PublishReadyToRun property to false. [D:\a\1\s\samples\LibVLCSharp.WinUI.Sample\LibVLCSharp.WinUI.Sample.csproj]
CI ain't happy. Can't repro locally.
This is blocked by the need for a newer LibVLC.Windows version since the WinUI 3.x implementation relies on a new native change not present in the current 3.0.17.4 build.
The official VLC 3.0.18 release is under way, RC and tagging is happening in the coming weeks. Stay tuned.
UWP namespace for WinUI is suboptimal but there is no proper way to have it be .WinUI due to the different Generic.xaml
The UWP namespace is really weird. Why you don't want to use a different namespace in Generic.xaml for the WinUI platform ?
In my memories, we could do something like that :
In AssemblyInfo.cs
#if WinUI
[assembly: XmlnsDefinition("libvlcsharp", "LibVLCSharp.Platforms.WinUI")]
#else
[assembly: XmlnsDefinition("libvlcsharp", "LibVLCSharp.Platforms.UWP")]
#endif
and in Generic.xaml
: xmlns:vlc="libvlcsharp"
I tried but can't get it to work (either it doesn't build or it crashes at runtime).
If you have time to give it a try, it's much welcome @kakone :-)
nice to see this being work on :) thx MAUI is comming :D
I tried but can't get it to work (either it doesn't build or it crashes at runtime).
Part of the problem is that I can't find a way to import the namespace required for XmlnsDefinition
for the UAP target (the WinUI net6 target is fine). Neither the System.Windows.Markup
nor the Windows.UI.Xaml.Markup
namespaces seem to accepted for UAP.
@mfkl, can you share the content of your folder C:\Users\Martin\Desktop\vlc-3.0.18 ? 😄
Part of the problem is that I can't find a way to import the namespace required for XmlnsDefinition for the UAP target
Yes, you are right, it doesn't work for the UAP target and I didn't find any workaround.
Ok well this will have to do then. Thanks for trying.
IMHO, renaming the namespace to a common namespace (like Windows) would be a better solution. I prefer to introduce a breaking change than keeping a namespace of a deprecated platform.
is there any progress pls ? or we waiting for 3.0.18 still ?
is there any progress pls ? or we waiting for 3.0.18 still ?
Waiting still. Pinging the PR will not make it go faster.
IMHO, renaming the namespace to a common namespace (like Windows) would be a better solution. I prefer to introduce a breaking change than keeping a namespace of a deprecated platform.
Rebased and done.
Forgot the Uno part, CI caught it. Will handle it soon.
Forgot the Uno part, CI caught it. Will handle it soon.
Nice,. Maybe stupid question, but after this would be player working also with maui android target ?
after this would be player working also with maui android target?
No this PR is about WinUI, not MAUI.
libvlc 3.0.18 finally landed so we should be able to have a look at this (once I get some time...).
Seems there is a small d3d11 leak when closing the WinUI sample
D3D11 WARNING: Live Producer at 0x000001DACAFE9580, Refcount: 8. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFA1C5030, Refcount: 1. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFA23A140, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAF9C7BD00, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAF9C7A5C0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAF9C7AD80, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAF9C788B0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFA141D50, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFA1C2090, Refcount: 2. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFA8947B0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAF9C81BF0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAF9C82F50, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFA894B90, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFD0D2FF0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAF9C81240, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAF9C806A0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFD3A99A0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFD3A7EF0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFD3A7380, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFD3A6BE0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFA173420, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFD3F47D0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFD3F2D90, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFA1C2FC0, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAC949F040, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object at 0x000001DAFBC8A070, Refcount: 0. [ STATE_CREATION WARNING #0: UNKNOWN]
D3D11 WARNING: Live Object : 25 [ STATE_CREATION WARNING #0: UNKNOWN]
DXGI WARNING: Live Producer at 0x000001DAF9C0FCB8, Refcount: 6. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x000001DAF9C50800, Refcount: 3. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x000001DAF9C4F500, Refcount: 1. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x000001DAF9C4F040, Refcount: 1. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object at 0x000001DAFA27FC20, Refcount: 1. [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live Object : 4 [ STATE_CREATION WARNING #0: ]
Got it down to these few leaks.
DXGI WARNING: Live IDXGIFactory at 0x0000028A7CE326B0, Refcount: 4 [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live IDXGIAdapter at 0x0000028A7CEDC800, Refcount: 1 [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live IDXGIAdapter at 0x0000028A7CEDDFC0, Refcount: 1 [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live IDXGIAdapter at 0x0000028A7CEDD640, Refcount: 1 [ STATE_CREATION WARNING #0: ]
DXGI WARNING: Live IDXGIAdapter : 3 [ STATE_CREATION WARNING #0: ]
D3D11 WARNING: Live ID3D11Device at 0x0000028A71BE2EA0, Refcount: 2 [ STATE_CREATION WARNING #441: LIVE_DEVICE]
I don't see where they originate from, though.
Hi @mfkl is it possible to download a Nuget "preview" package with this feature from somewhere? would be really nice, thanks a lot for your work!
Hi, there is no preview for this as there are a few memory leaks. Help is welcome to fix them coz I can't find out where they come from.
Hi, there is no preview for this as there are a few memory leaks. Help is welcome to fix them coz I can't find out where they come from.
Thanks for your reply, unfortunately I'm not able to help with these specific ones, I hope you'll figure it or someone more expert than me will be able to pint you out to the right direction, sorry :/
Leak was identified and fixed in https://code.videolan.org/videolan/vlc/-/merge_requests/3441. This PR should be ready to go through, at least for a beta support package.
Will this support both packaged and unpackaged winui3 apps?
Will this support both packaged and unpackaged winui3 apps?
With some toolchain hacks, yes. Always had trouble running unpackaged WinUI apps, unrelated to libvlcsharp.