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 private import gstreamer.Buffer;
70 private import gstreamer.Caps;
71 private import gstreamer.Segment;
72 private import gstreamer.Structure;
73 
74 
75 
76 /**
77  * A GstSample is a small object containing data, a type, timing and
78  * extra arbitrary information.
79  *
80  * Last reviewed on 2012-03-29 (0.11.3)
81  */
82 public class Sample
83 {
84 	
85 	/** the main Gtk struct */
86 	protected GstSample* gstSample;
87 	
88 	
89 	/** Get the main Gtk struct */
90 	public GstSample* getSampleStruct()
91 	{
92 		return gstSample;
93 	}
94 	
95 	
96 	/** the main Gtk struct as a void* */
97 	protected void* getStruct()
98 	{
99 		return cast(void*)gstSample;
100 	}
101 	
102 	/**
103 	 * Sets our main struct and passes it to the parent class
104 	 */
105 	public this (GstSample* gstSample)
106 	{
107 		this.gstSample = gstSample;
108 	}
109 	
110 	/**
111 	 */
112 	
113 	/**
114 	 * Get the buffer associated with sample
115 	 * 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]
116 	 */
117 	public Buffer getBuffer()
118 	{
119 		// GstBuffer * gst_sample_get_buffer (GstSample *sample);
120 		auto p = gst_sample_get_buffer(gstSample);
121 		
122 		if(p is null)
123 		{
124 			return null;
125 		}
126 		
127 		return ObjectG.getDObject!(Buffer)(cast(GstBuffer*) p);
128 	}
129 	
130 	/**
131 	 * Get the caps associated with sample
132 	 * 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]
133 	 */
134 	public Caps getCaps()
135 	{
136 		// GstCaps * gst_sample_get_caps (GstSample *sample);
137 		auto p = gst_sample_get_caps(gstSample);
138 		
139 		if(p is null)
140 		{
141 			return null;
142 		}
143 		
144 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
145 	}
146 	
147 	/**
148 	 * Get extra information associated with sample.
149 	 * Returns: the extra info of sample. The info remains valid as long as sample is valid. [transfer none]
150 	 */
151 	public Structure getInfo()
152 	{
153 		// const GstStructure * gst_sample_get_info (GstSample *sample);
154 		auto p = gst_sample_get_info(gstSample);
155 		
156 		if(p is null)
157 		{
158 			return null;
159 		}
160 		
161 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
162 	}
163 	
164 	/**
165 	 * Get the segment associated with sample
166 	 * Returns: the segment of sample. The segment remains valid as long as sample is valid. [transfer none]
167 	 */
168 	public Segment getSegment()
169 	{
170 		// GstSegment * gst_sample_get_segment (GstSample *sample);
171 		auto p = gst_sample_get_segment(gstSample);
172 		
173 		if(p is null)
174 		{
175 			return null;
176 		}
177 		
178 		return ObjectG.getDObject!(Segment)(cast(GstSegment*) p);
179 	}
180 	
181 	/**
182 	 * Create a new GstSample with the provided details.
183 	 * Free-function: gst_sample_unref
184 	 * Params:
185 	 * buffer = a GstBuffer, or NULL. [transfer none][allow-none]
186 	 * caps = a GstCaps, or NULL. [transfer none][allow-none]
187 	 * segment = a GstSegment, or NULL. [transfer none][allow-none]
188 	 * info = a GstStructure, or NULL. [transfer full][allow-none]
189 	 * Throws: ConstructionException GTK+ fails to create the object.
190 	 */
191 	public this (Buffer buffer, Caps caps, Segment segment, Structure info)
192 	{
193 		// GstSample * gst_sample_new (GstBuffer *buffer,  GstCaps *caps,  const GstSegment *segment,  GstStructure *info);
194 		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());
195 		if(p is null)
196 		{
197 			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())");
198 		}
199 		this(cast(GstSample*) p);
200 	}
201 	
202 	/**
203 	 * Increases the refcount of the given sample by one.
204 	 * Returns: sample. [transfer full]
205 	 */
206 	public Sample doref()
207 	{
208 		// GstSample * gst_sample_ref (GstSample *sample);
209 		auto p = gst_sample_ref(gstSample);
210 		
211 		if(p is null)
212 		{
213 			return null;
214 		}
215 		
216 		return ObjectG.getDObject!(Sample)(cast(GstSample*) p);
217 	}
218 	
219 	/**
220 	 * Decreases the refcount of the sample. If the refcount reaches 0, the
221 	 * sample will be freed.
222 	 */
223 	public void unref()
224 	{
225 		// void gst_sample_unref (GstSample *sample);
226 		gst_sample_unref(gstSample);
227 	}
228 }