forked from mirrors/gstreamer-rs
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:
parent
bbcd221e8d
commit
1dae136ae3
1 changed files with 9 additions and 4 deletions
|
@ -519,10 +519,9 @@ impl NavigationEvent {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build(&self) -> gst::Event {
|
pub fn structure(&self) -> gst::Structure {
|
||||||
skip_assert_initialized!();
|
skip_assert_initialized!();
|
||||||
|
match self {
|
||||||
gst::event::Navigation::new(match self {
|
|
||||||
Self::MouseMove { x, y } => gst::Structure::builder(NAVIGATION_EVENT_NAME)
|
Self::MouseMove { x, y } => gst::Structure::builder(NAVIGATION_EVENT_NAME)
|
||||||
.field("event", "mouse-move")
|
.field("event", "mouse-move")
|
||||||
.field("pointer_x", x)
|
.field("pointer_x", x)
|
||||||
|
@ -570,7 +569,13 @@ impl NavigationEvent {
|
||||||
.field("event", "command")
|
.field("event", "command")
|
||||||
.field("command-code", command)
|
.field("command-code", command)
|
||||||
.build(),
|
.build(),
|
||||||
})
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn build(&self) -> gst::Event {
|
||||||
|
skip_assert_initialized!();
|
||||||
|
|
||||||
|
gst::event::Navigation::new(self.structure())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue