Skip to content

Commit

Permalink
Merge pull request #167 from ferjm/player.construction.errors
Browse files Browse the repository at this point in the history
Check that we have the required elements to instantiate a gst-player
  • Loading branch information
ferjm committed Nov 29, 2018
2 parents 508a8a0 + 65941a3 commit f90235b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions backends/gstreamer/src/lib.rs
Expand Up @@ -29,6 +29,7 @@ pub enum BackendError {
Gstreamer(gst::Error),
InvalidMediaFormat,
InvalidSample,
MissingElement(&'static str),
PadLinkFailed,
PipelineBusError(String),
PipelineFailed(&'static str),
Expand Down
8 changes: 8 additions & 0 deletions backends/gstreamer/src/player.rs
Expand Up @@ -234,6 +234,14 @@ impl GStreamerPlayer {
return Ok(());
}

// Check that we actually have the elements that we
// need to make this work.
for element in vec!["playbin", "queue"].iter() {
if gst::ElementFactory::find(element).is_none() {
return Err(BackendError::MissingElement(element));
}
}

let player = gst_player::Player::new(
/* video renderer */ None, /* signal dispatcher */ None,
);
Expand Down

0 comments on commit f90235b

Please sign in to comment.