1 /*** 2 This file is part of PulseAudio. 3 4 Copyright 2004-2006 Lennart Poettering 5 Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB 6 7 PulseAudio is free software; you can redistribute it and/or modify 8 it under the terms of the GNU Lesser General Public License as published 9 by the Free Software Foundation; either version 2.1 of the License, 10 or (at your option) any later version. 11 12 PulseAudio is distributed in the hope that it will be useful, but 13 WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 General Public License for more details. 16 17 You should have received a copy of the GNU Lesser General Public License 18 along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 19 ***/ 20 21 22 #ifndef PULSE_DEVICE_PORT_H 23 #define PULSE_DEVICE_PORT_H 24 25 #ifdef __cplusplus 26 extern "C" { 27 #else 28 #include <stdbool.h> 29 #endif 30 31 #include "compat.h" 32 33 typedef struct pa_card pa_card; 34 typedef struct pa_device_port pa_device_port; 35 36 /** Port type. \since 14.0 */ 37 typedef enum pa_device_port_type { 38 PA_DEVICE_PORT_TYPE_UNKNOWN = 0, 39 PA_DEVICE_PORT_TYPE_AUX = 1, 40 PA_DEVICE_PORT_TYPE_SPEAKER = 2, 41 PA_DEVICE_PORT_TYPE_HEADPHONES = 3, 42 PA_DEVICE_PORT_TYPE_LINE = 4, 43 PA_DEVICE_PORT_TYPE_MIC = 5, 44 PA_DEVICE_PORT_TYPE_HEADSET = 6, 45 PA_DEVICE_PORT_TYPE_HANDSET = 7, 46 PA_DEVICE_PORT_TYPE_EARPIECE = 8, 47 PA_DEVICE_PORT_TYPE_SPDIF = 9, 48 PA_DEVICE_PORT_TYPE_HDMI = 10, 49 PA_DEVICE_PORT_TYPE_TV = 11, 50 PA_DEVICE_PORT_TYPE_RADIO = 12, 51 PA_DEVICE_PORT_TYPE_VIDEO = 13, 52 PA_DEVICE_PORT_TYPE_USB = 14, 53 PA_DEVICE_PORT_TYPE_BLUETOOTH = 15, 54 PA_DEVICE_PORT_TYPE_PORTABLE = 16, 55 PA_DEVICE_PORT_TYPE_HANDSFREE = 17, 56 PA_DEVICE_PORT_TYPE_CAR = 18, 57 PA_DEVICE_PORT_TYPE_HIFI = 19, 58 PA_DEVICE_PORT_TYPE_PHONE = 20, 59 PA_DEVICE_PORT_TYPE_NETWORK = 21, 60 PA_DEVICE_PORT_TYPE_ANALOG = 22, 61 } pa_device_port_type_t; 62 63 struct pa_device_port { 64 struct acp_port port; 65 66 pa_card *card; 67 68 char *name; 69 char *description; 70 char *preferred_profile; 71 pa_device_port_type_t type; 72 73 unsigned priority; 74 pa_available_t available; /* PA_AVAILABLE_UNKNOWN, PA_AVAILABLE_NO or PA_AVAILABLE_YES */ 75 char *availability_group; /* a string identifier which determine the group of devices handling the available state simultaneously */ 76 77 pa_direction_t direction; 78 int64_t latency_offset; 79 80 pa_proplist *proplist; 81 pa_hashmap *profiles; 82 pa_dynarray prof; 83 84 pa_dynarray devices; 85 86 void (*impl_free)(struct pa_device_port *port); 87 void *user_data; 88 }; 89 90 #define PA_DEVICE_PORT_DATA(p) (p->user_data); 91 92 typedef struct pa_device_port_new_data { 93 char *name; 94 char *description; 95 pa_available_t available; 96 char *availability_group; 97 pa_direction_t direction; 98 pa_device_port_type_t type; 99 } pa_device_port_new_data; 100 101 pa_device_port_new_data *pa_device_port_new_data_init(pa_device_port_new_data *data); 102 void pa_device_port_new_data_set_name(pa_device_port_new_data *data, const char *name); 103 void pa_device_port_new_data_set_description(pa_device_port_new_data *data, const char *description); 104 void pa_device_port_new_data_set_available(pa_device_port_new_data *data, pa_available_t available); 105 void pa_device_port_new_data_set_availability_group(pa_device_port_new_data *data, const char *group); 106 void pa_device_port_new_data_set_direction(pa_device_port_new_data *data, pa_direction_t direction); 107 void pa_device_port_new_data_set_type(pa_device_port_new_data *data, pa_device_port_type_t type); 108 void pa_device_port_new_data_done(pa_device_port_new_data *data); 109 110 pa_device_port *pa_device_port_new(pa_core *c, pa_device_port_new_data *data, size_t extra); 111 void pa_device_port_free(pa_device_port *port); 112 113 void pa_device_port_set_available(pa_device_port *p, pa_available_t status); 114 115 #ifdef __cplusplus 116 } 117 #endif 118 119 #endif /* PULSE_DEVICE_PORT_H */ 120