| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 | /*Copyright (C) 2014 by Leonhard Oelke <[email protected]>This program is free software: you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation, either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program.  If not, see <http://www.gnu.org/licenses/>.*/#include <inttypes.h>#include <pulse/stream.h>#include <pulse/context.h>#include <pulse/introspect.h>#pragma once/** * Initialize the pulseaudio mainloop and increase the reference count */int_fast32_t pulse_init();/** * Unreference the pulseaudio mainloop, when the reference count reaches * zero the mainloop will automatically be destroyed */void pulse_unref();/** * Lock the mainloop * * In order to allow for multiple threads to use the same mainloop pulseaudio * provides it's own locking mechanism. This function should be called before * using any pulseaudio function that is in any way related to the mainloop or * context. * * @note use of this function may cause deadlocks * * @warning do not use with pulse_ wrapper functions */void pulse_lock();/** * Unlock the mainloop * * @see pulse_lock() */void pulse_unlock();/** * Wait for events to happen * * This function should be called when waiting for an event to happen. */void pulse_wait();/** * Wait for accept signal from calling thread * * This function tells the pulseaudio mainloop wheter the data provided to * the callback should be retained until the calling thread executes * pulse_accept() * * If wait_for_accept is 0 the function returns and the data is freed. */void pulse_signal(int wait_for_accept);/** * Signal the waiting callback to return * * This function is used in conjunction with pulse_signal() */void pulse_accept();/** * Request source information * * The function will block until the operation was executed and the mainloop * called the provided callback function. * * @return negative on error * * @note The function will block until the server context is ready. * * @warning call without active locks */int_fast32_t pulse_get_source_info_list(pa_source_info_cb_t cb, void *userdata);/** * Request sink information * * The function will block until the operation was executed and the mainloop * called the provided callback function. * * @return negative on error * * @note The function will block until the server context is ready. * * @warning call without active locks */int_fast32_t pulse_get_sink_info_list(pa_sink_info_cb_t cb, void *userdata);/** * Request source information from a specific source * * The function will block until the operation was executed and the mainloop * called the provided callback function. * * @param cb pointer to the callback function * @param name the source name to get information for * @param userdata pointer to userdata the callback will be called with * * @return negative on error * * @note The function will block until the server context is ready. * * @warning call without active locks */int_fast32_t pulse_get_source_info(pa_source_info_cb_t cb, const char *name,				   void *userdata);/** * Request server information * * The function will block until the operation was executed and the mainloop * called the provided callback function. * * @return negative on error * * @note The function will block until the server context is ready. * * @warning call without active locks */int_fast32_t pulse_get_server_info(pa_server_info_cb_t cb, void *userdata);/** * Create a new stream with the default properties * * @note The function will block until the server context is ready. * * @warning call without active locks */pa_stream *pulse_stream_new(const char *name, const pa_sample_spec *ss,			    const pa_channel_map *map);
 |