mfkl / libvlcsharp-readonly Goto Github PK
View Code? Open in Web Editor NEW.NET bindings for LibVLC
License: GNU Lesser General Public License v2.1
.NET bindings for LibVLC
License: GNU Lesser General Public License v2.1
Hello there I have started a small Project , to port the java code into C# still long way to finish though
What do you think of this idea ?
https://github.com/ahmad-crossplatform/Libvlc.Xamarin.Android
So the current libvlcpp API for events is about one EventManager abstract class and several specialized implementation for each core objects. This approach is fine by itself, but we're thinking using INotifyPropertyChanged could be more .NET-ty and easier to integrate with native views on each platform.
The MediaPlayer seems to be a good candidate to discuss this.
Links of interest:
C# MediaPlayer https://github.com/mfkl/LibVLCSharp/blob/master/LibVlcSharp/MediaPlayer.cs
C++ MediaPlayer https://code.videolan.org/videolan/libvlcpp/blob/master/vlcpp/MediaPlayer.hpp
C# EventManagers https://github.com/mfkl/LibVLCSharp/blob/master/LibVlcSharp/EventManager.cs
C++ EventManagers: https://code.videolan.org/videolan/libvlcpp/blob/master/vlcpp/EventManager.hpp
C# Events https://github.com/mfkl/LibVLCSharp/blob/master/LibVlcSharp/Events/LibVLCEvent.cs
I think we should choose one approach or the other, but not both. Less API surface == less confused users.
I think we should try to implement it all with INPC. But... if we have a C# getter that directly calls the C getter and returns the value with no backing field, what do we do with the event data when for example ChapterChanged is fired?
/cc @jeremyVignelles
Currently the DllImport call uses "vlc" as the dll name, which is wrong. It should be "libvlc". Haven't managed to make that work yet, "lib" always gets stripped.
related issues/code that might help
mono/CppSharp#715
mono/CppSharp#730
mono/CppSharp#33
In libvlcpp, it's currently done with an #if def.
Would it be a good idea to check the LIBVLC_API C macro value at runtime of the used .dll
before making libvlc >= 3.0 API calls?
Guess that has a runtime cost, but not sure how else to dynamically support dlls
with different public APIs with the same code.
This header is currently ignored when parsing because it generates code that does not compile. Generated code needs customization to be correct. See PostProcess
method.
Temporary workaround
Some delegates seem to be GC'd if not kept in a static field.
Regular instance field reference should be enough but it's not working at the moment.
To test, launch WPF sample (put libvlc dll in correct dir).
/cc @jeremyVignelles
Currently using Vlc.DotNet solution which uses Win32 APIs.
We (also) need an implemention with Mono for Linux/OSX.
Would be good to return a Task from Media.ParseAsync
and Media.ParseWithOptions
(also async).
Notes:
ParseAsync
is deprecated. Should favor using ParseWithOptions
.ParseWithOptions
is actually async (Should add Async
in C# method name?).libvlc_MediaParsedChanged
event.ParseWithOptions
timeout: "maximum time allowed to preparse the media. If -1, the default "preparse-timeout" option will be used as a timeout. If 0, it will wait indefinitely. If > 0, the timeout will be used (in milliseconds)."ParseStop
.libvlc C API doc
https://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__media.html#ga55f5a33e22aa32e17a9bb75decd1497b
https://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__media.html#gae7cedd70494f7110df5ce8e704ffb9d4
https://www.videolan.org/developers/vlc/doc/doxygen/html/group__libvlc__media.html#gaa6ee5287c7b4620cc86b89518173a7dc
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
Setup Appveyor with deploy to nuget/myget.
Dunno if a cake script is needed.
To do this, marshalling needs to be changed for
internal static extern unsafe int LibVLCVideoGetSize(IntPtr mediaPlayer, uint num, uint* px, uint* py);
internal static extern unsafe int LibVLCVideoGetCursor(IntPtr mediaPlayer, uint num, int* px, int* py);
When creating a new VLC Instance
object, we can pass CLI flags to it to configure VLC.
To make this more .NET-feel like, I was thinking we could use some kind of VLCConfiguration
object that would encapsulate those flags (with matching documentation in comments for intellisense) in a builder pattern
-like fashion, not unlike NServiceBus does it https://gist.github.com/Particular/6107912. It would then fold into an array of strings with the corresponding configuration flags before being marshalled to libvlc.
Maybe something like:
instance.Configure.With()
.EnableBluray()
.DisableSmb()
.Mad(path)
...
@jeremyVignelles thoughts?
How do I implement this in xamarin forms? I'd like to sample it in xaml, It's possible?
What should we do about results returned by native methods?
Typically int
indicating presence of error, such as libvlc_event_attach
. Throwing exceptions seems maybe a bit aggressive, but it would be nice to convey the results to the caller and/or maybe log.
Do you have any instructions on how to use your project it looks really interesting but we can't get any of the sample projects to build our end.
What is actually required to be implemented for it to work?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.