How to set audio format in code

Jim restlessmindsstudio at gmail.com
Thu Feb 28 09:46:51 PST 2013


Thanks Chuck, good to know there are a couple ways to do it.

 

Jim

 

From:
gstreamer-devel-bounces+restlessmindsstudio=gmail.com at lists.freedesktop.org
[mailto:gstreamer-devel-bounces+restlessmindsstudio=gmail.com at lists.freedesk
top.org] On Behalf Of Chuck Crisler
Sent: Thursday, February 28, 2013 9:57 AM
To: Discussion of the development of and with GStreamer
Subject: Re: How to set audio format in code

 

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/160919bc/attachment.html>


More information about the gstreamer-devel mailing list