<div><div>Re-hi,</div><div>Of course, this should also work. </div><div>"capsfilter caps=" + the profile string.</div><div><br></div><div>gchar *profile_str = "capsfilter caps=audio/x-raw-int,rate=22050,channels=1 ! wavenc name=enc";</div>
<div><br></div><div>GError *err = NULL;</div><div>GstBin *bin = gst_parse_bin_from_description(profile_str, TRUE, &err);</div><div>if (err) {</div><div>   ...</div><div>}</div></div><div><br></div><div>Alex.</div><br>
<br><div class="gmail_quote">On Sun, Sep 23, 2012 at 7:27 PM, Alexander Botero <span dir="ltr"><<a href="mailto:alex.botero@gmail.com" target="_blank">alex.botero@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>Hello,</div><div>The GNOME-desktop has a list of supported/installed media profiles and audio formats.</div><div>I can see these in THE gconf-editor,  system -> gstreamer -> 0.10 -> audio -> profiles:</div>

<div><br></div><div>Sample profiles:</div><div>FLAC: "audio/x-raw-int,rate=44100,channels=2 ! flacenc name=enc"</div><div>OGG:  "audio/x-raw-float,rate=44100,channels=2 ! vorbisenc name=enc quality=0.5 ! oggmux"</div>

<div>MP3:  "audio/x-raw-int,rate=44100,channels=2 ! lamemp3enc name=enc target=0 quality=6 ! xingmux ! id3v2mux"</div><div><br></div><div>I want to create a complete pipeline of these formats, and I want to build it from separate elements (not from gst_parse_launch(...)).</div>

<div><br></div><div>Q: Is this right way to parse the profile string?</div><div><br></div><div>0) Split the string to two (2) parts. The parts are separated by first "!".</div><div><br></div><div>F.ex let's study the OGG-profile.</div>

<div><br></div><div>1) Create GstCaps from the capabilities string (the <a href="http://1.st" target="_blank">1.st</a> part).</div><div>   Create GstCapsfilter element and set "caps" on it.</div><div><br></div>
<div>  GstElement *filter = gst_element_factory_make("capsfilter", NULL);</div>
<div>  GstCaps *caps = gst_caps_from_string("audio/x-raw-float,rate=44100,channels=2");</div><div>  g_object_set(G_OBJECT(filter), "caps", caps, NULL);</div><div>  gst_caps_unref(caps);</div><div><br>
</div>
<div>2) Create a GstBin from the profile's encoder/mux part.</div><div>  gchar *str = "vorbisenc name=enc quality=0.5 ! oggmux";</div><div><br></div><div>  GError *err = NULL;</div><div>  GstBin *bin = gst_parse_bin_from_description(str, TRUE, &err);</div>

<div>  </div><div>3) Create rest of the pipeline as usual. </div><div>  gst_bin_add_many(GST_BIN(pipe), ...);</div><div>  gst_element_link_many(source,...,audioconvert, audioresample, filter, bin, filesink, NULL);</div><div>

<br></div><div>This approach seems to work pretty well. Have you a better approach?</div><div>----------------------------</div><div><br></div><div>The gst_parse_launch(...) function seems to do this magick automatically.</div>

<div><br></div><div>For example this works fine:</div><div>const gchar *str = "pulsesrc"</div><div>             " ! queue"</div><div>             " ! audioconvert"</div><div>             " ! audio/x-raw-int,rate=44100,channels=2 ! flacenc name=enc"</div>

<div>             " ! filesink location=xxx");</div><div><br></div><div>GError *err = NULL;</div><div>GstElement *pipe = gst_parse_launch(str, &err);</div><div><br></div></div></blockquote></div>