gst/: Fix docs.
[platform/upstream/gstreamer.git] / gst / gsturi.h
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 typedef struct _GstURIHandler GstURIHandler;
64 typedef struct _GstURIHandlerInterface GstURIHandlerInterface;
65
66 /**
67  * GstURIHandlerInterface:
68  * @parent: The parent interface type
69  * @get_type: Method to tell wether the element handles source or sink URI.
70  * @get_protocols: Method to return the list of protocols handled by the element.
71  * @get_uri: Method to return the URI currently handled by the element.
72  * @set_uri: Method to set a new URI.
73  *
74  * #GstElements using this interface should implement these methods.
75  */
76 struct _GstURIHandlerInterface {
77   GTypeInterface        parent;
78
79   /*< private >*/
80   /* signals */
81   void          (* new_uri)                     (GstURIHandler * handler,
82                                                  const gchar *   uri);
83   /* idea for the future ?
84   gboolean      (* require_password)            (GstURIHandler * handler,
85                                                  gchar **        username,
86                                                  gchar **        password);
87    */
88
89   /* vtable */
90
91   /*< public >*/
92   /* querying capabilities */
93   GstURIType            (* get_type)            (void);
94   gchar **              (* get_protocols)       (void);
95
96   /* using the interface */
97   G_CONST_RETURN gchar *(* get_uri)             (GstURIHandler * handler);
98   gboolean              (* set_uri)             (GstURIHandler * handler,
99                                                  const gchar *   uri);
100
101   /*< private >*/
102   /* we might want to add functions here to query features,
103    * someone with gnome-vfs knowledge go ahead */
104
105   gpointer _gst_reserved[GST_PADDING];
106 };
107
108 /* general URI functions */
109
110 gboolean        gst_uri_protocol_is_valid       (const gchar * protocol);
111 gboolean        gst_uri_is_valid                (const gchar * uri);
112 gchar *         gst_uri_get_protocol            (const gchar * uri);
113 gchar *         gst_uri_get_location            (const gchar * uri);
114 gchar *         gst_uri_construct               (const gchar * protocol,
115                                                  const gchar * location);
116
117 GstElement *    gst_element_make_from_uri       (const GstURIType type,
118                                                  const gchar *    uri,
119                                                  const gchar *    elementname);
120
121 /* accessing the interface */
122 GType           gst_uri_handler_get_type        (void);
123
124 guint           gst_uri_handler_get_uri_type    (GstURIHandler * handler);
125 gchar **        gst_uri_handler_get_protocols   (GstURIHandler * handler);
126 G_CONST_RETURN
127 gchar *         gst_uri_handler_get_uri         (GstURIHandler * handler);
128 gboolean        gst_uri_handler_set_uri         (GstURIHandler * handler,
129                                                  const gchar *   uri);
130 void            gst_uri_handler_new_uri         (GstURIHandler * handler,
131                                                  const gchar *   uri);
132
133 G_END_DECLS
134
135 #endif /* __GST_URI_H__ */