1 /* GStreamer 2 * Copyright (C) 2021 Seungha Yang <seungha@centricular.com> 3 * 4 * This library is free software; you can redistribute it and/or 5 * modify it under the terms of the GNU Library General Public 6 * License as published by the Free Software Foundation; either 7 * version 2 of the License, or (at your option) any later version. 8 * 9 * This library is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 * Library General Public License for more details. 13 * 14 * You should have received a copy of the GNU Library General Public 15 * License along with this library; if not, write to the 16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, 17 * Boston, MA 02110-1301, USA. 18 */ 19 20 #ifndef __GST_WINRT_DEVICE_WATCHER_H__ 21 #define __GST_WINRT_DEVICE_WATCHER_H__ 22 23 #include <gst/gst.h> 24 #include <gst/winrt/winrt-prelude.h> 25 #include <windows.devices.enumeration.h> 26 27 G_BEGIN_DECLS 28 29 #define GST_TYPE_WINRT_DEVICE_WATCHER (gst_winrt_device_watcher_get_type()) 30 #define GST_WINRT_DEVICE_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_WINRT_DEVICE_WATCHER, GstWinRTDeviceWatcher)) 31 #define GST_WINRT_DEVICE_WATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_WINRT_DEVICE_WATCHER, GstWinRTDeviceWatcherClass)) 32 #define GST_IS_WINRT_DEVICE_WATCHER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_WINRT_DEVICE_WATCHER)) 33 #define GST_IS_WINRT_DEVICE_WATCHER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_WINRT_DEVICE_WATCHER)) 34 #define GST_WINRT_DEVICE_WATCHER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), GST_TYPE_WINRT_DEVICE_WATCHER, GstWinRTDeviceWatcherClass)) 35 #define GST_WINRT_DEVICE_WATCHER_CAST(obj) ((GstWinRTDeviceWatcher *)obj) 36 37 typedef struct _GstWinRTDeviceWatcher GstWinRTDeviceWatcher; 38 typedef struct _GstWinRTDeviceWatcherClass GstWinRTDeviceWatcherClass; 39 typedef struct _GstWinRTDeviceWatcherPrivate GstWinRTDeviceWatcherPrivate; 40 41 /* ABI::Windows::Devices::Enumeration::DeviceClass */ 42 #define GST_TYPE_WINRT_DEVICE_CLASS (gst_winrt_device_class_get_type ()) 43 typedef enum 44 { 45 GST_WINRT_DEVICE_CLASS_ALL = 0, 46 GST_WINRT_DEVICE_CLASS_AUDIO_CAPTURE = 1, 47 GST_WINRT_DEVICE_CLASS_AUDIO_RENDER = 2, 48 GST_WINRT_DEVICE_CLASS_PORTABLE_STORAGE_DEVICE = 3, 49 GST_WINRT_DEVICE_CLASS_VIDEO_CAPTURE = 4, 50 } GstWinRTDeviceClass; 51 52 typedef struct 53 { 54 /** 55 * GstWinRTDeviceWatcherCallbacks::added: 56 * @watcher: a #GstWinRTDeviceWatcher 57 * @info: (transfer none): a IDeviceInformation interface handle 58 * @user_data: a user_data 59 * 60 * Called when a device is added to the collection enumerated by the DeviceWatcher 61 */ 62 void (*added) (GstWinRTDeviceWatcher * watcher, 63 __x_ABI_CWindows_CDevices_CEnumeration_CIDeviceInformation * info, 64 gpointer user_data); 65 66 /** 67 * GstWinRTDeviceWatcherCallbacks::updated: 68 * @watcher: a #GstWinRTDeviceWatcher 69 * @info_update: (transfer none): a IDeviceInformationUpdate interface handle 70 * @user_data: a user_data 71 * 72 * Called when a device is updated in the collection of enumerated devices 73 */ 74 void (*updated) (GstWinRTDeviceWatcher * watcher, 75 __x_ABI_CWindows_CDevices_CEnumeration_CIDeviceInformationUpdate * info_update, 76 gpointer user_data); 77 78 /** 79 * GstWinRTDeviceWatcherCallbacks::removed: 80 * @watcher: a #GstWinRTDeviceWatcher 81 * @info_update: (transfer none): a IDeviceInformationUpdate interface handle 82 * @user_data: a user_data 83 * 84 * Called when a device is removed from the collection of enumerated devices 85 */ 86 void (*removed) (GstWinRTDeviceWatcher * watcher, 87 __x_ABI_CWindows_CDevices_CEnumeration_CIDeviceInformationUpdate * info_update, 88 gpointer user_data); 89 90 /** 91 * GstWinRTDeviceWatcherCallbacks::removed: 92 * @watcher: a #GstWinRTDeviceWatcher 93 * @user_data: a user_data 94 * 95 * Called when the enumeration of devices completes 96 */ 97 void (*enumeration_completed) (GstWinRTDeviceWatcher * watcher, 98 gpointer user_data); 99 } GstWinRTDeviceWatcherCallbacks; 100 101 struct _GstWinRTDeviceWatcher 102 { 103 GstObject parent; 104 105 GstWinRTDeviceWatcherPrivate *priv; 106 107 gpointer _gst_reserved[GST_PADDING]; 108 }; 109 110 struct _GstWinRTDeviceWatcherClass 111 { 112 GstObjectClass parent_class; 113 114 gpointer _gst_reserved[GST_PADDING_LARGE]; 115 }; 116 117 GST_WINRT_API 118 GType gst_winrt_device_class_get_type (void); 119 120 GST_WINRT_API 121 GType gst_winrt_device_watcher_get_type (void); 122 123 GST_WINRT_API 124 GstWinRTDeviceWatcher * gst_winrt_device_watcher_new (GstWinRTDeviceClass device_class, 125 const GstWinRTDeviceWatcherCallbacks * callbacks, 126 gpointer user_data); 127 128 GST_WINRT_API 129 gboolean gst_winrt_device_watcher_start (GstWinRTDeviceWatcher * watcher); 130 131 GST_WINRT_API 132 void gst_winrt_device_watcher_stop (GstWinRTDeviceWatcher * watcher); 133 134 G_END_DECLS 135 136 #endif /* __GST_WINRT_DEVICE_WATCHER_H__ */ 137