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