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.Sample;
26 
27 private import glib.ConstructionException;
28 private import gobject.ObjectG;
29 private import gstreamer.Buffer;
30 private import gstreamer.BufferList;
31 private import gstreamer.Caps;
32 private import gstreamer.Segment;
33 private import gstreamer.Structure;
34 private import gstreamerc.gstreamer;
35 public  import gstreamerc.gstreamertypes;
36 
37 
38 /**
39  * A #GstSample is a small object containing data, a type, timing and
40  * extra arbitrary information.
41  */
42 public class Sample
43 {
44 	/** the main Gtk struct */
45 	protected GstSample* gstSample;
46 
47 	/** Get the main Gtk struct */
48 	public GstSample* getSampleStruct()
49 	{
50 		return gstSample;
51 	}
52 
53 	/** the main Gtk struct as a void* */
54 	protected void* getStruct()
55 	{
56 		return cast(void*)gstSample;
57 	}
58 
59 	/**
60 	 * Sets our main struct and passes it to the parent class.
61 	 */
62 	public this (GstSample* gstSample)
63 	{
64 		this.gstSample = gstSample;
65 	}
66 
67 	/**
68 	 */
69 
70 	public static GType getType()
71 	{
72 		return gst_sample_get_type();
73 	}
74 
75 	/**
76 	 * Create a new #GstSample with the provided details.
77 	 *
78 	 * Free-function: gst_sample_unref
79 	 *
80 	 * Params:
81 	 *     buffer = a #GstBuffer, or %NULL
82 	 *     caps = a #GstCaps, or %NULL
83 	 *     segment = a #GstSegment, or %NULL
84 	 *     info = a #GstStructure, or %NULL
85 	 *
86 	 * Return: the new #GstSample. gst_sample_unref()
87 	 *     after usage.
88 	 *
89 	 * Throws: ConstructionException GTK+ fails to create the object.
90 	 */
91 	public this(Buffer buffer, Caps caps, Segment segment, Structure info)
92 	{
93 		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());
94 		
95 		if(p is null)
96 		{
97 			throw new ConstructionException("null returned by new");
98 		}
99 		
100 		this(cast(GstSample*) p);
101 	}
102 
103 	/**
104 	 * Get the buffer associated with @sample
105 	 *
106 	 * Return: the buffer of @sample or %NULL
107 	 *     when there is no buffer. The buffer remains valid as long as
108 	 *     @sample is valid.  If you need to hold on to it for longer than
109 	 *     that, take a ref to the buffer with gst_buffer_ref().
110 	 */
111 	public Buffer getBuffer()
112 	{
113 		auto p = gst_sample_get_buffer(gstSample);
114 		
115 		if(p is null)
116 		{
117 			return null;
118 		}
119 		
120 		return ObjectG.getDObject!(Buffer)(cast(GstBuffer*) p);
121 	}
122 
123 	/**
124 	 * Get the buffer list associated with @sample
125 	 *
126 	 * Return: the buffer list of @sample or %NULL
127 	 *     when there is no buffer list. The buffer list remains valid as long as
128 	 *     @sample is valid.  If you need to hold on to it for longer than
129 	 *     that, take a ref to the buffer list with gst_mini_object_ref ().
130 	 *
131 	 * Since: 1.6
132 	 */
133 	public BufferList getBufferList()
134 	{
135 		auto p = gst_sample_get_buffer_list(gstSample);
136 		
137 		if(p is null)
138 		{
139 			return null;
140 		}
141 		
142 		return ObjectG.getDObject!(BufferList)(cast(GstBufferList*) p);
143 	}
144 
145 	/**
146 	 * Get the caps associated with @sample
147 	 *
148 	 * Return: the caps of @sample or %NULL
149 	 *     when there is no caps. The caps remain valid as long as @sample is
150 	 *     valid.  If you need to hold on to the caps for longer than that,
151 	 *     take a ref to the caps with gst_caps_ref().
152 	 */
153 	public Caps getCaps()
154 	{
155 		auto p = gst_sample_get_caps(gstSample);
156 		
157 		if(p is null)
158 		{
159 			return null;
160 		}
161 		
162 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
163 	}
164 
165 	/**
166 	 * Get extra information associated with @sample.
167 	 *
168 	 * Return: the extra info of @sample.
169 	 *     The info remains valid as long as @sample is valid.
170 	 */
171 	public Structure getInfo()
172 	{
173 		auto p = gst_sample_get_info(gstSample);
174 		
175 		if(p is null)
176 		{
177 			return null;
178 		}
179 		
180 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
181 	}
182 
183 	/**
184 	 * Get the segment associated with @sample
185 	 *
186 	 * Return: the segment of @sample.
187 	 *     The segment remains valid as long as @sample is valid.
188 	 */
189 	public Segment getSegment()
190 	{
191 		auto p = gst_sample_get_segment(gstSample);
192 		
193 		if(p is null)
194 		{
195 			return null;
196 		}
197 		
198 		return ObjectG.getDObject!(Segment)(cast(GstSegment*) p);
199 	}
200 
201 	/**
202 	 * Set the buffer list associated with @sample
203 	 *
204 	 * Params:
205 	 *     bufferList = a #GstBufferList
206 	 *
207 	 * Since: 1.6
208 	 */
209 	public void setBufferList(BufferList bufferList)
210 	{
211 		gst_sample_set_buffer_list(gstSample, (bufferList is null) ? null : bufferList.getBufferListStruct());
212 	}
213 }