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);
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
106 GST_NAVIGATION_COMMAND_INVALID = 0,
108 GST_NAVIGATION_COMMAND_MENU1 = 1,
109 GST_NAVIGATION_COMMAND_MENU2 = 2,
110 GST_NAVIGATION_COMMAND_MENU3 = 3,
111 GST_NAVIGATION_COMMAND_MENU4 = 4,
112 GST_NAVIGATION_COMMAND_MENU5 = 5,
113 GST_NAVIGATION_COMMAND_MENU6 = 6,
114 GST_NAVIGATION_COMMAND_MENU7 = 7,
116 GST_NAVIGATION_COMMAND_LEFT = 20,
117 GST_NAVIGATION_COMMAND_RIGHT = 21,
118 GST_NAVIGATION_COMMAND_UP = 22,
119 GST_NAVIGATION_COMMAND_DOWN = 23,
120 GST_NAVIGATION_COMMAND_ACTIVATE = 24,
122 GST_NAVIGATION_COMMAND_PREV_ANGLE = 30,
123 GST_NAVIGATION_COMMAND_NEXT_ANGLE = 31
124 } GstNavigationCommand;
126 /* Some aliases for the menu command types */
127 #define GST_NAVIGATION_COMMAND_DVD_MENU GST_NAVIGATION_COMMAND_MENU1
128 #define GST_NAVIGATION_COMMAND_DVD_TITLE_MENU GST_NAVIGATION_COMMAND_MENU2
129 #define GST_NAVIGATION_COMMAND_DVD_ROOT_MENU GST_NAVIGATION_COMMAND_MENU3
130 #define GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU GST_NAVIGATION_COMMAND_MENU4
131 #define GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU GST_NAVIGATION_COMMAND_MENU5
132 #define GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU GST_NAVIGATION_COMMAND_MENU6
133 #define GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU GST_NAVIGATION_COMMAND_MENU7
137 * GstNavigationQueryType:
138 * @GST_NAVIGATION_QUERY_INVALID: invalid query
139 * @GST_NAVIGATION_QUERY_COMMANDS: command query
140 * @GST_NAVIGATION_QUERY_ANGLES: viewing angle query
142 * Tyoes of navigation interface queries.
146 GST_NAVIGATION_QUERY_INVALID = 0,
147 GST_NAVIGATION_QUERY_COMMANDS = 1,
148 GST_NAVIGATION_QUERY_ANGLES = 2
149 } GstNavigationQueryType;
151 GstNavigationQueryType gst_navigation_query_get_type (GstQuery *query);
153 GstQuery * gst_navigation_query_new_commands (void);
154 void gst_navigation_query_set_commands (GstQuery *query, gint n_cmds, ...);
155 void gst_navigation_query_set_commandsv (GstQuery *query, gint n_cmds,
156 GstNavigationCommand *cmds);
157 gboolean gst_navigation_query_parse_commands_length (GstQuery *query,
159 gboolean gst_navigation_query_parse_commands_nth (GstQuery *query, guint nth,
160 GstNavigationCommand *cmd);
162 GstQuery * gst_navigation_query_new_angles (void);
163 void gst_navigation_query_set_angles (GstQuery *query, guint cur_angle,
165 gboolean gst_navigation_query_parse_angles (GstQuery *query, guint *cur_angle,
168 /* Element messages */
170 * GstNavigationMessageType:
171 * @GST_NAVIGATION_MESSAGE_INVALID: Returned from
172 * gst_navigation_message_get_type() when the passed message is not a
173 * navigation message.
174 * @GST_NAVIGATION_MESSAGE_MOUSE_OVER: Sent when the mouse moves over or leaves a
175 * clickable region of the output, such as a DVD menu button.
176 * @GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED: Sent when the set of available commands
177 * changes and should re-queried by interested applications.
178 * @GST_NAVIGATION_MESSAGE_ANGLES_CHANGED: Sent when display angles in a multi-angle
179 * feature (such as a multiangle DVD) change - either angles have appeared or
182 * A set of notifications that may be received on the bus when navigation
183 * related status changes.
186 GST_NAVIGATION_MESSAGE_INVALID,
187 GST_NAVIGATION_MESSAGE_MOUSE_OVER,
188 GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED,
189 GST_NAVIGATION_MESSAGE_ANGLES_CHANGED
190 } GstNavigationMessageType;
192 GstNavigationMessageType gst_navigation_message_get_type (GstMessage *message);
194 GstMessage * gst_navigation_message_new_mouse_over (GstObject *src,
196 gboolean gst_navigation_message_parse_mouse_over (GstMessage *message,
199 GstMessage * gst_navigation_message_new_commands_changed (GstObject *src);
201 GstMessage * gst_navigation_message_new_angles_changed (GstObject *src,
204 gboolean gst_navigation_message_parse_angles_changed (GstMessage *message,
208 /* event parsing functions */
210 * GstNavigationEventType:
211 * @GST_NAVIGATION_EVENT_INVALID: Returned from
212 * gst_navigation_event_get_type() when the passed event is not a navigation event.
213 * @GST_NAVIGATION_EVENT_KEY_PRESS: A key press event. Use
214 * gst_navigation_event_parse_key_event() to extract the details from the event.
215 * @GST_NAVIGATION_EVENT_KEY_RELEASE: A key release event. Use
216 * gst_navigation_event_parse_key_event() to extract the details from the event.
217 * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS: A mouse button press event. Use
218 * gst_navigation_event_parse_mouse_button_event() to extract the details from the
220 * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE: A mouse button release event. Use
221 * gst_navigation_event_parse_mouse_button_event() to extract the details from the
223 * @GST_NAVIGATION_EVENT_MOUSE_MOVE: A mouse movement event. Use
224 * gst_navigation_event_parse_mouse_move_event() to extract the details from the
226 * @GST_NAVIGATION_EVENT_COMMAND: A navigation command event. Use
227 * gst_navigation_event_parse_command() to extract the details from the event.
229 * Enum values for the various events that an element implementing the
230 * GstNavigation interface might send up the pipeline.
233 GST_NAVIGATION_EVENT_INVALID = 0,
234 GST_NAVIGATION_EVENT_KEY_PRESS = 1,
235 GST_NAVIGATION_EVENT_KEY_RELEASE = 2,
236 GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS = 3,
237 GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE = 4,
238 GST_NAVIGATION_EVENT_MOUSE_MOVE = 5,
239 GST_NAVIGATION_EVENT_COMMAND = 6
240 } GstNavigationEventType;
242 GstNavigationEventType gst_navigation_event_get_type (GstEvent *event);
244 gboolean gst_navigation_event_parse_key_event (GstEvent *event,
246 gboolean gst_navigation_event_parse_mouse_button_event (GstEvent *event,
247 gint *button, gdouble *x, gdouble *y);
248 gboolean gst_navigation_event_parse_mouse_move_event (GstEvent *event,
249 gdouble *x, gdouble *y);
250 gboolean gst_navigation_event_parse_command (GstEvent *event,
251 GstNavigationCommand *command);
253 /* interface virtual function wrappers */
254 void gst_navigation_send_event (GstNavigation *navigation,
255 GstStructure *structure);
256 void gst_navigation_send_key_event (GstNavigation *navigation,
257 const char *event, const char *key);
258 void gst_navigation_send_mouse_event (GstNavigation *navigation,
259 const char *event, int button, double x, double y);
260 void gst_navigation_send_command (GstNavigation *navigation,
261 GstNavigationCommand command);
265 #endif /* __GST_NAVIGATION_H__ */