event/message: provide mutable API
See the following snippet changing caps from a pad probe:
if let Some(gst::PadProbeData::Event(ref mut event)) = &mut info.data {
if let gst::EventView::Caps(caps) = event.view() {
let mut updated_caps = caps.caps_owned();
{
let caps = updated_caps.make_mut();
let s = caps.structure_mut(0).unwrap();
s.remove_field("framerate");
}
let updated_event = event.make_mut();
let event_s = updated_event.structure_mut();
event_s.set("caps", updated_caps);
}
}
It's not that easy to figure out, so we could provide better API to make it easier:
-
event.view_mut()
as we already haveQueryViewMut
- provide setters on the event so we don't have to modify the
GstStructure