mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-10-31 22:58:51 +00:00
Remove various unneeded unwraps
This commit is contained in:
parent
58786fa0b5
commit
6aed1ed926
8 changed files with 19 additions and 20 deletions
|
@ -279,8 +279,11 @@ impl CustomSource {
|
|||
|
||||
// Otherwise from the caps
|
||||
if stream_type.is_none() {
|
||||
let caps = match pad.get_current_caps().or_else(|| pad.query_caps(None)) {
|
||||
Some(caps) if !caps.is_any() && !caps.is_empty() => caps,
|
||||
let caps = match pad
|
||||
.get_current_caps()
|
||||
.unwrap_or_else(|| pad.query_caps(None))
|
||||
{
|
||||
caps if !caps.is_any() && !caps.is_empty() => caps,
|
||||
_ => {
|
||||
gst_error!(CAT, obj: element, "Pad {} had no caps", pad.get_name());
|
||||
return Err(gst_error_msg!(
|
||||
|
|
|
@ -1306,8 +1306,11 @@ impl FallbackSrc {
|
|||
x if x.starts_with("audio_") => ("audio", &mut state.audio_stream),
|
||||
x if x.starts_with("video_") => ("video", &mut state.video_stream),
|
||||
_ => {
|
||||
let caps = match pad.get_current_caps().or_else(|| pad.query_caps(None)) {
|
||||
Some(caps) if !caps.is_any() && !caps.is_empty() => caps,
|
||||
let caps = match pad
|
||||
.get_current_caps()
|
||||
.unwrap_or_else(|| pad.query_caps(None))
|
||||
{
|
||||
caps if !caps.is_any() && !caps.is_empty() => caps,
|
||||
_ => return Ok(()),
|
||||
};
|
||||
|
||||
|
|
|
@ -265,11 +265,10 @@ impl Cea608Overlay {
|
|||
|
||||
if let Some(features) = overlay_caps.get_mut_features(0) {
|
||||
features.add(&gst_video::CAPS_FEATURE_META_GST_VIDEO_OVERLAY_COMPOSITION);
|
||||
if let Some(peercaps) = self.srcpad.peer_query_caps(Some(&caps_clone)) {
|
||||
downstream_accepts_meta = !peercaps.is_empty();
|
||||
if downstream_accepts_meta {
|
||||
caps = caps_clone;
|
||||
}
|
||||
let peercaps = self.srcpad.peer_query_caps(Some(&caps_clone));
|
||||
downstream_accepts_meta = !peercaps.is_empty();
|
||||
if downstream_accepts_meta {
|
||||
caps = caps_clone;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -286,7 +286,7 @@ impl Cea608ToTt {
|
|||
}
|
||||
|
||||
let mut downstream_caps = match self.srcpad.get_allowed_caps() {
|
||||
None => self.srcpad.get_pad_template_caps().unwrap(),
|
||||
None => self.srcpad.get_pad_template_caps(),
|
||||
Some(caps) => caps,
|
||||
};
|
||||
|
||||
|
|
|
@ -62,10 +62,7 @@ impl PullState {
|
|||
fn new(element: &super::MccParse, pad: &gst::Pad) -> Self {
|
||||
Self {
|
||||
need_stream_start: true,
|
||||
stream_id: pad
|
||||
.create_stream_id(element, Some("src"))
|
||||
.unwrap()
|
||||
.to_string(),
|
||||
stream_id: pad.create_stream_id(element, Some("src")).to_string(),
|
||||
offset: 0,
|
||||
duration: gst::CLOCK_TIME_NONE,
|
||||
}
|
||||
|
|
|
@ -55,10 +55,7 @@ impl PullState {
|
|||
fn new(element: &super::SccParse, pad: &gst::Pad) -> Self {
|
||||
Self {
|
||||
need_stream_start: true,
|
||||
stream_id: pad
|
||||
.create_stream_id(element, Some("src"))
|
||||
.unwrap()
|
||||
.to_string(),
|
||||
stream_id: pad.create_stream_id(element, Some("src")).to_string(),
|
||||
offset: 0,
|
||||
duration: gst::CLOCK_TIME_NONE,
|
||||
}
|
||||
|
|
|
@ -679,7 +679,7 @@ impl TtToCea608 {
|
|||
match event.view() {
|
||||
EventView::Caps(..) => {
|
||||
let mut downstream_caps = match self.srcpad.get_allowed_caps() {
|
||||
None => self.srcpad.get_pad_template_caps().unwrap(),
|
||||
None => self.srcpad.get_pad_template_caps(),
|
||||
Some(caps) => caps,
|
||||
};
|
||||
|
||||
|
|
|
@ -663,7 +663,7 @@ impl FlvDemux {
|
|||
|
||||
srcpad.set_active(true).unwrap();
|
||||
|
||||
let full_stream_id = srcpad.create_stream_id(element, Some(name)).unwrap();
|
||||
let full_stream_id = srcpad.create_stream_id(element, Some(name));
|
||||
// FIXME group id
|
||||
srcpad.push_event(gst::event::StreamStart::new(&full_stream_id));
|
||||
srcpad.push_event(gst::event::Caps::new(&caps));
|
||||
|
|
Loading…
Reference in a new issue