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