Convert launch examples to get the pipeline string from the commandline

This commit is contained in:
Sebastian Dröge 2017-07-11 21:21:56 +03:00
parent 9cfb83d6a2
commit 6461be1372
2 changed files with 8 additions and 3 deletions

View file

@ -2,11 +2,14 @@ extern crate gstreamer as gst;
use gst::*;
use std::u64;
use std::env;
fn main() {
let pipeline_str = env::args().collect::<Vec<String>>()[1..].join(" ");
gst::init().unwrap();
let pipeline = gst::parse_launch("audiotestsrc ! autoaudiosink").unwrap();
let pipeline = gst::parse_launch(&pipeline_str).unwrap();
let bus = pipeline.get_bus().unwrap();
let ret = pipeline.set_state(gst::State::Playing);

View file

@ -5,14 +5,16 @@ use gst::ObjectExt as GstObjectExt;
extern crate glib;
use glib::*;
use std::u64;
use std::env;
fn main() {
let pipeline_str = env::args().collect::<Vec<String>>()[1..].join(" ");
gst::init().unwrap();
let main_loop = MainLoop::new(None, false);
let pipeline = gst::parse_launch("audiotestsrc ! autoaudiosink").unwrap();
let pipeline = gst::parse_launch(&pipeline_str).unwrap();
let bus = pipeline.get_bus().unwrap();
let ret = pipeline.set_state(gst::State::Playing);