mirror of
https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
synced 2024-11-25 21:11:00 +00:00
uriplaylistbin: reset element when switching back to NULL
Allow us to re-use the element later. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs/-/merge_requests/1121>
This commit is contained in:
parent
3ef8a48ded
commit
f7c02cb3b0
1 changed files with 21 additions and 1 deletions
|
@ -962,7 +962,13 @@ impl ElementImpl for UriPlaylistBin {
|
|||
}
|
||||
}
|
||||
|
||||
self.parent_change_state(transition)
|
||||
let res = self.parent_change_state(transition);
|
||||
|
||||
if transition == gst::StateChange::ReadyToNull {
|
||||
self.stop();
|
||||
}
|
||||
|
||||
res
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1683,6 +1689,20 @@ impl UriPlaylistBin {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
fn stop(&self) {
|
||||
// remove all children and pads
|
||||
let children = self.obj().children();
|
||||
let children_ref = children.iter().collect::<Vec<_>>();
|
||||
self.obj().remove_many(&children_ref).unwrap();
|
||||
|
||||
for pad in self.obj().src_pads() {
|
||||
self.obj().remove_pad(&pad).unwrap();
|
||||
}
|
||||
|
||||
let mut state_guard = self.state.lock().unwrap();
|
||||
*state_guard = None;
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Clone, Debug)]
|
||||
|
|
Loading…
Reference in a new issue