Package org.freedesktop.gstreamer.video
Interface Navigation
- All Superinterfaces:
Proxy
- All Known Implementing Classes:
Navigation.NavigationImpl
The Navigation interface is used for creating and injecting navigation
related events such as mouse button presses, cursor motion and key presses.
The associated library also provides methods for parsing received events, and
for sending and receiving navigation related bus events. One main usecase is
DVD menu navigation.
The main parts of the API are:
- The GstNavigation interface, implemented by elements which provide an application with the ability to create and inject navigation events into the pipeline.
- GstNavigation event handling API. GstNavigation events are created in response to calls on a GstNavigation interface implementation, and sent in the pipeline. Upstream elements can use the navigation event API functions to parse the contents of received messages.
- GstNavigation message handling API. GstNavigation messages may be sent on the message bus to inform applications of navigation related changes in the pipeline, such as the mouse moving over a clickable region, or the set of available angles changing.
The GstNavigation message functions provide functions for creating and parsing custom bus messages for signaling GstNavigation changes.
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic class
The NavigationImpl type represents a native instance of the Navigation interface.static class
Navigation interface. -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
Try to retrieve x and y coordinates of aGstNavigation
event.static NavigationEventType
eventGetType
(Event event) Inspect aGstEvent
and return theGstNavigationEventType
of the event, orGST_NAVIGATION_EVENT_INVALID
if the event is not aGstNavigation
event.static Event
eventNewCommand
(NavigationCommand command) Create a new navigation event given navigation command..static Event
eventNewKeyPress
(String key, Set<NavigationModifierType> state) Create a new navigation event for the given key press.static Event
eventNewKeyPress
(String key, NavigationModifierType... state) Create a new navigation event for the given key press.static Event
eventNewKeyRelease
(String key, Set<NavigationModifierType> state) Create a new navigation event for the given key release.static Event
eventNewKeyRelease
(String key, NavigationModifierType... state) Create a new navigation event for the given key release.static Event
eventNewMouseButtonPress
(int button, double x, double y, Set<NavigationModifierType> state) Create a new navigation event for the given key mouse button press.static Event
eventNewMouseButtonPress
(int button, double x, double y, NavigationModifierType... state) Create a new navigation event for the given key mouse button press.static Event
eventNewMouseButtonRelease
(int button, double x, double y, Set<NavigationModifierType> state) Create a new navigation event for the given key mouse button release.static Event
eventNewMouseButtonRelease
(int button, double x, double y, NavigationModifierType... state) Create a new navigation event for the given key mouse button release.static Event
eventNewMouseMove
(double x, double y, Set<NavigationModifierType> state) Create a new navigation event for the new mouse location.static Event
eventNewMouseMove
(double x, double y, NavigationModifierType... state) Create a new navigation event for the new mouse location.static Event
eventNewMouseScroll
(double x, double y, double deltaX, double deltaY, Set<NavigationModifierType> state) Create a new navigation event for the mouse scroll.static Event
eventNewMouseScroll
(double x, double y, double deltaX, double deltaY, NavigationModifierType... state) Create a new navigation event for the mouse scroll.static Event
Create a new navigation event signalling that all currently active touch points are cancelled and should be discarded.static Event
eventNewTouchCancel
(NavigationModifierType... state) Create a new navigation event signalling that all currently active touch points are cancelled and should be discarded.static Event
eventNewTouchDown
(int identifier, double x, double y, double pressure, Set<NavigationModifierType> state) Create a new navigation event for an added touch point.static Event
eventNewTouchDown
(int identifier, double x, double y, double pressure, NavigationModifierType... state) Create a new navigation event for an added touch point.static Event
Create a new navigation event signalling the end of a touch frame.static Event
eventNewTouchFrame
(NavigationModifierType... state) Create a new navigation event signalling the end of a touch frame.static Event
eventNewTouchMotion
(int identifier, double x, double y, double pressure, Set<NavigationModifierType> state) Create a new navigation event for a moved touch point.static Event
eventNewTouchMotion
(int identifier, double x, double y, double pressure, NavigationModifierType... state) Create a new navigation event for a moved touch point.static Event
eventNewTouchUp
(int identifier, double x, double y, Set<NavigationModifierType> state) Create a new navigation event for a removed touch point.static Event
eventNewTouchUp
(int identifier, double x, double y, NavigationModifierType... state) Create a new navigation event for a removed touch point.static boolean
eventParseCommand
(Event event, @Nullable Out<NavigationCommand> command) Inspect aGstNavigation
command event and retrieve the enum value of the associated command.static boolean
eventParseKeyEvent
(Event event, @Nullable Out<String> key) static boolean
eventParseModifierState
(Event event, MemorySegment state) static boolean
eventParseMouseButtonEvent
(Event event, @Nullable Out<Integer> button, @Nullable Out<Double> x, @Nullable Out<Double> y) Retrieve the details of either aGstNavigation
mouse button press event or a mouse button release event.static boolean
Inspect aGstNavigation
mouse movement event and extract the coordinates of the event.static boolean
eventParseMouseScrollEvent
(Event event, @Nullable Out<Double> x, @Nullable Out<Double> y, @Nullable Out<Double> deltaX, @Nullable Out<Double> deltaY) Inspect aGstNavigation
mouse scroll event and extract the coordinates of the event.static boolean
eventParseTouchEvent
(Event event, @Nullable Out<Integer> identifier, @Nullable Out<Double> x, @Nullable Out<Double> y, @Nullable Out<Double> pressure) Retrieve the details of aGstNavigation
touch-down or touch-motion event.static boolean
eventParseTouchUpEvent
(Event event, @Nullable Out<Integer> identifier, @Nullable Out<Double> x, @Nullable Out<Double> y) Retrieve the details of aGstNavigation
touch-up event.static boolean
eventSetCoordinates
(Event event, double x, double y) Try to set x and y coordinates on aGstNavigation
event.static Type
getType()
Get the GType of the Navigation classstatic NavigationMessageType
messageGetType
(Message message) Check a bus message to see if it is aGstNavigation
event, and return theGstNavigationMessageType
identifying the type of the message if so.static Message
messageNewAnglesChanged
(GstObject src, int curAngle, int nAngles) Creates a newGstNavigation
message with typeGST_NAVIGATION_MESSAGE_ANGLES_CHANGED
for notifying an application that the current angle, or current number of angles available in a multiangle video has changed.static Message
Creates a newGstNavigation
message with typeGST_NAVIGATION_MESSAGE_COMMANDS_CHANGED
static Message
messageNewEvent
(GstObject src, Event event) Creates a newGstNavigation
message with typeGST_NAVIGATION_MESSAGE_EVENT
.static Message
messageNewMouseOver
(GstObject src, boolean active) Creates a newGstNavigation
message with typeGST_NAVIGATION_MESSAGE_MOUSE_OVER
.static boolean
messageParseAnglesChanged
(Message message, @Nullable Out<Integer> curAngle, @Nullable Out<Integer> nAngles) Parse aGstNavigation
message of type GST_NAVIGATION_MESSAGE_ANGLES_CHANGED and extract thecurAngle
andnAngles
parameters.static boolean
messageParseEvent
(Message message, @Nullable Out<Event> event) Parse aGstNavigation
message of typeGST_NAVIGATION_MESSAGE_EVENT
and extract containedGstEvent
.static boolean
messageParseMouseOver
(Message message, @Nullable Out<Boolean> active) Parse aGstNavigation
message of typeGST_NAVIGATION_MESSAGE_MOUSE_OVER
and extract the active/inactive flag.static NavigationQueryType
queryGetType
(Query query) Inspect aGstQuery
and return theGstNavigationQueryType
associated with it if it is aGstNavigation
query.static Query
Create a newGstNavigation
angles query.static Query
Create a newGstNavigation
commands query.static boolean
Parse the current angle number in theGstNavigation
anglesquery
into theguint
pointed to by thecurAngle
variable, and the number of available angles into theguint
pointed to by thenAngles
variable.static boolean
queryParseCommandsLength
(Query query, @Nullable Out<Integer> nCmds) Parse the number of commands in theGstNavigation
commandsquery
.static boolean
queryParseCommandsNth
(Query query, int nth, @Nullable Out<NavigationCommand> cmd) Parse theGstNavigation
command query and retrieve thenth
command from it intocmd
.static void
querySetAngles
(Query query, int curAngle, int nAngles) Set theGstNavigation
angles query result field inquery
.static void
querySetCommands
(Query query, int nCmds, Object... varargs) Set theGstNavigation
command query result fields inquery
.static void
querySetCommandsv
(Query query, NavigationCommand[] cmds) Set theGstNavigation
command query result fields inquery
.default void
sendCommand
(NavigationCommand command) Sends the indicated command to the navigation interface.default void
default void
sendEventSimple
(Event event) Sends an event to the navigation interface.default void
sendKeyEvent
(String event, String key) default void
sendMouseEvent
(String event, int button, double x, double y) Sends a mouse event to the navigation interface.default void
sendMouseScrollEvent
(double x, double y, double deltaX, double deltaY) Sends a mouse scroll event to the navigation interface.
-
Method Details
-
getType
-
eventGetCoordinates
static boolean eventGetCoordinates(Event event, @Nullable @Nullable Out<Double> x, @Nullable @Nullable Out<Double> y) Try to retrieve x and y coordinates of aGstNavigation
event.- Parameters:
event
- TheGstEvent
to inspect.x
- Pointer to a gdouble to receive the x coordinate of the navigation event.y
- Pointer to a gdouble to receive the y coordinate of the navigation event.- Returns:
- A boolean indicating success.
-
eventGetType
Inspect aGstEvent
and return theGstNavigationEventType
of the event, orGST_NAVIGATION_EVENT_INVALID
if the event is not aGstNavigation
event.- Parameters:
event
- AGstEvent
to inspect.
-
eventNewKeyPress
Create a new navigation event for the given key press.- Parameters:
key
- A string identifying the key press.state
- a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
- a new
GstEvent
-
eventNewKeyRelease
Create a new navigation event for the given key release.- Parameters:
key
- A string identifying the released key.state
- a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
- a new
GstEvent
-
eventNewMouseButtonPress
static Event eventNewMouseButtonPress(int button, double x, double y, Set<NavigationModifierType> state) Create a new navigation event for the given key mouse button press.- Parameters:
button
- The number of the pressed mouse button.x
- The x coordinate of the mouse cursor.y
- The y coordinate of the mouse cursor.state
- a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
- a new
GstEvent
-
eventNewMouseButtonRelease
static Event eventNewMouseButtonRelease(int button, double x, double y, Set<NavigationModifierType> state) Create a new navigation event for the given key mouse button release.- Parameters:
button
- The number of the released mouse button.x
- The x coordinate of the mouse cursor.y
- The y coordinate of the mouse cursor.state
- a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
- a new
GstEvent
-
eventNewMouseMove
Create a new navigation event for the new mouse location.- Parameters:
x
- The x coordinate of the mouse cursor.y
- The y coordinate of the mouse cursor.state
- a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
- a new
GstEvent
-
eventNewMouseScroll
static Event eventNewMouseScroll(double x, double y, double deltaX, double deltaY, Set<NavigationModifierType> state) Create a new navigation event for the mouse scroll.- Parameters:
x
- The x coordinate of the mouse cursor.y
- The y coordinate of the mouse cursor.deltaX
- The x component of the scroll movement.deltaY
- The y component of the scroll movement.state
- a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
- a new
GstEvent
-
eventNewTouchCancel
Create a new navigation event signalling that all currently active touch points are cancelled and should be discarded. For example, under Wayland this event might be sent when a swipe passes the threshold to be recognized as a gesture by the compositor.- Parameters:
state
- a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
- a new
GstEvent
-
eventNewTouchDown
static Event eventNewTouchDown(int identifier, double x, double y, double pressure, Set<NavigationModifierType> state) Create a new navigation event for an added touch point.- Parameters:
identifier
- A number uniquely identifying this touch point. It must stay unique to this touch point at least until an up event is sent for the same identifier, or all touch points are cancelled.x
- The x coordinate of the new touch point.y
- The y coordinate of the new touch point.pressure
- Pressure data of the touch point, from 0.0 to 1.0, or NaN if no data is available.state
- a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
- a new
GstEvent
-
eventNewTouchFrame
Create a new navigation event signalling the end of a touch frame. Touch frames signal that all previous down, motion and up events not followed by another touch frame event already should be considered simultaneous.- Parameters:
state
- a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
- a new
GstEvent
-
eventNewTouchMotion
static Event eventNewTouchMotion(int identifier, double x, double y, double pressure, Set<NavigationModifierType> state) Create a new navigation event for a moved touch point.- Parameters:
identifier
- A number uniquely identifying this touch point. It must correlate to exactly one previous touch_start event.x
- The x coordinate of the touch point.y
- The y coordinate of the touch point.pressure
- Pressure data of the touch point, from 0.0 to 1.0, or NaN if no data is available.state
- a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
- a new
GstEvent
-
eventNewTouchUp
Create a new navigation event for a removed touch point.- Parameters:
identifier
- A number uniquely identifying this touch point. It must correlate to exactly one previous down event, but can be reused after sending this event.x
- The x coordinate of the touch point.y
- The y coordinate of the touch point.state
- a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt).- Returns:
- a new
GstEvent
-
eventParseCommand
Inspect aGstNavigation
command event and retrieve the enum value of the associated command.- Parameters:
event
- AGstEvent
to inspect.command
- Pointer to GstNavigationCommand to receive the type of the navigation event.- Returns:
- TRUE if the navigation command could be extracted, otherwise FALSE.
-
eventParseKeyEvent
Note: Modifier keys (as defined inGstNavigationModifierType
) press and release events are generated even if those states are present on all other related events- Parameters:
event
- AGstEvent
to inspect.key
- A pointer to a location to receive the string identifying the key press. The returned string is owned by the event, and valid only until the event is unreffed.
-
eventParseModifierState
-
eventParseMouseButtonEvent
static boolean eventParseMouseButtonEvent(Event event, @Nullable @Nullable Out<Integer> button, @Nullable @Nullable Out<Double> x, @Nullable @Nullable Out<Double> y) Retrieve the details of either aGstNavigation
mouse button press event or a mouse button release event. Determine which type the event is using gst_navigation_event_get_type() to retrieve theGstNavigationEventType
.- Parameters:
event
- AGstEvent
to inspect.button
- Pointer to a gint that will receive the button number associated with the event.x
- Pointer to a gdouble to receive the x coordinate of the mouse button event.y
- Pointer to a gdouble to receive the y coordinate of the mouse button event.- Returns:
- TRUE if the button number and both coordinates could be extracted, otherwise FALSE.
-
eventParseMouseMoveEvent
static boolean eventParseMouseMoveEvent(Event event, @Nullable @Nullable Out<Double> x, @Nullable @Nullable Out<Double> y) Inspect aGstNavigation
mouse movement event and extract the coordinates of the event.- Parameters:
event
- AGstEvent
to inspect.x
- Pointer to a gdouble to receive the x coordinate of the mouse movement.y
- Pointer to a gdouble to receive the y coordinate of the mouse movement.- Returns:
- TRUE if both coordinates could be extracted, otherwise FALSE.
-
eventParseMouseScrollEvent
static boolean eventParseMouseScrollEvent(Event event, @Nullable @Nullable Out<Double> x, @Nullable @Nullable Out<Double> y, @Nullable @Nullable Out<Double> deltaX, @Nullable @Nullable Out<Double> deltaY) Inspect aGstNavigation
mouse scroll event and extract the coordinates of the event.- Parameters:
event
- AGstEvent
to inspect.x
- Pointer to a gdouble to receive the x coordinate of the mouse movement.y
- Pointer to a gdouble to receive the y coordinate of the mouse movement.deltaX
- Pointer to a gdouble to receive the delta_x coordinate of the mouse movement.deltaY
- Pointer to a gdouble to receive the delta_y coordinate of the mouse movement.- Returns:
- TRUE if all coordinates could be extracted, otherwise FALSE.
-
eventParseTouchEvent
static boolean eventParseTouchEvent(Event event, @Nullable @Nullable Out<Integer> identifier, @Nullable @Nullable Out<Double> x, @Nullable @Nullable Out<Double> y, @Nullable @Nullable Out<Double> pressure) Retrieve the details of aGstNavigation
touch-down or touch-motion event. Determine which type the event is using gst_navigation_event_get_type() to retrieve theGstNavigationEventType
.- Parameters:
event
- AGstEvent
to inspect.identifier
- Pointer to a guint that will receive the identifier unique to this touch point.x
- Pointer to a gdouble that will receive the x coordinate of the touch event.y
- Pointer to a gdouble that will receive the y coordinate of the touch event.pressure
- Pointer to a gdouble that will receive the force of the touch event, in the range from 0.0 to 1.0. If pressure data is not available, NaN will be set instead.- Returns:
- TRUE if all details could be extracted, otherwise FALSE.
-
eventParseTouchUpEvent
static boolean eventParseTouchUpEvent(Event event, @Nullable @Nullable Out<Integer> identifier, @Nullable @Nullable Out<Double> x, @Nullable @Nullable Out<Double> y) Retrieve the details of aGstNavigation
touch-up event.- Parameters:
event
- AGstEvent
to inspect.identifier
- Pointer to a guint that will receive the identifier unique to this touch point.x
- Pointer to a gdouble that will receive the x coordinate of the touch event.y
- Pointer to a gdouble that will receive the y coordinate of the touch event.- Returns:
- TRUE if all details could be extracted, otherwise FALSE.
-
eventSetCoordinates
Try to set x and y coordinates on aGstNavigation
event. The event must be writable.- Parameters:
event
- TheGstEvent
to modify.x
- The x coordinate to set.y
- The y coordinate to set.- Returns:
- A boolean indicating success.
-
messageGetType
Check a bus message to see if it is aGstNavigation
event, and return theGstNavigationMessageType
identifying the type of the message if so.- Parameters:
message
- AGstMessage
to inspect.- Returns:
- The type of the
GstMessage
, orGST_NAVIGATION_MESSAGE_INVALID
if the message is not aGstNavigation
notification.
-
messageNewAnglesChanged
Creates a newGstNavigation
message with typeGST_NAVIGATION_MESSAGE_ANGLES_CHANGED
for notifying an application that the current angle, or current number of angles available in a multiangle video has changed.- Parameters:
src
- AGstObject
to set as source of the new message.curAngle
- The currently selected angle.nAngles
- The number of viewing angles now available.- Returns:
- The new
GstMessage
.
-
messageNewCommandsChanged
-
messageNewEvent
-
messageNewMouseOver
Creates a newGstNavigation
message with typeGST_NAVIGATION_MESSAGE_MOUSE_OVER
.- Parameters:
src
- AGstObject
to set as source of the new message.active
-true
if the mouse has entered a clickable area of the display.false
if it over a non-clickable area.- Returns:
- The new
GstMessage
.
-
messageParseAnglesChanged
static boolean messageParseAnglesChanged(Message message, @Nullable @Nullable Out<Integer> curAngle, @Nullable @Nullable Out<Integer> nAngles) Parse aGstNavigation
message of type GST_NAVIGATION_MESSAGE_ANGLES_CHANGED and extract thecurAngle
andnAngles
parameters.- Parameters:
message
- AGstMessage
to inspect.curAngle
- A pointer to aguint
to receive the new current angle number, or NULLnAngles
- A pointer to aguint
to receive the new angle count, or NULL.- Returns:
true
if the message could be successfully parsed.false
if not.
-
messageParseEvent
Parse aGstNavigation
message of typeGST_NAVIGATION_MESSAGE_EVENT
and extract containedGstEvent
. The caller must unref theevent
when done with it.- Parameters:
message
- AGstMessage
to inspect.event
- a pointer to aGstEvent
to receive the contained navigation event.- Returns:
true
if the message could be successfully parsed.false
if not.
-
messageParseMouseOver
Parse aGstNavigation
message of typeGST_NAVIGATION_MESSAGE_MOUSE_OVER
and extract the active/inactive flag. If the mouse over event is marked active, it indicates that the mouse is over a clickable area.- Parameters:
message
- AGstMessage
to inspect.active
- A pointer to a gboolean to receive the active/inactive state, or NULL.- Returns:
true
if the message could be successfully parsed.false
if not.
-
queryGetType
Inspect aGstQuery
and return theGstNavigationQueryType
associated with it if it is aGstNavigation
query.- Parameters:
query
- The query to inspect- Returns:
- The
GstNavigationQueryType
of the query, orGST_NAVIGATION_QUERY_INVALID
-
queryNewAngles
Create a newGstNavigation
angles query. When executed, it will query the pipeline for the set of currently available angles, which may be greater than one in a multiangle video.- Returns:
- The new query.
-
queryNewCommands
Create a newGstNavigation
commands query. When executed, it will query the pipeline for the set of currently available commands.- Returns:
- The new query.
-
queryParseAngles
static boolean queryParseAngles(Query query, @Nullable @Nullable Out<Integer> curAngle, @Nullable @Nullable Out<Integer> nAngles) Parse the current angle number in theGstNavigation
anglesquery
into theguint
pointed to by thecurAngle
variable, and the number of available angles into theguint
pointed to by thenAngles
variable.- Parameters:
query
- aGstQuery
curAngle
- Pointer to aguint
into which to store the currently selected angle value from the query, or NULLnAngles
- Pointer to aguint
into which to store the number of angles value from the query, or NULL- Returns:
true
if the query could be successfully parsed.false
if not.
-
queryParseCommandsLength
Parse the number of commands in theGstNavigation
commandsquery
.- Parameters:
query
- aGstQuery
nCmds
- the number of commands in this query.- Returns:
true
if the query could be successfully parsed.false
if not.
-
queryParseCommandsNth
static boolean queryParseCommandsNth(Query query, int nth, @Nullable @Nullable Out<NavigationCommand> cmd) Parse theGstNavigation
command query and retrieve thenth
command from it intocmd
. If the list contains less elements thannth
,cmd
will be set toGST_NAVIGATION_COMMAND_INVALID
.- Parameters:
query
- aGstQuery
nth
- the nth command to retrieve.cmd
- a pointer to store the nth command into.- Returns:
true
if the query could be successfully parsed.false
if not.
-
querySetAngles
Set theGstNavigation
angles query result field inquery
.- Parameters:
query
- aGstQuery
curAngle
- the current viewing angle to set.nAngles
- the number of viewing angles to set.
-
querySetCommands
Set theGstNavigation
command query result fields inquery
. The number of commands passed must be equal tonCommands
.- Parameters:
query
- aGstQuery
nCmds
- the number of commands to set.varargs
- A list ofGstNavigationCommand
values,nCmds
entries long.
-
sendEvent
-
sendEventSimple
Sends an event to the navigation interface.- Parameters:
event
- The event to send
-
sendKeyEvent
-
sendMouseEvent
Sends a mouse event to the navigation interface. Mouse event coordinates are sent relative to the display space of the related output area. This is usually the size in pixels of the window associated with the element implementing theGstNavigation
interface.- Parameters:
event
- The type of mouse event, as a text string. Recognised values are "mouse-button-press", "mouse-button-release" and "mouse-move".button
- The button number of the button being pressed or released. Pass 0 for mouse-move events.x
- The x coordinate of the mouse event.y
- The y coordinate of the mouse event.
-
sendMouseScrollEvent
default void sendMouseScrollEvent(double x, double y, double deltaX, double deltaY) Sends a mouse scroll event to the navigation interface. Mouse event coordinates are sent relative to the display space of the related output area. This is usually the size in pixels of the window associated with the element implementing theGstNavigation
interface.- Parameters:
x
- The x coordinate of the mouse event.y
- The y coordinate of the mouse event.deltaX
- The delta_x coordinate of the mouse event.deltaY
- The delta_y coordinate of the mouse event.
-