First kinda working

This commit is contained in:
Rafael Caricio 2021-12-29 18:19:29 +01:00
parent 75ea4729ba
commit 0e572be6c0
Signed by: rafaelcaricio
GPG key ID: 3C86DBCE8E93C947

View file

@ -16,13 +16,14 @@ fn main() -> Result<(), Error> {
.downcast::<gst::Pipeline>() .downcast::<gst::Pipeline>()
.expect("Expected a gst::Pipeline"); .expect("Expected a gst::Pipeline");
let text_src = gst::ElementFactory::make("appsrc", Some("text-src")).unwrap(); let text_src = gst::ElementFactory::make("appsrc", Some("text-src")).unwrap().downcast::<gst_app::AppSrc>().unwrap();
text_src.set_property("is-live", true); text_src.set_is_live(true);
text_src.set_property("caps", text_src.set_format(gst::Format::Time);
text_src.set_caps(Some(
&gst::Caps::builder("text/x-raw") &gst::Caps::builder("text/x-raw")
.field("format", "utf8") .field("format", "utf8")
.build(), .build(),
); ));
pipeline.add(&text_src).expect("Failed to add elements to pipeline"); pipeline.add(&text_src).expect("Failed to add elements to pipeline");
let converter = pipeline.by_name("converter").unwrap(); let converter = pipeline.by_name("converter").unwrap();