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