Skip to content
This repository has been archived by the owner on Jun 5, 2018. It is now read-only.

WPF sample #19

Open
mfkl opened this issue Dec 8, 2017 · 8 comments
Open

WPF sample #19

mfkl opened this issue Dec 8, 2017 · 8 comments

Comments

@mfkl
Copy link
Owner

mfkl commented Dec 8, 2017

Will use this to set the drawable surface.
https://github.com/mfkl/LibVLCSharp/blob/783e104b485931de978eee48d6d22a067d220cab/LibVlcSharp/MediaPlayer.cs#L773
May be of interest:
https://github.com/prasannavl/WinApi
https://msdn.microsoft.com/en-us/library/ms618134
https://docs.microsoft.com/en-us/dotnet/framework/wpf/advanced/wpf-and-win32-interoperation

We probably should do something very similar to https://github.com/kakone/VLC.MediaElement/blob/master/VLCMediaElement/MediaElement.cs, but move all crossplatform-capable code in a MediaElementBase abstract class. Each platform would inherit from that and perform platform-specific initialization (set drawable surface etc).

/cc @jeremyVignelles

@mfkl
Copy link
Owner Author

mfkl commented Dec 14, 2017

(very) early API draft:
Crossplatform https://github.com/mfkl/LibVLCSharp/blob/wpf/LibVLCSharp/MediaElementCore.cs
WPF https://github.com/mfkl/LibVLCSharp/blob/wpf/LibVLCSharp.WPF.Sample/MediaElement.cs

Regarding potential HWND issues, this project seems to have done some interesting stuff we maybe could use: https://github.com/dzimchuk/power-video-player

@mfkl
Copy link
Owner Author

mfkl commented Dec 14, 2017

@mfkl
Copy link
Owner Author

mfkl commented Dec 14, 2017

For reference https://github.com/unosquare/ffmediaelement Also.

@jeremyVignelles
Copy link
Collaborator

Of the few options that are listed on this page, none seems to be "awesome":

  • WinApi seems to require a DxWindow so that's not very convenient
  • VLCMediaElement uses SwapChainPanel, which is a UWP-only thing
  • https://github.com/dzimchuk/power-video-player uses HwndHost, I think we will have the same issues as with Vlc.DotNet's WinFormsHost.
  • ffmediaelement Writes to a bitmap (like Meta.Vlc)

I'm currently looking if this is possible with SharpDX

@mfkl
Copy link
Owner Author

mfkl commented Dec 21, 2017

@mfkl
Copy link
Owner Author

mfkl commented Dec 21, 2017

ffmediaelement Writes to a bitmap (like Meta.Vlc)

Anything wrong with that?

@jeremyVignelles
Copy link
Collaborator

jeremyVignelles commented Dec 21, 2017

https://github.com/Microsoft/WPFDXInterop/blob/master/samples/D3D11Image/WpfD3D11Interop/MainWindow.xaml.cs seems interesting, but I still don't undestand how it is supposed to work, and it links to an inexistant documentation. Specifically, I don't see the difference with the built-in D3DImage.

Anything wrong with that?

Performance is the main reason I'd like to avoid that : That would require vlc to write the pictures in the memory, converting them in a C# buffer, writing them to the bitmap that would then be finally rendered on the screen. It feels like there are too many copies involved.

@jeremyVignelles
Copy link
Collaborator

Using directX in WPF "natively" seems to cause a lot of issues. See: sharpdx/SharpDX#599 (comment)

We need performance, and currently, I think the only reasonable way we have is to wrap the WinForms component at the cost of not being able to write above the video and some other event issues.
Thus, I don't think this is necessary to have a Wpf component since it would add another layer and can be achieved with a few lines.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants