Revert again, this time without post-commit reindent hooks to put back the indentatio...
[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 typedef enum {
34   GST_URI_UNKNOWN,
35   GST_URI_SINK,
36   GST_URI_SRC
37 } GstURIType;
38
39 #define GST_URI_TYPE_IS_VALID(type) ((type) == GST_URI_SRC || (type) == GST_URI_SINK)
40
41 /* uri handler functions */
42 #define GST_TYPE_URI_HANDLER            (gst_uri_handler_get_type ())
43 #define GST_URI_HANDLER(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_URI_HANDLER, GstURIHandler))
44 #define GST_IS_URI_HANDLER(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_URI_HANDLER))
45 #define GST_URI_HANDLER_GET_INTERFACE(obj)      (G_TYPE_INSTANCE_GET_INTERFACE ((obj), GST_TYPE_URI_HANDLER, GstURIHandlerInterface))
46 #define GST_URI_HANDLER_CLASS(obj)      (G_TYPE_CHECK_CLASS_CAST ((obj), GST_TYPE_URI_HANDLER, GstURIHandler))
47
48 typedef struct _GstURIHandler GstURIHandler;
49 typedef struct _GstURIHandlerInterface GstURIHandlerInterface;
50
51 struct _GstURIHandlerInterface {
52   GTypeInterface        parent;
53
54   /* signals */
55   void                  (* new_uri)                             (GstURIHandler *        handler,
56                                                                  const gchar *          uri);
57   /* idea for the future ?
58   gboolean              (* require_password)                    (GstURIHandler *        handler,
59                                                                  gchar **               username,
60                                                                  gchar **               password);
61    */
62
63   /* vtable */
64
65   /* querying capabilities */
66   GstURIType            (* get_type)                            (void);
67   gchar **              (* get_protocols)                       (void);
68
69   /* using the interface */
70   G_CONST_RETURN gchar *(* get_uri)                             (GstURIHandler *        handler);
71   gboolean              (* set_uri)                             (GstURIHandler *        handler,
72                                                                  const gchar *          uri);
73   
74   /* we might want to add functions here to query features, someone with gnome-vfs knowledge go ahead */
75
76   gpointer _gst_reserved[GST_PADDING];
77 };
78
79 /* general URI functions */
80
81 gboolean                gst_uri_protocol_is_valid               (const gchar *          protocol);
82 gboolean                gst_uri_is_valid                        (const gchar *          uri);
83 gchar *                 gst_uri_get_protocol                    (const gchar *          uri);
84 gchar *                 gst_uri_get_location                    (const gchar *          uri);
85 gchar *                 gst_uri_construct                       (const gchar *          protocol,
86                                                                  const gchar *          location);
87
88 GstElement *            gst_element_make_from_uri               (const GstURIType       type,
89                                                                  const gchar *          uri,
90                                                                  const gchar *          elementname);
91
92 /* accessing the interface */
93 GType                   gst_uri_handler_get_type                (void);
94
95 guint                   gst_uri_handler_get_uri_type            (GstURIHandler *        handler);
96 gchar **                gst_uri_handler_get_protocols           (GstURIHandler *        handler);
97 G_CONST_RETURN gchar *  gst_uri_handler_get_uri                 (GstURIHandler *        handler);
98 gboolean                gst_uri_handler_set_uri                 (GstURIHandler *        handler,
99                                                                  const gchar *          uri);
100 void                    gst_uri_handler_new_uri                 (GstURIHandler *        handler,
101                                                                  const gchar *          uri);
102
103 G_END_DECLS
104
105 #endif /* __GST_URI_H__ */