This file is indexed.

/usr/include/d/gtkd-3/gstreamer/PadTemplate.d is in libgstreamerd-3-dev 3.7.5-2build1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
/*
 * 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 gstreamer.PadTemplate;

private import glib.ConstructionException;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
private import gstreamer.Caps;
private import gstreamer.ObjectGst;
private import gstreamer.Pad;
private import gstreamer.c.functions;
public  import gstreamer.c.types;
public  import gstreamerc.gstreamertypes;
private import std.algorithm;


/**
 * Padtemplates describe the possible media types a pad or an elementfactory can
 * handle. This allows for both inspection of handled types before loading the
 * element plugin as well as identifying pads on elements that are not yet
 * created (request or sometimes pads).
 * 
 * Pad and PadTemplates have #GstCaps attached to it to describe the media type
 * they are capable of dealing with. gst_pad_template_get_caps() or
 * GST_PAD_TEMPLATE_CAPS() are used to get the caps of a padtemplate. It's not
 * possible to modify the caps of a padtemplate after creation.
 * 
 * PadTemplates have a #GstPadPresence property which identifies the lifetime
 * of the pad and that can be retrieved with GST_PAD_TEMPLATE_PRESENCE(). Also
 * the direction of the pad can be retrieved from the #GstPadTemplate with
 * GST_PAD_TEMPLATE_DIRECTION().
 * 
 * The GST_PAD_TEMPLATE_NAME_TEMPLATE () is important for GST_PAD_REQUEST pads
 * because it has to be used as the name in the gst_element_get_request_pad()
 * call to instantiate a pad from this template.
 * 
 * Padtemplates can be created with gst_pad_template_new() or with
 * gst_static_pad_template_get (), which creates a #GstPadTemplate from a
 * #GstStaticPadTemplate that can be filled with the
 * convenient GST_STATIC_PAD_TEMPLATE() macro.
 * 
 * A padtemplate can be used to create a pad (see gst_pad_new_from_template()
 * or gst_pad_new_from_static_template ()) or to add to an element class
 * (see gst_element_class_add_static_pad_template ()).
 * 
 * The following code example shows the code to create a pad from a padtemplate.
 * |[<!-- language="C" -->
 * GstStaticPadTemplate my_template =
 * GST_STATIC_PAD_TEMPLATE (
 * "sink",          // the name of the pad
 * GST_PAD_SINK,    // the direction of the pad
 * GST_PAD_ALWAYS,  // when this pad will be present
 * GST_STATIC_CAPS (        // the capabilities of the padtemplate
 * "audio/x-raw, "
 * "channels = (int) [ 1, 6 ]"
 * )
 * );
 * void
 * my_method (void)
 * {
 * GstPad *pad;
 * pad = gst_pad_new_from_static_template (&amp;my_template, "sink");
 * ...
 * }
 * ]|
 * 
 * The following example shows you how to add the padtemplate to an
 * element class, this is usually done in the class_init of the class:
 * |[<!-- language="C" -->
 * static void
 * my_element_class_init (GstMyElementClass *klass)
 * {
 * GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
 * 
 * gst_element_class_add_static_pad_template (gstelement_class, &amp;my_template);
 * }
 * ]|
 */
public class PadTemplate : ObjectGst
{
	/** the main Gtk struct */
	protected GstPadTemplate* gstPadTemplate;

	/** Get the main Gtk struct */
	public GstPadTemplate* getPadTemplateStruct(bool transferOwnership = false)
	{
		if (transferOwnership)
			ownedRef = false;
		return gstPadTemplate;
	}

	/** the main Gtk struct as a void* */
	protected override void* getStruct()
	{
		return cast(void*)gstPadTemplate;
	}

	protected override void setStruct(GObject* obj)
	{
		gstPadTemplate = cast(GstPadTemplate*)obj;
		super.setStruct(obj);
	}

	/**
	 * Sets our main struct and passes it to the parent class.
	 */
	public this (GstPadTemplate* gstPadTemplate, bool ownedRef = false)
	{
		this.gstPadTemplate = gstPadTemplate;
		super(cast(GstObject*)gstPadTemplate, ownedRef);
	}


	/** */
	public static GType getType()
	{
		return gst_pad_template_get_type();
	}

	/**
	 * Creates a new pad template with a name according to the given template
	 * and with the given arguments.
	 *
	 * Params:
	 *     nameTemplate = the name template.
	 *     direction = the #GstPadDirection of the template.
	 *     presence = the #GstPadPresence of the pad.
	 *     caps = a #GstCaps set for the template.
	 *
	 * Returns: a new #GstPadTemplate.
	 *
	 * Throws: ConstructionException GTK+ fails to create the object.
	 */
	public this(string nameTemplate, GstPadDirection direction, GstPadPresence presence, Caps caps)
	{
		auto p = gst_pad_template_new(Str.toStringz(nameTemplate), direction, presence, (caps is null) ? null : caps.getCapsStruct());

		if(p is null)
		{
			throw new ConstructionException("null returned by new");
		}

		this(cast(GstPadTemplate*) p);
	}

	/**
	 * Gets the capabilities of the pad template.
	 *
	 * Returns: the #GstCaps of the pad template.
	 *     Unref after usage.
	 */
	public Caps getCaps()
	{
		auto p = gst_pad_template_get_caps(gstPadTemplate);

		if(p is null)
		{
			return null;
		}

		return ObjectG.getDObject!(Caps)(cast(GstCaps*) p, true);
	}

	/**
	 * Emit the pad-created signal for this template when created by this pad.
	 *
	 * Params:
	 *     pad = the #GstPad that created it
	 */
	public void padCreated(Pad pad)
	{
		gst_pad_template_pad_created(gstPadTemplate, (pad is null) ? null : pad.getPadStruct());
	}

	protected class OnPadCreatedDelegateWrapper
	{
		void delegate(Pad, PadTemplate) dlg;
		gulong handlerId;

		this(void delegate(Pad, PadTemplate) dlg)
		{
			this.dlg = dlg;
			onPadCreatedListeners ~= this;
		}

		void remove(OnPadCreatedDelegateWrapper source)
		{
			foreach(index, wrapper; onPadCreatedListeners)
			{
				if (wrapper.handlerId == source.handlerId)
				{
					onPadCreatedListeners[index] = null;
					onPadCreatedListeners = std.algorithm.remove(onPadCreatedListeners, index);
					break;
				}
			}
		}
	}
	OnPadCreatedDelegateWrapper[] onPadCreatedListeners;

	/**
	 * This signal is fired when an element creates a pad from this template.
	 *
	 * Params:
	 *     pad = the pad that was created.
	 */
	gulong addOnPadCreated(void delegate(Pad, PadTemplate) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
	{
		auto wrapper = new OnPadCreatedDelegateWrapper(dlg);
		wrapper.handlerId = Signals.connectData(
			this,
			"pad-created",
			cast(GCallback)&callBackPadCreated,
			cast(void*)wrapper,
			cast(GClosureNotify)&callBackPadCreatedDestroy,
			connectFlags);
		return wrapper.handlerId;
	}

	extern(C) static void callBackPadCreated(GstPadTemplate* padtemplateStruct, GstPad* pad, OnPadCreatedDelegateWrapper wrapper)
	{
		wrapper.dlg(ObjectG.getDObject!(Pad)(pad), wrapper.outer);
	}

	extern(C) static void callBackPadCreatedDestroy(OnPadCreatedDelegateWrapper wrapper, GClosure* closure)
	{
		wrapper.remove(wrapper);
	}
}