navigation: Add a method to get the GstStructure from NavigationEvent

The `GstNavigationInterface` requires to pass a GstStructure to it
`send_event()` method, so it makes sense to allow getting that structure
without building the navigation event itself
This commit is contained in:
Thibault Saunier 2021-12-27 11:47:54 -03:00 committed by Sebastian Dröge
parent bbcd221e8d
commit 1dae136ae3

View file

@ -519,10 +519,9 @@ impl NavigationEvent {
})
}
pub fn build(&self) -> gst::Event {
pub fn structure(&self) -> gst::Structure {
skip_assert_initialized!();
gst::event::Navigation::new(match self {
match self {
Self::MouseMove { x, y } => gst::Structure::builder(NAVIGATION_EVENT_NAME)
.field("event", "mouse-move")
.field("pointer_x", x)
@ -570,7 +569,13 @@ impl NavigationEvent {
.field("event", "command")
.field("command-code", command)
.build(),
})
}
}
pub fn build(&self) -> gst::Event {
skip_assert_initialized!();
gst::event::Navigation::new(self.structure())
}
}