本文整理汇总了C++中pa_threaded_mainloop_lock函数的典型用法代码示例。如果您正苦于以下问题:C++ pa_threaded_mainloop_lock函数的具体用法?C++ pa_threaded_mainloop_lock怎么用?C++ pa_threaded_mainloop_lock使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pa_threaded_mainloop_lock函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: get_delay_pulse
static double get_delay_pulse(struct ao *ao)
{
struct priv *priv = ao->priv;
pa_usec_t latency = (pa_usec_t) -1;
pa_threaded_mainloop_lock(priv->mainloop);
while (pa_stream_get_latency(priv->stream, &latency, NULL) < 0) {
if (pa_context_errno(priv->context) != PA_ERR_NODATA) {
GENERIC_ERR_MSG("pa_stream_get_latency() failed");
break;
}
/* Wait until latency data is available again */
pa_threaded_mainloop_wait(priv->mainloop);
}
pa_threaded_mainloop_unlock(priv->mainloop);
return latency == (pa_usec_t) -1 ? 0 : latency / 1000000.0;
}
开发者ID:jmglogow,项目名称:mpv,代码行数:16,代码来源:ao_pulse.c
示例2: pulse_write_process
static void pulse_write_process(MSFilter *f){
PulseWriteState *s=(PulseWriteState*)f->data;
mblk_t *im;
while((im=ms_queue_get(f->inputs[0]))!=NULL){
int bsize=msgdsize(im);
if (s->stream){
pa_threaded_mainloop_lock(pa_loop);
if (pa_stream_writable_size(s->stream)>=bsize){
//ms_message("Pushing data to pulseaudio");
pa_stream_write(s->stream,im->b_rptr,bsize,NULL,0,PA_SEEK_RELATIVE);
}
pa_threaded_mainloop_unlock(pa_loop);
}
freemsg(im);
}
}
开发者ID:LaughingAngus,项目名称:linphone-vs2008,代码行数:16,代码来源:pulseaudio.c
示例3: audin_pulse_connect
static tbool audin_pulse_connect(IAudinDevice* device)
{
pa_context_state_t state;
AudinPulseDevice* pulse = (AudinPulseDevice*) device;
if (!pulse->context)
return false;
if (pa_context_connect(pulse->context, NULL, 0, NULL))
{
DEBUG_WARN("pa_context_connect failed (%d)",
pa_context_errno(pulse->context));
return false;
}
pa_threaded_mainloop_lock(pulse->mainloop);
if (pa_threaded_mainloop_start(pulse->mainloop) < 0)
{
pa_threaded_mainloop_unlock(pulse->mainloop);
DEBUG_WARN("pa_threaded_mainloop_start failed (%d)",
pa_context_errno(pulse->context));
return false;
}
for (;;)
{
state = pa_context_get_state(pulse->context);
if (state == PA_CONTEXT_READY)
break;
if (!PA_CONTEXT_IS_GOOD(state))
{
DEBUG_WARN("bad context state (%d)",
pa_context_errno(pulse->context));
break;
}
pa_threaded_mainloop_wait(pulse->mainloop);
}
pa_threaded_mainloop_unlock(pulse->mainloop);
if (state == PA_CONTEXT_READY)
{
DEBUG_DVC("connected");
return true;
}
else
{
pa_context_disconnect(pulse->context);
return false;
}
}
开发者ID:joshiggins,项目名称:NeutrinoRDP,代码行数:47,代码来源:audin_pulse.c
示例4: Open
static int Open (vlc_object_t *obj)
{
services_discovery_t *sd = (services_discovery_t *)obj;
pa_operation *op;
pa_context *ctx;
services_discovery_sys_t *sys = malloc (sizeof (*sys));
if (unlikely(sys == NULL))
return VLC_ENOMEM;
ctx = vlc_pa_connect (obj, &sys->mainloop);
if (ctx == NULL)
{
free (sys);
return VLC_EGENERIC;
}
sd->p_sys = sys;
sd->description = _("Audio capture");
sys->context = ctx;
sys->root = NULL;
/* Subscribe for source events */
const pa_subscription_mask_t mask = PA_SUBSCRIPTION_MASK_SOURCE;
pa_threaded_mainloop_lock (sys->mainloop);
pa_context_set_subscribe_callback (ctx, ContextCallback, sd);
op = pa_context_subscribe (ctx, mask, NULL, NULL);
if (likely(op != NULL))
pa_operation_unref (op);
/* Enumerate existing sources */
op = pa_context_get_source_info_list (ctx, SourceCallback, sd);
if (likely(op != NULL))
{
//while (pa_operation_get_state (op) == PA_OPERATION_RUNNING)
// pa_threaded_mainloop_wait (sys->mainloop);
pa_operation_unref (op);
}
pa_threaded_mainloop_unlock (sys->mainloop);
return VLC_SUCCESS;
/*
error:
pa_threaded_mainloop_unlock (sys->mainloop);
vlc_pa_disconnect (obj, ctx, sys->mainloop);
free (sys);
return VLC_EGENERIC;*/
}
开发者ID:IAPark,项目名称:vlc,代码行数:47,代码来源:pulse.c
示例5: tsmf_pulse_connect
static int
tsmf_pulse_connect(TSMFPulseAudioDevice * pulse)
{
pa_context_state_t state;
if (!pulse->context)
return 1;
if (pa_context_connect(pulse->context, NULL, 0, NULL))
{
LLOGLN(0, ("tsmf_pulse_connect: pa_context_connect failed (%d)",
pa_context_errno(pulse->context)));
return 1;
}
pa_threaded_mainloop_lock(pulse->mainloop);
if (pa_threaded_mainloop_start(pulse->mainloop) < 0)
{
pa_threaded_mainloop_unlock(pulse->mainloop);
LLOGLN(0, ("tsmf_pulse_connect: pa_threaded_mainloop_start failed (%d)",
pa_context_errno(pulse->context)));
return 1;
}
for (;;)
{
state = pa_context_get_state(pulse->context);
if (state == PA_CONTEXT_READY)
break;
if (!PA_CONTEXT_IS_GOOD(state))
{
LLOGLN(0, ("tsmf_pulse_connect: bad context state (%d)",
pa_context_errno(pulse->context)));
break;
}
pa_threaded_mainloop_wait(pulse->mainloop);
}
pa_threaded_mainloop_unlock(pulse->mainloop);
if (state == PA_CONTEXT_READY)
{
LLOGLN(0, ("tsmf_pulse_connect: connected"));
return 0;
}
else
{
pa_context_disconnect(pulse->context);
return 1;
}
}
开发者ID:FreeRDP,项目名称:FreeRDP-old,代码行数:47,代码来源:tsmf_pulse.c
示例6: quisk_flush_pulseaudio
//Flush function. Holds mainloop lock until operation is completed.
void quisk_flush_pulseaudio(struct sound_dev *dev) {
pa_stream *s = dev->handle;
pa_operation *o;
pa_threaded_mainloop_lock(pa_ml);
if (!(o = pa_stream_flush(s, stream_flushed_callback, dev))) {
printf("pa_stream_flush(): %s\n", pa_strerror(pa_context_errno(pa_stream_get_context(s))));
exit(1);
}
else {
while(pa_operation_get_state(o) == PA_OPERATION_RUNNING)
pa_threaded_mainloop_wait(pa_ml);
pa_operation_unref(o);
}
pa_threaded_mainloop_unlock(pa_ml);
}
开发者ID:gonesurfing,项目名称:quisk-main,代码行数:18,代码来源:sound_pulseaudio.c
示例7: instream_pause_pa
static int instream_pause_pa(SoundIoPrivate *si, SoundIoInStreamPrivate *is, bool pause) {
SoundIoInStreamPulseAudio *ispa = &is->backend_data.pulseaudio;
SoundIoPulseAudio *sipa = &si->backend_data.pulseaudio;
pa_threaded_mainloop_lock(sipa->main_loop);
if (pause != pa_stream_is_corked(ispa->stream)) {
pa_operation *op = pa_stream_cork(ispa->stream, pause, NULL, NULL);
if (!op)
return SoundIoErrorStreaming;
pa_operation_unref(op);
}
pa_threaded_mainloop_unlock(sipa->main_loop);
return 0;
}
开发者ID:siavashserver,项目名称:libsoundio,代码行数:17,代码来源:pulseaudio.cpp
示例8: instream_destroy_pa
static void instream_destroy_pa(struct SoundIoPrivate *si, struct SoundIoInStreamPrivate *is) {
struct SoundIoInStreamPulseAudio *ispa = &is->backend_data.pulseaudio;
struct SoundIoPulseAudio *sipa = &si->backend_data.pulseaudio;
pa_stream *stream = ispa->stream;
if (stream) {
pa_threaded_mainloop_lock(sipa->main_loop);
pa_stream_set_state_callback(stream, NULL, NULL);
pa_stream_set_read_callback(stream, NULL, NULL);
pa_stream_disconnect(stream);
pa_stream_unref(stream);
pa_threaded_mainloop_unlock(sipa->main_loop);
ispa->stream = NULL;
}
}
开发者ID:IceDragon200,项目名称:libsoundio,代码行数:17,代码来源:pulseaudio.c
示例9: pa_simple_get_stream_index
int pa_simple_get_stream_index(pa_simple *p, unsigned int *idx, int *rerror) {
pa_assert(p);
CHECK_VALIDITY_RETURN_ANY(rerror, idx != NULL, PA_ERR_INVALID, -1);
pa_threaded_mainloop_lock(p->mainloop);
CHECK_DEAD_GOTO(p, rerror, unlock_and_fail);
*idx = pa_stream_get_index(p->stream);
pa_threaded_mainloop_unlock(p->mainloop);
return 0;
unlock_and_fail:
pa_threaded_mainloop_unlock(p->mainloop);
return -1;
}
开发者ID:tizenorg,项目名称:framework.multimedia.pulseaudio,代码行数:17,代码来源:simple.c
示例10: gst_pulsesrc_device_description
static gchar *
gst_pulsesrc_device_description (GstPulseSrc * pulsesrc)
{
pa_operation *o = NULL;
gchar *t;
if (!pulsesrc->mainloop)
goto no_mainloop;
pa_threaded_mainloop_lock (pulsesrc->mainloop);
if (!(o = pa_context_get_source_info_by_name (pulsesrc->context,
pulsesrc->device, gst_pulsesrc_source_info_cb, pulsesrc))) {
GST_ELEMENT_ERROR (pulsesrc, RESOURCE, FAILED,
("pa_stream_get_source_info() failed: %s",
pa_strerror (pa_context_errno (pulsesrc->context))), (NULL));
goto unlock;
}
while (pa_operation_get_state (o) == PA_OPERATION_RUNNING) {
if (gst_pulsesrc_is_dead (pulsesrc, FALSE))
goto unlock;
pa_threaded_mainloop_wait (pulsesrc->mainloop);
}
unlock:
if (o)
pa_operation_unref (o);
t = g_strdup (pulsesrc->device_description);
pa_threaded_mainloop_unlock (pulsesrc->mainloop);
return t;
no_mainloop:
{
GST_DEBUG_OBJECT (pulsesrc, "have no mainloop");
return NULL;
}
}
开发者ID:spunktsch,项目名称:svtplayer,代码行数:45,代码来源:pulsesrc.c
示例11: pulse_output_enable
static bool
pulse_output_enable(struct audio_output *ao, GError **error_r)
{
struct pulse_output *po = (struct pulse_output *)ao;
assert(po->mainloop == NULL);
assert(po->context == NULL);
/* create the libpulse mainloop and start the thread */
po->mainloop = pa_threaded_mainloop_new();
if (po->mainloop == NULL) {
g_free(po);
g_set_error(error_r, pulse_output_quark(), 0,
"pa_threaded_mainloop_new() has failed");
return false;
}
pa_threaded_mainloop_lock(po->mainloop);
if (pa_threaded_mainloop_start(po->mainloop) < 0) {
pa_threaded_mainloop_unlock(po->mainloop);
pa_threaded_mainloop_free(po->mainloop);
po->mainloop = NULL;
g_set_error(error_r, pulse_output_quark(), 0,
"pa_threaded_mainloop_start() has failed");
return false;
}
/* create the libpulse context and connect it */
if (!pulse_output_setup_context(po, error_r)) {
pa_threaded_mainloop_unlock(po->mainloop);
pa_threaded_mainloop_stop(po->mainloop);
pa_threaded_mainloop_free(po->mainloop);
po->mainloop = NULL;
return false;
}
pa_threaded_mainloop_unlock(po->mainloop);
return true;
}
开发者ID:Acidburn0zzz,项目名称:mpd,代码行数:45,代码来源:pulse_output_plugin.c
示例12: rdpsnd_pulse_play
static void rdpsnd_pulse_play(rdpsndDevicePlugin* device, uint8* data, int size)
{
rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
int len;
int ret;
uint8* src;
if (!pulse->stream)
return;
if (pulse->format == 0x11)
{
pulse->dsp_context->decode_ima_adpcm(pulse->dsp_context,
data, size, pulse->sample_spec.channels, pulse->block_size);
size = pulse->dsp_context->adpcm_size;
src = pulse->dsp_context->adpcm_buffer;
}
else
{
src = data;
}
pa_threaded_mainloop_lock(pulse->mainloop);
while (size > 0)
{
while ((len = pa_stream_writable_size(pulse->stream)) == 0)
{
pa_threaded_mainloop_wait(pulse->mainloop);
}
if (len < 0)
break;
if (len > size)
len = size;
ret = pa_stream_write(pulse->stream, src, len, NULL, 0LL, PA_SEEK_RELATIVE);
if (ret < 0)
{
DEBUG_WARN("pa_stream_write failed (%d)",
pa_context_errno(pulse->context));
break;
}
src += len;
size -= len;
}
pa_threaded_mainloop_unlock(pulse->mainloop);
}
开发者ID:littlejawa,项目名称:FreeRDP,代码行数:45,代码来源:rdpsnd_pulse.c
示例13: tsmf_pulse_close_stream
static boolean tsmf_pulse_close_stream(TSMFPulseAudioDevice* pulse)
{
if (!pulse->context || !pulse->stream)
return false;
DEBUG_DVC("");
pa_threaded_mainloop_lock(pulse->mainloop);
pa_stream_set_write_callback(pulse->stream, NULL, NULL);
tsmf_pulse_wait_for_operation(pulse,
pa_stream_drain(pulse->stream, tsmf_pulse_stream_success_callback, pulse));
pa_stream_disconnect(pulse->stream);
pa_stream_unref(pulse->stream);
pulse->stream = NULL;
pa_threaded_mainloop_unlock(pulse->mainloop);
return true;
}
开发者ID:felfert,项目名称:FreeRDP,代码行数:18,代码来源:tsmf_pulse.c
示例14: pa_threaded_mainloop_lock
void CAESinkPULSE::GetDelay(AEDelayStatus& status)
{
if (!m_IsAllocated)
{
status.SetDelay(0);
return;
}
pa_threaded_mainloop_lock(m_MainLoop);
pa_usec_t r_usec;
int negative;
if (pa_stream_get_latency(m_Stream, &r_usec, &negative) < 0)
r_usec = 0;
pa_threaded_mainloop_unlock(m_MainLoop);
status.SetDelay(r_usec / 1000000.0);
}
开发者ID:anaconda,项目名称:xbmc,代码行数:18,代码来源:AESinkPULSE.cpp
示例15: rdpsnd_pulse_close
static int
rdpsnd_pulse_close(rdpsndDevicePlugin * devplugin)
{
struct pulse_device_data * pulse_data;
pulse_data = (struct pulse_device_data *) devplugin->device_data;
if (!pulse_data->context || !pulse_data->stream)
return 1;
LLOGLN(0, ("rdpsnd_pulse_close:"));
pa_threaded_mainloop_lock(pulse_data->mainloop);
rdpsnd_pulse_wait_for_operation(devplugin,
pa_stream_drain(pulse_data->stream, rdpsnd_pulse_stream_success_callback, devplugin));
pa_stream_disconnect(pulse_data->stream);
pa_stream_unref(pulse_data->stream);
pulse_data->stream = NULL;
pa_threaded_mainloop_unlock(pulse_data->mainloop);
return 0;
}
开发者ID:nidelius,项目名称:FreeRDP,代码行数:18,代码来源:rdpsnd_pulse.c
示例16: context_create
const QStringList *get_source_names(){
if(source_names == NULL){
context_create();
source_names = new QStringList();
finished = false;
pa_context_get_source_info_list(context, get_source_info_list_callback, NULL);
do{
pa_threaded_mainloop_lock(threaded_main_loop);
pa_threaded_mainloop_wait(threaded_main_loop);
qDebug("Received signal...");
}while(! finished);
pa_threaded_mainloop_unlock(threaded_main_loop);
context_stop();
}
return source_names;
}
开发者ID:ruedigergad,项目名称:stultitiasimplex,代码行数:18,代码来源:pa_utils.cpp
示例17: rdpsnd_pulse_connect
static boolean rdpsnd_pulse_connect(rdpsndDevicePlugin* device)
{
rdpsndPulsePlugin* pulse = (rdpsndPulsePlugin*)device;
pa_context_state_t state;
if (!pulse->context)
return False;
if (pa_context_connect(pulse->context, NULL, 0, NULL))
{
DEBUG_WARN("pa_context_connect failed (%d)", pa_context_errno(pulse->context));
return False;
}
pa_threaded_mainloop_lock(pulse->mainloop);
if (pa_threaded_mainloop_start(pulse->mainloop) < 0)
{
pa_threaded_mainloop_unlock(pulse->mainloop);
DEBUG_WARN("pa_threaded_mainloop_start failed (%d)", pa_context_errno(pulse->context));
return False;
}
for (;;)
{
state = pa_context_get_state(pulse->context);
if (state == PA_CONTEXT_READY)
break;
if (!PA_CONTEXT_IS_GOOD(state))
{
DEBUG_WARN("bad context state (%d)", pa_context_errno(pulse->context));
break;
}
pa_threaded_mainloop_wait(pulse->mainloop);
}
pa_threaded_mainloop_unlock(pulse->mainloop);
if (state == PA_CONTEXT_READY)
{
DEBUG_SVC("connected");
return True;
}
else
{
pa_context_disconnect(pulse->context);
return False;
}
}
开发者ID:roman-b,项目名称:FreeRDP-1.0,代码行数:44,代码来源:rdpsnd_pulse.c
示例18: alc_pulse_init
ALCboolean alc_pulse_init(BackendFuncs *func_list)
{
ALCboolean ret = ALC_FALSE;
if(pulse_load())
{
pa_threaded_mainloop *loop;
pulse_ctx_flags = 0;
if(!GetConfigValueBool("pulse", "spawn-server", 0))
pulse_ctx_flags |= PA_CONTEXT_NOAUTOSPAWN;
if((loop=pa_threaded_mainloop_new()) &&
pa_threaded_mainloop_start(loop) >= 0)
{
pa_context *context;
pa_threaded_mainloop_lock(loop);
context = connect_context(loop, AL_TRUE);
if(context)
{
*func_list = pulse_funcs;
ret = ALC_TRUE;
/* Some libraries (Phonon, Qt) set some pulseaudio properties
* through environment variables, which causes all streams in
* the process to inherit them. This attempts to filter those
* properties out by setting them to 0-length data. */
prop_filter = pa_proplist_new();
pa_proplist_set(prop_filter, PA_PROP_MEDIA_ROLE, NULL, 0);
pa_proplist_set(prop_filter, "phonon.streamid", NULL, 0);
pa_context_disconnect(context);
pa_context_unref(context);
}
pa_threaded_mainloop_unlock(loop);
pa_threaded_mainloop_stop(loop);
}
if(loop)
pa_threaded_mainloop_free(loop);
}
return ret;
}
开发者ID:24BitGames,项目名称:LoomSDK,代码行数:44,代码来源:pulseaudio.c
示例19: pulse_get_attribute
static int pulse_get_attribute(snd_ctl_ext_t * ext, snd_ctl_ext_key_t key,
int *type, unsigned int *acc,
unsigned int *count)
{
snd_ctl_pulse_t *ctl = ext->private_data;
int err = 0;
if (key > 3)
return -EINVAL;
assert(ctl);
if (!ctl->p || !ctl->p->mainloop)
return -EBADFD;
pa_threaded_mainloop_lock(ctl->p->mainloop);
err = pulse_check_connection(ctl->p);
if (err < 0)
goto finish;
err = pulse_update_volume(ctl);
if (err < 0)
goto finish;
if (key & 1)
*type = SND_CTL_ELEM_TYPE_BOOLEAN;
else
*type = SND_CTL_ELEM_TYPE_INTEGER;
*acc = SND_CTL_EXT_ACCESS_READWRITE;
if (key == 0)
*count = ctl->source_volume.channels;
else if (key == 2)
*count = ctl->sink_volume.channels;
else
*count = 1;
finish:
pa_threaded_mainloop_unlock(ctl->p->mainloop);
return err;
}
开发者ID:Boshin,项目名称:workspace,代码行数:44,代码来源:ctl_pulse.c
示例20: tsmf_pulse_connect
static BOOL tsmf_pulse_connect(TSMFPulseAudioDevice *pulse)
{
pa_context_state_t state;
if(!pulse->context)
return FALSE;
if(pa_context_connect(pulse->context, NULL, 0, NULL))
{
DEBUG_WARN("pa_context_connect failed (%d)",
pa_context_errno(pulse->context));
return FALSE;
}
pa_threaded_mainloop_lock(pulse->mainloop);
if(pa_threaded_mainloop_start(pulse->mainloop) < 0)
{
pa_threaded_mainloop_unlock(pulse->mainloop);
DEBUG_WARN("pa_threaded_mainloop_start failed (%d)",
pa_context_errno(pulse->context));
return FALSE;
}
for(;;)
{
state = pa_context_get_state(pulse->context);
if(state == PA_CONTEXT_READY)
break;
if(!PA_CONTEXT_IS_GOOD(state))
{
DEBUG_TSMF("bad context state (%d)",
pa_context_errno(pulse->context));
break;
}
pa_threaded_mainloop_wait(pulse->mainloop);
}
pa_threaded_mainloop_unlock(pulse->mainloop);
if(state == PA_CONTEXT_READY)
{
DEBUG_TSMF("connected");
return TRUE;
}
else
{
pa_context_disconnect(pulse->context);
return FALSE;
}
}
开发者ID:10084462,项目名称:FreeRDP,代码行数:44,代码来源:tsmf_pulse.c
注:本文中的pa_threaded_mainloop_lock函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论