1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400
|
/*
* This file is part of gtkD.
*
* gtkD is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 3
* of the License, or (at your option) any later version, with
* some exceptions, please read the COPYING file.
*
* gtkD is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with gtkD; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
*/
// generated automatically - do not change
// find conversion definition on APILookup.txt
// implement new conversion functionalities on the wrap.utils pakage
module gst.base.BaseTransform;
private import glib.MemorySlice;
private import gobject.ObjectG;
private import gst.base.c.functions;
public import gst.base.c.types;
private import gstreamer.AllocationParams;
private import gstreamer.Allocator;
private import gstreamer.BufferPool;
private import gstreamer.Caps;
private import gstreamer.Element;
/**
* This base class is for filter elements that process data. Elements
* that are suitable for implementation using #GstBaseTransform are ones
* where the size and caps of the output is known entirely from the input
* caps and buffer sizes. These include elements that directly transform
* one buffer into another, modify the contents of a buffer in-place, as
* well as elements that collate multiple input buffers into one output buffer,
* or that expand one input buffer into multiple output buffers. See below
* for more concrete use cases.
*
* It provides for:
*
* * one sinkpad and one srcpad
* * Possible formats on sink and source pad implemented
* with custom transform_caps function. By default uses
* same format on sink and source.
*
* * Handles state changes
* * Does flushing
* * Push mode
* * Pull mode if the sub-class transform can operate on arbitrary data
*
* # Use Cases
*
* ## Passthrough mode
*
* * Element has no interest in modifying the buffer. It may want to inspect it,
* in which case the element should have a transform_ip function. If there
* is no transform_ip function in passthrough mode, the buffer is pushed
* intact.
*
* * The #GstBaseTransformClass.passthrough_on_same_caps variable
* will automatically set/unset passthrough based on whether the
* element negotiates the same caps on both pads.
*
* * #GstBaseTransformClass.passthrough_on_same_caps on an element that
* doesn't implement a transform_caps function is useful for elements that
* only inspect data (such as level)
*
* * Example elements
*
* * Level
* * Videoscale, audioconvert, videoconvert, audioresample in certain modes.
*
* ## Modifications in-place - input buffer and output buffer are the same thing.
*
* * The element must implement a transform_ip function.
* * Output buffer size must <= input buffer size
* * If the always_in_place flag is set, non-writable buffers will be copied
* and passed to the transform_ip function, otherwise a new buffer will be
* created and the transform function called.
*
* * Incoming writable buffers will be passed to the transform_ip function
* immediately.
* * only implementing transform_ip and not transform implies always_in_place = %TRUE
*
* * Example elements:
* * Volume
* * Audioconvert in certain modes (signed/unsigned conversion)
* * videoconvert in certain modes (endianness swapping)
*
* ## Modifications only to the caps/metadata of a buffer
*
* * The element does not require writable data, but non-writable buffers
* should be subbuffered so that the meta-information can be replaced.
*
* * Elements wishing to operate in this mode should replace the
* prepare_output_buffer method to create subbuffers of the input buffer
* and set always_in_place to %TRUE
*
* * Example elements
* * Capsfilter when setting caps on outgoing buffers that have
* none.
* * identity when it is going to re-timestamp buffers by
* datarate.
*
* ## Normal mode
* * always_in_place flag is not set, or there is no transform_ip function
* * Element will receive an input buffer and output buffer to operate on.
* * Output buffer is allocated by calling the prepare_output_buffer function.
* * Example elements:
* * Videoscale, videoconvert, audioconvert when doing
* scaling/conversions
*
* ## Special output buffer allocations
* * Elements which need to do special allocation of their output buffers
* beyond allocating output buffers via the negotiated allocator or
* buffer pool should implement the prepare_output_buffer method.
*
* * Example elements:
* * efence
*
* # Sub-class settable flags on GstBaseTransform
*
* * passthrough
*
* * Implies that in the current configuration, the sub-class is not interested in modifying the buffers.
* * Elements which are always in passthrough mode whenever the same caps has been negotiated on both pads can set the class variable passthrough_on_same_caps to have this behaviour automatically.
*
* * always_in_place
* * Determines whether a non-writable buffer will be copied before passing
* to the transform_ip function.
*
* * Implied %TRUE if no transform function is implemented.
* * Implied %FALSE if ONLY transform function is implemented.
*/
public class BaseTransform : Element
{
/** the main Gtk struct */
protected GstBaseTransform* gstBaseTransform;
/** Get the main Gtk struct */
public GstBaseTransform* getBaseTransformStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gstBaseTransform;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gstBaseTransform;
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GstBaseTransform* gstBaseTransform, bool ownedRef = false)
{
this.gstBaseTransform = gstBaseTransform;
super(cast(GstElement*)gstBaseTransform, ownedRef);
}
/** */
public static GType getType()
{
return gst_base_transform_get_type();
}
/**
* Lets #GstBaseTransform sub-classes to know the memory @allocator
* used by the base class and its @params.
*
* Unref the @allocator after use it.
*
* Params:
* allocator = the #GstAllocator
* used
* params = the
* #GstAllocationParams of @allocator
*/
public void getAllocator(out Allocator allocator, out AllocationParams params)
{
GstAllocator* outallocator = null;
GstAllocationParams* outparams = sliceNew!GstAllocationParams();
gst_base_transform_get_allocator(gstBaseTransform, &outallocator, outparams);
allocator = ObjectG.getDObject!(Allocator)(outallocator);
params = ObjectG.getDObject!(AllocationParams)(outparams, true);
}
/**
* Returns: the instance of the #GstBufferPool used
* by @trans; free it after use it
*/
public BufferPool getBufferPool()
{
auto p = gst_base_transform_get_buffer_pool(gstBaseTransform);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(BufferPool)(cast(GstBufferPool*) p, true);
}
/**
* See if @trans is configured as a in_place transform.
*
* Returns: %TRUE is the transform is configured in in_place mode.
*
* MT safe.
*/
public bool isInPlace()
{
return gst_base_transform_is_in_place(gstBaseTransform) != 0;
}
/**
* See if @trans is configured as a passthrough transform.
*
* Returns: %TRUE is the transform is configured in passthrough mode.
*
* MT safe.
*/
public bool isPassthrough()
{
return gst_base_transform_is_passthrough(gstBaseTransform) != 0;
}
/**
* Queries if the transform will handle QoS.
*
* Returns: %TRUE if QoS is enabled.
*
* MT safe.
*/
public bool isQosEnabled()
{
return gst_base_transform_is_qos_enabled(gstBaseTransform) != 0;
}
/**
* Instructs @trans to request renegotiation upstream. This function is
* typically called after properties on the transform were set that
* influence the input format.
*/
public void reconfigureSink()
{
gst_base_transform_reconfigure_sink(gstBaseTransform);
}
/**
* Instructs @trans to renegotiate a new downstream transform on the next
* buffer. This function is typically called after properties on the transform
* were set that influence the output format.
*/
public void reconfigureSrc()
{
gst_base_transform_reconfigure_src(gstBaseTransform);
}
/**
* If @gap_aware is %FALSE (the default), output buffers will have the
* %GST_BUFFER_FLAG_GAP flag unset.
*
* If set to %TRUE, the element must handle output buffers with this flag set
* correctly, i.e. it can assume that the buffer contains neutral data but must
* unset the flag if the output is no neutral data.
*
* MT safe.
*
* Params:
* gapAware = New state
*/
public void setGapAware(bool gapAware)
{
gst_base_transform_set_gap_aware(gstBaseTransform, gapAware);
}
/**
* Determines whether a non-writable buffer will be copied before passing
* to the transform_ip function.
*
* * Always %TRUE if no transform function is implemented.
* * Always %FALSE if ONLY transform function is implemented.
*
* MT safe.
*
* Params:
* inPlace = Boolean value indicating that we would like to operate
* on in_place buffers.
*/
public void setInPlace(bool inPlace)
{
gst_base_transform_set_in_place(gstBaseTransform, inPlace);
}
/**
* Set passthrough mode for this filter by default. This is mostly
* useful for filters that do not care about negotiation.
*
* Always %TRUE for filters which don't implement either a transform
* or transform_ip method.
*
* MT safe.
*
* Params:
* passthrough = boolean indicating passthrough mode.
*/
public void setPassthrough(bool passthrough)
{
gst_base_transform_set_passthrough(gstBaseTransform, passthrough);
}
/**
* If @prefer_passthrough is %TRUE (the default), @trans will check and
* prefer passthrough caps from the list of caps returned by the
* transform_caps vmethod.
*
* If set to %FALSE, the element must order the caps returned from the
* transform_caps function in such a way that the preferred format is
* first in the list. This can be interesting for transforms that can do
* passthrough transforms but prefer to do something else, like a
* capsfilter.
*
* MT safe.
*
* Params:
* preferPassthrough = New state
*
* Since: 1.0.1
*/
public void setPreferPassthrough(bool preferPassthrough)
{
gst_base_transform_set_prefer_passthrough(gstBaseTransform, preferPassthrough);
}
/**
* Enable or disable QoS handling in the transform.
*
* MT safe.
*
* Params:
* enabled = new state
*/
public void setQosEnabled(bool enabled)
{
gst_base_transform_set_qos_enabled(gstBaseTransform, enabled);
}
/**
* Set the QoS parameters in the transform. This function is called internally
* when a QOS event is received but subclasses can provide custom information
* when needed.
*
* MT safe.
*
* Params:
* proportion = the proportion
* diff = the diff against the clock
* timestamp = the timestamp of the buffer generating the QoS expressed in
* running_time.
*/
public void updateQos(double proportion, GstClockTimeDiff diff, GstClockTime timestamp)
{
gst_base_transform_update_qos(gstBaseTransform, proportion, diff, timestamp);
}
/**
* Updates the srcpad caps and send the caps downstream. This function
* can be used by subclasses when they have already negotiated their caps
* but found a change in them (or computed new information). This way,
* they can notify downstream about that change without losing any
* buffer.
*
* Params:
* updatedCaps = An updated version of the srcpad caps to be pushed
* downstream
*
* Returns: %TRUE if the caps could be send downstream %FALSE otherwise
*
* Since: 1.6
*/
public bool updateSrcCaps(Caps updatedCaps)
{
return gst_base_transform_update_src_caps(gstBaseTransform, (updatedCaps is null) ? null : updatedCaps.getCapsStruct()) != 0;
}
}
|