Page 1 of 1

open file by file descriptor

Posted: 12 Jul 2019 02:09
by mangup
I discovered that it is implemented, but does not work for me.
How to do it properly?

Re: open file by file descriptor

Posted: 16 Jul 2019 08:59
by unidan
Hi, according to the tests, it works with fd://thefiledescriptornumber, like fd://0 for stdin.
What do you mean by it doesn't not work ?

Re: open file by file descriptor

Posted: 16 Jul 2019 11:17
by mangup
open file, write data, get fd and put it to input_SlaveSourceAdd() instead of file path

Re: open file by file descriptor

Posted: 16 Jul 2019 11:23
by unidan
And what are the logs ?

Re: open file by file descriptor

Posted: 16 Jul 2019 11:58
by mangup
[00007f61193227e8] main generic debug: no access modules matched
[000055e2e5388270] main input warning: failed to add fd://4134900864 as slave
[000055e2e5388270] main input debug: failed input_SlaveSourceAdd

Re: open file by file descriptor

Posted: 16 Jul 2019 13:01
by unidan
It's in the same access as file access so you probably have an issue with your modules instead

Re: open file by file descriptor

Posted: 16 Jul 2019 16:19
by mangup
Sorry, I did not catch your idea.
I can create file, write data, close it and pass file path to input_SlaveSourceAdd(..., "file:///path", ...) and it works.
But: open file, write data, get fd and call input_SlaveSourceAdd(..., "fd:///<fd-string>", ...) does not work.

Re: open file by file descriptor

Posted: 16 Jul 2019 18:19
by unidan
Actually, fd://4134900864 looks like a wrong file descriptor, as the default limit is really lower that that and it's bigger than INT_MAX. What did you do ? Can you scan the file descriptor from the process when doing this ?

Re: open file by file descriptor

Posted: 17 Jul 2019 20:53
by mangup
Now I've fixed fd. it is 33 :)
But still faild to load data from open file via fd - no module is selected inside vlc_stream_FilterNew() function during "priv->module = module_need(s, "stream_filter", psz_stream_filter, true);" call.

#0 0x00007ffff708503b in vlc_stream_FilterNew (p_source=0x7fff74c65280, psz_stream_filter=0x7fff75b45d80 "prefetch,cache") at input/stream_filter.c:78
#1 0x00007ffff708517b in stream_FilterChainNew (p_source=0x7fff74c65280, psz_chain=0x7ffff71039c0 "prefetch,cache") at input/stream_filter.c:117
#2 0x00007ffff70451d7 in stream_AccessNew (parent=0x5555558445d0, input=0x5555558445d0, out=0x7fff74000fc0, preparsing=false, url=0x7fff76196440 "fd://33") at input/access.c:344
#3 0x00007ffff706d688 in InputDemuxNew (p_input=0x5555558445d0, p_source=0x7fff74c66520, url=0x7fff76196440 "fd://33", psz_demux=0x7ffff710aed4 "subtitle", psz_anchor=0x7ffff710a262 "") at input/input.c:2534
#4 0x00007ffff706dccb in InputSourceNew (p_input=0x5555558445d0, psz_mrl=0x7fff74cdd730 "fd://33", psz_forced_demux=0x7ffff710aed4 "subtitle", b_in_can_fail=true) at input/input.c:2678
#5 0x00007ffff7070b36 in input_SlaveSourceAdd (p_input=0x5555558445d0, i_type=SLAVE_TYPE_SPU, psz_uri=0x7fff74cdd730 "fd://33", i_flags=7) at input/input.c:4002
#6 0x00007ffff706c376 in Control (p_input=0x5555558445d0, i_type=32, param=...) at input/input.c:2104
#7 0x00007ffff706858a in MainLoop (p_input=0x5555558445d0, b_interactive=true) at input/input.c:778
#8 0x00007ffff70679ff in Run (data=0x5555558445d0) at input/input.c:485
#9 0x00007ffff77866db in start_thread (arg=0x7fffac136700) at pthread_create.c:463
#10 0x00007ffff74af88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Re: open file by file descriptor

Posted: 17 Jul 2019 23:07
by unidan
Hi, this is probably not the real issue, but it's difficult to tell like that.

Re: open file by file descriptor

Posted: 18 Jul 2019 10:25
by mangup
hm. so, what can i do?