Page 1 of 1

libVLC and rc client interface

Posted: 02 May 2015 01:07
by calanor
Dear all,

If I use:

Code: Select all

vlc -I rc --cli-host=localhost:9082 sample.mp4
the rc lua client interface work fine.

but in libVLC, if I use rc in args, rc not work:

Code: Select all

const char * const vlc_args[] = { "-I","rc", "--cli-host=localhost:9082" }
But if I add inteface with this function:

Code: Select all

libvlc_add_intf(m_vlc,"rc");
Lua client interface work but some CLI commands like "stats" ,"info", "atrack" or "vratio" don't return any value.
Other commands like "fullscreen" return:
Error in `fullscreen' lua/intf/modules/common.lua:16: VLC lua error in file libs/video.c line 51 (function vlclua_fullscreen)
All this commands work fine in vlc with commandline.

How I use rc client in libVLC with all CLI commands ?

Thanks!
(vlc version 2.1.6 Rincewind on Ubuntu 14.04 LTS )

Re: libVLC and rc client interface

Posted: 02 May 2015 20:08
by Jean-Baptiste Kempf
Look at the VLC logs.

Re: libVLC and rc client interface

Posted: 02 May 2015 23:57
by calanor
Hi Jean-Baptiste,
I only see a few lines about rc:
[0x2407418] main playlist debug: keeping audio output
[0x240ffd8] main interface debug: looking for interface module matching "rc": 19 candidates
[0x240ffd8] [cli] lua interface debug: Found lua interface script: /usr/lib/vlc/lua/intf/cli.luac
[0x23f6278] pulse audio output debug: adding sink 0: alsa_output.pci-0000_00_06.1.analog-stereo (Audio intern Estèreo analògic)
[0x23f6278] pulse audio output debug: adding sink 1: alsa_output.pci-0000_03_00.1.hdmi-stereo (Turks/Whistler HDMI Audio [Radeon HD 6000 Series] Digital Stereo (HDMI))
[0x240ffd8] [cli] lua interface debug: Setting config variable: config={cli={host='localhost:9082'}}
[0x240ffd8] [cli] main interface debug: using interface module "lua"
[0x240ffd8] [cli] lua interface: Listening on host "localhost:9082".
[0x240ffd8] [cli] main interface debug: net: listening to localhost port 9082
[0x2419a28] main input debug: Creating an input for 'http://127.0.0.1/test/sample.mp4'
[0x2419a28] main input debug: using timeshift granularity of 50 MiB, in path '/tmp'
.
.
.
[0x7fe148003e48] main video output warning: picture is too late to be displayed (missing 126 ms)
[0x240ffd8] [cli] main interface debug: accepted socket 22 (from socket 13)
[0x7fe148003e48] main video output warning: picture is too late to be displayed (missing 43 ms)
[0x7fe148003e48] main video output warning: picture is too late to be displayed (missing 126 ms)
No command works in rc, and some return error:
| voldown [X] . . . . . . . . . . . . . . lower audio volume X steps
| achan [X] . . . . . . . . . . . . set/get stereo audio output mode
| atrack [X] . . . . . . . . . . . . . . . . . . . set/get audio track
| vtrack [X] . . . . . . . . . . . . . . . . . . . set/get video track
| vratio [X] . . . . . . . . . . . . . . . set/get video aspect ratio
| vcrop, crop [X] . . . . . . . . . . . . . . . . set/get video crop
| vzoom, zoom [X] . . . . . . . . . . . . . . . . set/get video zoom
| vdeinterlace [X] . . . . . . . . . . . . . set/get video deinterlace
| vdeinterlace_mode [X] . . . . . . . set/get video deinterlace mode
| snapshot . . . . . . . . . . . . . . . . . . . . take video snapshot
| strack [X] . . . . . . . . . . . . . . . . . set/get subtitle track
|
| vlm . . . . . . . . . . . . . . . . . . . . . . . . . load the VLM
| description . . . . . . . . . . . . . . . . . describe this module
| help, ? [pattern] . . . . . . . . . . . . . . . . . a help message
| longhelp [pattern] . . . . . . . . . . . . . . a longer help message
| lock . . . . . . . . . . . . . . . . . . . . lock the telnet prompt
| logout . . . . . . . . . . . . . . exit (if in a socket connection)
| quit . . . . . . . . quit VLC (or logout if in a socket connection)
| shutdown . . . . . . . . . . . . . . . . . . . . . . . shutdown VLC
+----[ end of help ]
> stop
> pause
> volume
0
> atrack
> info
> stats
> fullscreen
Error in `fullscreen' lua/intf/modules/common.lua:16: VLC lua error in file libs/video.c line 51 (function vlclua_fullscreen)
> vratio
> achan
+----[ stereo-mode ]
Error in `achan' lua/intf/cli.lua:517: bad argument #1 to 'ipairs' (table expected, got number)
>
Thanks.

Re: libVLC and rc client interface

Posted: 03 May 2015 12:52
by Jean-Baptiste Kempf
Are you playing something?

Re: libVLC and rc client interface

Posted: 04 May 2015 00:06
by calanor
yes!
several local videos and network streams.

Work fine with vlc commandline ( vlc -I rc --cli-host=localhost:9082 sample.mp4 )
Also tested with 2.0.10 Twoflower with the same results.

Thanks!

Re: libVLC and rc client interface

Posted: 04 May 2015 11:54
by calanor
The same efect if I do this :
libvlc_add_intf(_vlcinstance,"cli");
instead
libvlc_add_intf(_vlcinstance,"rc");
All commands return "nothing" except "help", "longhelp" and "?" which displays the list of commands, "description" which displays the some help and description, "volume" command always return "0" and some commands display an error:

Code: Select all

> achan +----[ stereo-mode ] Error in `achan' lua/intf/cli.lua:517: bad argument #1 to 'ipairs' (table expected, got number) > fullscreen Error in `fullscreen' lua/intf/modules/common.lua:16: VLC lua error in file libs/video.c line 51 (function vlclua_fullscreen) > title Error in `title' lua/intf/cli.lua:446: bad argument #1 to 'get' (vlc_object expected, got nil) >

Re: libVLC and rc client interface

Posted: 04 May 2015 12:19
by Rémi Denis-Courmont
So what do "status" and "playlist" command report? If the LibVLC instance is not playing anything, yoru results are perfectly normal and expected.

Re: libVLC and rc client interface

Posted: 04 May 2015 15:51
by calanor
Hi Rémi,
here "status" and "playlist" command report:

Code: Select all

> status ( audio volume: 0 ) ( state stopped ) > playlist +----[ Playlist - No definit ] | 2 - Llista de reproducció +----[ End of playlist ] >
But the video is not stopped and I see it play normally.

Code: Select all

libvlc_state_t _mp_state = libvlc_media_player_get_state(_mp); // IDLE/CLOSE=0, OPENING=1, BUFFERING=2, PLAYING=3, PAUSED=4, STOPPING=5, ENDED=6, ERROR=7
This function return the value 3


I looked at the cli.lua source code and it seems that functions like vlc.var.get( ) and vlc.var.get_list( ) do not work properly or not return the correct values when use libVLC.

Thanks!

Re: libVLC and rc client interface

Posted: 04 May 2015 16:15
by Rémi Denis-Courmont
It seems to me that everything is fine. The commands do nothing because the playlist is empty.

Re: libVLC and rc client interface

Posted: 04 May 2015 20:04
by calanor
I don't use playlist, but I changed direct play:

Code: Select all

const char * const vlc_args[] = { "-vvv", // "-I","rc" // adding in vlc_args not work!!! "--cli-host=localhost:9982" }; _vlcinstance=libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args); libvlc_add_intf(_vlcinstance,"cli"); // or "rc" _mp = libvlc_media_player_new (_vlcinstance); _m = libvlc_media_new_path(_vlcinstance, "sample.mp4"); libvlc_media_player_set_media (_mp, _m); libvlc_media_release(_m); int windid = contentWidget->winId(); libvlc_media_player_set_xwindow (_mp, windid ); /* Play */ libvlc_media_player_play (_mp );
to play with playlist:

Code: Select all

const char * const vlc_args[] = { "-vvv", // "-I","rc" "--cli-host=localhost:9982" }; _vlcinstance=libvlc_new(sizeof(vlc_args) / sizeof(vlc_args[0]), vlc_args); libvlc_add_intf(_vlcinstance,"cli"); //or "rc" _ml = libvlc_media_list_new(_vlcinstance); _m = libvlc_media_new_path(_vlcinstance, "sample.mp4"); libvlc_media_list_add_media(_ml, _m); libvlc_media_release(_m); _mlp = libvlc_media_list_player_new(_vlcinstance); _mp = libvlc_media_player_new(_vlcinstance); /* Use our media list */ libvlc_media_list_player_set_media_list(_mlp, _ml); /* Use a given media player */ libvlc_media_list_player_set_media_player(_mlp, _mp); /* Get our media instance to use our window */ int windid = contentWidget->winId(); libvlc_media_player_set_xwindow (_mp, windid ); /* Play */ libvlc_media_list_player_play(_mlp);
with the same result in rc client. Plays video correctly but no data :
> stats
> info
> status
( audio volume: 0 )
( state stopped )
> playlist
+----[ Playlist - No definit ]
| 2 - Llista de reproducció
+----[ End of playlist ]
>
playlist It is also empty.


Thanks!

Re: libVLC and rc client interface

Posted: 04 May 2015 22:27
by Rémi Denis-Courmont
You need to pass URLs to libvlc_new() or fill the playlist using the RC interface. Otherwise, the playlist will by design remain empty.

Re: libVLC and rc client interface

Posted: 05 May 2015 08:58
by calanor
Ok,
adding the url in args o fill the playlist using RC works well. But:
- If I pass the video in args to do play from rc.
- Also the video does not fills in the custom widget (libvlc_media_player_set_xwindow ) but it opens in a new window.


Thanks a lot!

Re: libVLC and rc client interface

Posted: 05 May 2015 09:09
by Rémi Denis-Courmont
That's again normal.