oaubert / python-vlc

Python vlc bindings
GNU Lesser General Public License v2.1
391 stars 111 forks source link

Add missing media_new_location definition #261

Open Bi0T1N opened 1 year ago

Bi0T1N commented 1 year ago

Looks like it was added manually but only to the 3.0 file. However, it's mentioned in every definition of media_new.

oaubert commented 1 year ago

Thanks for the patch. In fact, the situation is a bit different. The signature for libvlc_media_new_location changed in the dev version: it was previously (in 2.2 and 3.0) libvlc_media_new_location(libvlc_instance_t *p_instance, const char * psz_mrl ) with a libvlc_instance as first parameter. It was then properly automatically wrapped in the pythonic conversion to a vlc.Instance method. In the dev version the first parameter (libvlc_instance_t) has been removed, which makes it not anymore a default vlc.Instance method. The signature is now libvlc_media_new_location(const char * psz_mrl); The question is now: should we try to maintain backward compatibility (which required having a vlc.Instance just to instanciate a media), or should we track the API principle of decoupling what can be decoupled.

Bi0T1N commented 1 year ago

Alright but you still need to create an Instance before you can do anything useful:

Before it can do anything useful, LibVLC must be initialized.

You can create one (or more) instance(s) of LibVLC in a given process, with libvlc_new() and destroy them with libvlc_release().

So I assume that creating a media via libvlc_media_new_location and trying to play it will result in an error. Therefore calling it from vlc.Instance is probably the better pythonic approach, no?