Building a FUSE fs.

Sean McNamara smcnam at gmail.com
Sat Jul 2 11:08:36 PDT 2011


Hi,

On Sat, Jul 2, 2011 at 1:48 PM, Stef Bon <stefbon at gmail.com> wrote:
> Hi,
>
> I'm building an audio-format-decode fs, and would like to use
> Gstreamer for that. Hurray!
>
> (I've found some other FUSE fs's using Gstreamer....)
>
> Now, haven't been programming Gstreamer before, and I have some questions.
>
> How can I make a prog determine the audio conversions supported? Or
> are there tooo many?
>
> And how do I program a a "chain", from one format to another.
> I've read some of the documentation, and it looks it's a chain of
> various steps. How do I know what steps,
> and in what order?

It's called a pipeline. Video works in a similar way, but I'm just
going to talk about audio here.

The catch-all format of an audio conversion pipeline is something like this:

<src> ! decodebin2 ! audioconvert ! <encoder> ! <sink>

where <src> is a source element, <encoder> is an encoder element,
<sink> is a sink element, and the other two are the names of actual
element classes that you'll need.

The formats that can be decoded and/or demuxed by decodebin2 depends
on what plugins are installed by your gstreamer installation.

The formats that can be encoded and/or muxed depends on which encoder
element you choose.

Keep in mind that encodebin, a fairly new element in gst-plugins-base,
can basically encapsulate the entire "guts" of the pipeline except for
the source and sink as stated above:

<src> ! encodebin ! <sink>

All you have to do then is specify the desired profile to the
encodebin by setting the profile property.

There's an example of getting all the existing profiles on the system
in the docs: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-encoding-profile.html#GstEncodingProfile

This would make it easy to discover all the possible output formats in
a user-friendly way, rather than trying to determine all the formats
manually from the caps supported by encoders on the system.

And it's nice that encodebin supports automatic passthrough if your
input data is already in the output format; so for example if you
wanted to "convert" from MP3 to MP3, it would just pass it through
instead of re-encoding (causing loss of data).

Only downside of encodebin is that it's relatively new, and thus has
less thorough testing in real-world applications. But I think it
should be, at least, interesting to try it out and see if it works for
you, and if not, report a bug.

Last thing I would suggest is to download DevHelp (if you're
developing on GNU/Linux, BSD, or another platform where Gnome is
supported) and grab the gstreamer docs. It's nice to be able to access
the gstreamer docs from within devhelp, and many of the element
classes and base classes have example C code in the docs.

If you're confused by the notation I used above, with an exclamation
point between elements, that's what's called "gst-launch syntax",
because you can pass that kind of string to the console command
gst-launch-0.10. For example:

$ gst-launch-0.10 audiotestsrc ! volume volume=0.10 ! audioconvert !
autoaudiosink

The pipeline must always contain at least one source (abbreviated src)
and at least one sink. A source is where data originates from outside
the gstreamer environment (a file, the network, etc), and a sink is
where data exits the gstreamer environment (a file, the network, sound
card, etc).

All of that is covered in the app developer docs:
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html

HTH,

Sean

>
> Thanks in advance,
>
> Stef
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>


More information about the gstreamer-devel mailing list