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