Top |
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.
void gst_navigation_send_event (GstNavigation *navigation
,GstStructure *structure
);
void gst_navigation_send_key_event (GstNavigation *navigation
,const char *event
,const char *key
);
void gst_navigation_send_mouse_event (GstNavigation *navigation
,const char *event
,int button
,double x
,double y
);
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 the GstNavigation interface.
navigation |
The navigation interface instance |
|
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. |
void gst_navigation_send_command (GstNavigation *navigation
,GstNavigationCommand command
);
Sends the indicated command to the navigation interface.
gboolean gst_navigation_event_parse_command (GstEvent *event
,GstNavigationCommand *command
);
Inspect a GstNavigation command event and retrieve the enum value of the associated command.
event |
A GstEvent to inspect. |
|
command |
Pointer to GstNavigationCommand to receive the type of the navigation event. |
gboolean gst_navigation_event_parse_key_event (GstEvent *event
,const gchar **key
);
event |
A GstEvent 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. |
gboolean gst_navigation_event_parse_mouse_button_event (GstEvent *event
,gint *button
,gdouble *x
,gdouble *y
);
Retrieve the details of either a GstNavigation mouse button press event or
a mouse button release event. Determine which type the event is using
gst_navigation_event_get_type()
to retrieve the GstNavigationEventType.
event |
A GstEvent 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. |
gboolean gst_navigation_event_parse_mouse_move_event (GstEvent *event
,gdouble *x
,gdouble *y
);
Inspect a GstNavigation mouse movement event and extract the coordinates of the event.
event |
A GstEvent 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. |
GstNavigationMessageType
gst_navigation_message_get_type (GstMessage *message
);
Check a bus message to see if it is a GstNavigation event, and return the GstNavigationMessageType identifying the type of the message if so.
The type of the GstMessage, or GST_NAVIGATION_MESSAGE_INVALID if the message is not a GstNavigation notification.
GstMessage * gst_navigation_message_new_angles_changed (GstObject *src
,guint cur_angle
,guint n_angles
);
Creates a new GstNavigation message with type GST_NAVIGATION_MESSAGE_ANGLES_CHANGED for notifying an application that the current angle, or current number of angles available in a multiangle video has changed.
src |
A GstObject to set as source of the new message. |
|
cur_angle |
The currently selected angle. |
|
n_angles |
The number of viewing angles now available. |
GstMessage *
gst_navigation_message_new_commands_changed
(GstObject *src
);
Creates a new GstNavigation message with type GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED
GstMessage * gst_navigation_message_new_event (GstObject *src
,GstEvent *event
);
Creates a new GstNavigation message with type GST_NAVIGATION_MESSAGE_EVENT.
Since: 1.6
GstMessage * gst_navigation_message_new_mouse_over (GstObject *src
,gboolean active
);
Creates a new GstNavigation message with type GST_NAVIGATION_MESSAGE_MOUSE_OVER.
gboolean gst_navigation_message_parse_angles_changed (GstMessage *message
,guint *cur_angle
,guint *n_angles
);
Parse a GstNavigation message of type GST_NAVIGATION_MESSAGE_ANGLES_CHANGED
and extract the cur_angle
and n_angles
parameters.
message |
A GstMessage to inspect. |
|
cur_angle |
A pointer to a guint to receive the new current angle number, or NULL |
|
n_angles |
A pointer to a guint to receive the new angle count, or NULL. |
gboolean gst_navigation_message_parse_event (GstMessage *message
,GstEvent **event
);
Parse a GstNavigation message of type GST_NAVIGATION_MESSAGE_EVENT
and extract contained GstEvent. The caller must unref the event
when done
with it.
message |
A GstMessage to inspect. |
|
event |
a pointer to a GstEvent to receive the contained navigation event. |
[out][transfer full] |
Since: 1.6
gboolean gst_navigation_message_parse_mouse_over (GstMessage *message
,gboolean *active
);
Parse a GstNavigation message of type GST_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.
message |
A GstMessage to inspect. |
|
active |
A pointer to a gboolean to receive the active/inactive state, or NULL. |
GstQuery *
gst_navigation_query_new_angles (void
);
Create a new GstNavigation 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.
GstNavigationQueryType
gst_navigation_query_get_type (GstQuery *query
);
Inspect a GstQuery and return the GstNavigationQueryType associated with it if it is a GstNavigation query.
GstQuery *
gst_navigation_query_new_commands (void
);
Create a new GstNavigation commands query. When executed, it will query the pipeline for the set of currently available commands.
gboolean gst_navigation_query_parse_angles (GstQuery *query
,guint *cur_angle
,guint *n_angles
);
Parse the current angle number in the GstNavigation angles query
into the
guint pointed to by the cur_angle
variable, and the number of available
angles into the guint pointed to by the n_angles
variable.
gboolean gst_navigation_query_parse_commands_length (GstQuery *query
,guint *n_cmds
);
Parse the number of commands in the GstNavigation commands query
.
gboolean gst_navigation_query_parse_commands_nth (GstQuery *query
,guint nth
,GstNavigationCommand *cmd
);
Parse the GstNavigation command query and retrieve the nth
command from
it into cmd
. If the list contains less elements than nth
, cmd
will be
set to GST_NAVIGATION_COMMAND_INVALID.
query |
a GstQuery |
|
nth |
the nth command to retrieve. |
|
cmd |
a pointer to store the nth command into. |
[out] |
void gst_navigation_query_set_angles (GstQuery *query
,guint cur_angle
,guint n_angles
);
Set the GstNavigation angles query result field in query
.
query |
a GstQuery |
|
cur_angle |
the current viewing angle to set. |
|
n_angles |
the number of viewing angles to set. |
void gst_navigation_query_set_commands (GstQuery *query
,gint n_cmds
,...
);
Set the GstNavigation command query result fields in query
. The number
of commands passed must be equal to n_commands
.
query |
a GstQuery |
|
n_cmds |
the number of commands to set. |
|
... |
A list of |
void gst_navigation_query_set_commandsv (GstQuery *query
,gint n_cmds
,GstNavigationCommand *cmds
);
Set the GstNavigation command query result fields in query
. The number
of commands passed must be equal to n_commands
.
query |
a GstQuery |
|
n_cmds |
the number of commands to set. |
|
cmds |
An array containing |
struct GstNavigationInterface { GTypeInterface iface; /* virtual functions */ void (*send_event) (GstNavigation *navigation, GstStructure *structure); };
Navigation interface.
A set of commands that may be issued to an element providing the
GstNavigation interface. The available commands can be queried via
the gst_navigation_query_new_commands()
query.
For convenience in handling DVD navigation, the MENU commands are aliased as:
GST_NAVIGATION_COMMAND_DVD_MENU = GST_NAVIGATION_COMMAND_MENU1
GST_NAVIGATION_COMMAND_DVD_TITLE_MENU = GST_NAVIGATION_COMMAND_MENU2
GST_NAVIGATION_COMMAND_DVD_ROOT_MENU = GST_NAVIGATION_COMMAND_MENU3
GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU = GST_NAVIGATION_COMMAND_MENU4
GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU = GST_NAVIGATION_COMMAND_MENU5
GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU = GST_NAVIGATION_COMMAND_MENU6
GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU = GST_NAVIGATION_COMMAND_MENU7
An invalid command entry |
||
Execute navigation menu command 1. For DVD, this enters the DVD root menu, or exits back to the title from the menu. |
||
Execute navigation menu command 2. For DVD, this jumps to the DVD title menu. |
||
Execute navigation menu command 3. For DVD, this jumps into the DVD root menu. |
||
Execute navigation menu command 4. For DVD, this jumps to the Subpicture menu. |
||
Execute navigation menu command 5. For DVD, the jumps to the audio menu. |
||
Execute navigation menu command 6. For DVD, this jumps to the angles menu. |
||
Execute navigation menu command 7. For DVD, this jumps to the chapter menu. |
||
Select the next button to the left in a menu, if such a button exists. |
||
Select the next button to the right in a menu, if such a button exists. |
||
Select the button above the current one in a menu, if such a button exists. |
||
Select the button below the current one in a menu, if such a button exists. |
||
Activate (click) the currently selected button in a menu, if such a button exists. |
||
Switch to the previous angle in a multiangle feature. |
||
Switch to the next angle in a multiangle feature. |
Enum values for the various events that an element implementing the GstNavigation interface might send up the pipeline.
Returned from
|
||
A key press event. Use
|
||
A key release event. Use
|
||
A mouse button press event. Use
|
||
A mouse button release event. Use
|
||
A mouse movement event. Use
|
||
A navigation command event. Use
|
A set of notifications that may be received on the bus when navigation related status changes.
Returned from
|
||
Sent when the mouse moves over or leaves a clickable region of the output, such as a DVD menu button. |
||
Sent when the set of available commands changes and should re-queried by interested applications. |
||
Sent when display angles in a multi-angle feature (such as a multiangle DVD) change - either angles have appeared or disappeared. |
||
Sent when a navigation event was not handled by any element in the pipeline (Since 1.6) |
#define GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU GST_NAVIGATION_COMMAND_MENU6
#define GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU GST_NAVIGATION_COMMAND_MENU5
#define GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU GST_NAVIGATION_COMMAND_MENU7
#define GST_NAVIGATION_COMMAND_DVD_MENU GST_NAVIGATION_COMMAND_MENU1
#define GST_NAVIGATION_COMMAND_DVD_ROOT_MENU GST_NAVIGATION_COMMAND_MENU3
#define GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU GST_NAVIGATION_COMMAND_MENU4