From f578f49e3265bfed6bd7e37391e66506f9a4bc91 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Thu, 11 May 2006 20:14:38 +0000 Subject: * implement device probing for GstPolypMixer git-svn-id: file:///home/lennart/svn/public/gst-pulse/trunk@25 bb39ca4e-bce3-0310-b5d4-eea78a553289 --- src/polypprobe.h | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 src/polypprobe.h (limited to 'src/polypprobe.h') diff --git a/src/polypprobe.h b/src/polypprobe.h new file mode 100644 index 0000000..face7cb --- /dev/null +++ b/src/polypprobe.h @@ -0,0 +1,115 @@ +#ifndef __GST_POLYPPROBE_H__ +#define __GST_POLYPPROBE_H__ + +/* $Id$ */ + +/*** + This file is part of gst-polyp. + + gst-polyp 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 2.1 of the + License, or (at your option) any later version. + + gst-polyp 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 gst-polyp; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + +#include + +G_BEGIN_DECLS + +#include +#include +#include + +typedef struct _GstPolypProbe GstPolypProbe; + +struct _GstPolypProbe { + gchar *server; + GList *devices; + int devices_valid; + + pa_threaded_mainloop *mainloop; + pa_context *context; + + GList *properties; + guint prop_id; + + int enumerate_sinks, enumerate_sources; + int operation_success; +}; + +GstPolypProbe* gst_polypprobe_new(GObjectClass *klass, guint prop_id, const gchar *server, gboolean sinks, gboolean sources); +void gst_polypprobe_free(GstPolypProbe* probe); + +const GList* gst_polypprobe_get_properties(GstPolypProbe *probe); +gboolean gst_polypprobe_needs_probe(GstPolypProbe *probe, guint prop_id, const GParamSpec *pspec); +void gst_polypprobe_probe_property(GstPolypProbe *probe, guint prop_id, const GParamSpec *pspec); +GValueArray *gst_polypprobe_get_values(GstPolypProbe *probe, guint prop_id, const GParamSpec *pspec); + +void gst_polypprobe_set_server(GstPolypProbe *c, const gchar *server); + +#define GST_IMPLEMENT_POLYPPROBE_METHODS(Type, interface_as_function) \ +static const GList* \ +interface_as_function ## _get_properties(GstPropertyProbe * probe) \ +{ \ + Type *this = (Type*) probe; \ + \ + g_return_val_if_fail(this != NULL, NULL); \ + g_return_val_if_fail(this->probe != NULL, NULL); \ + \ + return gst_polypprobe_get_properties(this->probe); \ +} \ +static gboolean \ +interface_as_function ## _needs_probe(GstPropertyProbe *probe, guint prop_id, \ + const GParamSpec *pspec) \ +{ \ + Type *this = (Type*) probe; \ + \ + g_return_val_if_fail(this != NULL, FALSE); \ + g_return_val_if_fail(this->probe != NULL, FALSE); \ + \ + return gst_polypprobe_needs_probe(this->probe, prop_id, pspec); \ +} \ +static void \ +interface_as_function ## _probe_property(GstPropertyProbe *probe, \ + guint prop_id, const GParamSpec *pspec) \ +{ \ + Type *this = (Type*) probe; \ + \ + g_return_if_fail(this != NULL); \ + g_return_if_fail(this->probe != NULL); \ + \ + gst_polypprobe_probe_property(this->probe, prop_id, pspec); \ +} \ +static GValueArray* \ +interface_as_function ## _get_values(GstPropertyProbe *probe, guint prop_id, \ + const GParamSpec *pspec) \ +{ \ + Type *this = (Type*) probe; \ + \ + g_return_val_if_fail(this != NULL, NULL); \ + g_return_val_if_fail(this->probe != NULL, NULL); \ + \ + return gst_polypprobe_get_values(this->probe, prop_id, pspec); \ +} \ +static void \ +interface_as_function ## _property_probe_interface_init(GstPropertyProbeInterface *iface)\ +{ \ + iface->get_properties = interface_as_function ## _get_properties; \ + iface->needs_probe = interface_as_function ## _needs_probe; \ + iface->probe_property = interface_as_function ## _probe_property; \ + iface->get_values = interface_as_function ## _get_values; \ +} + +G_END_DECLS + +#endif -- cgit