Initialize Tizen 2.3
[framework/multimedia/gstreamer0.10.git] / mobile / 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
62 /**
63  * GstURIHandler:
64  *
65  * Opaque #GstURIHandler structure.
66  */
67 typedef struct _GstURIHandler GstURIHandler;
68 typedef struct _GstURIHandlerInterface GstURIHandlerInterface;
69
70 /**
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.
80  *   Since: 0.10.15.
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.
85  *
86  * Any #GstElement using this interface should implement these methods.
87  */
88 struct _GstURIHandlerInterface {
89   GTypeInterface        parent;
90
91   /*< private >*/
92   /* signals */
93   void          (* new_uri)                     (GstURIHandler * handler,
94                                                  const gchar *   uri);
95   /* idea for the future ?
96   gboolean      (* require_password)            (GstURIHandler * handler,
97                                                  gchar **        username,
98                                                  gchar **        password);
99    */
100
101   /* vtable */
102
103   /*< public >*/
104   /* querying capabilities */
105   GstURIType            (* get_type)            (void);
106   gchar **              (* get_protocols)       (void);
107
108   /* using the interface */
109   const gchar *         (* get_uri)             (GstURIHandler * handler);
110   gboolean              (* set_uri)             (GstURIHandler * handler,
111                                                  const gchar *   uri);
112
113   GstURIType            (* get_type_full)       (GType type);
114   gchar **              (* get_protocols_full)  (GType type);
115
116   /*< private >*/
117   /* we might want to add functions here to query features,
118    * someone with gnome-vfs knowledge go ahead */
119
120   gpointer _gst_reserved[GST_PADDING - 2];
121 };
122
123 /* general URI functions */
124
125 gboolean        gst_uri_protocol_is_valid       (const gchar * protocol);
126 gboolean        gst_uri_protocol_is_supported   (const GstURIType type,
127                                                  const gchar *protocol);
128 gboolean        gst_uri_is_valid                (const gchar * uri);
129 gchar *         gst_uri_get_protocol            (const gchar * uri) G_GNUC_MALLOC;
130 gboolean        gst_uri_has_protocol            (const gchar * uri,
131                                                  const gchar * protocol);
132 gchar *         gst_uri_get_location            (const gchar * uri) G_GNUC_MALLOC;
133 gchar *         gst_uri_construct               (const gchar * protocol,
134                                                  const gchar * location) G_GNUC_MALLOC;
135
136 gchar *         gst_filename_to_uri             (const gchar * filename,
137                                                  GError     ** error) G_GNUC_MALLOC;
138
139 GstElement *    gst_element_make_from_uri       (const GstURIType type,
140                                                  const gchar *    uri,
141                                                  const gchar *    elementname) G_GNUC_MALLOC;
142
143 /* accessing the interface */
144 GType           gst_uri_handler_get_type        (void);
145
146 guint           gst_uri_handler_get_uri_type    (GstURIHandler * handler);
147 gchar **        gst_uri_handler_get_protocols   (GstURIHandler * handler);
148 const gchar *   gst_uri_handler_get_uri         (GstURIHandler * handler);
149 gboolean        gst_uri_handler_set_uri         (GstURIHandler * handler,
150                                                  const gchar *   uri);
151 void            gst_uri_handler_new_uri         (GstURIHandler * handler,
152                                                  const gchar *   uri);
153
154 G_END_DECLS
155
156 #endif /* __GST_URI_H__ */