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_IFACE(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 * @g_iface: the parent interface
45 * @send_event: sending a navigation event
47 * Color-balance interface.
49 struct _GstNavigationInterface {
50 GTypeInterface g_iface;
52 /* virtual functions */
53 void (*send_event) (GstNavigation *navigation, GstStructure *structure);
56 gpointer _gst_reserved[GST_PADDING];
59 GType gst_navigation_get_type (void);
61 /* Navigation commands */
64 * GstNavigationCommand:
65 * @GST_NAVIGATION_COMMAND_INVALID: An invalid command entry
66 * @GST_NAVIGATION_COMMAND_MENU1: Execute navigation menu command 1. For DVD,
67 * this enters the DVD root menu, or exits back to the title from the menu.
68 * @GST_NAVIGATION_COMMAND_MENU2: Execute navigation menu command 2. For DVD,
69 * this jumps to the DVD title menu.
70 * @GST_NAVIGATION_COMMAND_MENU3: Execute navigation menu command 3. For DVD,
71 * this jumps into the DVD root menu.
72 * @GST_NAVIGATION_COMMAND_MENU4: Execute navigation menu command 4. For DVD,
73 * this jumps to the Subpicture menu.
74 * @GST_NAVIGATION_COMMAND_MENU5: Execute navigation menu command 5. For DVD,
75 * the jumps to the audio menu.
76 * @GST_NAVIGATION_COMMAND_MENU6: Execute navigation menu command 6. For DVD,
77 * this jumps to the angles menu.
78 * @GST_NAVIGATION_COMMAND_MENU7: Execute navigation menu command 7. For DVD,
79 * this jumps to the chapter menu.
80 * @GST_NAVIGATION_COMMAND_LEFT: Select the next button to the left in a menu,
81 * if such a button exists.
82 * @GST_NAVIGATION_COMMAND_RIGHT: Select the next button to the right in a menu,
83 * if such a button exists.
84 * @GST_NAVIGATION_COMMAND_UP: Select the button above the current one in a
85 * menu, if such a button exists.
86 * @GST_NAVIGATION_COMMAND_DOWN: Select the button below the current one in a
87 * menu, if such a button exists.
88 * @GST_NAVIGATION_COMMAND_ACTIVATE: Activate (click) the currently selected
89 * button in a menu, if such a button exists.
90 * @GST_NAVIGATION_COMMAND_PREV_ANGLE: Switch to the previous angle in a
92 * @GST_NAVIGATION_COMMAND_NEXT_ANGLE: Switch to the next angle in a multiangle
95 * A set of commands that may be issued to an element providing the
96 * #GstNavigation interface. The available commands can be queried via
97 * the gst_navigation_query_new_commands() query.
99 * For convenience in handling DVD navigation, the MENU commands are aliased as:
100 * GST_NAVIGATION_COMMAND_DVD_MENU = @GST_NAVIGATION_COMMAND_MENU1
101 * GST_NAVIGATION_COMMAND_DVD_TITLE_MENU = @GST_NAVIGATION_COMMAND_MENU2
102 * GST_NAVIGATION_COMMAND_DVD_ROOT_MENU = @GST_NAVIGATION_COMMAND_MENU3
103 * GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU = @GST_NAVIGATION_COMMAND_MENU4
104 * GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU = @GST_NAVIGATION_COMMAND_MENU5
105 * GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU = @GST_NAVIGATION_COMMAND_MENU6
106 * GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU = @GST_NAVIGATION_COMMAND_MENU7
111 GST_NAVIGATION_COMMAND_INVALID = 0,
113 GST_NAVIGATION_COMMAND_MENU1 = 1,
114 GST_NAVIGATION_COMMAND_MENU2 = 2,
115 GST_NAVIGATION_COMMAND_MENU3 = 3,
116 GST_NAVIGATION_COMMAND_MENU4 = 4,
117 GST_NAVIGATION_COMMAND_MENU5 = 5,
118 GST_NAVIGATION_COMMAND_MENU6 = 6,
119 GST_NAVIGATION_COMMAND_MENU7 = 7,
121 GST_NAVIGATION_COMMAND_LEFT = 20,
122 GST_NAVIGATION_COMMAND_RIGHT = 21,
123 GST_NAVIGATION_COMMAND_UP = 22,
124 GST_NAVIGATION_COMMAND_DOWN = 23,
125 GST_NAVIGATION_COMMAND_ACTIVATE = 24,
127 GST_NAVIGATION_COMMAND_PREV_ANGLE = 30,
128 GST_NAVIGATION_COMMAND_NEXT_ANGLE = 31
129 } GstNavigationCommand;
131 /* Some aliases for the menu command types */
132 #define GST_NAVIGATION_COMMAND_DVD_MENU GST_NAVIGATION_COMMAND_MENU1
133 #define GST_NAVIGATION_COMMAND_DVD_TITLE_MENU GST_NAVIGATION_COMMAND_MENU2
134 #define GST_NAVIGATION_COMMAND_DVD_ROOT_MENU GST_NAVIGATION_COMMAND_MENU3
135 #define GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU GST_NAVIGATION_COMMAND_MENU4
136 #define GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU GST_NAVIGATION_COMMAND_MENU5
137 #define GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU GST_NAVIGATION_COMMAND_MENU6
138 #define GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU GST_NAVIGATION_COMMAND_MENU7
142 * GstNavigationQueryType:
143 * @GST_NAVIGATION_QUERY_INVALID: invalid query
144 * @GST_NAVIGATION_QUERY_COMMANDS: command query
145 * @GST_NAVIGATION_QUERY_ANGLES: viewing angle query
147 * Tyoes of navigation interface queries.
151 GST_NAVIGATION_QUERY_INVALID = 0,
152 GST_NAVIGATION_QUERY_COMMANDS = 1,
153 GST_NAVIGATION_QUERY_ANGLES = 2
154 } GstNavigationQueryType;
156 GstNavigationQueryType gst_navigation_query_get_type (GstQuery *query);
158 GstQuery *gst_navigation_query_new_commands (void);
159 void gst_navigation_query_set_commands (GstQuery *query, gint n_cmds, ...);
160 void gst_navigation_query_set_commandsv (GstQuery *query, gint n_cmds,
161 GstNavigationCommand *cmds);
162 gboolean gst_navigation_query_parse_commands_length (GstQuery *query,
164 gboolean gst_navigation_query_parse_commands_nth (GstQuery *query, guint nth,
165 GstNavigationCommand *cmd);
167 GstQuery *gst_navigation_query_new_angles (void);
168 void gst_navigation_query_set_angles (GstQuery *query, guint cur_angle,
170 gboolean gst_navigation_query_parse_angles (GstQuery *query, guint *cur_angle,
173 /* Element messages */
175 * GstNavigationMessageType:
176 * @GST_NAVIGATION_MESSAGE_INVALID: Returned from
177 * gst_navigation_message_get_type() when the passed message is not a
178 * navigation message.
179 * @GST_NAVIGATION_MESSAGE_MOUSE_OVER: Sent when the mouse moves over or leaves a
180 * clickable region of the output, such as a DVD menu button.
181 * @GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED: Sent when the set of available commands
182 * changes and should re-queried by interested applications.
183 * @GST_NAVIGATION_MESSAGE_ANGLES_CHANGED: Sent when display angles in a multi-angle
184 * feature (such as a multiangle DVD) change - either angles have appeared or
187 * A set of notifications that may be received on the bus when navigation
188 * related status changes.
193 GST_NAVIGATION_MESSAGE_INVALID,
194 GST_NAVIGATION_MESSAGE_MOUSE_OVER,
195 GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED,
196 GST_NAVIGATION_MESSAGE_ANGLES_CHANGED
197 } GstNavigationMessageType;
199 GstNavigationMessageType gst_navigation_message_get_type (GstMessage *message);
201 GstMessage *gst_navigation_message_new_mouse_over (GstObject *src,
203 gboolean gst_navigation_message_parse_mouse_over (GstMessage *message,
206 GstMessage *gst_navigation_message_new_commands_changed (GstObject *src);
208 GstMessage *gst_navigation_message_new_angles_changed (GstObject *src,
211 gboolean gst_navigation_message_parse_angles_changed (GstMessage *message,
215 /* event parsing functions */
217 * GstNavigationEventType:
218 * @GST_NAVIGATION_EVENT_INVALID: Returned from
219 * gst_navigation_event_get_type() when the passed event is not a navigation event.
220 * @GST_NAVIGATION_EVENT_KEY_PRESS: A key press event. Use
221 * gst_navigation_event_parse_key_event() to extract the details from the event.
222 * @GST_NAVIGATION_EVENT_KEY_RELEASE: A key release event. Use
223 * gst_navigation_event_parse_key_event() to extract the details from the event.
224 * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS: A mouse button press event. Use
225 * gst_navigation_event_parse_mouse_button_event() to extract the details from the
227 * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE: A mouse button release event. Use
228 * gst_navigation_event_parse_mouse_button_event() to extract the details from the
230 * @GST_NAVIGATION_EVENT_MOUSE_MOVE: A mouse movement event. Use
231 * gst_navigation_event_parse_mouse_move_event() to extract the details from the
233 * @GST_NAVIGATION_EVENT_COMMAND: A navigation command event. Use
234 * gst_navigation_event_parse_command() to extract the details from the event.
236 * Enum values for the various events that an element implementing the
237 * GstNavigation interface might send up the pipeline.
242 GST_NAVIGATION_EVENT_INVALID = 0,
243 GST_NAVIGATION_EVENT_KEY_PRESS = 1,
244 GST_NAVIGATION_EVENT_KEY_RELEASE = 2,
245 GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS = 3,
246 GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE = 4,
247 GST_NAVIGATION_EVENT_MOUSE_MOVE = 5,
248 GST_NAVIGATION_EVENT_COMMAND = 6
249 } GstNavigationEventType;
251 GstNavigationEventType gst_navigation_event_get_type (GstEvent *event);
252 gboolean gst_navigation_event_parse_key_event (GstEvent *event,
254 gboolean gst_navigation_event_parse_mouse_button_event (GstEvent *event,
255 gint *button, gdouble *x, gdouble *y);
256 gboolean gst_navigation_event_parse_mouse_move_event (GstEvent *event,
257 gdouble *x, gdouble *y);
258 gboolean gst_navigation_event_parse_command (GstEvent *event,
259 GstNavigationCommand *command);
261 /* interface virtual function wrappers */
262 void gst_navigation_send_event (GstNavigation *navigation,
263 GstStructure *structure);
264 void gst_navigation_send_key_event (GstNavigation *navigation,
265 const char *event, const char *key);
266 void gst_navigation_send_mouse_event (GstNavigation *navigation,
267 const char *event, int button, double x, double y);
268 void gst_navigation_send_command (GstNavigation *navigation,
269 GstNavigationCommand command);
273 #endif /* __GST_NAVIGATION_H__ */