mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-12-31 22:38:47 +00:00
Update for event API changes
This commit is contained in:
parent
01a551f2ac
commit
c5d3a2efce
7 changed files with 25 additions and 24 deletions
|
@ -656,10 +656,8 @@ fn test_iradio_mode() {
|
|||
);
|
||||
|
||||
{
|
||||
use gst::EventView;
|
||||
let tag_event = srcpad.sticky_event(gst::EventType::Tag, 0).unwrap();
|
||||
if let EventView::Tag(tags) = tag_event.view() {
|
||||
let tags = tags.tag();
|
||||
if let Some(tag_event) = srcpad.sticky_event::<gst::event::Tag<_>>(0) {
|
||||
let tags = tag_event.tag();
|
||||
assert_eq!(tags.get::<gst::tags::Organization>().unwrap().get(), "Name");
|
||||
assert_eq!(tags.get::<gst::tags::Genre>().unwrap().get(), "Genre");
|
||||
assert_eq!(
|
||||
|
|
|
@ -697,7 +697,11 @@ impl JsonGstParse {
|
|||
}
|
||||
}
|
||||
|
||||
fn perform_seek(&self, event: &gst::event::Seek, element: &super::JsonGstParse) -> bool {
|
||||
fn perform_seek(
|
||||
&self,
|
||||
event: &gst::event::Seek<&gst::EventRef>,
|
||||
element: &super::JsonGstParse,
|
||||
) -> bool {
|
||||
if self.state.lock().unwrap().pull.is_none() {
|
||||
gst_error!(CAT, obj: element, "seeking is only supported in pull mode");
|
||||
return false;
|
||||
|
|
|
@ -259,10 +259,8 @@ impl CustomSource {
|
|||
let mut stream_type = None;
|
||||
|
||||
// Take stream type from stream-start event if we can
|
||||
if let Some(event) = pad.sticky_event(gst::EventType::StreamStart, 0) {
|
||||
if let gst::EventView::StreamStart(ev) = event.view() {
|
||||
stream_type = ev.stream().map(|s| s.stream_type());
|
||||
}
|
||||
if let Some(ev) = pad.sticky_event::<gst::event::StreamStart<_>>(0) {
|
||||
stream_type = ev.stream().map(|s| s.stream_type());
|
||||
}
|
||||
|
||||
// Otherwise from the caps
|
||||
|
|
|
@ -1267,11 +1267,8 @@ impl FallbackSrc {
|
|||
|
||||
let mut is_image = false;
|
||||
|
||||
if let Some(stream_event) = pad.sticky_event(gst::EventType::StreamStart, 0) {
|
||||
let stream = match stream_event.view() {
|
||||
gst::EventView::StreamStart(ref ev) => ev.stream(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
if let Some(ev) = pad.sticky_event::<gst::event::StreamStart<_>>(0) {
|
||||
let stream = ev.stream();
|
||||
|
||||
if let Some(stream) = stream {
|
||||
if let Some(caps) = stream.caps() {
|
||||
|
@ -1574,19 +1571,15 @@ impl FallbackSrc {
|
|||
None => return Ok(()),
|
||||
};
|
||||
|
||||
let ev = match pad.sticky_event(gst::EventType::Segment, 0) {
|
||||
Some(ev) => ev,
|
||||
let segment = match pad.sticky_event::<gst::event::Segment<_>>(0) {
|
||||
Some(ev) => ev.segment().clone(),
|
||||
None => {
|
||||
gst_warning!(CAT, obj: element, "Have no segment event yet");
|
||||
return Ok(());
|
||||
}
|
||||
};
|
||||
|
||||
let segment = match ev.view() {
|
||||
gst::EventView::Segment(s) => s.segment(),
|
||||
_ => unreachable!(),
|
||||
};
|
||||
let segment = segment.downcast_ref::<gst::ClockTime>().ok_or_else(|| {
|
||||
let segment = segment.downcast::<gst::ClockTime>().map_err(|_| {
|
||||
gst_error!(CAT, obj: element, "Have no time segment");
|
||||
gst::error_msg!(gst::CoreError::Clock, ["Have no time segment"])
|
||||
})?;
|
||||
|
|
|
@ -303,7 +303,7 @@ impl State {
|
|||
Ok(ret)
|
||||
}
|
||||
|
||||
fn handle_gap(&mut self, gap: gst::event::Gap) -> Vec<gst::Buffer> {
|
||||
fn handle_gap(&mut self, gap: gst::event::Gap<&gst::EventRef>) -> Vec<gst::Buffer> {
|
||||
let mut ret = vec![];
|
||||
|
||||
let (pts, duration) = gap.get();
|
||||
|
|
|
@ -955,7 +955,11 @@ impl MccParse {
|
|||
}
|
||||
}
|
||||
|
||||
fn perform_seek(&self, event: &gst::event::Seek, element: &super::MccParse) -> bool {
|
||||
fn perform_seek(
|
||||
&self,
|
||||
event: &gst::event::Seek<&gst::EventRef>,
|
||||
element: &super::MccParse,
|
||||
) -> bool {
|
||||
if self.state.lock().unwrap().pull.is_none() {
|
||||
gst_error!(CAT, obj: element, "seeking is only supported in pull mode");
|
||||
return false;
|
||||
|
|
|
@ -839,7 +839,11 @@ impl SccParse {
|
|||
}
|
||||
}
|
||||
|
||||
fn perform_seek(&self, event: &gst::event::Seek, element: &super::SccParse) -> bool {
|
||||
fn perform_seek(
|
||||
&self,
|
||||
event: &gst::event::Seek<&gst::EventRef>,
|
||||
element: &super::SccParse,
|
||||
) -> bool {
|
||||
if self.state.lock().unwrap().pull.is_none() {
|
||||
gst_error!(CAT, obj: element, "seeking is only supported in pull mode");
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue