gstdeviceprovider.h 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. /* GStreamer
  2. * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com>
  3. *
  4. * gstdeviceprovider.h: Device probing and monitoring
  5. *
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. */
  21. #ifndef __GST_DEVICE_PROVIDER_H__
  22. #define __GST_DEVICE_PROVIDER_H__
  23. #include <gst/gstelement.h>
  24. G_BEGIN_DECLS
  25. typedef struct _GstDeviceProvider GstDeviceProvider;
  26. typedef struct _GstDeviceProviderClass GstDeviceProviderClass;
  27. typedef struct _GstDeviceProviderPrivate GstDeviceProviderPrivate;
  28. #include <gst/gstdeviceproviderfactory.h>
  29. #define GST_TYPE_DEVICE_PROVIDER (gst_device_provider_get_type())
  30. #define GST_IS_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_DEVICE_PROVIDER))
  31. #define GST_IS_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_DEVICE_PROVIDER))
  32. #define GST_DEVICE_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
  33. #define GST_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_DEVICE_PROVIDER, GstDeviceProvider))
  34. #define GST_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_PROVIDER, GstDeviceProviderClass))
  35. #define GST_DEVICE_PROVIDER_CAST(obj) ((GstDeviceProvider *)(obj))
  36. /**
  37. * GstDeviceProvider:
  38. * @parent: The parent #GstObject
  39. * @devices: a #GList of the #GstDevice objects
  40. *
  41. * The structure of the base #GstDeviceProvider
  42. *
  43. * Since: 1.4
  44. */
  45. struct _GstDeviceProvider {
  46. GstObject parent;
  47. /* Protected by the Object lock */
  48. GList *devices;
  49. /*< private >*/
  50. GstDeviceProviderPrivate *priv;
  51. gpointer _gst_reserved[GST_PADDING];
  52. };
  53. /**
  54. * GstDeviceProviderClass:
  55. * @parent_class: the parent #GstObjectClass structure
  56. * @factory: a pointer to the #GstDeviceProviderFactory that creates this
  57. * provider
  58. * @probe: Returns a list of devices that are currently available.
  59. * This should never block.
  60. * @start: Starts monitoring for new devices. Only subclasses that can know
  61. * that devices have been added or remove need to implement this method.
  62. * @stop: Stops monitoring for new devices. Only subclasses that implement
  63. * the start() method need to implement this method.
  64. *
  65. * The structure of the base #GstDeviceProviderClass
  66. *
  67. * Since: 1.4
  68. */
  69. struct _GstDeviceProviderClass {
  70. GstObjectClass parent_class;
  71. GstDeviceProviderFactory *factory;
  72. GList* (*probe) (GstDeviceProvider * provider);
  73. gboolean (*start) (GstDeviceProvider * provider);
  74. void (*stop) (GstDeviceProvider * provider);
  75. /*< private >*/
  76. gpointer metadata;
  77. /*< private >*/
  78. gpointer _gst_reserved[GST_PADDING];
  79. };
  80. GType gst_device_provider_get_type (void);
  81. GList * gst_device_provider_get_devices (GstDeviceProvider * provider);
  82. gboolean gst_device_provider_start (GstDeviceProvider * provider);
  83. void gst_device_provider_stop (GstDeviceProvider * provider);
  84. gboolean gst_device_provider_can_monitor (GstDeviceProvider * provider);
  85. GstBus * gst_device_provider_get_bus (GstDeviceProvider * provider);
  86. void gst_device_provider_device_add (GstDeviceProvider * provider,
  87. GstDevice * device);
  88. void gst_device_provider_device_remove (GstDeviceProvider * provider,
  89. GstDevice * device);
  90. gchar ** gst_device_provider_get_hidden_providers (GstDeviceProvider * provider);
  91. void gst_device_provider_hide_provider (GstDeviceProvider * provider,
  92. const gchar * name);
  93. void gst_device_provider_unhide_provider (GstDeviceProvider * provider,
  94. const gchar * name);
  95. /* device provider class meta data */
  96. void gst_device_provider_class_set_metadata (GstDeviceProviderClass *klass,
  97. const gchar *longname,
  98. const gchar *classification,
  99. const gchar *description,
  100. const gchar *author);
  101. void gst_device_provider_class_set_static_metadata (GstDeviceProviderClass *klass,
  102. const gchar *longname,
  103. const gchar *classification,
  104. const gchar *description,
  105. const gchar *author);
  106. void gst_device_provider_class_add_metadata (GstDeviceProviderClass * klass,
  107. const gchar * key, const gchar * value);
  108. void gst_device_provider_class_add_static_metadata (GstDeviceProviderClass * klass,
  109. const gchar * key, const gchar * value);
  110. const gchar * gst_device_provider_class_get_metadata (GstDeviceProviderClass * klass,
  111. const gchar * key);
  112. /* factory management */
  113. GstDeviceProviderFactory * gst_device_provider_get_factory (GstDeviceProvider * provider);
  114. #ifdef G_DEFINE_AUTOPTR_CLEANUP_FUNC
  115. G_DEFINE_AUTOPTR_CLEANUP_FUNC(GstDeviceProvider, gst_object_unref)
  116. #endif
  117. G_END_DECLS
  118. #endif /* __GST_DEVICE_PROVIDER_H__ */