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 * Conversion parameters: 26 * inFile = gstreamer-GstSample.html 27 * outPack = gstreamer 28 * outFile = Sample 29 * strct = GstSample 30 * realStrct= 31 * ctorStrct= 32 * clss = Sample 33 * interf = 34 * class Code: No 35 * interface Code: No 36 * template for: 37 * extend = 38 * implements: 39 * prefixes: 40 * - gst_sample_ 41 * omit structs: 42 * omit prefixes: 43 * omit code: 44 * omit signals: 45 * imports: 46 * - gstreamer.Buffer 47 * - gstreamer.Caps 48 * - gstreamer.Segment 49 * - gstreamer.Structure 50 * structWrap: 51 * - GstBuffer* -> Buffer 52 * - GstCaps* -> Caps 53 * - GstSample* -> Sample 54 * - GstSegment* -> Segment 55 * - GstStructure* -> Structure 56 * module aliases: 57 * local aliases: 58 * overrides: 59 */ 60 61 module gstreamer.Sample; 62 63 public import gstreamerc.gstreamertypes; 64 65 private import gstreamerc.gstreamer; 66 private import glib.ConstructionException; 67 private import gobject.ObjectG; 68 69 70 private import gstreamer.Buffer; 71 private import gstreamer.Caps; 72 private import gstreamer.Segment; 73 private import gstreamer.Structure; 74 75 76 77 78 /** 79 * A GstSample is a small object containing data, a type, timing and 80 * extra arbitrary information. 81 * 82 * Last reviewed on 2012-03-29 (0.11.3) 83 */ 84 public class Sample 85 { 86 87 /** the main Gtk struct */ 88 protected GstSample* gstSample; 89 90 91 public GstSample* getSampleStruct() 92 { 93 return gstSample; 94 } 95 96 97 /** the main Gtk struct as a void* */ 98 protected void* getStruct() 99 { 100 return cast(void*)gstSample; 101 } 102 103 /** 104 * Sets our main struct and passes it to the parent class 105 */ 106 public this (GstSample* gstSample) 107 { 108 this.gstSample = gstSample; 109 } 110 111 /** 112 */ 113 114 /** 115 * Get the buffer associated with sample 116 * Returns: the buffer of sample or NULL when there is no buffer. The buffer remains valid as long as sample is valid. If you need to hold on to it for longer than that, take a ref to the buffer with gst_buffer_ref(). [transfer none] 117 */ 118 public Buffer getBuffer() 119 { 120 // GstBuffer * gst_sample_get_buffer (GstSample *sample); 121 auto p = gst_sample_get_buffer(gstSample); 122 123 if(p is null) 124 { 125 return null; 126 } 127 128 return ObjectG.getDObject!(Buffer)(cast(GstBuffer*) p); 129 } 130 131 /** 132 * Get the caps associated with sample 133 * Returns: the caps of sample or NULL when there is no caps. The caps remain valid as long as sample is valid. If you need to hold on to the caps for longer than that, take a ref to the caps with gst_caps_ref(). [transfer none] 134 */ 135 public Caps getCaps() 136 { 137 // GstCaps * gst_sample_get_caps (GstSample *sample); 138 auto p = gst_sample_get_caps(gstSample); 139 140 if(p is null) 141 { 142 return null; 143 } 144 145 return ObjectG.getDObject!(Caps)(cast(GstCaps*) p); 146 } 147 148 /** 149 * Get extra information associated with sample. 150 * Returns: the extra info of sample. The info remains valid as long as sample is valid. [transfer none] 151 */ 152 public Structure getInfo() 153 { 154 // const GstStructure * gst_sample_get_info (GstSample *sample); 155 auto p = gst_sample_get_info(gstSample); 156 157 if(p is null) 158 { 159 return null; 160 } 161 162 return ObjectG.getDObject!(Structure)(cast(GstStructure*) p); 163 } 164 165 /** 166 * Get the segment associated with sample 167 * Returns: the segment of sample. The segment remains valid as long as sample is valid. [transfer none] 168 */ 169 public Segment getSegment() 170 { 171 // GstSegment * gst_sample_get_segment (GstSample *sample); 172 auto p = gst_sample_get_segment(gstSample); 173 174 if(p is null) 175 { 176 return null; 177 } 178 179 return ObjectG.getDObject!(Segment)(cast(GstSegment*) p); 180 } 181 182 /** 183 * Create a new GstSample with the provided details. 184 * Free-function: gst_sample_unref 185 * Params: 186 * buffer = a GstBuffer, or NULL. [transfer none][allow-none] 187 * caps = a GstCaps, or NULL. [transfer none][allow-none] 188 * segment = a GstSegment, or NULL. [transfer none][allow-none] 189 * info = a GstStructure, or NULL. [transfer full][allow-none] 190 * Throws: ConstructionException GTK+ fails to create the object. 191 */ 192 public this (Buffer buffer, Caps caps, Segment segment, Structure info) 193 { 194 // GstSample * gst_sample_new (GstBuffer *buffer, GstCaps *caps, const GstSegment *segment, GstStructure *info); 195 auto p = gst_sample_new((buffer is null) ? null : buffer.getBufferStruct(), (caps is null) ? null : caps.getCapsStruct(), (segment is null) ? null : segment.getSegmentStruct(), (info is null) ? null : info.getStructureStruct()); 196 if(p is null) 197 { 198 throw new ConstructionException("null returned by gst_sample_new((buffer is null) ? null : buffer.getBufferStruct(), (caps is null) ? null : caps.getCapsStruct(), (segment is null) ? null : segment.getSegmentStruct(), (info is null) ? null : info.getStructureStruct())"); 199 } 200 this(cast(GstSample*) p); 201 } 202 203 /** 204 * Increases the refcount of the given sample by one. 205 * Returns: sample. [transfer full] 206 */ 207 public Sample doref() 208 { 209 // GstSample * gst_sample_ref (GstSample *sample); 210 auto p = gst_sample_ref(gstSample); 211 212 if(p is null) 213 { 214 return null; 215 } 216 217 return ObjectG.getDObject!(Sample)(cast(GstSample*) p); 218 } 219 220 /** 221 * Decreases the refcount of the sample. If the refcount reaches 0, the 222 * sample will be freed. 223 */ 224 public void unref() 225 { 226 // void gst_sample_unref (GstSample *sample); 227 gst_sample_unref(gstSample); 228 } 229 }