1 /* GStreamer 2 * Copyright (C) 2012 Olivier Crete <olivier.crete@collabora.com> 3 * 4 * pulsedeviceprovider.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 22 23 #ifndef __GST_PULSE_DEVICE_PROVIDER_H__ 24 #define __GST_PULSE_DEVICE_PROVIDER_H__ 25 26 #ifdef HAVE_CONFIG_H 27 #include "config.h" 28 #endif 29 30 #include <pulse/pulseaudio.h> 31 #include <pulse/thread-mainloop.h> 32 33 #include <gst/gst.h> 34 35 G_BEGIN_DECLS 36 37 typedef struct _GstPulseDeviceProvider GstPulseDeviceProvider; 38 typedef struct _GstPulseDeviceProviderClass GstPulseDeviceProviderClass; 39 40 #define GST_TYPE_PULSE_DEVICE_PROVIDER (gst_pulse_device_provider_get_type()) 41 #define GST_IS_PULSE_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PULSE_DEVICE_PROVIDER)) 42 #define GST_IS_PULSE_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PULSE_DEVICE_PROVIDER)) 43 #define GST_PULSE_DEVICE_PROVIDER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PULSE_DEVICE_PROVIDER, GstPulseDeviceProviderClass)) 44 #define GST_PULSE_DEVICE_PROVIDER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PULSE_DEVICE_PROVIDER, GstPulseDeviceProvider)) 45 #define GST_PULSE_DEVICE_PROVIDER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE_PROVIDER, GstPulseDeviceProviderClass)) 46 #define GST_PULSE_DEVICE_PROVIDER_CAST(obj) ((GstPulseDeviceProvider *)(obj)) 47 48 struct _GstPulseDeviceProvider { 49 GstDeviceProvider parent; 50 51 gchar *server; 52 gchar *client_name; 53 gchar *default_source_name; 54 gchar *default_sink_name; 55 56 pa_threaded_mainloop *mainloop; 57 pa_context *context; 58 }; 59 60 typedef enum { 61 GST_PULSE_DEVICE_TYPE_SOURCE, 62 GST_PULSE_DEVICE_TYPE_SINK 63 } GstPulseDeviceType; 64 65 struct _GstPulseDeviceProviderClass { 66 GstDeviceProviderClass parent_class; 67 }; 68 69 GType gst_pulse_device_provider_get_type (void); 70 71 72 typedef struct _GstPulseDevice GstPulseDevice; 73 typedef struct _GstPulseDeviceClass GstPulseDeviceClass; 74 75 #define GST_TYPE_PULSE_DEVICE (gst_pulse_device_get_type()) 76 #define GST_IS_PULSE_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_PULSE_DEVICE)) 77 #define GST_IS_PULSE_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_PULSE_DEVICE)) 78 #define GST_PULSE_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_PULSE_DEVICE, GstPulseDeviceClass)) 79 #define GST_PULSE_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_PULSE_DEVICE, GstPulseDevice)) 80 #define GST_PULSE_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_DEVICE, GstPulseDeviceClass)) 81 #define GST_PULSE_DEVICE_CAST(obj) ((GstPulseDevice *)(obj)) 82 83 struct _GstPulseDevice { 84 GstDevice parent; 85 86 GstPulseDeviceType type; 87 guint device_index; 88 gchar *internal_name; 89 gboolean is_default; 90 const gchar *element; 91 }; 92 93 struct _GstPulseDeviceClass { 94 GstDeviceClass parent_class; 95 }; 96 97 GType gst_pulse_device_get_type (void); 98 99 G_END_DECLS 100 101 #endif /* __GST_PULSE_DEVICE_PROVIDER_H__ */ 102