diff options
author | David Henningsson <david.henningsson@canonical.com> | 2011-11-25 15:17:12 +0100 |
---|---|---|
committer | Tanu Kaskinen <tanuk@iki.fi> | 2011-11-26 16:46:42 +0200 |
commit | d9685ec85db3722bf3988a64dda4d8ee21c7777b (patch) | |
tree | f6b18445054983e4c1ecbd1bdeb2af8b3917a93b /src/pulsecore/device-port.h | |
parent | 961ec210a676e768902956218ff50bfac26dae65 (diff) |
Turn device ports into reference counted objects
Since both cards and sinks can hold references to a port, it makes
sense to reference count them. Although no current implementation
actually has sinks with ports but without a card, it felt wrong
to make it harder to make such an implementation in the future.
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Diffstat (limited to 'src/pulsecore/device-port.h')
-rw-r--r-- | src/pulsecore/device-port.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/src/pulsecore/device-port.h b/src/pulsecore/device-port.h new file mode 100644 index 000000000..dfe3fc11f --- /dev/null +++ b/src/pulsecore/device-port.h @@ -0,0 +1,61 @@ +#ifndef foopulsedeviceporthfoo +#define foopulsedeviceporthfoo + +/*** + This file is part of PulseAudio. + + Copyright 2004-2006 Lennart Poettering + Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB + Copyright 2011 David Henningsson, Canonical Ltd. + + PulseAudio 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. + + PulseAudio 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 + General Public License for more details. + + You should have received a copy of the GNU Lesser General Public License + along with PulseAudio; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 + USA. +***/ + + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <inttypes.h> + +#include <pulse/def.h> +#include <pulsecore/object.h> +#include <pulsecore/hashmap.h> + +typedef struct pa_device_port pa_device_port; + +struct pa_device_port { + pa_object parent; /* Needed for reference counting */ + + char *name; + char *description; + + unsigned priority; + pa_port_available_t available; /* PA_PORT_AVAILABLE_UNKNOWN, PA_PORT_AVAILABLE_NO or PA_PORT_AVAILABLE_YES */ + + /* .. followed by some implementation specific data */ +}; + +PA_DECLARE_PUBLIC_CLASS(pa_device_port); +#define PA_DEVICE_PORT(s) (pa_device_port_cast(s)) + +#define PA_DEVICE_PORT_DATA(d) ((void*) ((uint8_t*) d + PA_ALIGN(sizeof(pa_device_port)))) + +pa_device_port *pa_device_port_new(const char *name, const char *description, size_t extra); + +void pa_device_port_hashmap_free(pa_hashmap *h); + +#endif |