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 gst.base.AggregatorPad;
26 
27 private import gobject.ObjectG;
28 private import gobject.Signals;
29 private import gst.base.c.functions;
30 public  import gst.base.c.types;
31 private import gstreamer.Buffer;
32 private import gstreamer.Pad;
33 private import std.algorithm;
34 
35 
36 /**
37  * Pads managed by a #GstAggregor subclass.
38  * 
39  * This class used to live in gst-plugins-bad and was moved to core.
40  *
41  * Since: 1.14
42  */
43 public class AggregatorPad : Pad
44 {
45 	/** the main Gtk struct */
46 	protected GstAggregatorPad* gstAggregatorPad;
47 
48 	/** Get the main Gtk struct */
49 	public GstAggregatorPad* getAggregatorPadStruct(bool transferOwnership = false)
50 	{
51 		if (transferOwnership)
52 			ownedRef = false;
53 		return gstAggregatorPad;
54 	}
55 
56 	/** the main Gtk struct as a void* */
57 	protected override void* getStruct()
58 	{
59 		return cast(void*)gstAggregatorPad;
60 	}
61 
62 	/**
63 	 * Sets our main struct and passes it to the parent class.
64 	 */
65 	public this (GstAggregatorPad* gstAggregatorPad, bool ownedRef = false)
66 	{
67 		this.gstAggregatorPad = gstAggregatorPad;
68 		super(cast(GstPad*)gstAggregatorPad, ownedRef);
69 	}
70 
71 
72 	/** */
73 	public static GType getType()
74 	{
75 		return gst_aggregator_pad_get_type();
76 	}
77 
78 	/**
79 	 * Drop the buffer currently queued in @pad.
80 	 *
81 	 * Returns: TRUE if there was a buffer queued in @pad, or FALSE if not.
82 	 */
83 	public bool dropBuffer()
84 	{
85 		return gst_aggregator_pad_drop_buffer(gstAggregatorPad) != 0;
86 	}
87 
88 	/**
89 	 * This checks if a pad has a buffer available that will be returned by
90 	 * a call to gst_aggregator_pad_peek_buffer() or
91 	 * gst_aggregator_pad_pop_buffer().
92 	 *
93 	 * Returns: %TRUE if the pad has a buffer available as the next thing.
94 	 *
95 	 * Since: 1.14.1
96 	 */
97 	public bool hasBuffer()
98 	{
99 		return gst_aggregator_pad_has_buffer(gstAggregatorPad) != 0;
100 	}
101 
102 	/**
103 	 * Returns: %TRUE if the pad is EOS, otherwise %FALSE.
104 	 */
105 	public bool isEos()
106 	{
107 		return gst_aggregator_pad_is_eos(gstAggregatorPad) != 0;
108 	}
109 
110 	/**
111 	 * Returns: A reference to the buffer in @pad or
112 	 *     NULL if no buffer was queued. You should unref the buffer after
113 	 *     usage.
114 	 */
115 	public Buffer peekBuffer()
116 	{
117 		auto p = gst_aggregator_pad_peek_buffer(gstAggregatorPad);
118 
119 		if(p is null)
120 		{
121 			return null;
122 		}
123 
124 		return ObjectG.getDObject!(Buffer)(cast(GstBuffer*) p, true);
125 	}
126 
127 	/**
128 	 * Steal the ref to the buffer currently queued in @pad.
129 	 *
130 	 * Returns: The buffer in @pad or NULL if no buffer was
131 	 *     queued. You should unref the buffer after usage.
132 	 */
133 	public Buffer popBuffer()
134 	{
135 		auto p = gst_aggregator_pad_pop_buffer(gstAggregatorPad);
136 
137 		if(p is null)
138 		{
139 			return null;
140 		}
141 
142 		return ObjectG.getDObject!(Buffer)(cast(GstBuffer*) p, true);
143 	}
144 
145 	/** */
146 	gulong addOnBufferConsumed(void delegate(Buffer, AggregatorPad) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
147 	{
148 		return Signals.connect(this, "buffer-consumed", dlg, connectFlags ^ ConnectFlags.SWAPPED);
149 	}
150 }