Search code examples
delphidllvlclibvlc

Delphi PasLibVLC - use without installing VLC player


In our application, I am trying to play a stream through the TPasLibVlcPlayer component (http://prog.olsztyn.pl/paslibvlc/). I succeeded in doing this, but only when VLC is installed.

The goal is to deploy the needed dll's with our application so we can use our application on a (Windows) pc that doesn't have VLC installed.

Question is: what do I need to do to make this work? So far I tried to put

  • libvlc.dll
  • libvlccore.dll

in a separate folder and deinstall VLC, then set the path to these dll's

PasLibVlcPlayer1.VLC.Path := 'C:\Tools';

However when trying to play the stream, nothing happens. I debugged and saw that the libvlc.dll is loaded (a handle is returned) and the needed procedures could be executed (GetProcAddress returns an assigned addres for all supported procedures), however when libvlc_new is called (inside TPasLibVlc.GetHandle), this returns nil.

Should there be other dll's in that directory or what do I need to do to make this work?


Solution

  • VLC is not a monolithic program.

    VLC is a complex framework of different classes plugins and the database of those plugins, and the dispatcher to build the interconnected network of those plugins for every particular task like converting or playing a given source.

    VLC is in the same league like GStreamer or Direct X ( the DirectShow/DirectMedia subpart of it ). Can you use Direct X framework without installing Direct X ? Hardly so.

    Even the AceStreamer project that aims to turn BitTorrent into p2p online video streaming platform and is being coding it for few years already they still did not "copied few libraries" from VLC but rather modified its soures and made their own build of VLC player to use with their P2P-to-streaming proxy daemon. After all the years and with all the experience they had and gained.

    Granted, VLC being Linux-originating is not dependent upon Windows means of installing, so if that is okay for your goal, you can install VLC in VLC terms but avoid installing it in Windows terms. To do it you would have to

    1. take the zip (not exe) distro of the VLC (win32 or win64 - should be the same as your program platform).
    2. create a folder where you would unpack the whole VLC to
    3. after unpacking you would have to run vlc-plugins-cache-generator so it would enumerate all the plugins and create the database of its classes and implementations
    4. then you would have to ensure all those files can be read and executed by mere user. Your installation would almost surely run under UAC-elevated Administrator permissions. That means by default all the unpacked VLC file including plugins DB would not be reachable by non-elevated or non-admin users of the computer. You would have to fix it explicitly giving users the rights to read/execute those files.
    5. Then you would be able to call VLC functions from DLLs in that folder.

    But personally I think the candles are not worth the game here and you better give your users the freedom to use VLC as they see fit and to upgrade it when new versions would be issued. Otherwise your program would most probably turn into a source of security problems for them.


    Above points were made from a purely technical point of view. But there is another issue - legal.

    Are you even going to DISTRIBUTE your program outside your office? As soon as you would pass any rights to your program from the original rights holder to a licensee - you would have to respect VLC team rights.

    http://www.videolan.org/legal.html - note that little "most" word, when VLC team describe status of smaller software projects they integrate into VLC.

    As long as you redistribute the non-modified VLC installation bundle - you are clean and safe. VLC team gave you explicit permission to do so. If anyone would consider VLC bundle having some pirated or otherwise illegal code - you are somewhat protected by "I did not know, I merely trusted them they do play fair" defence line. You are acting like a consumer when taking VLC installer for granted. Like a person who purchased a car in a shop. If later it would be revealed the shop was illegal and was selling hijacked cars - you would loose that car, but at least you would not go to jail yourself.

    However as soon as you would make your own VLC packages containing selected parts of VLC you become VLC co-developer. You gain those "four freedoms" of FLOSS, but any freedom comes with responsibility. Now if "intellectual property" vultures would come to you, you would no more say "VLC did it", no. From this point it is YOU who did it.

    And if some FLOSS project would claim VLC pirated their code (chances are very tiny, but hypothetically that is possible too, complex FLOSS project are assembled from hordes different small works (from libraries to snippets and bugfix patches) with different initial licenses, and it is responsibility of maintainer (that means now - of YOU) to check or negotiate re-licensing compatibility), you would be co-responsible for it after you abandon standard ready-made bundle.

    And then there come that very "virus nature" of strict GPL license. When you use standard installer package you do not mix your code with VLC code. You just put several different installers into one media and you only use APIs explicitly published to be consumed by other software. But if you would rehash VLC into your own streamlined set of files - from that point on you are a co-developer not a consumer any more. So chances are one day you would be asked to disclose the sources of your application because you use LGPL/GPL sources of VLC and your program now should be distributed under the same terms, otherwise your distribution of VLC maybe become piracy, maybe not, you are free to stand for your point of view in public trial.

    Would you like it ?

    Those concerns do not apply to you in two cases:

    • You do not DISTRIBUTE your program, you only use it in-house. Then GPL/LGPL responsibilities are not affecting you, and for "intellectual properties" vultures you are mostly under radars.
    • You use standard unmodified VLC bundle as it is made by VLC team. Then you are not bound by GPL/LGPL either and any vultures would have to fight with the VLC team first before they may come to you claiming VLC is illegal software.

    If those cases do not suit you then you want to become a co-developer of VLC and thus you do accept all the responsibilities of it. Just for small space gain. Are you ready for it? Are the candles worth the game?