Building a FUSE fs.

Stef Bon stefbon at gmail.com
Sun Jul 3 03:00:18 PDT 2011


Well I have some more questions.

In gstfs

see:

http://bobcopeland.com/gstfs/

an ogg file is decoded from mp3 to ogg on the fly.
There a pipeline is given on the commandline, like:

pipeline="filesrc name=\"_source\" ! oggdemux ! vorbisdec !
audioconvert ! lame bitrate=160 ! fdsink name=\"_dest\" sync=false"

in the program some additional parameters are set:

    thread_params.fd = pipefds[0];
    thread_params.add_data_cb = add_data_cb;
    thread_params.user_data = user_data;

    pthread_create(&thread, NULL, send_pipe, (void *) &thread_params);

    g_object_set(G_OBJECT(source), "location", filename, NULL);
    g_object_set(G_OBJECT(dest), "fd", pipefds[1], NULL);

    bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
    gst_bus_add_signal_watch(bus);
    gst_element_set_state(pipeline, GST_STATE_PLAYING);
    GstMessage *message = gst_bus_poll(bus, GST_MESSAGE_EOS |
        GST_MESSAGE_ERROR, -1);
    gst_message_unref(message);

    // close read-side so pipe will terminate
    close(pipefds[1]);
    pthread_join(thread, thread_status);


Here very important parameters are set. In the first place an fd, the
read site of a pipe.
An a callback, which is performed when data is received.

As I read it correctly, a thread is created to read the data, which
receives data, send over the pipe by another thread, the gstreamer
thread. This gstreamer thread sends over the data via the fd, set via

g_object_set(G_OBJECT(dest), "fd", pipefds[1], NULL);

When the receive thread receives data by reading the pipe, it calls
the read callback which writes the data to a buffer in memory ( and
corrects the size of this buffer on the fly...)

Am I correct?

How can I set the fd? It does not look like a gst call, more a glib call.

Stef


(My intention is to not use a pipe per file, but one write fd for all
the conversions, and the readsite it watched by an epoll instance. Is
it possible to add "user data" to the data send by the decoding
process?)


More information about the gstreamer-devel mailing list