/usr/include/d/gtkd-3/gstreamer/DeviceProvider.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 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 | /*
* 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.DeviceProvider;
private import glib.ListG;
private import glib.Str;
private import gobject.ObjectG;
private import gobject.Signals;
private import gstreamer.Bus;
private import gstreamer.Device;
private import gstreamer.DeviceProviderFactory;
private import gstreamer.ObjectGst;
private import gstreamer.Plugin;
private import gstreamer.c.functions;
public import gstreamer.c.types;
public import gstreamerc.gstreamertypes;
private import std.algorithm;
/**
* A #GstDeviceProvider subclass is provided by a plugin that handles devices
* if there is a way to programatically list connected devices. It can also
* optionally provide updates to the list of connected devices.
*
* Each #GstDeviceProvider subclass is a singleton, a plugin should
* normally provide a single subclass for all devices.
*
* Applications would normally use a #GstDeviceMonitor to monitor devices
* from all relevant providers.
*
* Since: 1.4
*/
public class DeviceProvider : ObjectGst
{
/** the main Gtk struct */
protected GstDeviceProvider* gstDeviceProvider;
/** Get the main Gtk struct */
public GstDeviceProvider* getDeviceProviderStruct(bool transferOwnership = false)
{
if (transferOwnership)
ownedRef = false;
return gstDeviceProvider;
}
/** the main Gtk struct as a void* */
protected override void* getStruct()
{
return cast(void*)gstDeviceProvider;
}
protected override void setStruct(GObject* obj)
{
gstDeviceProvider = cast(GstDeviceProvider*)obj;
super.setStruct(obj);
}
/**
* Sets our main struct and passes it to the parent class.
*/
public this (GstDeviceProvider* gstDeviceProvider, bool ownedRef = false)
{
this.gstDeviceProvider = gstDeviceProvider;
super(cast(GstObject*)gstDeviceProvider, ownedRef);
}
/** */
public static GType getType()
{
return gst_device_provider_get_type();
}
/**
* Create a new device providerfactory capable of instantiating objects of the
* @type and add the factory to @plugin.
*
* Params:
* plugin = #GstPlugin to register the device provider with, or %NULL for
* a static device provider.
* name = name of device providers of this type
* rank = rank of device provider (higher rank means more importance when autoplugging)
* type = GType of device provider to register
*
* Returns: %TRUE, if the registering succeeded, %FALSE on error
*
* Since: 1.4
*/
public static bool register(Plugin plugin, string name, uint rank, GType type)
{
return gst_device_provider_register((plugin is null) ? null : plugin.getPluginStruct(), Str.toStringz(name), rank, type) != 0;
}
/** */
public bool canMonitor()
{
return gst_device_provider_can_monitor(gstDeviceProvider) != 0;
}
/**
* Posts a message on the provider's #GstBus to inform applications that
* a new device has been added.
*
* This is for use by subclasses.
*
* Params:
* device = a #GstDevice that has been added
*
* Since: 1.4
*/
public void deviceAdd(Device device)
{
gst_device_provider_device_add(gstDeviceProvider, (device is null) ? null : device.getDeviceStruct());
}
/**
* Posts a message on the provider's #GstBus to inform applications that
* a device has been removed.
*
* This is for use by subclasses.
*
* Params:
* device = a #GstDevice that has been removed
*
* Since: 1.4
*/
public void deviceRemove(Device device)
{
gst_device_provider_device_remove(gstDeviceProvider, (device is null) ? null : device.getDeviceStruct());
}
/**
* Gets the #GstBus of this #GstDeviceProvider
*
* Returns: a #GstBus
*
* Since: 1.4
*/
public Bus getBus()
{
auto p = gst_device_provider_get_bus(gstDeviceProvider);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(Bus)(cast(GstBus*) p, true);
}
/**
* Gets a list of devices that this provider understands. This may actually
* probe the hardware if the provider is not currently started.
*
* Returns: a #GList of
* #GstDevice
*
* Since: 1.4
*/
public ListG getDevices()
{
auto p = gst_device_provider_get_devices(gstDeviceProvider);
if(p is null)
{
return null;
}
return new ListG(cast(GList*) p, true);
}
/**
* Retrieves the factory that was used to create this device provider.
*
* Returns: the #GstDeviceProviderFactory used for
* creating this device provider. no refcounting is needed.
*
* Since: 1.4
*/
public DeviceProviderFactory getFactory()
{
auto p = gst_device_provider_get_factory(gstDeviceProvider);
if(p is null)
{
return null;
}
return ObjectG.getDObject!(DeviceProviderFactory)(cast(GstDeviceProviderFactory*) p);
}
/**
* Get the provider factory names of the #GstDeviceProvider instances that
* are hidden by @provider.
*
* Returns: a list of hidden providers factory names or %NULL when
* nothing is hidden by @provider. Free with g_strfreev.
*
* Since: 1.6
*/
public string[] getHiddenProviders()
{
auto retStr = gst_device_provider_get_hidden_providers(gstDeviceProvider);
scope(exit) Str.freeStringArray(retStr);
return Str.toStringArray(retStr);
}
/**
* Make @provider hide the devices from the factory with @name.
*
* This function is used when @provider will also provide the devices reported
* by provider factory @name. A monitor should stop monitoring the
* device provider with @name to avoid duplicate devices.
*
* Params:
* name = a provider factory name
*
* Since: 1.6
*/
public void hideProvider(string name)
{
gst_device_provider_hide_provider(gstDeviceProvider, Str.toStringz(name));
}
/**
* Starts providering the devices. This will cause #GST_MESSAGE_DEVICE_ADDED
* and #GST_MESSAGE_DEVICE_REMOVED messages to be posted on the provider's bus
* when devices are added or removed from the system.
*
* Since the #GstDeviceProvider is a singleton,
* gst_device_provider_start() may already have been called by another
* user of the object, gst_device_provider_stop() needs to be called the same
* number of times.
*
* Returns: %TRUE if the device providering could be started
*
* Since: 1.4
*/
public bool start()
{
return gst_device_provider_start(gstDeviceProvider) != 0;
}
/**
* Decreases the use-count by one. If the use count reaches zero, this
* #GstDeviceProvider will stop providering the devices. This needs to be
* called the same number of times that gst_device_provider_start() was called.
*
* Since: 1.4
*/
public void stop()
{
gst_device_provider_stop(gstDeviceProvider);
}
/**
* Make @provider unhide the devices from factory @name.
*
* This function is used when @provider will no longer provide the devices
* reported by provider factory @name. A monitor should start
* monitoring the devices from provider factory @name in order to see
* all devices again.
*
* Params:
* name = a provider factory name
*
* Since: 1.6
*/
public void unhideProvider(string name)
{
gst_device_provider_unhide_provider(gstDeviceProvider, Str.toStringz(name));
}
protected class OnProviderHiddenDelegateWrapper
{
void delegate(string, DeviceProvider) dlg;
gulong handlerId;
this(void delegate(string, DeviceProvider) dlg)
{
this.dlg = dlg;
onProviderHiddenListeners ~= this;
}
void remove(OnProviderHiddenDelegateWrapper source)
{
foreach(index, wrapper; onProviderHiddenListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onProviderHiddenListeners[index] = null;
onProviderHiddenListeners = std.algorithm.remove(onProviderHiddenListeners, index);
break;
}
}
}
}
OnProviderHiddenDelegateWrapper[] onProviderHiddenListeners;
/** */
gulong addOnProviderHidden(void delegate(string, DeviceProvider) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnProviderHiddenDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"provider-hidden",
cast(GCallback)&callBackProviderHidden,
cast(void*)wrapper,
cast(GClosureNotify)&callBackProviderHiddenDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackProviderHidden(GstDeviceProvider* deviceproviderStruct, char* object, OnProviderHiddenDelegateWrapper wrapper)
{
wrapper.dlg(Str.toString(object), wrapper.outer);
}
extern(C) static void callBackProviderHiddenDestroy(OnProviderHiddenDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
protected class OnProviderUnhiddenDelegateWrapper
{
void delegate(string, DeviceProvider) dlg;
gulong handlerId;
this(void delegate(string, DeviceProvider) dlg)
{
this.dlg = dlg;
onProviderUnhiddenListeners ~= this;
}
void remove(OnProviderUnhiddenDelegateWrapper source)
{
foreach(index, wrapper; onProviderUnhiddenListeners)
{
if (wrapper.handlerId == source.handlerId)
{
onProviderUnhiddenListeners[index] = null;
onProviderUnhiddenListeners = std.algorithm.remove(onProviderUnhiddenListeners, index);
break;
}
}
}
}
OnProviderUnhiddenDelegateWrapper[] onProviderUnhiddenListeners;
/** */
gulong addOnProviderUnhidden(void delegate(string, DeviceProvider) dlg, ConnectFlags connectFlags=cast(ConnectFlags)0)
{
auto wrapper = new OnProviderUnhiddenDelegateWrapper(dlg);
wrapper.handlerId = Signals.connectData(
this,
"provider-unhidden",
cast(GCallback)&callBackProviderUnhidden,
cast(void*)wrapper,
cast(GClosureNotify)&callBackProviderUnhiddenDestroy,
connectFlags);
return wrapper.handlerId;
}
extern(C) static void callBackProviderUnhidden(GstDeviceProvider* deviceproviderStruct, char* object, OnProviderUnhiddenDelegateWrapper wrapper)
{
wrapper.dlg(Str.toString(object), wrapper.outer);
}
extern(C) static void callBackProviderUnhiddenDestroy(OnProviderUnhiddenDelegateWrapper wrapper, GClosure* closure)
{
wrapper.remove(wrapper);
}
}
|