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