Code Monkey home page Code Monkey logo

libvlcsharp-readonly's Introduction

libvlcsharp-readonly's People

Contributors

jeremyvignelles avatar mfkl avatar paulrouget avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

libvlcsharp-readonly's Issues

INPC and/or EventManager

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.

INPC (+)

  • Familiarity to .NET devs.
  • Easier to integrate with UIs (views and view models).

INPC (-)

  • Harder to implement?
  • Different from libvlcpp's approach.

EventManager (+)

  • Already implemented.
  • On par with libvlcpp API

EventManager (-)

  • Not .NET-ty

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

handle libvlc 3.0 or under API versioning

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.

Fix libvlc_events.h generation errors

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.

Async parse methods should return Task

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?).
  • Returning a Task can be implemented by listening to the 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)."
  • Cancellation token should call 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

WPF sample

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 CI

Setup Appveyor with deploy to nuget/myget.
Dunno if a cake script is needed.

Disable unsafe code flag

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);

VLC Configuration CLI flags

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?

handle returned result from native methods

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.

How to use your project

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.