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.URIHandlerT;
26 
27 public  import glib.ErrorG;
28 public  import glib.GException;
29 public  import glib.Str;
30 public  import gstreamerc.gstreamer;
31 public  import gstreamerc.gstreamertypes;
32 
33 
34 /**
35  * The #GstURIHandler is an interface that is implemented by Source and Sink
36  * #GstElement to unify 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 template URIHandlerT(TStruct)
45 {
46 	/** Get the main Gtk struct */
47 	public GstURIHandler* getURIHandlerStruct()
48 	{
49 		return cast(GstURIHandler*)getStruct();
50 	}
51 
52 	/**
53 	 */
54 
55 	/**
56 	 * Gets the list of protocols supported by @handler. This list may not be
57 	 * modified.
58 	 *
59 	 * Return: the
60 	 *     supported protocols.  Returns %NULL if the @handler isn't
61 	 *     implemented properly, or the @handler doesn't support any
62 	 *     protocols.
63 	 */
64 	public string[] getProtocols()
65 	{
66 		return Str.toStringArray(gst_uri_handler_get_protocols(getURIHandlerStruct()));
67 	}
68 
69 	/**
70 	 * Gets the currently handled URI.
71 	 *
72 	 * Return: the URI currently handled by
73 	 *     the @handler.  Returns %NULL if there are no URI currently
74 	 *     handled. The returned string must be freed with g_free() when no
75 	 *     longer needed.
76 	 */
77 	public string getUri()
78 	{
79 		return Str.toString(gst_uri_handler_get_uri(getURIHandlerStruct()));
80 	}
81 
82 	/**
83 	 * Gets the type of the given URI handler
84 	 *
85 	 * Return: the #GstURIType of the URI handler.
86 	 *     Returns #GST_URI_UNKNOWN if the @handler isn't implemented correctly.
87 	 */
88 	public GstURIType getUriType()
89 	{
90 		return gst_uri_handler_get_uri_type(getURIHandlerStruct());
91 	}
92 
93 	/**
94 	 * Tries to set the URI of the given handler.
95 	 *
96 	 * Params:
97 	 *     uri = URI to set
98 	 *
99 	 * Return: %TRUE if the URI was set successfully, else %FALSE.
100 	 *
101 	 * Throws: GException on failure.
102 	 */
103 	public bool setUri(string uri)
104 	{
105 		GError* err = null;
106 		
107 		auto p = gst_uri_handler_set_uri(getURIHandlerStruct(), Str.toStringz(uri), &err) != 0;
108 		
109 		if (err !is null)
110 		{
111 			throw new GException( new ErrorG(err) );
112 		}
113 		
114 		return p;
115 	}
116 }