153a5a1b3Sopenharmony_ci#ifndef foopulsedeviceporthfoo
253a5a1b3Sopenharmony_ci#define foopulsedeviceporthfoo
353a5a1b3Sopenharmony_ci
453a5a1b3Sopenharmony_ci/***
553a5a1b3Sopenharmony_ci  This file is part of PulseAudio.
653a5a1b3Sopenharmony_ci
753a5a1b3Sopenharmony_ci  Copyright 2004-2006 Lennart Poettering
853a5a1b3Sopenharmony_ci  Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
953a5a1b3Sopenharmony_ci  Copyright 2011 David Henningsson, Canonical Ltd.
1053a5a1b3Sopenharmony_ci
1153a5a1b3Sopenharmony_ci  PulseAudio is free software; you can redistribute it and/or modify
1253a5a1b3Sopenharmony_ci  it under the terms of the GNU Lesser General Public License as published
1353a5a1b3Sopenharmony_ci  by the Free Software Foundation; either version 2.1 of the License,
1453a5a1b3Sopenharmony_ci  or (at your option) any later version.
1553a5a1b3Sopenharmony_ci
1653a5a1b3Sopenharmony_ci  PulseAudio is distributed in the hope that it will be useful, but
1753a5a1b3Sopenharmony_ci  WITHOUT ANY WARRANTY; without even the implied warranty of
1853a5a1b3Sopenharmony_ci  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1953a5a1b3Sopenharmony_ci  General Public License for more details.
2053a5a1b3Sopenharmony_ci
2153a5a1b3Sopenharmony_ci  You should have received a copy of the GNU Lesser General Public License
2253a5a1b3Sopenharmony_ci  along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
2353a5a1b3Sopenharmony_ci***/
2453a5a1b3Sopenharmony_ci
2553a5a1b3Sopenharmony_ci#ifdef HAVE_CONFIG_H
2653a5a1b3Sopenharmony_ci#include <config.h>
2753a5a1b3Sopenharmony_ci#endif
2853a5a1b3Sopenharmony_ci
2953a5a1b3Sopenharmony_ci#include <inttypes.h>
3053a5a1b3Sopenharmony_ci
3153a5a1b3Sopenharmony_ci#include <pulsecore/typedefs.h>
3253a5a1b3Sopenharmony_ci#include <pulse/def.h>
3353a5a1b3Sopenharmony_ci#include <pulsecore/object.h>
3453a5a1b3Sopenharmony_ci#include <pulsecore/hashmap.h>
3553a5a1b3Sopenharmony_ci#include <pulsecore/core.h>
3653a5a1b3Sopenharmony_ci#include <pulsecore/card.h>
3753a5a1b3Sopenharmony_ci
3853a5a1b3Sopenharmony_cistruct pa_device_port {
3953a5a1b3Sopenharmony_ci    pa_object parent; /* Needed for reference counting */
4053a5a1b3Sopenharmony_ci    pa_core *core;
4153a5a1b3Sopenharmony_ci    pa_card *card;
4253a5a1b3Sopenharmony_ci
4353a5a1b3Sopenharmony_ci    char *name;
4453a5a1b3Sopenharmony_ci    char *description;
4553a5a1b3Sopenharmony_ci    char *preferred_profile;
4653a5a1b3Sopenharmony_ci    pa_device_port_type_t type;
4753a5a1b3Sopenharmony_ci
4853a5a1b3Sopenharmony_ci    unsigned priority;
4953a5a1b3Sopenharmony_ci    pa_available_t available;         /* PA_AVAILABLE_UNKNOWN, PA_AVAILABLE_NO or PA_AVAILABLE_YES */
5053a5a1b3Sopenharmony_ci    char *availability_group;         /* a string indentifier which determine the group of devices handling the available state simulteneously */
5153a5a1b3Sopenharmony_ci
5253a5a1b3Sopenharmony_ci    pa_proplist *proplist;
5353a5a1b3Sopenharmony_ci    pa_hashmap *profiles; /* Does not own the profiles */
5453a5a1b3Sopenharmony_ci    pa_direction_t direction;
5553a5a1b3Sopenharmony_ci    int64_t latency_offset;
5653a5a1b3Sopenharmony_ci
5753a5a1b3Sopenharmony_ci    /* Free the extra implementation specific data. Called before other members are freed. */
5853a5a1b3Sopenharmony_ci    void (*impl_free)(pa_device_port *port);
5953a5a1b3Sopenharmony_ci
6053a5a1b3Sopenharmony_ci    /* .. followed by some implementation specific data */
6153a5a1b3Sopenharmony_ci};
6253a5a1b3Sopenharmony_ci
6353a5a1b3Sopenharmony_ciPA_DECLARE_PUBLIC_CLASS(pa_device_port);
6453a5a1b3Sopenharmony_ci#define PA_DEVICE_PORT(s) (pa_device_port_cast(s))
6553a5a1b3Sopenharmony_ci
6653a5a1b3Sopenharmony_ci#define PA_DEVICE_PORT_DATA(d) ((void*) ((uint8_t*) d + PA_ALIGN(sizeof(pa_device_port))))
6753a5a1b3Sopenharmony_ci
6853a5a1b3Sopenharmony_citypedef struct pa_device_port_new_data {
6953a5a1b3Sopenharmony_ci    char *name;
7053a5a1b3Sopenharmony_ci    char *description;
7153a5a1b3Sopenharmony_ci    pa_available_t available;
7253a5a1b3Sopenharmony_ci    char *availability_group;
7353a5a1b3Sopenharmony_ci    pa_direction_t direction;
7453a5a1b3Sopenharmony_ci    pa_device_port_type_t type;
7553a5a1b3Sopenharmony_ci} pa_device_port_new_data;
7653a5a1b3Sopenharmony_ci
7753a5a1b3Sopenharmony_cipa_device_port_new_data *pa_device_port_new_data_init(pa_device_port_new_data *data);
7853a5a1b3Sopenharmony_civoid pa_device_port_new_data_set_name(pa_device_port_new_data *data, const char *name);
7953a5a1b3Sopenharmony_civoid pa_device_port_new_data_set_description(pa_device_port_new_data *data, const char *description);
8053a5a1b3Sopenharmony_civoid pa_device_port_new_data_set_available(pa_device_port_new_data *data, pa_available_t available);
8153a5a1b3Sopenharmony_civoid pa_device_port_new_data_set_availability_group(pa_device_port_new_data *data, const char *group);
8253a5a1b3Sopenharmony_civoid pa_device_port_new_data_set_direction(pa_device_port_new_data *data, pa_direction_t direction);
8353a5a1b3Sopenharmony_civoid pa_device_port_new_data_set_type(pa_device_port_new_data *data, pa_device_port_type_t type);
8453a5a1b3Sopenharmony_civoid pa_device_port_new_data_done(pa_device_port_new_data *data);
8553a5a1b3Sopenharmony_ci
8653a5a1b3Sopenharmony_cipa_device_port *pa_device_port_new(pa_core *c, pa_device_port_new_data *data, size_t extra);
8753a5a1b3Sopenharmony_ci
8853a5a1b3Sopenharmony_ci/* The port's available status has changed */
8953a5a1b3Sopenharmony_civoid pa_device_port_set_available(pa_device_port *p, pa_available_t available);
9053a5a1b3Sopenharmony_ci
9153a5a1b3Sopenharmony_civoid pa_device_port_set_latency_offset(pa_device_port *p, int64_t offset);
9253a5a1b3Sopenharmony_civoid pa_device_port_set_preferred_profile(pa_device_port *p, const char *new_pp);
9353a5a1b3Sopenharmony_ci
9453a5a1b3Sopenharmony_cipa_device_port *pa_device_port_find_best(pa_hashmap *ports);
9553a5a1b3Sopenharmony_ci
9653a5a1b3Sopenharmony_cipa_sink *pa_device_port_get_sink(pa_device_port *p);
9753a5a1b3Sopenharmony_ci
9853a5a1b3Sopenharmony_cipa_source *pa_device_port_get_source(pa_device_port *p);
9953a5a1b3Sopenharmony_ci
10053a5a1b3Sopenharmony_ci#endif
101