|
1 /* GStreamer |
|
2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu> |
|
3 * 2000 Wim Taymans <wtay@chello.be> |
|
4 * |
|
5 * gsturi.h: Header for uri to element mappings |
|
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 |
|
24 #ifndef __GST_URI_H__ |
|
25 #define __GST_URI_H__ |
|
26 |
|
27 #include <glib.h> |
|
28 #include <gst/gstelement.h> |
|
29 #include <gst/gstpluginfeature.h> |
|
30 |
|
31 G_BEGIN_DECLS |
|
32 |
|
33 /** |
|
34 * GstURIType: |
|
35 * @GST_URI_UNKNOWN : The URI direction is unknown |
|
36 * @GST_URI_SINK : The URI is a consumer. |
|
37 * @GST_URI_SRC : The URI is a producer. |
|
38 * |
|
39 * The different types of URI direction. |
|
40 */ |
|
41 |
|
42 typedef enum { |
|
43 GST_URI_UNKNOWN, |
|
44 GST_URI_SINK, |
|
45 GST_URI_SRC |
|
46 } GstURIType; |
|
47 |
|
48 /** |
|
49 * GST_URI_TYPE_IS_VALID: |
|
50 * @type: A #GstURIType |
|
51 * |
|
52 * Tests if the type direction is valid. |
|
53 */ |
|
54 #define GST_URI_TYPE_IS_VALID(type) ((type) == GST_URI_SRC || (type) == GST_URI_SINK) |
|
55 |
|
56 /* uri handler functions */ |
|
57 #define GST_TYPE_URI_HANDLER (gst_uri_handler_get_type ()) |
|
58 #define GST_URI_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_URI_HANDLER, GstURIHandler)) |
|
59 #define GST_IS_URI_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_URI_HANDLER)) |
|
60 #define GST_URI_HANDLER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_URI_HANDLER, GstURIHandlerInterface)) |
|
61 #define GST_URI_HANDLER_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), GST_TYPE_URI_HANDLER, GstURIHandler)) |
|
62 |
|
63 /** |
|
64 * GstURIHandler: |
|
65 * |
|
66 * Opaque #GstURIHandler structure. |
|
67 */ |
|
68 typedef struct _GstURIHandler GstURIHandler; |
|
69 typedef struct _GstURIHandlerInterface GstURIHandlerInterface; |
|
70 |
|
71 /** |
|
72 * GstURIHandlerInterface: |
|
73 * @parent: The parent interface type |
|
74 * @get_type: Method to tell whether the element handles source or sink URI. |
|
75 * @get_protocols: Method to return the list of protocols handled by the element. |
|
76 * @get_uri: Method to return the URI currently handled by the element. |
|
77 * @set_uri: Method to set a new URI. |
|
78 * @get_type_full: Variant of get_type which takes a GType argument. This is |
|
79 * for use by bindings that need to pass context when creating a URI Handler. * If implemented, get_type will be used in preference to get_type_full. |
|
80 * Since: 0.10.15 |
|
81 * @get_protocols_full: Variant of get_type which takes a GType argument. |
|
82 * This is for use by bindings that need to pass context when creating a URI |
|
83 * Handler. If implemented, get_protocols will be used in preference to |
|
84 * get_protocols_full. |
|
85 * Since: 0.10.15 |
|
86 * |
|
87 * #GstElements using this interface should implement these methods. |
|
88 */ |
|
89 struct _GstURIHandlerInterface { |
|
90 GTypeInterface parent; |
|
91 |
|
92 /*< private >*/ |
|
93 /* signals */ |
|
94 void (* new_uri) (GstURIHandler * handler, |
|
95 const gchar * uri); |
|
96 /* idea for the future ? |
|
97 gboolean (* require_password) (GstURIHandler * handler, |
|
98 gchar ** username, |
|
99 gchar ** password); |
|
100 */ |
|
101 |
|
102 /* vtable */ |
|
103 |
|
104 /*< public >*/ |
|
105 /* querying capabilities */ |
|
106 GstURIType (* get_type) (void); |
|
107 gchar ** (* get_protocols) (void); |
|
108 |
|
109 /* using the interface */ |
|
110 G_CONST_RETURN gchar *(* get_uri) (GstURIHandler * handler); |
|
111 gboolean (* set_uri) (GstURIHandler * handler, |
|
112 const gchar * uri); |
|
113 |
|
114 GstURIType (* get_type_full) (GType type); |
|
115 gchar ** (* get_protocols_full) (GType type); |
|
116 |
|
117 /*< private >*/ |
|
118 /* we might want to add functions here to query features, |
|
119 * someone with gnome-vfs knowledge go ahead */ |
|
120 |
|
121 gpointer _gst_reserved[GST_PADDING - 2]; |
|
122 }; |
|
123 |
|
124 /* general URI functions */ |
|
125 #ifdef __SYMBIAN32__ |
|
126 IMPORT_C |
|
127 #endif |
|
128 |
|
129 |
|
130 gboolean gst_uri_protocol_is_valid (const gchar * protocol); |
|
131 #ifdef __SYMBIAN32__ |
|
132 IMPORT_C |
|
133 #endif |
|
134 |
|
135 gboolean gst_uri_protocol_is_supported (const GstURIType type, |
|
136 const gchar *protocol); |
|
137 #ifdef __SYMBIAN32__ |
|
138 IMPORT_C |
|
139 #endif |
|
140 |
|
141 gboolean gst_uri_is_valid (const gchar * uri); |
|
142 #ifdef __SYMBIAN32__ |
|
143 IMPORT_C |
|
144 #endif |
|
145 |
|
146 gchar * gst_uri_get_protocol (const gchar * uri); |
|
147 #ifdef __SYMBIAN32__ |
|
148 IMPORT_C |
|
149 #endif |
|
150 |
|
151 gboolean gst_uri_has_protocol (const gchar * uri, |
|
152 const gchar * protocol); |
|
153 #ifdef __SYMBIAN32__ |
|
154 IMPORT_C |
|
155 #endif |
|
156 |
|
157 gchar * gst_uri_get_location (const gchar * uri); |
|
158 #ifdef __SYMBIAN32__ |
|
159 IMPORT_C |
|
160 #endif |
|
161 |
|
162 gchar * gst_uri_construct (const gchar * protocol, |
|
163 const gchar * location); |
|
164 #ifdef __SYMBIAN32__ |
|
165 IMPORT_C |
|
166 #endif |
|
167 |
|
168 |
|
169 GstElement * gst_element_make_from_uri (const GstURIType type, |
|
170 const gchar * uri, |
|
171 const gchar * elementname); |
|
172 |
|
173 /* accessing the interface */ |
|
174 #ifdef __SYMBIAN32__ |
|
175 IMPORT_C |
|
176 #endif |
|
177 |
|
178 GType gst_uri_handler_get_type (void); |
|
179 #ifdef __SYMBIAN32__ |
|
180 IMPORT_C |
|
181 #endif |
|
182 |
|
183 |
|
184 guint gst_uri_handler_get_uri_type (GstURIHandler * handler); |
|
185 #ifdef __SYMBIAN32__ |
|
186 IMPORT_C |
|
187 #endif |
|
188 |
|
189 gchar ** gst_uri_handler_get_protocols (GstURIHandler * handler); |
|
190 #ifdef __SYMBIAN32__ |
|
191 IMPORT_C |
|
192 #endif |
|
193 |
|
194 G_CONST_RETURN |
|
195 gchar * gst_uri_handler_get_uri (GstURIHandler * handler); |
|
196 #ifdef __SYMBIAN32__ |
|
197 IMPORT_C |
|
198 #endif |
|
199 |
|
200 gboolean gst_uri_handler_set_uri (GstURIHandler * handler, |
|
201 const gchar * uri); |
|
202 #ifdef __SYMBIAN32__ |
|
203 IMPORT_C |
|
204 #endif |
|
205 |
|
206 void gst_uri_handler_new_uri (GstURIHandler * handler, |
|
207 const gchar * uri); |
|
208 |
|
209 G_END_DECLS |
|
210 |
|
211 #endif /* __GST_URI_H__ */ |