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.Stream;
26 
27 private import glib.ConstructionException;
28 private import glib.Str;
29 private import gobject.ObjectG;
30 private import gstreamer.Caps;
31 private import gstreamer.ObjectGst;
32 private import gstreamer.TagList;
33 private import gstreamerc.gstreamer;
34 public  import gstreamerc.gstreamertypes;
35 
36 
37 /**
38  * A high-level object representing a single stream. It might be backed, or
39  * not, by an actual flow of data in a pipeline (#GstPad).
40  * 
41  * A #GstStream does not care about data changes (such as decoding, encoding,
42  * parsing,...) as long as the underlying data flow corresponds to the same
43  * high-level flow (ex: a certain audio track).
44  * 
45  * A #GstStream contains all the information pertinent to a stream, such as
46  * stream-id, tags, caps, type, ...
47  * 
48  * Elements can subclass a #GstStream for internal usage (to contain information
49  * pertinent to streams of data).
50  */
51 public class Stream : ObjectGst
52 {
53 	/** the main Gtk struct */
54 	protected GstStream* gstStream;
55 
56 	/** Get the main Gtk struct */
57 	public GstStream* getStreamStruct(bool transferOwnership = false)
58 	{
59 		if (transferOwnership)
60 			ownedRef = false;
61 		return gstStream;
62 	}
63 
64 	/** the main Gtk struct as a void* */
65 	protected override void* getStruct()
66 	{
67 		return cast(void*)gstStream;
68 	}
69 
70 	protected override void setStruct(GObject* obj)
71 	{
72 		gstStream = cast(GstStream*)obj;
73 		super.setStruct(obj);
74 	}
75 
76 	/**
77 	 * Sets our main struct and passes it to the parent class.
78 	 */
79 	public this (GstStream* gstStream, bool ownedRef = false)
80 	{
81 		this.gstStream = gstStream;
82 		super(cast(GstObject*)gstStream, ownedRef);
83 	}
84 
85 
86 	/** */
87 	public static GType getType()
88 	{
89 		return gst_stream_get_type();
90 	}
91 
92 	/**
93 	 * Create a new #GstStream for the given @stream_id, @caps, @type
94 	 * and @flags
95 	 *
96 	 * Params:
97 	 *     streamId = the id for the new stream. If %NULL,
98 	 *         a new one will be automatically generated
99 	 *     caps = the #GstCaps of the stream
100 	 *     type = the #GstStreamType of the stream
101 	 *     flags = the #GstStreamFlags of the stream
102 	 *
103 	 * Returns: The new #GstStream
104 	 *
105 	 * Since: 1.10
106 	 *
107 	 * Throws: ConstructionException GTK+ fails to create the object.
108 	 */
109 	public this(string streamId, Caps caps, GstStreamType type, GstStreamFlags flags)
110 	{
111 		auto p = gst_stream_new(Str.toStringz(streamId), (caps is null) ? null : caps.getCapsStruct(), type, flags);
112 		
113 		if(p is null)
114 		{
115 			throw new ConstructionException("null returned by new");
116 		}
117 		
118 		this(cast(GstStream*) p);
119 	}
120 
121 	/**
122 	 * Retrieve the caps for @stream, if any
123 	 *
124 	 * Returns: The #GstCaps for @stream
125 	 *
126 	 * Since: 1.10
127 	 */
128 	public Caps getCaps()
129 	{
130 		auto p = gst_stream_get_caps(gstStream);
131 		
132 		if(p is null)
133 		{
134 			return null;
135 		}
136 		
137 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
138 	}
139 
140 	/**
141 	 * Retrieve the current stream flags for @stream
142 	 *
143 	 * Returns: The #GstStreamFlags for @stream
144 	 *
145 	 * Since: 1.10
146 	 */
147 	public GstStreamFlags getStreamFlags()
148 	{
149 		return gst_stream_get_stream_flags(gstStream);
150 	}
151 
152 	/**
153 	 * Returns the stream ID of @stream.
154 	 *
155 	 * Returns: the stream ID of @stream. Only valid
156 	 *     during the lifetime of @stream.
157 	 *
158 	 * Since: 1.10
159 	 */
160 	public string getStreamId()
161 	{
162 		return Str.toString(gst_stream_get_stream_id(gstStream));
163 	}
164 
165 	/**
166 	 * Retrieve the stream type for @stream
167 	 *
168 	 * Returns: The #GstStreamType for @stream
169 	 *
170 	 * Since: 1.10
171 	 */
172 	public GstStreamType getStreamType()
173 	{
174 		return gst_stream_get_stream_type(gstStream);
175 	}
176 
177 	/**
178 	 * Retrieve the tags for @stream, if any
179 	 *
180 	 * Returns: The #GstTagList for @stream
181 	 *
182 	 * Since: 1.10
183 	 */
184 	public TagList getTags()
185 	{
186 		auto p = gst_stream_get_tags(gstStream);
187 		
188 		if(p is null)
189 		{
190 			return null;
191 		}
192 		
193 		return ObjectG.getDObject!(TagList)(cast(GstTagList*) p, true);
194 	}
195 
196 	/**
197 	 * Set the caps for the #GstStream
198 	 *
199 	 * Params:
200 	 *     caps = a #GstCaps
201 	 *
202 	 * Since: 1.10
203 	 */
204 	public void setCaps(Caps caps)
205 	{
206 		gst_stream_set_caps(gstStream, (caps is null) ? null : caps.getCapsStruct());
207 	}
208 
209 	/**
210 	 * Set the @flags for the @stream.
211 	 *
212 	 * Params:
213 	 *     flags = the flags to set on @stream
214 	 *
215 	 * Since: 1.10
216 	 */
217 	public void setStreamFlags(GstStreamFlags flags)
218 	{
219 		gst_stream_set_stream_flags(gstStream, flags);
220 	}
221 
222 	/**
223 	 * Set the stream type of @stream
224 	 *
225 	 * Params:
226 	 *     streamType = the type to set on @stream
227 	 *
228 	 * Since: 1.10
229 	 */
230 	public void setStreamType(GstStreamType streamType)
231 	{
232 		gst_stream_set_stream_type(gstStream, streamType);
233 	}
234 
235 	/**
236 	 * Set the tags for the #GstStream
237 	 *
238 	 * Params:
239 	 *     tags = a #GstTagList
240 	 *
241 	 * Since: 1.10
242 	 */
243 	public void setTags(TagList tags)
244 	{
245 		gst_stream_set_tags(gstStream, (tags is null) ? null : tags.getTagListStruct());
246 	}
247 }