mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2025-01-11 03:35:26 +00:00
Fix build after gstreamer-rs API changes
This commit is contained in:
parent
39b4d89790
commit
8873821340
4 changed files with 58 additions and 41 deletions
|
@ -106,7 +106,7 @@ pub struct Demuxer {
|
||||||
cat: gst::DebugCategory,
|
cat: gst::DebugCategory,
|
||||||
sinkpad: gst::Pad,
|
sinkpad: gst::Pad,
|
||||||
flow_combiner: Mutex<UniqueFlowCombiner>,
|
flow_combiner: Mutex<UniqueFlowCombiner>,
|
||||||
group_id: Mutex<u32>,
|
group_id: Mutex<gst::GroupId>,
|
||||||
srcpads: Mutex<BTreeMap<u32, gst::Pad>>,
|
srcpads: Mutex<BTreeMap<u32, gst::Pad>>,
|
||||||
imp: Mutex<Box<DemuxerImpl>>,
|
imp: Mutex<Box<DemuxerImpl>>,
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,11 +277,15 @@ impl BaseSrcImpl<BaseSrc> for Source {
|
||||||
fn do_seek(&self, src: &BaseSrc, segment: &mut gst::Segment) -> bool {
|
fn do_seek(&self, src: &BaseSrc, segment: &mut gst::Segment) -> bool {
|
||||||
let source_impl = &mut self.imp.lock().unwrap();
|
let source_impl = &mut self.imp.lock().unwrap();
|
||||||
|
|
||||||
let start = segment.get_start();
|
if segment.get_format() != gst::Format::Bytes {
|
||||||
let stop = match segment.get_stop() {
|
return false;
|
||||||
u64::MAX => None,
|
}
|
||||||
stop => Some(stop),
|
|
||||||
|
let start = match segment.get_start().try_to_bytes().unwrap() {
|
||||||
|
None => return false,
|
||||||
|
Some(start) => start,
|
||||||
};
|
};
|
||||||
|
let stop = segment.get_stop().try_to_bytes().unwrap();
|
||||||
|
|
||||||
gst_debug!(self.cat, obj: src, "Seeking to {:?}-{:?}", start, stop);
|
gst_debug!(self.cat, obj: src, "Seeking to {:?}-{:?}", start, stop);
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ impl Stream {
|
||||||
struct StreamState {
|
struct StreamState {
|
||||||
in_segment: gst::Segment,
|
in_segment: gst::Segment,
|
||||||
out_segment: gst::Segment,
|
out_segment: gst::Segment,
|
||||||
segment_seqnum: u32,
|
segment_seqnum: gst::Seqnum,
|
||||||
current_running_time: gst::ClockTime,
|
current_running_time: gst::ClockTime,
|
||||||
eos: bool,
|
eos: bool,
|
||||||
flushing: bool,
|
flushing: bool,
|
||||||
|
@ -335,17 +335,30 @@ impl ToggleRecord {
|
||||||
dts_or_pts
|
dts_or_pts
|
||||||
};
|
};
|
||||||
|
|
||||||
dts_or_pts = cmp::max(state.in_segment.get_start().into(), dts_or_pts);
|
dts_or_pts = cmp::max(
|
||||||
dts_or_pts_end = cmp::max(state.in_segment.get_start().into(), dts_or_pts_end);
|
state.in_segment.get_start().try_to_time().unwrap(),
|
||||||
if state.in_segment.get_stop() != gst::BUFFER_OFFSET_NONE {
|
dts_or_pts,
|
||||||
dts_or_pts = cmp::min(state.in_segment.get_stop().into(), dts_or_pts);
|
);
|
||||||
dts_or_pts_end = cmp::min(state.in_segment.get_stop().into(), dts_or_pts_end);
|
dts_or_pts_end = cmp::max(
|
||||||
|
state.in_segment.get_start().try_to_time().unwrap(),
|
||||||
|
dts_or_pts_end,
|
||||||
|
);
|
||||||
|
if state.in_segment.get_stop().try_to_time().unwrap().is_some() {
|
||||||
|
dts_or_pts = cmp::min(
|
||||||
|
state.in_segment.get_stop().try_to_time().unwrap(),
|
||||||
|
dts_or_pts,
|
||||||
|
);
|
||||||
|
dts_or_pts_end = cmp::min(
|
||||||
|
state.in_segment.get_stop().try_to_time().unwrap(),
|
||||||
|
dts_or_pts_end,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut current_running_time = state
|
let mut current_running_time = state
|
||||||
.in_segment
|
.in_segment
|
||||||
.to_running_time(gst::Format::Time, dts_or_pts.into())
|
.to_running_time(dts_or_pts)
|
||||||
.into();
|
.try_to_time()
|
||||||
|
.unwrap();
|
||||||
current_running_time = cmp::max(current_running_time, state.current_running_time);
|
current_running_time = cmp::max(current_running_time, state.current_running_time);
|
||||||
state.current_running_time = current_running_time;
|
state.current_running_time = current_running_time;
|
||||||
|
|
||||||
|
@ -357,8 +370,9 @@ impl ToggleRecord {
|
||||||
|
|
||||||
let current_running_time_end = state
|
let current_running_time_end = state
|
||||||
.in_segment
|
.in_segment
|
||||||
.to_running_time(gst::Format::Time, dts_or_pts_end.into())
|
.to_running_time(dts_or_pts_end)
|
||||||
.into();
|
.try_to_time()
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
gst_log!(
|
gst_log!(
|
||||||
self.cat,
|
self.cat,
|
||||||
|
@ -520,41 +534,40 @@ impl ToggleRecord {
|
||||||
pts
|
pts
|
||||||
};
|
};
|
||||||
|
|
||||||
pts = cmp::max(state.in_segment.get_start().into(), pts);
|
pts = cmp::max(state.in_segment.get_start().try_to_time().unwrap(), pts);
|
||||||
if state.in_segment.get_stop() != gst::BUFFER_OFFSET_NONE
|
if state.in_segment.get_stop().try_to_time().unwrap().is_some()
|
||||||
&& pts >= state.in_segment.get_stop().into()
|
&& pts >= state.in_segment.get_stop().try_to_time().unwrap()
|
||||||
{
|
{
|
||||||
state.current_running_time = state
|
state.current_running_time = state
|
||||||
.in_segment
|
.in_segment
|
||||||
.to_running_time(gst::Format::Time, state.in_segment.get_stop())
|
.to_running_time(state.in_segment.get_stop())
|
||||||
.into();
|
.try_to_time()
|
||||||
|
.unwrap();
|
||||||
state.eos = true;
|
state.eos = true;
|
||||||
gst_debug!(
|
gst_debug!(
|
||||||
self.cat,
|
self.cat,
|
||||||
obj: pad,
|
obj: pad,
|
||||||
"After segment end {} >= {}, EOS",
|
"After segment end {} >= {}, EOS",
|
||||||
pts,
|
pts,
|
||||||
gst::ClockTime::from(state.in_segment.get_stop())
|
state.in_segment.get_stop().try_to_time().unwrap()
|
||||||
);
|
);
|
||||||
|
|
||||||
return HandleResult::Eos;
|
return HandleResult::Eos;
|
||||||
}
|
}
|
||||||
pts_end = cmp::max(state.in_segment.get_start().into(), pts_end);
|
pts_end = cmp::max(state.in_segment.get_start().try_to_time().unwrap(), pts_end);
|
||||||
if state.in_segment.get_stop() != gst::BUFFER_OFFSET_NONE {
|
if state.in_segment.get_stop().try_to_time().unwrap().is_some() {
|
||||||
pts_end = cmp::min(state.in_segment.get_stop().into(), pts_end);
|
pts_end = cmp::min(state.in_segment.get_stop().try_to_time().unwrap(), pts_end);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut current_running_time = state
|
let mut current_running_time = state.in_segment.to_running_time(pts).try_to_time().unwrap();
|
||||||
.in_segment
|
|
||||||
.to_running_time(gst::Format::Time, pts.into())
|
|
||||||
.into();
|
|
||||||
current_running_time = cmp::max(current_running_time, state.current_running_time);
|
current_running_time = cmp::max(current_running_time, state.current_running_time);
|
||||||
state.current_running_time = current_running_time;
|
state.current_running_time = current_running_time;
|
||||||
|
|
||||||
let current_running_time_end: gst::ClockTime = state
|
let current_running_time_end = state
|
||||||
.in_segment
|
.in_segment
|
||||||
.to_running_time(gst::Format::Time, pts_end.into())
|
.to_running_time(pts_end)
|
||||||
.into();
|
.try_to_time()
|
||||||
|
.unwrap();
|
||||||
gst_log!(
|
gst_log!(
|
||||||
self.cat,
|
self.cat,
|
||||||
obj: pad,
|
obj: pad,
|
||||||
|
@ -849,11 +862,11 @@ impl ToggleRecord {
|
||||||
|
|
||||||
events.append(&mut state.pending_events);
|
events.append(&mut state.pending_events);
|
||||||
|
|
||||||
let out_running_time = gst::ClockTime::from(
|
let out_running_time = state
|
||||||
state
|
.out_segment
|
||||||
.out_segment
|
.to_running_time(buffer.get_pts())
|
||||||
.to_running_time(gst::Format::Time, buffer.get_pts().into()),
|
.try_to_time()
|
||||||
);
|
.unwrap();
|
||||||
|
|
||||||
// Unlock before pushing
|
// Unlock before pushing
|
||||||
drop(state);
|
drop(state);
|
||||||
|
@ -954,7 +967,6 @@ impl ToggleRecord {
|
||||||
EventView::Gap(e) => {
|
EventView::Gap(e) => {
|
||||||
gst_debug!(self.cat, obj: pad, "Handling Gap event {:?}", event);
|
gst_debug!(self.cat, obj: pad, "Handling Gap event {:?}", event);
|
||||||
let (pts, duration) = e.get();
|
let (pts, duration) = e.get();
|
||||||
let (pts, duration) = (pts.into(), duration.into());
|
|
||||||
let handle_result = if stream == self.main_stream {
|
let handle_result = if stream == self.main_stream {
|
||||||
self.handle_main_stream(pad, &stream, false, pts, duration)
|
self.handle_main_stream(pad, &stream, false, pts, duration)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -204,9 +204,10 @@ fn recv_buffers(
|
||||||
match val {
|
match val {
|
||||||
Left(buffer) => {
|
Left(buffer) => {
|
||||||
res.push((
|
res.push((
|
||||||
gst::ClockTime::from(
|
segment
|
||||||
segment.to_running_time(gst::Format::Time, buffer.get_pts().into()),
|
.to_running_time(buffer.get_pts())
|
||||||
),
|
.try_to_time()
|
||||||
|
.unwrap(),
|
||||||
buffer.get_pts(),
|
buffer.get_pts(),
|
||||||
));
|
));
|
||||||
n_buffers += 1;
|
n_buffers += 1;
|
||||||
|
@ -222,7 +223,7 @@ fn recv_buffers(
|
||||||
let (ts, _) = e.get();
|
let (ts, _) = e.get();
|
||||||
|
|
||||||
res.push((
|
res.push((
|
||||||
gst::ClockTime::from(segment.to_running_time(gst::Format::Time, ts)),
|
segment.to_running_time(ts).try_to_time().unwrap(),
|
||||||
ts.into(),
|
ts.into(),
|
||||||
));
|
));
|
||||||
n_buffers += 1;
|
n_buffers += 1;
|
||||||
|
|
Loading…
Reference in a new issue