1 /* GStreamer Navigation
2 * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3 * Copyright (C) 2003 David A. Schleef <ds@schleef.org>
5 * navigation.h: navigation interface design
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
20 * Boston, MA 02110-1301, USA.
23 #ifndef __GST_NAVIGATION_H__
24 #define __GST_NAVIGATION_H__
30 #define GST_TYPE_NAVIGATION \
31 (gst_navigation_get_type ())
32 #define GST_NAVIGATION(obj) \
33 (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_NAVIGATION, GstNavigation))
34 #define GST_IS_NAVIGATION(obj) \
35 (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_NAVIGATION))
36 #define GST_NAVIGATION_GET_INTERFACE(obj) \
37 (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_NAVIGATION, GstNavigationInterface))
39 typedef struct _GstNavigation GstNavigation;
40 typedef struct _GstNavigationInterface GstNavigationInterface;
43 * GstNavigationInterface:
44 * @iface: the parent interface
45 * @send_event: sending a navigation event
47 * Navigation interface.
49 struct _GstNavigationInterface {
52 /* virtual functions */
53 void (*send_event) (GstNavigation *navigation, GstStructure *structure);
57 GType gst_navigation_get_type (void);
59 /* Navigation commands */
62 * GstNavigationCommand:
63 * @GST_NAVIGATION_COMMAND_INVALID: An invalid command entry
64 * @GST_NAVIGATION_COMMAND_MENU1: Execute navigation menu command 1. For DVD,
65 * this enters the DVD root menu, or exits back to the title from the menu.
66 * @GST_NAVIGATION_COMMAND_MENU2: Execute navigation menu command 2. For DVD,
67 * this jumps to the DVD title menu.
68 * @GST_NAVIGATION_COMMAND_MENU3: Execute navigation menu command 3. For DVD,
69 * this jumps into the DVD root menu.
70 * @GST_NAVIGATION_COMMAND_MENU4: Execute navigation menu command 4. For DVD,
71 * this jumps to the Subpicture menu.
72 * @GST_NAVIGATION_COMMAND_MENU5: Execute navigation menu command 5. For DVD,
73 * the jumps to the audio menu.
74 * @GST_NAVIGATION_COMMAND_MENU6: Execute navigation menu command 6. For DVD,
75 * this jumps to the angles menu.
76 * @GST_NAVIGATION_COMMAND_MENU7: Execute navigation menu command 7. For DVD,
77 * this jumps to the chapter menu.
78 * @GST_NAVIGATION_COMMAND_LEFT: Select the next button to the left in a menu,
79 * if such a button exists.
80 * @GST_NAVIGATION_COMMAND_RIGHT: Select the next button to the right in a menu,
81 * if such a button exists.
82 * @GST_NAVIGATION_COMMAND_UP: Select the button above the current one in a
83 * menu, if such a button exists.
84 * @GST_NAVIGATION_COMMAND_DOWN: Select the button below the current one in a
85 * menu, if such a button exists.
86 * @GST_NAVIGATION_COMMAND_ACTIVATE: Activate (click) the currently selected
87 * button in a menu, if such a button exists.
88 * @GST_NAVIGATION_COMMAND_PREV_ANGLE: Switch to the previous angle in a
90 * @GST_NAVIGATION_COMMAND_NEXT_ANGLE: Switch to the next angle in a multiangle
93 * A set of commands that may be issued to an element providing the
94 * #GstNavigation interface. The available commands can be queried via
95 * the gst_navigation_query_new_commands() query.
97 * For convenience in handling DVD navigation, the MENU commands are aliased as:
98 * GST_NAVIGATION_COMMAND_DVD_MENU = @GST_NAVIGATION_COMMAND_MENU1
99 * GST_NAVIGATION_COMMAND_DVD_TITLE_MENU = @GST_NAVIGATION_COMMAND_MENU2
100 * GST_NAVIGATION_COMMAND_DVD_ROOT_MENU = @GST_NAVIGATION_COMMAND_MENU3
101 * GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU = @GST_NAVIGATION_COMMAND_MENU4
102 * GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU = @GST_NAVIGATION_COMMAND_MENU5
103 * GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU = @GST_NAVIGATION_COMMAND_MENU6
104 * GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU = @GST_NAVIGATION_COMMAND_MENU7
107 GST_NAVIGATION_COMMAND_INVALID = 0,
109 GST_NAVIGATION_COMMAND_MENU1 = 1,
110 GST_NAVIGATION_COMMAND_MENU2 = 2,
111 GST_NAVIGATION_COMMAND_MENU3 = 3,
112 GST_NAVIGATION_COMMAND_MENU4 = 4,
113 GST_NAVIGATION_COMMAND_MENU5 = 5,
114 GST_NAVIGATION_COMMAND_MENU6 = 6,
115 GST_NAVIGATION_COMMAND_MENU7 = 7,
117 GST_NAVIGATION_COMMAND_LEFT = 20,
118 GST_NAVIGATION_COMMAND_RIGHT = 21,
119 GST_NAVIGATION_COMMAND_UP = 22,
120 GST_NAVIGATION_COMMAND_DOWN = 23,
121 GST_NAVIGATION_COMMAND_ACTIVATE = 24,
123 GST_NAVIGATION_COMMAND_PREV_ANGLE = 30,
124 GST_NAVIGATION_COMMAND_NEXT_ANGLE = 31
125 } GstNavigationCommand;
127 /* Some aliases for the menu command types */
128 #define GST_NAVIGATION_COMMAND_DVD_MENU GST_NAVIGATION_COMMAND_MENU1
129 #define GST_NAVIGATION_COMMAND_DVD_TITLE_MENU GST_NAVIGATION_COMMAND_MENU2
130 #define GST_NAVIGATION_COMMAND_DVD_ROOT_MENU GST_NAVIGATION_COMMAND_MENU3
131 #define GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU GST_NAVIGATION_COMMAND_MENU4
132 #define GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU GST_NAVIGATION_COMMAND_MENU5
133 #define GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU GST_NAVIGATION_COMMAND_MENU6
134 #define GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU GST_NAVIGATION_COMMAND_MENU7
138 * GstNavigationQueryType:
139 * @GST_NAVIGATION_QUERY_INVALID: invalid query
140 * @GST_NAVIGATION_QUERY_COMMANDS: command query
141 * @GST_NAVIGATION_QUERY_ANGLES: viewing angle query
143 * Tyoes of navigation interface queries.
147 GST_NAVIGATION_QUERY_INVALID = 0,
148 GST_NAVIGATION_QUERY_COMMANDS = 1,
149 GST_NAVIGATION_QUERY_ANGLES = 2
150 } GstNavigationQueryType;
153 GstNavigationQueryType gst_navigation_query_get_type (GstQuery *query);
156 GstQuery * gst_navigation_query_new_commands (void);
159 void gst_navigation_query_set_commands (GstQuery *query, gint n_cmds, ...);
162 void gst_navigation_query_set_commandsv (GstQuery *query, gint n_cmds,
163 GstNavigationCommand *cmds);
166 gboolean gst_navigation_query_parse_commands_length (GstQuery *query,
170 gboolean gst_navigation_query_parse_commands_nth (GstQuery *query, guint nth,
171 GstNavigationCommand *cmd);
174 GstQuery * gst_navigation_query_new_angles (void);
177 void gst_navigation_query_set_angles (GstQuery *query, guint cur_angle,
181 gboolean gst_navigation_query_parse_angles (GstQuery *query, guint *cur_angle,
184 /* Element messages */
186 * GstNavigationMessageType:
187 * @GST_NAVIGATION_MESSAGE_INVALID: Returned from
188 * gst_navigation_message_get_type() when the passed message is not a
189 * navigation message.
190 * @GST_NAVIGATION_MESSAGE_MOUSE_OVER: Sent when the mouse moves over or leaves a
191 * clickable region of the output, such as a DVD menu button.
192 * @GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED: Sent when the set of available commands
193 * changes and should re-queried by interested applications.
194 * @GST_NAVIGATION_MESSAGE_ANGLES_CHANGED: Sent when display angles in a multi-angle
195 * feature (such as a multiangle DVD) change - either angles have appeared or
197 * @GST_NAVIGATION_MESSAGE_EVENT: Sent when a navigation event was not handled
198 * by any element in the pipeline (Since 1.6)
200 * A set of notifications that may be received on the bus when navigation
201 * related status changes.
204 GST_NAVIGATION_MESSAGE_INVALID,
205 GST_NAVIGATION_MESSAGE_MOUSE_OVER,
206 GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED,
207 GST_NAVIGATION_MESSAGE_ANGLES_CHANGED,
208 GST_NAVIGATION_MESSAGE_EVENT
209 } GstNavigationMessageType;
212 GstNavigationMessageType gst_navigation_message_get_type (GstMessage *message);
215 GstMessage * gst_navigation_message_new_mouse_over (GstObject *src,
219 gboolean gst_navigation_message_parse_mouse_over (GstMessage *message,
223 GstMessage * gst_navigation_message_new_commands_changed (GstObject *src);
226 GstMessage * gst_navigation_message_new_angles_changed (GstObject *src,
231 gboolean gst_navigation_message_parse_angles_changed (GstMessage *message,
236 GstMessage * gst_navigation_message_new_event (GstObject *src,
240 gboolean gst_navigation_message_parse_event (GstMessage *message,
242 /* event parsing functions */
244 * GstNavigationEventType:
245 * @GST_NAVIGATION_EVENT_INVALID: Returned from
246 * gst_navigation_event_get_type() when the passed event is not a navigation event.
247 * @GST_NAVIGATION_EVENT_KEY_PRESS: A key press event. Use
248 * gst_navigation_event_parse_key_event() to extract the details from the event.
249 * @GST_NAVIGATION_EVENT_KEY_RELEASE: A key release event. Use
250 * gst_navigation_event_parse_key_event() to extract the details from the event.
251 * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS: A mouse button press event. Use
252 * gst_navigation_event_parse_mouse_button_event() to extract the details from the
254 * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE: A mouse button release event. Use
255 * gst_navigation_event_parse_mouse_button_event() to extract the details from the
257 * @GST_NAVIGATION_EVENT_MOUSE_MOVE: A mouse movement event. Use
258 * gst_navigation_event_parse_mouse_move_event() to extract the details from the
260 * @GST_NAVIGATION_EVENT_COMMAND: A navigation command event. Use
261 * gst_navigation_event_parse_command() to extract the details from the event.
263 * Enum values for the various events that an element implementing the
264 * GstNavigation interface might send up the pipeline.
267 GST_NAVIGATION_EVENT_INVALID = 0,
268 GST_NAVIGATION_EVENT_KEY_PRESS = 1,
269 GST_NAVIGATION_EVENT_KEY_RELEASE = 2,
270 GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS = 3,
271 GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE = 4,
272 GST_NAVIGATION_EVENT_MOUSE_MOVE = 5,
273 GST_NAVIGATION_EVENT_COMMAND = 6
274 } GstNavigationEventType;
277 GstNavigationEventType gst_navigation_event_get_type (GstEvent *event);
280 gboolean gst_navigation_event_parse_key_event (GstEvent *event,
284 gboolean gst_navigation_event_parse_mouse_button_event (GstEvent *event,
285 gint *button, gdouble *x, gdouble *y);
288 gboolean gst_navigation_event_parse_mouse_move_event (GstEvent *event,
289 gdouble *x, gdouble *y);
292 gboolean gst_navigation_event_parse_command (GstEvent *event,
293 GstNavigationCommand *command);
295 /* interface virtual function wrappers */
298 void gst_navigation_send_event (GstNavigation *navigation,
299 GstStructure *structure);
302 void gst_navigation_send_key_event (GstNavigation *navigation,
303 const char *event, const char *key);
306 void gst_navigation_send_mouse_event (GstNavigation *navigation,
307 const char *event, int button, double x, double y);
310 void gst_navigation_send_command (GstNavigation *navigation,
311 GstNavigationCommand command);
315 #endif /* __GST_NAVIGATION_H__ */