fn register_bus_inspector(&self, ctx_tx: Sender<ContextMessage>) {
        let pipeline = self.pipeline.clone();
        self.pipeline.get_bus().unwrap().add_watch(move |_, msg| {
            match msg.view() {
                gst::MessageView::Eos(..) => {
                    if pipeline.set_state(gst::State::Null) == gst::StateChangeReturn::Failure {
                        ctx_tx
                            .send(ContextMessage::FailedToExport(gettext(
                                "Failed to terminate properly. Check the resulting file.",
                            )))
                            .unwrap();
                    }
                    ctx_tx.send(ContextMessage::Eos).unwrap();
                    return glib::Continue(false);
                }
                gst::MessageView::Error(err) => {
                    ctx_tx
                        .send(ContextMessage::FailedToExport(
                            err.get_error().description().to_owned(),
                        ))
                        .unwrap();
                    return glib::Continue(false);
                }
                gst::MessageView::AsyncDone(_) => {
                    // Start splitting
                    if pipeline.set_state(gst::State::Playing) == gst::StateChangeReturn::Failure {
                        ctx_tx
                            .send(ContextMessage::FailedToExport(gettext(
                                "Failed to start splitting.",
                            )))
                            .unwrap();
                    }
                }
                _ => (),
            }

            glib::Continue(true)
        });
    }
// Uses ctx_tx to notify the UI controllers
Uses ctx_tx to notify the UI controllers
Uses ctx_tx to notify the UI controllers
fn register_bus_inspector(&self, ctx_tx: Sender<ContextMessage>) {
        let pipeline = self.pipeline.clone();
        self.pipeline.get_bus().unwrap().add_watch(move |_, msg| {
            match msg.view() {
                gst::MessageView::Eos(..) => {
                    if pipeline.set_state(gst::State::Null) == gst::StateChangeReturn::Failure {
                        ctx_tx
                            .send(ContextMessage::FailedToExport(gettext(
                                "Failed to terminate properly. Check the resulting file.",
                            )))
                            .unwrap();
                    }
                    ctx_tx.send(ContextMessage::Eos).unwrap();
                    return glib::Continue(false);
                }
                gst::MessageView::Error(err) => {
                    ctx_tx
                        .send(ContextMessage::FailedToExport(
                            err.get_error().description().to_owned(),
                        ))
                        .unwrap();
                    return glib::Continue(false);
                }
                gst::MessageView::AsyncDone(_) => {
                    // Start splitting
                    if pipeline.set_state(gst::State::Playing) == gst::StateChangeReturn::Failure {
                        ctx_tx
                            .send(ContextMessage::FailedToExport(gettext(
                                "Failed to start splitting.",
                            )))
                            .unwrap();
                    }
                }
                _ => (),
            }
            glib::Continue(true)
        });
    }
fn register_bus_inspector ( & self , ctx_tx : Sender < ContextMessage > ) { let pipeline = self . pipeline . clone ( ) ; self . pipeline . get_bus ( ) . unwrap ( ) . add_watch ( move | _ , msg | { match msg . view ( ) { gst :: MessageView :: Eos ( .. ) => { if pipeline . set_state ( gst :: State :: Null ) == gst :: StateChangeReturn :: Failure { ctx_tx . send ( ContextMessage :: FailedToExport ( gettext ( " " , ) ) ) . unwrap ( ) ; } ctx_tx . send ( ContextMessage :: Eos ) . unwrap ( ) ; return glib :: Continue ( false ) ; } gst :: MessageView :: Error ( err ) => { ctx_tx . send ( ContextMessage :: FailedToExport ( err . get_error ( ) . description ( ) . to_owned ( ) , ) ) . unwrap ( ) ; return glib :: Continue ( false ) ; } gst :: MessageView :: AsyncDone ( _ ) => { // Start splitting if pipeline . set_state ( gst :: State :: Playing ) == gst :: StateChangeReturn :: Failure { ctx_tx . send ( ContextMessage :: FailedToExport ( gettext ( " " , ) ) ) . unwrap ( ) ; } } _ => ( ) , } glib :: Continue ( true ) } ) ; }
Uses ctx_tx to notify the UI controllers
Uses ctx_tx to notify the UI controllers
&self
ctx_tx
Sender<ContextMessage>
&self
ctx_tx
Sender<ContextMessage>