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