1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gstreamer.URIHandlerIF;
26 
27 private import glib.ErrorG;
28 private import glib.GException;
29 private import glib.Str;
30 private import gstreamerc.gstreamer;
31 public  import gstreamerc.gstreamertypes;
32 
33 
34 /**
35  * The URIHandler is an interface that is implemented by Source and Sink
36  * #GstElement to simplify then handling of URI.
37  * 
38  * An application can use the following functions to quickly get an element
39  * that handles the given URI for reading or writing
40  * (gst_element_make_from_uri()).
41  * 
42  * Source and Sink plugins should implement this interface when possible.
43  */
44 public interface URIHandlerIF{
45 	/** Get the main Gtk struct */
46 	public GstURIHandler* getURIHandlerStruct();
47 
48 	/** the main Gtk struct as a void* */
49 	protected void* getStruct();
50 
51 	/**
52 	 */
53 
54 	/**
55 	 * Gets the list of protocols supported by @handler. This list may not be
56 	 * modified.
57 	 *
58 	 * Return: the
59 	 *     supported protocols.  Returns %NULL if the @handler isn't
60 	 *     implemented properly, or the @handler doesn't support any
61 	 *     protocols.
62 	 */
63 	public string[] getProtocols();
64 
65 	/**
66 	 * Gets the currently handled URI.
67 	 *
68 	 * Return: the URI currently handled by
69 	 *     the @handler.  Returns %NULL if there are no URI currently
70 	 *     handled. The returned string must be freed with g_free() when no
71 	 *     longer needed.
72 	 */
73 	public string getUri();
74 
75 	/**
76 	 * Gets the type of the given URI handler
77 	 *
78 	 * Return: the #GstURIType of the URI handler.
79 	 *     Returns #GST_URI_UNKNOWN if the @handler isn't implemented correctly.
80 	 */
81 	public GstURIType getUriType();
82 
83 	/**
84 	 * Tries to set the URI of the given handler.
85 	 *
86 	 * Params:
87 	 *     uri = URI to set
88 	 *
89 	 * Return: %TRUE if the URI was set successfully, else %FALSE.
90 	 *
91 	 * Throws: GException on failure.
92 	 */
93 	public bool setUri(string uri);
94 
95 	/**
96 	 * Similar to g_filename_to_uri(), but attempts to handle relative file paths
97 	 * as well. Before converting @filename into an URI, it will be prefixed by
98 	 * the current working directory if it is a relative path, and then the path
99 	 * will be canonicalised so that it doesn't contain any './' or '../' segments.
100 	 *
101 	 * On Windows #filename should be in UTF-8 encoding.
102 	 *
103 	 * Params:
104 	 *     filename = absolute or relative file name path
105 	 *
106 	 * Throws: GException on failure.
107 	 */
108 	public static string filenameToUri(string filename);
109 
110 	/**
111 	 * Constructs a URI for a given valid protocol and location.
112 	 *
113 	 * Free-function: g_free
114 	 *
115 	 * Params:
116 	 *     protocol = Protocol for URI
117 	 *     location = Location for URI
118 	 *
119 	 * Return: a new string for this URI. Returns %NULL if the
120 	 *     given URI protocol is not valid, or the given location is %NULL.
121 	 */
122 	public static string uriConstruct(string protocol, string location);
123 
124 	public static GQuark uriErrorQuark();
125 
126 	/**
127 	 * Extracts the location out of a given valid URI, ie. the protocol and "://"
128 	 * are stripped from the URI, which means that the location returned includes
129 	 * the hostname if one is specified. The returned string must be freed using
130 	 * g_free().
131 	 *
132 	 * Free-function: g_free
133 	 *
134 	 * Params:
135 	 *     uri = A URI string
136 	 *
137 	 * Return: the location for this URI. Returns %NULL if the
138 	 *     URI isn't valid. If the URI does not contain a location, an empty
139 	 *     string is returned.
140 	 */
141 	public static string uriGetLocation(string uri);
142 
143 	/**
144 	 * Extracts the protocol out of a given valid URI. The returned string must be
145 	 * freed using g_free().
146 	 *
147 	 * Params:
148 	 *     uri = A URI string
149 	 *
150 	 * Return: The protocol for this URI.
151 	 */
152 	public static string uriGetProtocol(string uri);
153 
154 	/**
155 	 * Checks if the protocol of a given valid URI matches @protocol.
156 	 *
157 	 * Params:
158 	 *     uri = a URI string
159 	 *     protocol = a protocol string (e.g. "http")
160 	 *
161 	 * Return: %TRUE if the protocol matches.
162 	 */
163 	public static bool uriHasProtocol(string uri, string protocol);
164 
165 	/**
166 	 * Tests if the given string is a valid URI identifier. URIs start with a valid
167 	 * scheme followed by ":" and maybe a string identifying the location.
168 	 *
169 	 * Params:
170 	 *     uri = A URI string
171 	 *
172 	 * Return: %TRUE if the string is a valid URI
173 	 */
174 	public static bool uriIsValid(string uri);
175 
176 	/**
177 	 * Checks if an element exists that supports the given URI protocol. Note
178 	 * that a positive return value does not imply that a subsequent call to
179 	 * gst_element_make_from_uri() is guaranteed to work.
180 	 *
181 	 * Params:
182 	 *     type = Whether to check for a source or a sink
183 	 *     protocol = Protocol that should be checked for (e.g. "http" or "smb")
184 	 *
185 	 * Return: %TRUE
186 	 */
187 	public static bool uriProtocolIsSupported(GstURIType type, string protocol);
188 
189 	/**
190 	 * Tests if the given string is a valid protocol identifier. Protocols
191 	 * must consist of alphanumeric characters, '+', '-' and '.' and must
192 	 * start with a alphabetic character. See RFC 3986 Section 3.1.
193 	 *
194 	 * Params:
195 	 *     protocol = A string
196 	 *
197 	 * Return: %TRUE if the string is a valid protocol identifier, %FALSE otherwise.
198 	 */
199 	public static bool uriProtocolIsValid(string protocol);
200 }