]> code.delx.au - pulseaudio/blob - src/pulsecore/device-port.h
sink/source: Initialize port before fixate hook (fixes volume/mute not saved)
[pulseaudio] / src / pulsecore / device-port.h
1 #ifndef foopulsedeviceporthfoo
2 #define foopulsedeviceporthfoo
3
4 /***
5 This file is part of PulseAudio.
6
7 Copyright 2004-2006 Lennart Poettering
8 Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
9 Copyright 2011 David Henningsson, Canonical Ltd.
10
11 PulseAudio is free software; you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as published
13 by the Free Software Foundation; either version 2.1 of the License,
14 or (at your option) any later version.
15
16 PulseAudio is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with PulseAudio; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 USA.
25 ***/
26
27 typedef struct pa_device_port pa_device_port;
28
29 #ifdef HAVE_CONFIG_H
30 #include <config.h>
31 #endif
32
33 #include <inttypes.h>
34
35 #include <pulse/def.h>
36 #include <pulsecore/object.h>
37 #include <pulsecore/hashmap.h>
38 #include <pulsecore/core.h>
39 #include <pulsecore/card.h>
40
41 struct pa_device_port {
42 pa_object parent; /* Needed for reference counting */
43 pa_core *core;
44 pa_card *card;
45
46 char *name;
47 char *description;
48
49 unsigned priority;
50 pa_available_t available; /* PA_AVAILABLE_UNKNOWN, PA_AVAILABLE_NO or PA_AVAILABLE_YES */
51
52 pa_proplist *proplist;
53 pa_hashmap *profiles; /* Does not own the profiles */
54 pa_direction_t direction;
55 int64_t latency_offset;
56
57 /* .. followed by some implementation specific data */
58 };
59
60 PA_DECLARE_PUBLIC_CLASS(pa_device_port);
61 #define PA_DEVICE_PORT(s) (pa_device_port_cast(s))
62
63 #define PA_DEVICE_PORT_DATA(d) ((void*) ((uint8_t*) d + PA_ALIGN(sizeof(pa_device_port))))
64
65 typedef struct pa_device_port_new_data {
66 char *name;
67 char *description;
68 pa_available_t available;
69 pa_direction_t direction;
70 } pa_device_port_new_data;
71
72 pa_device_port_new_data *pa_device_port_new_data_init(pa_device_port_new_data *data);
73 void pa_device_port_new_data_set_name(pa_device_port_new_data *data, const char *name);
74 void pa_device_port_new_data_set_description(pa_device_port_new_data *data, const char *description);
75 void pa_device_port_new_data_set_available(pa_device_port_new_data *data, pa_available_t available);
76 void pa_device_port_new_data_set_direction(pa_device_port_new_data *data, pa_direction_t direction);
77 void pa_device_port_new_data_done(pa_device_port_new_data *data);
78
79 pa_device_port *pa_device_port_new(pa_core *c, pa_device_port_new_data *data, size_t extra);
80
81 /* The port's available status has changed */
82 void pa_device_port_set_available(pa_device_port *p, pa_available_t available);
83
84 void pa_device_port_set_latency_offset(pa_device_port *p, int64_t offset);
85
86 pa_device_port *pa_device_port_find_best(pa_hashmap *ports);
87
88 #endif