trying to pass parameters to vlclib

This forum is about all development around libVLC.
jocomau
New Cone
New Cone
Posts: 6
Joined: 31 Jul 2015 11:28

trying to pass parameters to vlclib

Postby jocomau » 03 Aug 2015 11:36

I'm trying to do a very simple player for windows 7 in C++ on Embarcadero using vlclib 2.2.1
Below is my very simple code to initialize lib and to start the video from a streaming udp source.
I run the program from command line to pass some parameters to it.

void __fastcall TForm3::FormShow(TObject *Sender)
{
m_pInst = libvlc_new (_argc-1, (const char *const *)&_argv[1]); // first parameter is exe filepath
m_pM = libvlc_media_new_location(m_pInst, "udp://@228.1.1.3:8080"); // udp source streaming muticast address and port
if(m_pM) {
m_pMP = libvlc_media_player_new_from_media (m_pM);
libvlc_media_player_set_hwnd (m_pMP, Handle);
if(m_pMP) {
libvlc_media_player_play (m_pMP);
}
}
}

I copied myplayer.exe on a vlc-2.2.1 folder to be sure to use same libraries, plugins, etc...
It's working (I mean I can see the video streaming) but I can pass to the player some parameters (for example myplayer.exe --file-logging --verbose=2)
but not --config=myvlcrc (It seems just ignoring it: the logfile is not generated and the second log window doesn't show).
myvlcrc is a modified vlcrc with logging property setted as above.
myvlcrc is a correct vlcrc file because if I run vlc.exe --config=myvlcrc I can see the log file and the second log window.

Can anybody help? What I'm doing wrong?

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: trying to pass parameters to vlclib

Postby Rémi Denis-Courmont » 03 Aug 2015 12:49

The parameters syntax is not compatible with Mplayer anyway. LibVLC has explicit function calls for debug/logging,
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

jocomau
New Cone
New Cone
Posts: 6
Joined: 31 Jul 2015 11:28

Re: trying to pass parameters to vlclib

Postby jocomau » 03 Aug 2015 15:00

I don't use Mplayer, I have my own player the code is above and I call it MYPLAYER.exe just to give it a name.

Found a (partial) solution: I need to pass also --no-ignore-config to MYPLAYER.exe

MYPLAYER.exe --no-ignore-config --config=myvlcrc
but for vlc is enough
VLC.exe --config=myvlcrc

Now the problem is:
maybe vlc has different default values? How can I be sure to have all the same default settings?

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: trying to pass parameters to vlclib

Postby Rémi Denis-Courmont » 03 Aug 2015 15:53

VLC does not use libvlc_media_player_* internally, and thus settings are interpreted differently anyway. So the question makes no sense.

Besides, using parameters is explicitly not supported. It's a question of when, not if, your app will break,
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

jocomau
New Cone
New Cone
Posts: 6
Joined: 31 Jul 2015 11:28

Re: trying to pass parameters to vlclib

Postby jocomau » 03 Aug 2015 16:31

Which question does not make sense?

I read the documentation, it says:
...
Version
Arguments are meant to be passed from the command line to LibVLC, just like VLC media player does....
and if you refer to
Warning
There is absolutely no warranty or promise of forward, backward and cross-platform compatibility with regards to libvlc_new() arguments. We recommend that you do not use them, other than when debugging.
I do not need to be forward, backward or cross-platform compatible, I just need to have player based on libvlc library version 2.2.1 that plays a video stream like vlc.exe (version 2.2.1) does passing the same parameters and/or using the same vlcrc config file.

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: trying to pass parameters to vlclib

Postby Rémi Denis-Courmont » 04 Aug 2015 09:28

VLC does not pass any options that would be relevant to playback by default.

Code: Select all

libvlc_new(NULL,0);
will give you the same results.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

jocomau
New Cone
New Cone
Posts: 6
Joined: 31 Jul 2015 11:28

Re: trying to pass parameters to vlclib

Postby jocomau » 04 Aug 2015 11:55

Thanks for your reply, I understood your point of view and that you are contrary to pass parameters to libvlc_new.
The reason why i need to pass parameters is that default values don't work or don't work well for my videos and my hw configuration.
So I tuned up parameters using a vlc.exe preferences interface and I played with many parameters (for example caching parameters and hw accelaration parameters) tryng many different configurations.
After some days of hard work finding the best values I saved vlcrc and I hoped to use that config file for my player (based on exactly the same vlc version 2.2.1), just finding that the result wasn't the same and that vlcrc setted values were ignored (at least before passing also --no-ignore-config).
Maybe you are right and I'm completly wrong doing a stupid and not possible thing, but i'm not thowing away a lot of work without even trying and asking on the forum,
maybe there is a suboptimal or even bad solution (that you don't like) but if it works, for me is enough. Perfect is the enemy of good said Voltaire.

Rémi Denis-Courmont
Developer
Developer
Posts: 15265
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: trying to pass parameters to vlclib

Postby Rémi Denis-Courmont » 04 Aug 2015 12:17

In the same thread, you say you want the same settings as VLC, and that you want custom settings (therefore not the same as VLC). Well, sorry but if you are contradicting your own self, nobody can help you.

Anyhow the VLC configuration is a terrible idea. There are literally hundreds of different ways that the user can change the VLC settings that will break or alter LibVLC behaviour. Just see how many LibVLC examples have cargo-culted "--ignore-config" for that exact reason.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

jocomau
New Cone
New Cone
Posts: 6
Joined: 31 Jul 2015 11:28

Re: trying to pass parameters to vlclib

Postby jocomau » 04 Aug 2015 13:46

I'm not contracticting me as you can see above i wrote this command line
VLC.exe --config=myvlcrc
that means I was using not all the default values but a specific myvlcrc with some values that override some default. And I also specified that:
myvlcrc is a modified vlcrc with logging property setted as above (verbose and log-file)
That was the easiest way to understand if my player was using the myvlcrc config file or not.
I had to open winvlc.c (I just have 2.0.7 code not 2.2.1 maybe it is changed) to find that

Code: Select all

char *argv[argc + 3]; BOOL crash_handling = TRUE; int j = 0; argv[j++] = FromWide( L"--media-library" ); argv[j++] = FromWide( L"--no-ignore-config" )
;
So --no-ignore-config is the default for vlc.exe (I do not need to pass it on command line) but is not the default for the library itself, and so it isn't the default for my player based on the library.
And also vlc.exe initialize with

Code: Select all

/* Initialize libvlc */ libvlc_instance_t *vlc; vlc = libvlc_new (argc, (const char **)argv); if (vlc != NULL) { libvlc_set_user_agent (vlc, "VLC media player", "VLC/"PACKAGE_VERSION); libvlc_add_intf (vlc, "globalhotkeys,none"); libvlc_add_intf (vlc, NULL);
So vlc.exe use the same libvlc_new method with argc and argv parameters you are discouraging me from using.

Then you said that user can change the VLC settings, but I have a my own player (with a minimal user inteface) exactly to prevent user for doing something that could do with vlc.exe.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 6 guests