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., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, 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);
56 GType gst_navigation_get_type (void);
58 /* Navigation commands */
61 * GstNavigationCommand:
62 * @GST_NAVIGATION_COMMAND_INVALID: An invalid command entry
63 * @GST_NAVIGATION_COMMAND_MENU1: Execute navigation menu command 1. For DVD,
64 * this enters the DVD root menu, or exits back to the title from the menu.
65 * @GST_NAVIGATION_COMMAND_MENU2: Execute navigation menu command 2. For DVD,
66 * this jumps to the DVD title menu.
67 * @GST_NAVIGATION_COMMAND_MENU3: Execute navigation menu command 3. For DVD,
68 * this jumps into the DVD root menu.
69 * @GST_NAVIGATION_COMMAND_MENU4: Execute navigation menu command 4. For DVD,
70 * this jumps to the Subpicture menu.
71 * @GST_NAVIGATION_COMMAND_MENU5: Execute navigation menu command 5. For DVD,
72 * the jumps to the audio menu.
73 * @GST_NAVIGATION_COMMAND_MENU6: Execute navigation menu command 6. For DVD,
74 * this jumps to the angles menu.
75 * @GST_NAVIGATION_COMMAND_MENU7: Execute navigation menu command 7. For DVD,
76 * this jumps to the chapter menu.
77 * @GST_NAVIGATION_COMMAND_LEFT: Select the next button to the left in a menu,
78 * if such a button exists.
79 * @GST_NAVIGATION_COMMAND_RIGHT: Select the next button to the right in a menu,
80 * if such a button exists.
81 * @GST_NAVIGATION_COMMAND_UP: Select the button above the current one in a
82 * menu, if such a button exists.
83 * @GST_NAVIGATION_COMMAND_DOWN: Select the button below the current one in a
84 * menu, if such a button exists.
85 * @GST_NAVIGATION_COMMAND_ACTIVATE: Activate (click) the currently selected
86 * button in a menu, if such a button exists.
87 * @GST_NAVIGATION_COMMAND_PREV_ANGLE: Switch to the previous angle in a
89 * @GST_NAVIGATION_COMMAND_NEXT_ANGLE: Switch to the next angle in a multiangle
92 * A set of commands that may be issued to an element providing the
93 * #GstNavigation interface. The available commands can be queried via
94 * the gst_navigation_query_new_commands() query.
96 * For convenience in handling DVD navigation, the MENU commands are aliased as:
97 * GST_NAVIGATION_COMMAND_DVD_MENU = @GST_NAVIGATION_COMMAND_MENU1
98 * GST_NAVIGATION_COMMAND_DVD_TITLE_MENU = @GST_NAVIGATION_COMMAND_MENU2
99 * GST_NAVIGATION_COMMAND_DVD_ROOT_MENU = @GST_NAVIGATION_COMMAND_MENU3
100 * GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU = @GST_NAVIGATION_COMMAND_MENU4
101 * GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU = @GST_NAVIGATION_COMMAND_MENU5
102 * GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU = @GST_NAVIGATION_COMMAND_MENU6
103 * GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU = @GST_NAVIGATION_COMMAND_MENU7
108 GST_NAVIGATION_COMMAND_INVALID = 0,
110 GST_NAVIGATION_COMMAND_MENU1 = 1,
111 GST_NAVIGATION_COMMAND_MENU2 = 2,
112 GST_NAVIGATION_COMMAND_MENU3 = 3,
113 GST_NAVIGATION_COMMAND_MENU4 = 4,
114 GST_NAVIGATION_COMMAND_MENU5 = 5,
115 GST_NAVIGATION_COMMAND_MENU6 = 6,
116 GST_NAVIGATION_COMMAND_MENU7 = 7,
118 GST_NAVIGATION_COMMAND_LEFT = 20,
119 GST_NAVIGATION_COMMAND_RIGHT = 21,
120 GST_NAVIGATION_COMMAND_UP = 22,
121 GST_NAVIGATION_COMMAND_DOWN = 23,
122 GST_NAVIGATION_COMMAND_ACTIVATE = 24,
124 GST_NAVIGATION_COMMAND_PREV_ANGLE = 30,
125 GST_NAVIGATION_COMMAND_NEXT_ANGLE = 31
126 } GstNavigationCommand;
128 /* Some aliases for the menu command types */
129 #define GST_NAVIGATION_COMMAND_DVD_MENU GST_NAVIGATION_COMMAND_MENU1
130 #define GST_NAVIGATION_COMMAND_DVD_TITLE_MENU GST_NAVIGATION_COMMAND_MENU2
131 #define GST_NAVIGATION_COMMAND_DVD_ROOT_MENU GST_NAVIGATION_COMMAND_MENU3
132 #define GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU GST_NAVIGATION_COMMAND_MENU4
133 #define GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU GST_NAVIGATION_COMMAND_MENU5
134 #define GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU GST_NAVIGATION_COMMAND_MENU6
135 #define GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU GST_NAVIGATION_COMMAND_MENU7
139 * GstNavigationQueryType:
140 * @GST_NAVIGATION_QUERY_INVALID: invalid query
141 * @GST_NAVIGATION_QUERY_COMMANDS: command query
142 * @GST_NAVIGATION_QUERY_ANGLES: viewing angle query
144 * Tyoes of navigation interface queries.
148 GST_NAVIGATION_QUERY_INVALID = 0,
149 GST_NAVIGATION_QUERY_COMMANDS = 1,
150 GST_NAVIGATION_QUERY_ANGLES = 2
151 } GstNavigationQueryType;
153 GstNavigationQueryType gst_navigation_query_get_type (GstQuery *query);
155 GstQuery * gst_navigation_query_new_commands (void);
156 void gst_navigation_query_set_commands (GstQuery *query, gint n_cmds, ...);
157 void gst_navigation_query_set_commandsv (GstQuery *query, gint n_cmds,
158 GstNavigationCommand *cmds);
159 gboolean gst_navigation_query_parse_commands_length (GstQuery *query,
161 gboolean gst_navigation_query_parse_commands_nth (GstQuery *query, guint nth,
162 GstNavigationCommand *cmd);
164 GstQuery * gst_navigation_query_new_angles (void);
165 void gst_navigation_query_set_angles (GstQuery *query, guint cur_angle,
167 gboolean gst_navigation_query_parse_angles (GstQuery *query, guint *cur_angle,
170 /* Element messages */
172 * GstNavigationMessageType:
173 * @GST_NAVIGATION_MESSAGE_INVALID: Returned from
174 * gst_navigation_message_get_type() when the passed message is not a
175 * navigation message.
176 * @GST_NAVIGATION_MESSAGE_MOUSE_OVER: Sent when the mouse moves over or leaves a
177 * clickable region of the output, such as a DVD menu button.
178 * @GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED: Sent when the set of available commands
179 * changes and should re-queried by interested applications.
180 * @GST_NAVIGATION_MESSAGE_ANGLES_CHANGED: Sent when display angles in a multi-angle
181 * feature (such as a multiangle DVD) change - either angles have appeared or
184 * A set of notifications that may be received on the bus when navigation
185 * related status changes.
190 GST_NAVIGATION_MESSAGE_INVALID,
191 GST_NAVIGATION_MESSAGE_MOUSE_OVER,
192 GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED,
193 GST_NAVIGATION_MESSAGE_ANGLES_CHANGED
194 } GstNavigationMessageType;
196 GstNavigationMessageType gst_navigation_message_get_type (GstMessage *message);
198 GstMessage * gst_navigation_message_new_mouse_over (GstObject *src,
200 gboolean gst_navigation_message_parse_mouse_over (GstMessage *message,
203 GstMessage * gst_navigation_message_new_commands_changed (GstObject *src);
205 GstMessage * gst_navigation_message_new_angles_changed (GstObject *src,
208 gboolean gst_navigation_message_parse_angles_changed (GstMessage *message,
212 /* event parsing functions */
214 * GstNavigationEventType:
215 * @GST_NAVIGATION_EVENT_INVALID: Returned from
216 * gst_navigation_event_get_type() when the passed event is not a navigation event.
217 * @GST_NAVIGATION_EVENT_KEY_PRESS: A key press event. Use
218 * gst_navigation_event_parse_key_event() to extract the details from the event.
219 * @GST_NAVIGATION_EVENT_KEY_RELEASE: A key release event. Use
220 * gst_navigation_event_parse_key_event() to extract the details from the event.
221 * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS: A mouse button press event. Use
222 * gst_navigation_event_parse_mouse_button_event() to extract the details from the
224 * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE: A mouse button release event. Use
225 * gst_navigation_event_parse_mouse_button_event() to extract the details from the
227 * @GST_NAVIGATION_EVENT_MOUSE_MOVE: A mouse movement event. Use
228 * gst_navigation_event_parse_mouse_move_event() to extract the details from the
230 * @GST_NAVIGATION_EVENT_COMMAND: A navigation command event. Use
231 * gst_navigation_event_parse_command() to extract the details from the event.
233 * Enum values for the various events that an element implementing the
234 * GstNavigation interface might send up the pipeline.
239 GST_NAVIGATION_EVENT_INVALID = 0,
240 GST_NAVIGATION_EVENT_KEY_PRESS = 1,
241 GST_NAVIGATION_EVENT_KEY_RELEASE = 2,
242 GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS = 3,
243 GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE = 4,
244 GST_NAVIGATION_EVENT_MOUSE_MOVE = 5,
245 GST_NAVIGATION_EVENT_COMMAND = 6
246 } GstNavigationEventType;
248 GstNavigationEventType gst_navigation_event_get_type (GstEvent *event);
250 gboolean gst_navigation_event_parse_key_event (GstEvent *event,
252 gboolean gst_navigation_event_parse_mouse_button_event (GstEvent *event,
253 gint *button, gdouble *x, gdouble *y);
254 gboolean gst_navigation_event_parse_mouse_move_event (GstEvent *event,
255 gdouble *x, gdouble *y);
256 gboolean gst_navigation_event_parse_command (GstEvent *event,
257 GstNavigationCommand *command);
259 /* interface virtual function wrappers */
260 void gst_navigation_send_event (GstNavigation *navigation,
261 GstStructure *structure);
262 void gst_navigation_send_key_event (GstNavigation *navigation,
263 const char *event, const char *key);
264 void gst_navigation_send_mouse_event (GstNavigation *navigation,
265 const char *event, int button, double x, double y);
266 void gst_navigation_send_command (GstNavigation *navigation,
267 GstNavigationCommand command);
271 #endif /* __GST_NAVIGATION_H__ */