• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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, see <http://www.gnu.org/licenses/>.
23 ***/
24 
25 #ifdef HAVE_CONFIG_H
26 #include <config.h>
27 #endif
28 
29 #include <inttypes.h>
30 
31 #include <pulsecore/typedefs.h>
32 #include <pulse/def.h>
33 #include <pulsecore/object.h>
34 #include <pulsecore/hashmap.h>
35 #include <pulsecore/core.h>
36 #include <pulsecore/card.h>
37 
38 struct pa_device_port {
39     pa_object parent; /* Needed for reference counting */
40     pa_core *core;
41     pa_card *card;
42 
43     char *name;
44     char *description;
45     char *preferred_profile;
46     pa_device_port_type_t type;
47 
48     unsigned priority;
49     pa_available_t available;         /* PA_AVAILABLE_UNKNOWN, PA_AVAILABLE_NO or PA_AVAILABLE_YES */
50     char *availability_group;         /* a string indentifier which determine the group of devices handling the available state simulteneously */
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     /* Free the extra implementation specific data. Called before other members are freed. */
58     void (*impl_free)(pa_device_port *port);
59 
60     /* .. followed by some implementation specific data */
61 };
62 
63 PA_DECLARE_PUBLIC_CLASS(pa_device_port);
64 #define PA_DEVICE_PORT(s) (pa_device_port_cast(s))
65 
66 #define PA_DEVICE_PORT_DATA(d) ((void*) ((uint8_t*) d + PA_ALIGN(sizeof(pa_device_port))))
67 
68 typedef struct pa_device_port_new_data {
69     char *name;
70     char *description;
71     pa_available_t available;
72     char *availability_group;
73     pa_direction_t direction;
74     pa_device_port_type_t type;
75 } pa_device_port_new_data;
76 
77 pa_device_port_new_data *pa_device_port_new_data_init(pa_device_port_new_data *data);
78 void pa_device_port_new_data_set_name(pa_device_port_new_data *data, const char *name);
79 void pa_device_port_new_data_set_description(pa_device_port_new_data *data, const char *description);
80 void pa_device_port_new_data_set_available(pa_device_port_new_data *data, pa_available_t available);
81 void pa_device_port_new_data_set_availability_group(pa_device_port_new_data *data, const char *group);
82 void pa_device_port_new_data_set_direction(pa_device_port_new_data *data, pa_direction_t direction);
83 void pa_device_port_new_data_set_type(pa_device_port_new_data *data, pa_device_port_type_t type);
84 void pa_device_port_new_data_done(pa_device_port_new_data *data);
85 
86 pa_device_port *pa_device_port_new(pa_core *c, pa_device_port_new_data *data, size_t extra);
87 
88 /* The port's available status has changed */
89 void pa_device_port_set_available(pa_device_port *p, pa_available_t available);
90 
91 void pa_device_port_set_latency_offset(pa_device_port *p, int64_t offset);
92 void pa_device_port_set_preferred_profile(pa_device_port *p, const char *new_pp);
93 
94 pa_device_port *pa_device_port_find_best(pa_hashmap *ports);
95 
96 pa_sink *pa_device_port_get_sink(pa_device_port *p);
97 
98 pa_source *pa_device_port_get_source(pa_device_port *p);
99 
100 #endif
101