Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / gst-libs / gst / interfaces / navigation.h
1 /* GStreamer Navigation
2  * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
3  * Copyright (C) 2003 David A. Schleef <ds@schleef.org>
4  *
5  * navigation.h: navigation interface design
6  *
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.
11  *
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.
16  *
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.
21  */
22
23 #ifndef __GST_NAVIGATION_H__
24 #define __GST_NAVIGATION_H__
25
26 #include <gst/gst.h>
27
28 G_BEGIN_DECLS
29
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))
38
39 typedef struct _GstNavigation GstNavigation;
40 typedef struct _GstNavigationInterface GstNavigationInterface;
41
42 struct _GstNavigationInterface {
43   GTypeInterface g_iface;
44
45   /* virtual functions */
46   void (*send_event) (GstNavigation *navigation, GstStructure *structure);
47   
48   gpointer _gst_reserved[GST_PADDING];
49 };
50
51 GType           gst_navigation_get_type (void);
52
53 /* Navigation commands */
54
55 /**
56  * GstNavigationCommand:
57  * @GST_NAVIGATION_COMMAND_INVALID: An invalid command entry
58  * @GST_NAVIGATION_COMMAND_MENU1: Execute navigation menu command 1. For DVD,
59  * this enters the DVD root menu, or exits back to the title from the menu.
60  * @GST_NAVIGATION_COMMAND_MENU2: Execute navigation menu command 2. For DVD,
61  * this jumps to the DVD title menu.
62  * @GST_NAVIGATION_COMMAND_MENU3: Execute navigation menu command 3. For DVD,
63  * this jumps into the DVD root menu.
64  * @GST_NAVIGATION_COMMAND_MENU4: Execute navigation menu command 4. For DVD,
65  * this jumps to the Subpicture menu.
66  * @GST_NAVIGATION_COMMAND_MENU5: Execute navigation menu command 5. For DVD,
67  * the jumps to the audio menu.
68  * @GST_NAVIGATION_COMMAND_MENU6: Execute navigation menu command 6. For DVD,
69  * this jumps to the angles menu.
70  * @GST_NAVIGATION_COMMAND_MENU7: Execute navigation menu command 7. For DVD,
71  * this jumps to the chapter menu.
72  * @GST_NAVIGATION_COMMAND_LEFT: Select the next button to the left in a menu,
73  * if such a button exists.
74  * @GST_NAVIGATION_COMMAND_RIGHT: Select the next button to the right in a menu,
75  * if such a button exists.
76  * @GST_NAVIGATION_COMMAND_UP: Select the button above the current one in a
77  * menu, if such a button exists.
78  * @GST_NAVIGATION_COMMAND_DOWN: Select the button below the current one in a
79  * menu, if such a button exists.
80  * @GST_NAVIGATION_COMMAND_ACTIVATE: Activate (click) the currently selected
81  * button in a menu, if such a button exists.
82  * @GST_NAVIGATION_COMMAND_PREV_ANGLE: Switch to the previous angle in a
83  * multiangle feature.
84  * @GST_NAVIGATION_COMMAND_NEXT_ANGLE: Switch to the next angle in a multiangle
85  * feature.
86  *
87  * A set of commands that may be issued to an element providing the
88  * #GstNavigation interface. The available commands can be queried via
89  * the gst_navigation_query_new_commands() query.
90  *
91  * For convenience in handling DVD navigation, the MENU commands are aliased as:
92  *    GST_NAVIGATION_COMMAND_DVD_MENU            = @GST_NAVIGATION_COMMAND_MENU1
93  *    GST_NAVIGATION_COMMAND_DVD_TITLE_MENU      = @GST_NAVIGATION_COMMAND_MENU2
94  *    GST_NAVIGATION_COMMAND_DVD_ROOT_MENU       = @GST_NAVIGATION_COMMAND_MENU3
95  *    GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU = @GST_NAVIGATION_COMMAND_MENU4
96  *    GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU      = @GST_NAVIGATION_COMMAND_MENU5
97  *    GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU      = @GST_NAVIGATION_COMMAND_MENU6
98  *    GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU    = @GST_NAVIGATION_COMMAND_MENU7
99  *
100  * Since: 0.10.23
101  */
102 typedef enum {
103   GST_NAVIGATION_COMMAND_INVALID  = 0,
104
105   GST_NAVIGATION_COMMAND_MENU1    = 1,
106   GST_NAVIGATION_COMMAND_MENU2    = 2,
107   GST_NAVIGATION_COMMAND_MENU3    = 3,
108   GST_NAVIGATION_COMMAND_MENU4    = 4,
109   GST_NAVIGATION_COMMAND_MENU5    = 5,
110   GST_NAVIGATION_COMMAND_MENU6    = 6,
111   GST_NAVIGATION_COMMAND_MENU7    = 7,
112   
113   GST_NAVIGATION_COMMAND_LEFT     = 20,
114   GST_NAVIGATION_COMMAND_RIGHT    = 21,
115   GST_NAVIGATION_COMMAND_UP       = 22,
116   GST_NAVIGATION_COMMAND_DOWN     = 23,
117   GST_NAVIGATION_COMMAND_ACTIVATE = 24,
118
119   GST_NAVIGATION_COMMAND_PREV_ANGLE = 30,
120   GST_NAVIGATION_COMMAND_NEXT_ANGLE = 31
121 } GstNavigationCommand;
122
123 /* Some aliases for the menu command types */
124 #define GST_NAVIGATION_COMMAND_DVD_MENU            GST_NAVIGATION_COMMAND_MENU1
125 #define GST_NAVIGATION_COMMAND_DVD_TITLE_MENU      GST_NAVIGATION_COMMAND_MENU2
126 #define GST_NAVIGATION_COMMAND_DVD_ROOT_MENU       GST_NAVIGATION_COMMAND_MENU3
127 #define GST_NAVIGATION_COMMAND_DVD_SUBPICTURE_MENU GST_NAVIGATION_COMMAND_MENU4
128 #define GST_NAVIGATION_COMMAND_DVD_AUDIO_MENU      GST_NAVIGATION_COMMAND_MENU5
129 #define GST_NAVIGATION_COMMAND_DVD_ANGLE_MENU      GST_NAVIGATION_COMMAND_MENU6
130 #define GST_NAVIGATION_COMMAND_DVD_CHAPTER_MENU    GST_NAVIGATION_COMMAND_MENU7
131
132 /* Queries */
133 typedef enum
134 {
135   GST_NAVIGATION_QUERY_INVALID     = 0,
136   GST_NAVIGATION_QUERY_COMMANDS    = 1,
137   GST_NAVIGATION_QUERY_ANGLES      = 2
138 } GstNavigationQueryType;
139
140 GstNavigationQueryType gst_navigation_query_get_type (GstQuery *query);
141
142 GstQuery *gst_navigation_query_new_commands (void);
143 void gst_navigation_query_set_commands (GstQuery *query, gint n_cmds, ...);
144 void gst_navigation_query_set_commandsv (GstQuery *query, gint n_cmds,
145     GstNavigationCommand *cmds);
146 gboolean gst_navigation_query_parse_commands_length (GstQuery *query,
147                                                  guint *n_cmds);
148 gboolean gst_navigation_query_parse_commands_nth (GstQuery *query, guint nth,
149                                               GstNavigationCommand *cmd);
150
151 GstQuery *gst_navigation_query_new_angles (void);
152 void gst_navigation_query_set_angles (GstQuery *query, guint cur_angle,
153                                       guint n_angles);
154 gboolean gst_navigation_query_parse_angles (GstQuery *query, guint *cur_angle,
155                                             guint *n_angles);
156
157 /* Element messages */
158 /**
159  * GstNavigationMessageType:
160  * @GST_NAVIGATION_MESSAGE_INVALID: Returned from
161  * gst_navigation_message_get_type() when the passed message is not a
162  * navigation message.
163  * @GST_NAVIGATION_MESSAGE_MOUSE_OVER: Sent when the mouse moves over or leaves a
164  * clickable region of the output, such as a DVD menu button.
165  * @GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED: Sent when the set of available commands
166  * changes and should re-queried by interested applications.
167  * @GST_NAVIGATION_MESSAGE_ANGLES_CHANGED: Sent when display angles in a multi-angle
168  * feature (such as a multiangle DVD) change - either angles have appeared or
169  * disappeared.
170  *
171  * A set of notifications that may be received on the bus when navigation
172  * related status changes.
173  *
174  * Since: 0.10.23
175  */
176 typedef enum {
177   GST_NAVIGATION_MESSAGE_INVALID,
178   GST_NAVIGATION_MESSAGE_MOUSE_OVER,
179   GST_NAVIGATION_MESSAGE_COMMANDS_CHANGED,
180   GST_NAVIGATION_MESSAGE_ANGLES_CHANGED
181 } GstNavigationMessageType;
182
183 GstNavigationMessageType gst_navigation_message_get_type (GstMessage *message);
184
185 GstMessage *gst_navigation_message_new_mouse_over (GstObject *src,
186                                                    gboolean active);
187 gboolean gst_navigation_message_parse_mouse_over (GstMessage *message,
188                                               gboolean *active);
189
190 GstMessage *gst_navigation_message_new_commands_changed (GstObject *src);
191
192 GstMessage *gst_navigation_message_new_angles_changed (GstObject *src,
193                                                        guint cur_angle,
194                                                        guint n_angles);
195 gboolean gst_navigation_message_parse_angles_changed (GstMessage *message,
196                                                       guint *cur_angle,
197                                                       guint *n_angles);
198
199 /* event parsing functions */
200 /**
201  * GstNavigationEventType:
202  * @GST_NAVIGATION_EVENT_INVALID: Returned from
203  * gst_navigation_event_get_type() when the passed event is not a navigation event.
204  * @GST_NAVIGATION_EVENT_KEY_PRESS: A key press event. Use
205  * gst_navigation_event_parse_key_event() to extract the details from the event.
206  * @GST_NAVIGATION_EVENT_KEY_RELEASE: A key release event. Use
207  * gst_navigation_event_parse_key_event() to extract the details from the event.
208  * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS: A mouse button press event. Use
209  * gst_navigation_event_parse_mouse_button_event() to extract the details from the
210  * event.
211  * @GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE: A mouse button release event. Use
212  * gst_navigation_event_parse_mouse_button_event() to extract the details from the
213  * event.
214  * @GST_NAVIGATION_EVENT_MOUSE_MOVE: A mouse movement event. Use
215  * gst_navigation_event_parse_mouse_move_event() to extract the details from the
216  * event.
217  * @GST_NAVIGATION_EVENT_COMMAND: A navigation command event. Use
218  * gst_navigation_event_parse_command() to extract the details from the event.
219  *
220  * Enum values for the various events that an element implementing the
221  * GstNavigation interface might send up the pipeline.
222  *
223  * Since: 0.10.23
224  */
225 typedef enum {
226   GST_NAVIGATION_EVENT_INVALID                    = 0,
227   GST_NAVIGATION_EVENT_KEY_PRESS                  = 1,
228   GST_NAVIGATION_EVENT_KEY_RELEASE                = 2,
229   GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS         = 3,
230   GST_NAVIGATION_EVENT_MOUSE_BUTTON_RELEASE       = 4,
231   GST_NAVIGATION_EVENT_MOUSE_MOVE                 = 5,
232   GST_NAVIGATION_EVENT_COMMAND                    = 6
233 } GstNavigationEventType;
234
235 GstNavigationEventType gst_navigation_event_get_type (GstEvent *event);
236 gboolean gst_navigation_event_parse_key_event (GstEvent *event,
237     const gchar **key);
238 gboolean gst_navigation_event_parse_mouse_button_event (GstEvent *event,
239     gint *button, gdouble *x, gdouble *y);
240 gboolean gst_navigation_event_parse_mouse_move_event (GstEvent *event,
241     gdouble *x, gdouble *y);
242 gboolean gst_navigation_event_parse_command (GstEvent *event,
243     GstNavigationCommand *command);
244
245 /* interface virtual function wrappers */
246 void gst_navigation_send_event (GstNavigation *navigation,
247         GstStructure *structure);
248 void gst_navigation_send_key_event (GstNavigation *navigation, 
249         const char *event, const char *key);
250 void gst_navigation_send_mouse_event (GstNavigation *navigation, 
251         const char *event, int button, double x, double y);
252 void gst_navigation_send_command (GstNavigation *navigation,
253         GstNavigationCommand command);
254
255 G_END_DECLS
256
257 #endif /* __GST_NAVIGATION_H__ */