[gst-devel] fork() and then use gstreamer functions?

Alejandro Forero Cuervo azul at freaks-unidos.net
Mon Sep 14 01:59:04 CEST 2009


I've been working in a music player.  I figured it was time to get it
to use gstreamer.  I'm having some issues.

The music player receives a path that it scans recursively for files.
To do the scanning, it forks a child process that obtains the
information about the files, one at a time, and reports the results
back to the parent process over a pipe.  Currently, it just uses
readdir(2) and stat(2) and reports to the parent process the list of
files it finds and their sizes.  I've been modifying the code to hook
gstreamer so that it can report metadata about the file.

The problem I'm having is that when I call fork(2) and, after setting
a pipeline, the child process calls gst_bus_poll, the child process
seems to be trying to interact with the X server!  Y get some
assertion failures in xlib's code.  I'm guessing gst_bus_poll just
calls the glib primitives for the main loop, which still have the
gtk-dependencies.

I tried closing all files in the child (except the pipe used to talk
to the parent and the standard error) but this just results in an
assertion failure, Fatal IO error 9 (Bad file descriptor) on X server
:0.0.

So what's a programmer to do in order to fork a process and use
gstreamer functions without having the child process attempt to keep
track of all the widgets and stuff?

Thanks!

Alejo.
http://azul.freaks-unidos.net/




More information about the gstreamer-devel mailing list