[vlc-devel] Re: Problem with exec(), system() popen() of VLC
Rémi Denis-Courmont
rem at videolan.org
Wed May 24 16:30:54 CEST 2006
Le Mercredi 24 Mai 2006 16:08, Michael Pujos a écrit :
> I want to launch vlc in a C program using either system(),
> fork()/exec() or popen and
> in all cases I have the same problem:
> All of these functions are waiting for VLC to return, but it never
> returns and my program can't continue.
system() waits. It's supposed to. exec() will surely not wait, because
it does not return at all unless it failed. As for popen(), it's very
much like system(), except that you get either the input or output
through a FILE pointer.
> Even launching VLC with -d (daemon) do not work.
It does work. It detach vlc from the current session and runs it in the
background. But of course, you cannot pipe anything into a daemonized
process.
> Theproblem I believe
> is the parent process is waiting for a signal from the
> child with wait(), but that signal never arrives.
No sorry. VLC does not reinvents the POSIX API. In fact, no POSIX-like
kernel will ever allow it to do so.
> In fact I want this call to return:
>
> system("dvbstream -f 490000000 -rtp -o 8192 | vlc - -d -I dummy
> --program 260 --sout '#standard{access=http,mux=ts,dst=:3001}'");
>
> forget dvbstream, that isn't the cause of the problem.
You CANNOT pipe into a daemonized process.
> Any idea to make this work would be greatly appreciated. I already
> tried a lot of things like -d or adding a '&' without success and
> everything I could think of using exec / popen.
Don't use the daemon option. Simply fork() before you call system().
--
Rémi Denis-Courmont
Otaniemi, Espoo, Finland
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20060524/121ba21d/attachment.sig>
More information about the vlc-devel
mailing list