How to create a pipeline from ready-made media profiles?
Alexander Botero
alex.botero at gmail.com
Sun Sep 23 10:27:30 PDT 2012
Hello,
The GNOME-desktop has a list of supported/installed media profiles and
audio formats.
I can see these in THE gconf-editor, system -> gstreamer -> 0.10 -> audio
-> profiles:
Sample profiles:
FLAC: "audio/x-raw-int,rate=44100,channels=2 ! flacenc name=enc"
OGG: "audio/x-raw-float,rate=44100,channels=2 ! vorbisenc name=enc
quality=0.5 ! oggmux"
MP3: "audio/x-raw-int,rate=44100,channels=2 ! lamemp3enc name=enc target=0
quality=6 ! xingmux ! id3v2mux"
I want to create a complete pipeline of these formats, and I want to build
it from separate elements (not from gst_parse_launch(...)).
Q: Is this right way to parse the profile string?
0) Split the string to two (2) parts. The parts are separated by first "!".
F.ex let's study the OGG-profile.
1) Create GstCaps from the capabilities string (the 1.st part).
Create GstCapsfilter element and set "caps" on it.
GstElement *filter = gst_element_factory_make("capsfilter", NULL);
GstCaps *caps =
gst_caps_from_string("audio/x-raw-float,rate=44100,channels=2");
g_object_set(G_OBJECT(filter), "caps", caps, NULL);
gst_caps_unref(caps);
2) Create a GstBin from the profile's encoder/mux part.
gchar *str = "vorbisenc name=enc quality=0.5 ! oggmux";
GError *err = NULL;
GstBin *bin = gst_parse_bin_from_description(str, TRUE, &err);
3) Create rest of the pipeline as usual.
gst_bin_add_many(GST_BIN(pipe), ...);
gst_element_link_many(source,...,audioconvert, audioresample, filter,
bin, filesink, NULL);
This approach seems to work pretty well. Have you a better approach?
----------------------------
The gst_parse_launch(...) function seems to do this magick automatically.
For example this works fine:
const gchar *str = "pulsesrc"
" ! queue"
" ! audioconvert"
" ! audio/x-raw-int,rate=44100,channels=2 ! flacenc name=enc"
" ! filesink location=xxx");
GError *err = NULL;
GstElement *pipe = gst_parse_launch(str, &err);
...
Kindly
Alexander
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20120923/2244e605/attachment.html>
More information about the gstreamer-devel
mailing list