How to set audio format in code

Chuck Crisler ccrisler at mutualink.net
Thu Feb 28 08:57:05 PST 2013


2 ways, depending on what you want. I think that what you are asking is
setting caps. Here is what you do.

GstCaps *pCaps = gst_caps_new_simple("audio/x-raw-int", "channels", g_int
(?), 2, NULL);
gst_link_filtered(element*1, element*2, pCaps);
gst_caps_unref(pCaps);

You can also set parameters on elements using:

g_object_set(G_OBJECT(someelement), "option1", value, "option2", value,
NULL);

Refer to the GstCaps and GstElement sections in the Core Reference Manual.

On Thu, Feb 28, 2013 at 11:46 AM, Jim <restlessmindsstudio at gmail.com> wrote:

> In the following gst-launch command line, right before the alsasink
> element, the audio format is being specified:****
>
> ** **
>
> gst-launch filesrc location=video.ts typefind=true ! flutsdemux name=demux
> demux. ! queue max-size-buffers=0 max-size-time=0 ! vpudec ! mfw_v4lsink
> demux. ! queue max-size-buffers=0 max-size-time=0 ! beepdec ! audioconvert
> ! 'audio/x-raw-int, channels=2' ! alsasink****
>
> ** **
>
> How would I specify the audio format in my C code? Since this is separated
> with an exclamation point (!) in the command line, it seems like a separate
> element so I tried:****
>
> gst_element_factory_make("audio/x-raw-int, channels=2", "myAudioFormat");
> ****
>
> but that didn’t work.****
>
> ** **
>
> Thanks,****
>
> Jim****
>
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130228/b85bc08f/attachment-0001.html>


More information about the gstreamer-devel mailing list