tizen 2.3 release
[framework/multimedia/gst-plugins-base0.10.git] / 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 /**
43  * GstNavigationInterface:
44  * @g_iface: the parent interface
45  * @send_event: sending a navigation event
46  *
47  * Color-balance interface.
48  */
49 struct _GstNavigationInterface {
50   GTypeInterface g_iface;
51
52   /* virtual functions */
53   void (*send_event) (GstNavigation *navigation, GstStructure *structure);
54
55   /*< private >*/
56   gpointer _gst_reserved[GST_PADDING];
57 };
58
59 GType           gst_navigation_get_type (void);
60
61 /* Navigation commands */
62
63 /**
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
91  * multiangle feature.
92  * @GST_NAVIGATION_COMMAND_NEXT_ANGLE: Switch to the next angle in a multiangle
93  * feature.
94  *
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.
98  *
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
107  *
108  * Since: 0.10.23
109  */
110 typedef enum {
111   GST_NAVIGATION_COMMAND_INVALID  = 0,
112
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,
120
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,
126
127   GST_NAVIGATION_COMMAND_PREV_ANGLE = 30,
128   GST_NAVIGATION_COMMAND_NEXT_ANGLE = 31
129 } GstNavigationCommand;
130
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
139
140 /* Queries */
141 /**
142  * GstNavigationQueryType:
143  * @GST_NAVIGATION_QUERY_INVALID: invalid query
144  * @GST_NAVIGATION_QUERY_COMMANDS: command query
145  * @GST_NAVIGATION_QUERY_ANGLES: viewing angle query
146  *
147  * Tyoes of navigation interface queries.
148  */
149 typedef enum
150 {
151   GST_NAVIGATION_QUERY_INVALID     = 0,
152   GST_NAVIGATION_QUERY_COMMANDS    = 1,
153   GST_NAVIGATION_QUERY_ANGLES      = 2
154 } GstNavigationQueryType;
155
156 GstNavigationQueryType gst_navigation_query_get_type (GstQuery *query);
157
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,
163                                                  guint *n_cmds);
164 gboolean gst_navigation_query_parse_commands_nth (GstQuery *query, guint nth,
165                                               GstNavigationCommand *cmd);
166
167 GstQuery *gst_navigation_query_new_angles (void);
168 void gst_navigation_query_set_angles (GstQuery *query, guint cur_angle,
169                                       guint n_angles);
170 gboolean gst_navigation_query_parse_angles (GstQuery *query, guint *cur_angle,
171                                             guint *n_angles);
172
173 /* Element messages */
174 /**
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
185  * disappeared.
186  *
187  * A set of notifications that may be received on the bus when navigation
188  * related status changes.
189  *
190  * Since: 0.10.23
191  */
192 typedef enum {
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;
198
199 GstNavigationMessageType gst_navigation_message_get_type (GstMessage *message);
200
201 GstMessage *gst_navigation_message_new_mouse_over (GstObject *src,
202                                                    gboolean active);
203 gboolean gst_navigation_message_parse_mouse_over (GstMessage *message,
204                                               gboolean *active);
205
206 GstMessage *gst_navigation_message_new_commands_changed (GstObject *src);
207
208 GstMessage *gst_navigation_message_new_angles_changed (GstObject *src,
209                                                        guint cur_angle,
210                                                        guint n_angles);
211 gboolean gst_navigation_message_parse_angles_changed (GstMessage *message,
212                                                       guint *cur_angle,
213                                                       guint *n_angles);
214
215 /* event parsing functions */
216 /**
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
226  * event.
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
229  * event.
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
232  * event.
233  * @GST_NAVIGATION_EVENT_COMMAND: A navigation command event. Use
234  * gst_navigation_event_parse_command() to extract the details from the event.
235  *
236  * Enum values for the various events that an element implementing the
237  * GstNavigation interface might send up the pipeline.
238  *
239  * Since: 0.10.23
240  */
241 typedef enum {
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;
250
251 GstNavigationEventType gst_navigation_event_get_type (GstEvent *event);
252 gboolean gst_navigation_event_parse_key_event (GstEvent *event,
253     const gchar **key);
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);
260
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);
270
271 G_END_DECLS
272
273 #endif /* __GST_NAVIGATION_H__ */