MCPcopy Create free account
hub / github.com/Recordscript/recordscript / gstreamer_loop

Function gstreamer_loop

src-tauri/src/util.rs:39–65  ·  view source on GitHub ↗
(
    pipeline: gst::Pipeline,
    on_message: impl Fn(&gst::Message) -> bool,
)

Source from the content-addressed store, hash-verified

37}
38
39pub fn gstreamer_loop(
40 pipeline: gst::Pipeline,
41 on_message: impl Fn(&gst::Message) -> bool,
42) -> anyhow::Result<()> {
43 use gst::prelude::*;
44
45 pipeline.set_state(gst::State::Playing)?;
46
47 let bus = pipeline.bus().unwrap();
48
49 for message in bus.iter_timed(gst::ClockTime::NONE) {
50 match message.view() {
51 gst::MessageView::Eos(_) => break,
52 gst::MessageView::Error(err) => anyhow::bail!(format!("{:?}", err)),
53 _ => {}
54 }
55
56 let should_break = on_message(&message);
57 if should_break {
58 break;
59 };
60 }
61
62 pipeline.set_state(gst::State::Null)?;
63
64 Ok(())
65}
66
67pub fn replace_multiple_whitespace(input: &str) -> String {
68 let mut result = String::new();

Callers 3

mainFunction · 0.85
previewMethod · 0.85
decode_audioFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected