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 	public static GType getType()
70 	{
71 		return gst_sample_get_type();
72 	}
73 
74 	/**
75 	 * Create a new #GstSample with the provided details.
76 	 *
77 	 * Free-function: gst_sample_unref
78 	 *
79 	 * Params:
80 	 *     buffer = a #GstBuffer, or %NULL
81 	 *     caps = a #GstCaps, or %NULL
82 	 *     segment = a #GstSegment, or %NULL
83 	 *     info = a #GstStructure, or %NULL
84 	 *
85 	 * Return: the new #GstSample. gst_sample_unref()
86 	 *     after usage.
87 	 *
88 	 * Throws: ConstructionException GTK+ fails to create the object.
89 	 */
90 	public this(Buffer buffer, Caps caps, Segment segment, Structure info)
91 	{
92 		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());
93 		
94 		if(p is null)
95 		{
96 			throw new ConstructionException("null returned by new");
97 		}
98 		
99 		this(cast(GstSample*) p);
100 	}
101 
102 	/**
103 	 * Get the buffer associated with @sample
104 	 *
105 	 * Return: the buffer of @sample or %NULL
106 	 *     when there is no buffer. The buffer remains valid as long as
107 	 *     @sample is valid.  If you need to hold on to it for longer than
108 	 *     that, take a ref to the buffer with gst_buffer_ref().
109 	 */
110 	public Buffer getBuffer()
111 	{
112 		auto p = gst_sample_get_buffer(gstSample);
113 		
114 		if(p is null)
115 		{
116 			return null;
117 		}
118 		
119 		return ObjectG.getDObject!(Buffer)(cast(GstBuffer*) p);
120 	}
121 
122 	/**
123 	 * Get the buffer list associated with @sample
124 	 *
125 	 * Return: the buffer list of @sample or %NULL
126 	 *     when there is no buffer list. The buffer list remains valid as long as
127 	 *     @sample is valid.  If you need to hold on to it for longer than
128 	 *     that, take a ref to the buffer list with gst_mini_object_ref ().
129 	 *
130 	 * Since: 1.6
131 	 */
132 	public BufferList getBufferList()
133 	{
134 		auto p = gst_sample_get_buffer_list(gstSample);
135 		
136 		if(p is null)
137 		{
138 			return null;
139 		}
140 		
141 		return ObjectG.getDObject!(BufferList)(cast(GstBufferList*) p);
142 	}
143 
144 	/**
145 	 * Get the caps associated with @sample
146 	 *
147 	 * Return: the caps of @sample or %NULL
148 	 *     when there is no caps. The caps remain valid as long as @sample is
149 	 *     valid.  If you need to hold on to the caps for longer than that,
150 	 *     take a ref to the caps with gst_caps_ref().
151 	 */
152 	public Caps getCaps()
153 	{
154 		auto p = gst_sample_get_caps(gstSample);
155 		
156 		if(p is null)
157 		{
158 			return null;
159 		}
160 		
161 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
162 	}
163 
164 	/**
165 	 * Get extra information associated with @sample.
166 	 *
167 	 * Return: the extra info of @sample.
168 	 *     The info remains valid as long as @sample is valid.
169 	 */
170 	public Structure getInfo()
171 	{
172 		auto p = gst_sample_get_info(gstSample);
173 		
174 		if(p is null)
175 		{
176 			return null;
177 		}
178 		
179 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
180 	}
181 
182 	/**
183 	 * Get the segment associated with @sample
184 	 *
185 	 * Return: the segment of @sample.
186 	 *     The segment remains valid as long as @sample is valid.
187 	 */
188 	public Segment getSegment()
189 	{
190 		auto p = gst_sample_get_segment(gstSample);
191 		
192 		if(p is null)
193 		{
194 			return null;
195 		}
196 		
197 		return ObjectG.getDObject!(Segment)(cast(GstSegment*) p);
198 	}
199 
200 	/**
201 	 * Set the buffer list associated with @sample
202 	 *
203 	 * Params:
204 	 *     bufferList = a #GstBufferList
205 	 *
206 	 * Since: 1.6
207 	 */
208 	public void setBufferList(BufferList bufferList)
209 	{
210 		gst_sample_set_buffer_list(gstSample, (bufferList is null) ? null : bufferList.getBufferListStruct());
211 	}
212 }