2 * Copyright (C) 1999,2000 Erik Walthinsen <omega@cse.ogi.edu>
3 * 2000 Wim Taymans <wtay@chello.be>
5 * gsturi.h: Header for uri to element mappings
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.
28 #include <gst/gstelement.h>
29 #include <gst/gstpluginfeature.h>
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.
39 * The different types of URI direction.
49 * GST_URI_TYPE_IS_VALID:
50 * @type: A #GstURIType
52 * Tests if the type direction is valid.
54 #define GST_URI_TYPE_IS_VALID(type) ((type) == GST_URI_SRC || (type) == GST_URI_SINK)
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))
65 * Opaque #GstURIHandler structure.
67 typedef struct _GstURIHandler GstURIHandler;
68 typedef struct _GstURIHandlerInterface GstURIHandlerInterface;
71 * GstURIHandlerInterface:
72 * @parent: The parent interface type
73 * @get_type: Method to tell whether the element handles source or sink URI.
74 * @get_protocols: Method to return the list of protocols handled by the element.
75 * @get_uri: Method to return the URI currently handled by the element.
76 * @set_uri: Method to set a new URI.
77 * @get_type_full: Variant of get_type which takes a GType argument. This is
78 * for use by bindings that need to pass context when creating a URI Handler.
79 * If implemented, get_type will be used in preference to get_type_full.
81 * @get_protocols_full: Variant of get_protocols 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. Since: 0.10.15.
86 * Any #GstElement using this interface should implement these methods.
88 struct _GstURIHandlerInterface {
89 GTypeInterface parent;
93 void (* new_uri) (GstURIHandler * handler,
95 /* idea for the future ?
96 gboolean (* require_password) (GstURIHandler * handler,
104 /* querying capabilities */
105 GstURIType (* get_type) (GType type);
106 gchar ** (* get_protocols) (GType type);
108 /* using the interface */
109 const gchar * (* get_uri) (GstURIHandler * handler);
110 gboolean (* set_uri) (GstURIHandler * handler,
114 /* we might want to add functions here to query features,
115 * someone with gnome-vfs knowledge go ahead */
117 gpointer _gst_reserved[GST_PADDING];
120 /* general URI functions */
122 gboolean gst_uri_protocol_is_valid (const gchar * protocol);
123 gboolean gst_uri_protocol_is_supported (const GstURIType type,
124 const gchar *protocol);
125 gboolean gst_uri_is_valid (const gchar * uri);
126 gchar * gst_uri_get_protocol (const gchar * uri);
127 gboolean gst_uri_has_protocol (const gchar * uri,
128 const gchar * protocol);
129 gchar * gst_uri_get_location (const gchar * uri);
130 gchar * gst_uri_construct (const gchar * protocol,
131 const gchar * location);
133 gchar * gst_filename_to_uri (const gchar * filename,
136 GstElement * gst_element_make_from_uri (const GstURIType type,
138 const gchar * elementname);
140 /* accessing the interface */
141 GType gst_uri_handler_get_type (void);
143 guint gst_uri_handler_get_uri_type (GstURIHandler * handler);
144 gchar ** gst_uri_handler_get_protocols (GstURIHandler * handler);
145 const gchar * gst_uri_handler_get_uri (GstURIHandler * handler);
146 gboolean gst_uri_handler_set_uri (GstURIHandler * handler,
148 void gst_uri_handler_new_uri (GstURIHandler * handler,
153 #endif /* __GST_URI_H__ */