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.Caps;
31 private import gstreamer.Segment;
32 private import gstreamer.Structure;
33 private import gstreamerc.gstreamer;
34 public  import gstreamerc.gstreamertypes;
35 
36 
37 /**
38  * A #GstSample is a small object containing data, a type, timing and
39  * extra arbitrary information.
40  */
41 public class Sample
42 {
43 	/** the main Gtk struct */
44 	protected GstSample* gstSample;
45 
46 	/** Get the main Gtk struct */
47 	public GstSample* getSampleStruct()
48 	{
49 		return gstSample;
50 	}
51 
52 	/** the main Gtk struct as a void* */
53 	protected void* getStruct()
54 	{
55 		return cast(void*)gstSample;
56 	}
57 
58 	/**
59 	 * Sets our main struct and passes it to the parent class.
60 	 */
61 	public this (GstSample* gstSample)
62 	{
63 		this.gstSample = gstSample;
64 	}
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 caps associated with @sample
124 	 *
125 	 * Return: the caps of @sample or %NULL
126 	 *     when there is no caps. The caps remain valid as long as @sample is
127 	 *     valid.  If you need to hold on to the caps for longer than that,
128 	 *     take a ref to the caps with gst_caps_ref().
129 	 */
130 	public Caps getCaps()
131 	{
132 		auto p = gst_sample_get_caps(gstSample);
133 		
134 		if(p is null)
135 		{
136 			return null;
137 		}
138 		
139 		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p);
140 	}
141 
142 	/**
143 	 * Get extra information associated with @sample.
144 	 *
145 	 * Return: the extra info of @sample.
146 	 *     The info remains valid as long as @sample is valid.
147 	 */
148 	public Structure getInfo()
149 	{
150 		auto p = gst_sample_get_info(gstSample);
151 		
152 		if(p is null)
153 		{
154 			return null;
155 		}
156 		
157 		return ObjectG.getDObject!(Structure)(cast(GstStructure*) p);
158 	}
159 
160 	/**
161 	 * Get the segment associated with @sample
162 	 *
163 	 * Return: the segment of @sample.
164 	 *     The segment remains valid as long as @sample is valid.
165 	 */
166 	public Segment getSegment()
167 	{
168 		auto p = gst_sample_get_segment(gstSample);
169 		
170 		if(p is null)
171 		{
172 			return null;
173 		}
174 		
175 		return ObjectG.getDObject!(Segment)(cast(GstSegment*) p);
176 	}
177 }