43 default:
return PA_SAMPLE_INVALID;
64 switch (pa_context_get_state(c)) {
65 case PA_CONTEXT_FAILED:
66 case PA_CONTEXT_TERMINATED:
69 case PA_CONTEXT_READY:
83 pa_context_set_state_callback(*pa_ctx,
NULL,
NULL);
84 pa_context_disconnect(*pa_ctx);
85 pa_context_unref(*pa_ctx);
88 pa_mainloop_free(*pa_ml);
94 const char *server,
const char *description)
97 pa_mainloop_api *pa_mlapi =
NULL;
106 if (!(*pa_ml = pa_mainloop_new()))
108 if (!(pa_mlapi = pa_mainloop_get_api(*pa_ml))) {
112 if (!(*pa_ctx = pa_context_new(pa_mlapi, description))) {
116 pa_context_set_state_callback(*pa_ctx,
pa_state_cb, &context_state);
117 if (pa_context_connect(*pa_ctx, server, 0,
NULL) < 0) {
123 pa_mainloop_iterate(*pa_ml, 1,
NULL);
136 const char *
name,
const char *description)
173 int eol,
void *userdata)
180 int eol,
void *userdata)
199 pa_mainloop *pa_ml =
NULL;
200 pa_operation *pa_op =
NULL;
201 pa_context *pa_ctx =
NULL;
202 enum pa_operation_state op_state;
220 while ((op_state = pa_operation_get_state(pa_op)) == PA_OPERATION_RUNNING)
221 pa_mainloop_iterate(pa_ml, 1,
NULL);
222 if (op_state != PA_OPERATION_DONE)
224 pa_operation_unref(pa_op);
229 while ((op_state = pa_operation_get_state(pa_op)) == PA_OPERATION_RUNNING)
230 pa_mainloop_iterate(pa_ml, 1,
NULL);
231 if (op_state != PA_OPERATION_DONE)
233 pa_operation_unref(pa_op);
Structure describes basic parameters of the device.
char * device_description
human friendly name
memory handling functions
char * device_name
device name, format depends on device
Macro definitions for various function/variable attributes.
#define av_assert0(cond)
assert() equivalent, that is always enabled.
int ff_pulse_audio_connect_context(pa_mainloop **pa_ml, pa_context **pa_ctx, const char *server, const char *description)
AVCodecID
Identify the syntax and semantics of the bitstream.
int av_dynarray_add_nofree(void *tab_ptr, int *nb_ptr, void *elem)
Add an element to a dynamic array.
simple assert() macros that are a bit more flexible than ISO C assert().
AVDeviceInfo ** devices
list of autodetected devices
void ff_pulse_audio_disconnect_context(pa_mainloop **pa_ml, pa_context **pa_ctx)
pa_sample_format_t av_cold ff_codec_id_to_pulse_format(enum AVCodecID codec_id)
static void pa_state_cb(pa_context *c, void *userdata)
char * av_strdup(const char *s)
Duplicate the string s.
static void pulse_audio_sink_device_cb(pa_context *c, const pa_sink_info *dev, int eol, void *userdata)
static void pulse_server_info_cb(pa_context *c, const pa_server_info *i, void *userdata)
int ff_pulse_audio_get_devices(AVDeviceInfoList *devices, const char *server, int output)
int default_device
index of default device or -1 if no default
static void pulse_audio_source_device_cb(pa_context *c, const pa_source_info *dev, int eol, void *userdata)
AVDeviceInfoList * devices
static void pulse_add_detected_device(PulseAudioDeviceList *info, const char *name, const char *description)
int nb_devices
number of autodetected devices
#define AVERROR_EXTERNAL
Generic error in an external library.
void * av_mallocz(size_t size)
Allocate a block of size bytes with alignment suitable for all memory accesses (including vectors if ...