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