mirror of
https://gitlab.freedesktop.org/dabrain34/GstPipelineStudio.git
synced 2025-03-07 03:21:12 +00:00
pipeline: Able to render a graph and check for error
If the pipeline can not be created, display an error dialog when checking it.
This commit is contained in:
parent
5c25417569
commit
ee66f53171
4 changed files with 47 additions and 32 deletions
15
TODO.md
15
TODO.md
|
@ -32,6 +32,10 @@
|
|||
- [x] add a css class for pad (presence always or sometimes)
|
||||
- [ ] Add property to port to store some specific value(Caps)
|
||||
|
||||
### GStreamer:
|
||||
|
||||
- [ ] Implement pipeline unit test
|
||||
|
||||
### app
|
||||
|
||||
- [x] check that a node accept to create a port on request (input/output)
|
||||
|
@ -41,20 +45,19 @@
|
|||
- [x] unable to connect a port which is already connected
|
||||
- [ ] Create a window for the video output
|
||||
- [ ] Add multiple graphviews with tabs.
|
||||
- [ ] Property window in the main window
|
||||
- [x] Property window in the main window
|
||||
- [ ] Connect the GPS status to GST status
|
||||
- [ ] Implement graph dot render/load
|
||||
- [ ] Implement a command line parser to graph
|
||||
- [ ] Render the parse launch line in a message box
|
||||
- [ ] Prevent to create a pad in an element without the template
|
||||
- [ ] Check the pipeline validity
|
||||
- [ ] Implement pipeline unit test
|
||||
- [x] Render the parse launch line in a message box
|
||||
- [x] Prevent to create a pad in an element without the template
|
||||
- [x] Check the pipeline validity
|
||||
- [x] Save node position in XML
|
||||
- [x] Autosave the graph
|
||||
- [x] Logger in file/app all over the app
|
||||
- [ ] handle the caps setter element
|
||||
- [ ] Add probes on each pad to monitor the pipeline
|
||||
- [ ] Display pad properties with tooltip hover
|
||||
- [x] Display pad properties with tooltip hover
|
||||
- [ ] Render a media file
|
||||
- [ ] Offer compatible element to a pad (autorender)
|
||||
- [ ] Display tags/meta/message detected
|
||||
|
|
|
@ -537,7 +537,11 @@ impl GPSApp {
|
|||
move |_,_| {
|
||||
let app = upgrade_weak!(app_weak);
|
||||
let render_parse_launch = app.pipeline.borrow().render_gst_launch(&app.graphview.borrow());
|
||||
GPSUI::message::display_message_dialog(&render_parse_launch,gtk::MessageType::Info, |_| {});
|
||||
if app.pipeline.borrow().create_pipeline(&render_parse_launch).is_ok() {
|
||||
GPSUI::message::display_message_dialog(&render_parse_launch,gtk::MessageType::Info, |_| {});
|
||||
} else {
|
||||
GPSUI::message::display_error_dialog(false, &format!("Unable to render:\n\n{}", render_parse_launch));
|
||||
}
|
||||
}
|
||||
);
|
||||
pop_menu.show();
|
||||
|
|
|
@ -80,12 +80,34 @@ impl Pipeline {
|
|||
Ok(pipeline)
|
||||
}
|
||||
|
||||
pub fn create_pipeline(&self, description: &str) -> anyhow::Result<()> {
|
||||
pub fn create_pipeline(&self, description: &str) -> anyhow::Result<gstreamer::Pipeline> {
|
||||
GPS_INFO!("Creating pipeline {}", description);
|
||||
|
||||
// Create pipeline from the description
|
||||
let pipeline = gst::parse_launch(&description.to_string())?;
|
||||
if let Ok(pipeline) = pipeline.downcast::<gst::Pipeline>() {
|
||||
let pipeline = pipeline.downcast::<gst::Pipeline>();
|
||||
/* start playing */
|
||||
if pipeline.is_err() {
|
||||
GPS_ERROR!("Can not create a proper pipeline from gstreamer parse_launch");
|
||||
return Err(anyhow::anyhow!(
|
||||
"Unable to create a pipeline from the given parse launch {"
|
||||
));
|
||||
}
|
||||
Ok(pipeline.unwrap())
|
||||
}
|
||||
|
||||
pub fn start_pipeline(
|
||||
&self,
|
||||
graphview: &GraphView,
|
||||
new_state: PipelineState,
|
||||
) -> anyhow::Result<PipelineState> {
|
||||
if self.state() == PipelineState::Stopped {
|
||||
let pipeline = self
|
||||
.create_pipeline(&self.render_gst_launch(graphview))
|
||||
.map_err(|err| {
|
||||
GPS_ERROR!("Unable to start a pipeline: {}", err);
|
||||
err
|
||||
})?;
|
||||
let bus = pipeline.bus().expect("Pipeline had no bus");
|
||||
let pipeline_weak = self.downgrade();
|
||||
bus.add_watch_local(move |_bus, msg| {
|
||||
|
@ -95,24 +117,6 @@ impl Pipeline {
|
|||
})?;
|
||||
|
||||
*self.pipeline.borrow_mut() = Some(pipeline);
|
||||
/* start playing */
|
||||
} else {
|
||||
GPS_ERROR!("Can not create a proper pipeline from gstreamer parse_launch");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub fn start_pipeline(
|
||||
&self,
|
||||
graphview: &GraphView,
|
||||
new_state: PipelineState,
|
||||
) -> anyhow::Result<PipelineState> {
|
||||
if self.state() == PipelineState::Stopped {
|
||||
self.create_pipeline(&self.render_gst_launch(graphview))
|
||||
.map_err(|err| {
|
||||
GPS_ERROR!("Unable to start a pipeline: {}", err);
|
||||
err
|
||||
})?;
|
||||
}
|
||||
|
||||
self.set_state(new_state).map_err(|error| {
|
||||
|
|
|
@ -63,9 +63,13 @@ pub fn display_message_dialog<F: Fn(Application) + 'static>(
|
|||
|
||||
#[allow(dead_code)]
|
||||
pub fn display_error_dialog(fatal: bool, message: &str) {
|
||||
display_message_dialog(message, gtk::MessageType::Error, move |app| {
|
||||
if fatal {
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
display_message_dialog(
|
||||
&format!("Error: {}", message),
|
||||
gtk::MessageType::Error,
|
||||
move |app| {
|
||||
if fatal {
|
||||
app.quit();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue