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 change21 // find conversion definition on APILookup.txt22 // implement new conversion functionalities on the wrap.utils pakage23 24 25 modulegst.base.Aggregator;
26 27 privateimportglib.MemorySlice;
28 privateimportgobject.ObjectG;
29 privateimportgst.base.c.functions;
30 publicimportgst.base.c.types;
31 privateimportgstreamer.AllocationParams;
32 privateimportgstreamer.Allocator;
33 privateimportgstreamer.Buffer;
34 privateimportgstreamer.BufferPool;
35 privateimportgstreamer.Caps;
36 privateimportgstreamer.Element;
37 38 39 /**
40 * Manages a set of pads with the purpose of aggregating their buffers.
41 * Control is given to the subclass when all pads have data.
42 *
43 * * Base class for mixers and muxers. Subclasses should at least implement
44 * the #GstAggregatorClass.aggregate() virtual method.
45 *
46 * * Installs a #GstPadChainFunction, a #GstPadEventFullFunction and a
47 * #GstPadQueryFunction to queue all serialized data packets per sink pad.
48 * Subclasses should not overwrite those, but instead implement
49 * #GstAggregatorClass.sink_event() and #GstAggregatorClass.sink_query() as
50 * needed.
51 *
52 * * When data is queued on all pads, the aggregate vmethod is called.
53 *
54 * * One can peek at the data on any given GstAggregatorPad with the
55 * gst_aggregator_pad_peek_buffer () method, and remove it from the pad
56 * with the gst_aggregator_pad_pop_buffer () method. When a buffer
57 * has been taken with pop_buffer (), a new buffer can be queued
58 * on that pad.
59 *
60 * * If the subclass wishes to push a buffer downstream in its aggregate
61 * implementation, it should do so through the
62 * gst_aggregator_finish_buffer () method. This method will take care
63 * of sending and ordering mandatory events such as stream start, caps
64 * and segment.
65 *
66 * * Same goes for EOS events, which should not be pushed directly by the
67 * subclass, it should instead return GST_FLOW_EOS in its aggregate
68 * implementation.
69 *
70 * * Note that the aggregator logic regarding gap event handling is to turn
71 * these into gap buffers with matching PTS and duration. It will also
72 * flag these buffers with GST_BUFFER_FLAG_GAP and GST_BUFFER_FLAG_DROPPABLE
73 * to ease their identification and subsequent processing.
74 *
75 * * Subclasses must use (a subclass of) #GstAggregatorPad for both their
76 * sink and source pads.
77 * See gst_element_class_add_static_pad_template_with_gtype().
78 *
79 * This class used to live in gst-plugins-bad and was moved to core.
80 *
81 * Since: 1.14
82 */83 publicclassAggregator : Element84 {
85 /** the main Gtk struct */86 protectedGstAggregator* gstAggregator;
87 88 /** Get the main Gtk struct */89 publicGstAggregator* getAggregatorStruct(booltransferOwnership = false)
90 {
91 if (transferOwnership)
92 ownedRef = false;
93 returngstAggregator;
94 }
95 96 /** the main Gtk struct as a void* */97 protectedoverridevoid* getStruct()
98 {
99 returncast(void*)gstAggregator;
100 }
101 102 /**
103 * Sets our main struct and passes it to the parent class.
104 */105 publicthis (GstAggregator* gstAggregator, boolownedRef = false)
106 {
107 this.gstAggregator = gstAggregator;
108 super(cast(GstElement*)gstAggregator, ownedRef);
109 }
110 111 112 /** */113 publicstaticGTypegetType()
114 {
115 returngst_aggregator_get_type();
116 }
117 118 /**
119 * This method will push the provided output buffer downstream. If needed,
120 * mandatory events such as stream-start, caps, and segment events will be
121 * sent before pushing the buffer.
122 *
123 * Params:
124 * buffer = the #GstBuffer to push.
125 */126 publicGstFlowReturnfinishBuffer(Bufferbuffer)
127 {
128 returngst_aggregator_finish_buffer(gstAggregator, (bufferisnull) ? null : buffer.getBufferStruct());
129 }
130 131 /**
132 * Lets #GstAggregator sub-classes get the memory @allocator
133 * acquired by the base class and its @params.
134 *
135 * Unref the @allocator after use it.
136 *
137 * Params:
138 * allocator = the #GstAllocator
139 * used
140 * params = the
141 * #GstAllocationParams of @allocator
142 */143 publicvoidgetAllocator(outAllocatorallocator, outAllocationParamsparams)
144 {
145 GstAllocator* outallocator = null;
146 GstAllocationParams* outparams = sliceNew!GstAllocationParams();
147 148 gst_aggregator_get_allocator(gstAggregator, &outallocator, outparams);
149 150 allocator = ObjectG.getDObject!(Allocator)(outallocator);
151 params = ObjectG.getDObject!(AllocationParams)(outparams, true);
152 }
153 154 /**
155 * Returns: the instance of the #GstBufferPool used
156 * by @trans; free it after use it
157 */158 publicBufferPoolgetBufferPool()
159 {
160 autop = gst_aggregator_get_buffer_pool(gstAggregator);
161 162 if(pisnull)
163 {
164 returnnull;
165 }
166 167 returnObjectG.getDObject!(BufferPool)(cast(GstBufferPool*) p, true);
168 }
169 170 /**
171 * Retrieves the latency values reported by @self in response to the latency
172 * query, or %GST_CLOCK_TIME_NONE if there is not live source connected and the element
173 * will not wait for the clock.
174 *
175 * Typically only called by subclasses.
176 *
177 * Returns: The latency or %GST_CLOCK_TIME_NONE if the element does not sync
178 */179 publicGstClockTimegetLatency()
180 {
181 returngst_aggregator_get_latency(gstAggregator);
182 }
183 184 /**
185 * Lets #GstAggregator sub-classes tell the baseclass what their internal
186 * latency is. Will also post a LATENCY message on the bus so the pipeline
187 * can reconfigure its global latency.
188 *
189 * Params:
190 * minLatency = minimum latency
191 * maxLatency = maximum latency
192 */193 publicvoidsetLatency(GstClockTimeminLatency, GstClockTimemaxLatency)
194 {
195 gst_aggregator_set_latency(gstAggregator, minLatency, maxLatency);
196 }
197 198 /**
199 * Sets the caps to be used on the src pad.
200 *
201 * Params:
202 * caps = The #GstCaps to set on the src pad.
203 */204 publicvoidsetSrcCaps(Capscaps)
205 {
206 gst_aggregator_set_src_caps(gstAggregator, (capsisnull) ? null : caps.getCapsStruct());
207 }
208 209 /**
210 * This is a simple #GstAggregator::get_next_time implementation that
211 * just looks at the #GstSegment on the srcpad of the aggregator and bases
212 * the next time on the running time there.
213 *
214 * This is the desired behaviour in most cases where you have a live source
215 * and you have a dead line based aggregator subclass.
216 *
217 * Returns: The running time based on the position
218 *
219 * Since: 1.16
220 */221 publicGstClockTimesimpleGetNextTime()
222 {
223 returngst_aggregator_simple_get_next_time(gstAggregator);
224 }
225 }