pipeline to code help
Brendan Long
self at brendanlong.com
Wed Jul 17 09:53:53 PDT 2013
On 07/17/2013 10:04 AM, stixxy wrote:
> i have follow line and i want to compile what is the best solution for a
> simple code?
> gst-launch-0.10 alsasrc device=hw:0,0 ! audioconvert ! alsasink
> device=hw:0,0
You can create the same pipeline in C with gst_parse_launch
<http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstParse.html#gst-parse-launch>:
GError* error;
GstElement* pipeline = gst_parse_launch("alsasrc device=hw:0,0 !
audioconvert ! alsasink device=hw:0,0", &error);
if (error) {
// print error
}
if (pipeline) {
gst_element_set_state(pipeline, GST_STATE_PLAYING);
}
Or you could build it by hand:
GstElement* pipeline = gst_pipeline_new(NULL);
GstElement* alsasrc = gst_element_factory_make("alsasrc", NULL);
g_object_set(alsasrc, "device", "hw:0,0", NULL);
gst_bin_add(GST_BIN(pipeline), alsasrc);
GstElement* audioconvert = gst_element_factory_make("audioconvert",
NULL);
gst_bin_add(GST_BIN(pipeline), audioconvert);
gst_element_link(alsasrc, audioconvert);
GstElement* alsasink = gst_element_factory_make("alsasink", NULL);
g_object_set(alsasink, "device", "hw:0,0", NULL);
gst_bin_add(GST_BIN(pipeline), alsasink);
gst_element_link(audioconvert, alsasink);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20130717/caac49e3/attachment-0001.html>
More information about the gstreamer-devel
mailing list