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  * Conversion parameters:
26  * inFile  = gstreamer-GstUriHandler.html
27  * outPack = gstreamer
28  * outFile = UriHandlerIF
29  * strct   = GstURIHandler
30  * realStrct=
31  * ctorStrct=
32  * clss    = UriHandlerT
33  * interf  = UriHandlerIF
34  * class Code: No
35  * interface Code: No
36  * template for:
37  * extend  = 
38  * implements:
39  * prefixes:
40  * 	- gst_uri_protocol_
41  * omit structs:
42  * omit prefixes:
43  * omit code:
44  * omit signals:
45  * imports:
46  * 	- glib.Str
47  * 	- glib.ErrorG
48  * 	- glib.GException
49  * 	- gstreamer.Element
50  * structWrap:
51  * 	- GstElement* -> Element
52  * module aliases:
53  * local aliases:
54  * overrides:
55  */
56 
57 module gstreamer.UriHandlerIF;
58 
59 public  import gstreamerc.gstreamertypes;
60 
61 private import gstreamerc.gstreamer;
62 private import glib.ConstructionException;
63 private import gobject.ObjectG;
64 
65 
66 private import glib.Str;
67 private import glib.ErrorG;
68 private import glib.GException;
69 private import gstreamer.Element;
70 
71 
72 
73 
74 /**
75  * The URIHandler is an interface that is implemented by Source and Sink
76  * GstElement to simplify then handling of URI.
77  *
78  * An application can use the following functions to quickly get an element
79  * that handles the given URI for reading or writing
80  * (gst_element_make_from_uri()).
81  *
82  * Source and Sink plugins should implement this interface when possible.
83  *
84  * Last reviewed on 2005-11-09 (0.9.4)
85  */
86 public interface UriHandlerIF
87 {
88 	
89 	
90 	public GstURIHandler* getUriHandlerTStruct();
91 	
92 	/** the main Gtk struct as a void* */
93 	protected void* getStruct();
94 	
95 	
96 	/**
97 	 */
98 	
99 	/**
100 	 */
101 	public static GQuark gstUriErrorQuark();
102 	
103 	/**
104 	 * Tests if the given string is a valid protocol identifier. Protocols
105 	 * must consist of alphanumeric characters, '+', '-' and '.' and must
106 	 * start with a alphabetic character. See RFC 3986 Section 3.1.
107 	 * Params:
108 	 * protocol = A string
109 	 * Returns: TRUE if the string is a valid protocol identifier, FALSE otherwise.
110 	 */
111 	public static int isValid(string protocol);
112 	
113 	/**
114 	 * Checks if an element exists that supports the given URI protocol. Note
115 	 * that a positive return value does not imply that a subsequent call to
116 	 * gst_element_make_from_uri() is guaranteed to work.
117 	 * Params:
118 	 * type = Whether to check for a source or a sink
119 	 * protocol = Protocol that should be checked for (e.g. "http" or "smb")
120 	 * Returns: TRUE
121 	 */
122 	public static int isSupported(GstURIType type, string protocol);
123 	
124 	/**
125 	 * Tests if the given string is a valid URI identifier. URIs start with a valid
126 	 * scheme followed by ":" and maybe a string identifying the location.
127 	 * Params:
128 	 * uri = A URI string
129 	 * Returns: TRUE if the string is a valid URI
130 	 */
131 	public static int gstUriIsValid(string uri);
132 	
133 	/**
134 	 * Checks if the protocol of a given valid URI matches protocol.
135 	 * Params:
136 	 * uri = a URI string
137 	 * protocol = a protocol string (e.g. "http")
138 	 * Returns: TRUE if the protocol matches.
139 	 */
140 	public static int gstUriHasProtocol(string uri, string protocol);
141 	
142 	/**
143 	 * Extracts the protocol out of a given valid URI. The returned string must be
144 	 * freed using g_free().
145 	 * Params:
146 	 * uri = A URI string
147 	 * Returns: The protocol for this URI.
148 	 */
149 	public static string gstUriGetProtocol(string uri);
150 	
151 	/**
152 	 * Extracts the location out of a given valid URI, ie. the protocol and "://"
153 	 * are stripped from the URI, which means that the location returned includes
154 	 * the hostname if one is specified. The returned string must be freed using
155 	 * g_free().
156 	 * Free-function: g_free
157 	 * Params:
158 	 * uri = A URI string
159 	 * Returns: the location for this URI. Returns NULL if the URI isn't valid. If the URI does not contain a location, an empty string is returned. [transfer full]
160 	 */
161 	public static string gstUriGetLocation(string uri);
162 	
163 	/**
164 	 * Constructs a URI for a given valid protocol and location.
165 	 * Free-function: g_free
166 	 * Params:
167 	 * protocol = Protocol for URI
168 	 * location = Location for URI. [transfer none]
169 	 * Returns: a new string for this URI. Returns NULL if the given URI protocol is not valid, or the given location is NULL. [transfer full]
170 	 */
171 	public static string gstUriConstruct(string protocol, string location);
172 	
173 	/**
174 	 * Similar to g_filename_to_uri(), but attempts to handle relative file paths
175 	 * as well. Before converting filename into an URI, it will be prefixed by
176 	 * the current working directory if it is a relative path, and then the path
177 	 * will be canonicalised so that it doesn't contain any './' or '../' segments.
178 	 * On Windows filename should be in UTF-8 encoding.
179 	 * Params:
180 	 * filename = absolute or relative file name path
181 	 * Throws: GException on failure.
182 	 */
183 	public static string gstFilenameToUri(string filename);
184 	
185 	/**
186 	 * Creates an element for handling the given URI.
187 	 * Params:
188 	 * type = Whether to create a source or a sink
189 	 * uri = URI to create an element for
190 	 * elementname = Name of created element, can be NULL. [allow-none]
191 	 * Returns: a new element or NULL if none could be created. [transfer floating]
192 	 * Throws: GException on failure.
193 	 */
194 	public static Element gstElementMakeFromUri(GstURIType type, string uri, string elementname);
195 	
196 	/**
197 	 * Gets the type of the given URI handler
198 	 * Returns: the GstURIType of the URI handler. Returns GST_URI_UNKNOWN if the handler isn't implemented correctly.
199 	 */
200 	public GstURIType gstUriHandlerGetUriType();
201 	
202 	/**
203 	 * Gets the list of protocols supported by handler. This list may not be
204 	 * modified.
205 	 * Returns: the supported protocols. Returns NULL if the handler isn't implemented properly, or the handler doesn't support any protocols. [transfer none][element-type utf8]
206 	 */
207 	public string[] gstUriHandlerGetProtocols();
208 	
209 	/**
210 	 * Gets the currently handled URI.
211 	 * Returns: the URI currently handled by the handler. Returns NULL if there are no URI currently handled. The returned string must be freed with g_free() when no longer needed. [transfer full]
212 	 */
213 	public string gstUriHandlerGetUri();
214 	
215 	/**
216 	 * Tries to set the URI of the given handler.
217 	 * Params:
218 	 * uri = URI to set
219 	 * Returns: TRUE if the URI was set successfully, else FALSE.
220 	 * Throws: GException on failure.
221 	 */
222 	public int gstUriHandlerSetUri(string uri);
223 }