本文整理汇总了C++中pa_context_unref函数的典型用法代码示例。如果您正苦于以下问题:C++ pa_context_unref函数的具体用法?C++ pa_context_unref怎么用?C++ pa_context_unref使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pa_context_unref函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: pstream_memblock_callback
static void pstream_memblock_callback(pa_pstream *p, uint32_t channel, int64_t offset, pa_seek_mode_t seek, const pa_memchunk *chunk, void *userdata) {
pa_context *c = userdata;
pa_stream *s;
pa_assert(p);
pa_assert(chunk);
pa_assert(chunk->length > 0);
pa_assert(c);
pa_assert(PA_REFCNT_VALUE(c) >= 1);
pa_context_ref(c);
if (c->srb_template.readfd != -1 && c->srb_template.memblock == NULL) {
handle_srbchannel_memblock(c, chunk->memblock);
pa_context_unref(c);
return;
}
if ((s = pa_hashmap_get(c->record_streams, PA_UINT32_TO_PTR(channel)))) {
if (chunk->memblock) {
pa_memblockq_seek(s->record_memblockq, offset, seek, true);
pa_memblockq_push_align(s->record_memblockq, chunk);
} else
pa_memblockq_seek(s->record_memblockq, offset+chunk->length, seek, true);
if (s->read_callback) {
size_t l;
if ((l = pa_memblockq_get_length(s->record_memblockq)) > 0)
s->read_callback(s, l, s->read_userdata);
}
}
pa_context_unref(c);
}
开发者ID:Wezl,项目名称:pulseaudio,代码行数:36,代码来源:context.c
示例2: ausrv_destroy
void ausrv_destroy(struct ausrv *ausrv)
{
if (ausrv != NULL) {
stream_kill_all(ausrv);
if (ausrv->context != NULL)
pa_context_unref(ausrv->context);
if (ausrv->mainloop != NULL)
pa_glib_mainloop_free(ausrv->mainloop);
free(ausrv->server);
free(ausrv);
}
}
开发者ID:jusa,项目名称:tone-generator,代码行数:15,代码来源:ausrv.c
示例3: xmms_pulse_backend_free
void xmms_pulse_backend_free (xmms_pulse *p)
{
assert (p);
if (p->stream)
xmms_pulse_backend_close_stream (p);
if (p->mainloop)
pa_threaded_mainloop_stop (p->mainloop);
if (p->context)
pa_context_unref (p->context);
if (p->mainloop)
pa_threaded_mainloop_free (p->mainloop);
g_free (p);
}
开发者ID:kfihihc,项目名称:xmms2-devel,代码行数:15,代码来源:backend.c
示例4: m_destroy
static void m_destroy(GtkWindow *window, gpointer user_data)
{
if (m_pa_ctx) {
pa_context_unref(m_pa_ctx);
m_pa_ctx = NULL;
}
if (m_pa_ml) {
pa_threaded_mainloop_stop(m_pa_ml);
pa_threaded_mainloop_free(m_pa_ml);
m_pa_ml = NULL;
}
gtk_main_quit();
}
开发者ID:martyr-deepin,项目名称:pypulseaudio,代码行数:15,代码来源:cgtk.c
示例5: pa_mainloop_new
bool PulseAudio::init(bool)
{
pa_ml = pa_mainloop_new();
pa_mainloop_api* pa_mlapi = pa_mainloop_get_api(pa_ml);
pa_context* pa_ctx = pa_context_new(pa_mlapi, "MuseScore");
if (pa_context_connect(pa_ctx, NULL, pa_context_flags_t(0), NULL) != 0) {
qDebug("PulseAudio Context Connect Failed with Error: %s", pa_strerror(pa_context_errno(pa_ctx)));
return false;
}
int pa_ready = 0;
pa_context_set_state_callback(pa_ctx, pa_state_cb, &pa_ready);
while (pa_ready == 0)
pa_mainloop_iterate(pa_ml, 1, NULL);
if (pa_ready == 2)
return false;
ss.rate = _sampleRate;
ss.channels = 2;
ss.format = PA_SAMPLE_FLOAT32LE;
pa_stream* playstream = pa_stream_new(pa_ctx, "Playback", &ss, NULL);
if (!playstream) {
qDebug("pa_stream_new failed: %s", pa_strerror(pa_context_errno(pa_ctx)));
return false;
}
pa_stream_set_write_callback(playstream, paCallback, this);
bufattr.fragsize = (uint32_t)-1;
bufattr.maxlength = FRAMES * 2 * sizeof(float);
bufattr.minreq = FRAMES * 1 * sizeof(float); // pa_usec_to_bytes(0, &ss);
bufattr.prebuf = (uint32_t)-1;
bufattr.tlength = bufattr.maxlength;
int r = pa_stream_connect_playback(playstream, nullptr, &bufattr,
PA_STREAM_NOFLAGS, nullptr, nullptr);
if (r < 0) {
qDebug("pa_stream_connect_playback failed");
pa_context_disconnect(pa_ctx);
pa_context_unref(pa_ctx);
pa_mainloop_free(pa_ml);
pa_ml = 0;
return false;
}
return true;
}
开发者ID:CammyVee,项目名称:MuseScore,代码行数:48,代码来源:pulseaudio.cpp
示例6: pa_threaded_mainloop_stop
void QPulseAudioThread::cleanup()
{
pa_threaded_mainloop_stop ( mainloop );
if ( stream )
pa_stream_unref ( stream );
if ( context )
pa_context_unref ( context );
if ( stdio_event ) {
assert ( mainloop_api );
mainloop_api->io_free ( stdio_event );
}
if ( time_event ) {
assert ( mainloop_api );
mainloop_api->time_free ( time_event );
}
if ( mainloop_api )
mainloop_api->quit ( mainloop_api, 0 );
if ( mainloop ) {
pa_signal_done();
pa_threaded_mainloop_free ( mainloop );
}
if ( buffer )
pa_xfree ( buffer );
if ( server )
pa_xfree ( server );
if ( device )
pa_xfree ( device );
if ( client_name )
pa_xfree ( client_name );
if ( stream_name )
pa_xfree ( stream_name );
return ;
}
开发者ID:flair2005,项目名称:scribble,代码行数:48,代码来源:QPulseAudioThread.cpp
示例7: pa_context_disconnect
CPulseAE::~CPulseAE()
{
if (m_Context)
{
pa_context_disconnect(m_Context);
pa_context_unref(m_Context);
m_Context = NULL;
}
if (m_MainLoop)
{
pa_threaded_mainloop_stop(m_MainLoop);
pa_threaded_mainloop_free(m_MainLoop);
}
}
开发者ID:2BReality,项目名称:xbmc,代码行数:16,代码来源:PulseAE.cpp
示例8: pa_context_disconnect
AudioDevPulseAudio::~AudioDevPulseAudio()
{
this->uninit();
if (this->d->m_context) {
pa_context_disconnect(this->d->m_context);
pa_context_unref(this->d->m_context);
}
if (this->d->m_mainLoop) {
pa_threaded_mainloop_stop(this->d->m_mainLoop);
pa_threaded_mainloop_free(this->d->m_mainLoop);
}
delete this->d;
}
开发者ID:webcamoid,项目名称:webcamoid,代码行数:16,代码来源:audiodevpulseaudio.cpp
示例9: pa_threaded_mainloop_stop
void Sounds::destroy() {
if (m_loop) {
pa_threaded_mainloop_stop(m_loop);
}
if (m_ctx) {
pa_context_disconnect(m_ctx);
pa_context_unref(m_ctx);
m_ctx = 0;
}
if (m_loop) {
pa_threaded_mainloop_free(m_loop);
m_loop = 0;
}
}
开发者ID:alinelena,项目名称:cameraplus,代码行数:16,代码来源:sounds.cpp
示例10: pa_path_get_filename
static pa_context *connect_context(pa_threaded_mainloop *loop, ALboolean silent)
{
const char *name = "OpenAL Soft";
char path_name[PATH_MAX];
pa_context_state_t state;
pa_context *context;
int err;
if(pa_get_binary_name(path_name, sizeof(path_name)))
name = pa_path_get_filename(path_name);
context = pa_context_new(pa_threaded_mainloop_get_api(loop), name);
if(!context)
{
ERR("pa_context_new() failed\n");
return NULL;
}
pa_context_set_state_callback(context, context_state_callback, loop);
if((err=pa_context_connect(context, NULL, pulse_ctx_flags, NULL)) >= 0)
{
while((state=pa_context_get_state(context)) != PA_CONTEXT_READY)
{
if(!PA_CONTEXT_IS_GOOD(state))
{
err = pa_context_errno(context);
if(err > 0) err = -err;
break;
}
pa_threaded_mainloop_wait(loop);
}
}
pa_context_set_state_callback(context, NULL, NULL);
if(err < 0)
{
if(!silent)
ERR("Context did not connect: %s\n", pa_strerror(err));
pa_context_unref(context);
return NULL;
}
return context;
}
开发者ID:siana,项目名称:2p-openal,代码行数:46,代码来源:pulseaudio.c
示例11: setVolumes
PulseAudioSystem::~PulseAudioSystem() {
bRunning = false;
if (bAttenuating) {
qmWait.lock();
bAttenuating = false;
setVolumes();
bool success = qwcWait.wait(&qmWait, 1000);
if (! success) {
qWarning("PulseAudio: Shutdown timeout when attempting to restore volumes.");
}
qmWait.unlock();
}
pa_threaded_mainloop_stop(pam);
pa_context_disconnect(pacContext);
pa_context_unref(pacContext);
pa_threaded_mainloop_free(pam);
}
开发者ID:AceXare,项目名称:mumble,代码行数:17,代码来源:PulseAudio.cpp
示例12: pa_command_enable_srbchannel
static void pa_command_enable_srbchannel(pa_pdispatch *pd, uint32_t command, uint32_t tag, pa_tagstruct *t, void *userdata) {
pa_context *c = userdata;
#ifdef HAVE_CREDS
pa_cmsg_ancil_data *ancil = NULL;
pa_assert(pd);
pa_assert(command == PA_COMMAND_ENABLE_SRBCHANNEL);
pa_assert(t);
pa_assert(c);
pa_assert(PA_REFCNT_VALUE(c) >= 1);
ancil = pa_pdispatch_take_ancil_data(pd);
if (!ancil)
goto fail;
/* Currently only one srb channel is supported, might change in future versions */
if (c->srb_template.readfd != -1)
goto fail;
if (ancil->nfd != 2 || ancil->fds[0] == -1 || ancil->fds[1] == -1)
goto fail;
pa_context_ref(c);
c->srb_template.readfd = ancil->fds[0];
c->srb_template.writefd = ancil->fds[1];
c->srb_setup_tag = tag;
pa_context_unref(c);
ancil->close_fds_on_cleanup = false;
return;
fail:
if (ancil)
pa_cmsg_ancil_data_close_fds(ancil);
pa_context_fail(c, PA_ERR_PROTOCOL);
return;
#else
pa_assert(c);
pa_context_fail(c, PA_ERR_PROTOCOL);
#endif
}
开发者ID:Wezl,项目名称:pulseaudio,代码行数:45,代码来源:context.c
示例13: pa_stream_disconnect
void PulseAudioPlayer::CloseStream()
{
if (!open) return;
//printf("Closing PuseAudio\n");
if (is_playing) Stop();
// Hope for the best and just do things as quickly as possible
pa_stream_disconnect(stream);
pa_stream_unref(stream);
pa_context_disconnect(context);
pa_context_unref(context);
pa_threaded_mainloop_stop(mainloop);
pa_threaded_mainloop_free(mainloop);
//printf("Closed PulseAudio\n");
open = false;
}
开发者ID:Azpidatziak,项目名称:Aegisub,代码行数:18,代码来源:audio_player_pulse.cpp
示例14: gst_pulsesrc_destroy_context
static void
gst_pulsesrc_destroy_context (GstPulseSrc * pulsesrc)
{
gst_pulsesrc_destroy_stream (pulsesrc);
if (pulsesrc->context) {
pa_context_disconnect (pulsesrc->context);
/* Make sure we don't get any further callbacks */
pa_context_set_state_callback (pulsesrc->context, NULL, NULL);
pa_context_set_subscribe_callback (pulsesrc->context, NULL, NULL);
pa_context_unref (pulsesrc->context);
pulsesrc->context = NULL;
}
}
开发者ID:PeterXu,项目名称:gst-mobile,代码行数:18,代码来源:pulsesrc.c
示例15: pai_context_set_state
static void
pai_context_set_state(pa_context *c, pa_context_state_t new_state)
{
if (c->state == new_state)
return;
pa_context_ref(c);
c->state = new_state;
if (c->state_cb)
c->state_cb(c, c->state_cb_userdata);
if (new_state == PA_CONTEXT_FAILED || new_state == PA_CONTEXT_TERMINATED) {
c->state_cb = NULL;
}
pa_context_unref(c);
}
开发者ID:i-rinat,项目名称:apulse,代码行数:18,代码来源:apulse-context.c
示例16: 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
示例17: uninit
/** Destroy libao driver */
static void uninit(int immed) {
if (stream) {
if (!immed && pa_stream_get_state(stream) == PA_STREAM_READY)
wait_for_operation(pa_stream_drain(stream, NULL, NULL));
pa_stream_unref(stream);
stream = NULL;
}
if (context) {
pa_context_unref(context);
context = NULL;
}
if (mainloop) {
pa_mainloop_free(mainloop);
mainloop = NULL;
}
}
开发者ID:OpenSageTV,项目名称:mplayer-sage9orig,代码行数:20,代码来源:ao_polyp.c
示例18: pa_context_set_state
void pa_context_set_state(pa_context *c, pa_context_state_t st) {
pa_assert(c);
pa_assert(PA_REFCNT_VALUE(c) >= 1);
if (c->state == st)
return;
pa_context_ref(c);
c->state = st;
if (c->state_callback)
c->state_callback(c, c->state_userdata);
if (st == PA_CONTEXT_FAILED || st == PA_CONTEXT_TERMINATED)
context_unlink(c);
pa_context_unref(c);
}
开发者ID:felfert,项目名称:pulseaudio,代码行数:19,代码来源:context.c
示例19: pa_context_disconnect
void QPulseAudioEngine::release()
{
if (!m_prepared)
return;
if (m_context) {
pa_context_disconnect(m_context);
pa_context_unref(m_context);
m_context = 0;
}
if (m_mainLoop) {
pa_threaded_mainloop_stop(m_mainLoop);
pa_threaded_mainloop_free(m_mainLoop);
m_mainLoop = 0;
}
m_prepared = false;
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:19,代码来源:qpulseaudioengine.cpp
示例20: qpa_audio_fini
static void qpa_audio_fini (void *opaque)
{
paaudio *g = opaque;
if (g->mainloop) {
pa_threaded_mainloop_stop (g->mainloop);
}
if (g->context) {
pa_context_disconnect (g->context);
pa_context_unref (g->context);
}
if (g->mainloop) {
pa_threaded_mainloop_free (g->mainloop);
}
g_free(g);
}
开发者ID:juanquintela,项目名称:qemu,代码行数:19,代码来源:paaudio.c
注:本文中的pa_context_unref函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论