本文整理汇总了C++中pa_threaded_mainloop_get_api函数的典型用法代码示例。如果您正苦于以下问题:C++ pa_threaded_mainloop_get_api函数的具体用法?C++ pa_threaded_mainloop_get_api怎么用?C++ pa_threaded_mainloop_get_api使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pa_threaded_mainloop_get_api函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: audio_pa_init
int
audio_pa_init(void)
{
pa_audio_mode_t *pam;
audio_mode_t *am;
TRACE(TRACE_DEBUG, "PA", "Headerversion: %s, library: %s",
pa_get_headers_version(), pa_get_library_version());
mainloop = pa_threaded_mainloop_new();
api = pa_threaded_mainloop_get_api(mainloop);
pa_threaded_mainloop_lock(mainloop);
pa_threaded_mainloop_start(mainloop);
pa_threaded_mainloop_unlock(mainloop);
pam = calloc(1, sizeof(pa_audio_mode_t));
am = &pam->am;
am->am_multich_controls = 1;
am->am_formats =
AM_FORMAT_PCM_STEREO | AM_FORMAT_PCM_5DOT1 | AM_FORMAT_PCM_7DOT1;
am->am_sample_rates = AM_SR_ANY;
am->am_title = strdup("Pulseaudio");
am->am_id = strdup("pulseaudio");
am->am_preferred_size = 1024;
am->am_entry = pa_audio_start;
am->am_float = 1;
audio_mode_register(am);
return 1;
}
开发者ID:Allba,项目名称:showtime,代码行数:31,代码来源:pulseaudio.c
示例2: pulse_output_setup_context
/**
* Create, set up and connect a context.
*
* Caller must lock the main loop.
*
* @return true on success, false on error
*/
static bool
pulse_output_setup_context(struct pulse_output *po, GError **error_r)
{
assert(po != NULL);
assert(po->mainloop != NULL);
po->context = pa_context_new(pa_threaded_mainloop_get_api(po->mainloop),
MPD_PULSE_NAME);
if (po->context == NULL) {
g_set_error(error_r, pulse_output_quark(), 0,
"pa_context_new() has failed");
return false;
}
pa_context_set_state_callback(po->context,
pulse_output_context_state_cb, po);
pa_context_set_subscribe_callback(po->context,
pulse_output_subscribe_cb, po);
if (!pulse_output_connect(po, error_r)) {
pulse_output_delete_context(po);
return false;
}
return true;
}
开发者ID:Acidburn0zzz,项目名称:mpd,代码行数:33,代码来源:pulse_output_plugin.c
示例3: pulse_set_volume
static void pulse_set_volume(int l, int r) {
if (! connected)
return;
pa_threaded_mainloop_lock (mainloop);
CHECK_DEAD_GOTO (fail, 1);
/* sanitize output volumes. */
l = CLAMP(l, 0, 100);
r = CLAMP(r, 0, 100);
if (!volume_valid || volume.channels != 1) {
volume.values[0] = ((pa_volume_t) l * PA_VOLUME_NORM + 50) / 100;
volume.values[1] = ((pa_volume_t) r * PA_VOLUME_NORM + 50) / 100;
volume.channels = 2;
} else {
volume.values[0] = ((pa_volume_t) MAX (l, r) * PA_VOLUME_NORM + 50) / 100;
volume.channels = 1;
}
volume_valid = 1;
if (connected && !volume_time_event) {
struct timeval tv;
pa_mainloop_api *api = pa_threaded_mainloop_get_api(mainloop);
volume_time_event = api->time_new(api, pa_timeval_add(pa_gettimeofday(&tv), 100000), volume_time_cb, NULL);
}
fail:
if (connected)
pa_threaded_mainloop_unlock(mainloop);
}
开发者ID:Pitxyoki,项目名称:audacious-plugins,代码行数:33,代码来源:pulse_audio.c
示例4: tsmf_pulse_open
static BOOL tsmf_pulse_open(ITSMFAudioDevice *audio, const char *device)
{
TSMFPulseAudioDevice *pulse = (TSMFPulseAudioDevice *) audio;
if(device)
{
strcpy(pulse->device, device);
}
pulse->mainloop = pa_threaded_mainloop_new();
if(!pulse->mainloop)
{
DEBUG_WARN("pa_threaded_mainloop_new failed");
return FALSE;
}
pulse->context = pa_context_new(pa_threaded_mainloop_get_api(pulse->mainloop), "freerdp");
if(!pulse->context)
{
DEBUG_WARN("pa_context_new failed");
return FALSE;
}
pa_context_set_state_callback(pulse->context, tsmf_pulse_context_state_callback, pulse);
if(tsmf_pulse_connect(pulse))
{
DEBUG_WARN("tsmf_pulse_connect failed");
return FALSE;
}
DEBUG_TSMF("open device %s", pulse->device);
return TRUE;
}
开发者ID:10084462,项目名称:FreeRDP,代码行数:28,代码来源:tsmf_pulse.c
示例5: tsmf_pulse_open
static int
tsmf_pulse_open(ITSMFAudioDevice * audio, const char * device)
{
TSMFPulseAudioDevice * pulse = (TSMFPulseAudioDevice *) audio;
if (device)
{
strcpy(pulse->device, device);
}
pulse->mainloop = pa_threaded_mainloop_new();
if (!pulse->mainloop)
{
LLOGLN(0, ("tsmf_pulse_open: pa_threaded_mainloop_new failed"));
return 1;
}
pulse->context = pa_context_new(pa_threaded_mainloop_get_api(pulse->mainloop), "freerdp");
if (!pulse->context)
{
LLOGLN(0, ("tsmf_pulse_open: pa_context_new failed"));
return 1;
}
pa_context_set_state_callback(pulse->context, tsmf_pulse_context_state_callback, pulse);
if (tsmf_pulse_connect(pulse))
{
LLOGLN(0, ("tsmf_pulse_open: tsmf_pulse_connect failed"));
return 1;
}
LLOGLN(0, ("tsmf_pulse_open: open device %s", pulse->device));
return 0;
}
开发者ID:FreeRDP,项目名称:FreeRDP-old,代码行数:32,代码来源:tsmf_pulse.c
示例6: guac_pa_start_stream
void guac_pa_start_stream(guac_client* client) {
vnc_guac_client_data* client_data = (vnc_guac_client_data*) client->data;
pa_context* context;
guac_client_log_info(client, "Starting audio stream");
guac_audio_stream_begin(client_data->audio,
GUAC_VNC_AUDIO_RATE,
GUAC_VNC_AUDIO_CHANNELS,
GUAC_VNC_AUDIO_BPS);
/* Init main loop */
client_data->pa_mainloop = pa_threaded_mainloop_new();
/* Create context */
context = pa_context_new(
pa_threaded_mainloop_get_api(client_data->pa_mainloop),
"Guacamole Audio");
/* Set up context */
pa_context_set_state_callback(context, __context_state_callback, client);
pa_context_connect(context, client_data->pa_servername,
PA_CONTEXT_NOAUTOSPAWN, NULL);
/* Start loop */
pa_threaded_mainloop_start(client_data->pa_mainloop);
}
开发者ID:Huangyan9188,项目名称:guacamole-server,代码行数:28,代码来源:pulse.c
示例7: moko_notify_init
static void
moko_notify_init (MokoNotify *notify)
{
MokoNotifyPrivate *priv;
pa_threaded_mainloop *mainloop = NULL;
pa_mainloop_api *mapi = NULL;
priv = notify->priv = MOKO_NOTIFY_GET_PRIVATE (notify);
priv->started = 0;
priv->pac = NULL;
/* Start up pulse audio */
mainloop = pa_threaded_mainloop_new ();
if (!mainloop)
{
g_warning ("Unable to create PulseAudio mainloop.");
return;
}
mapi = pa_threaded_mainloop_get_api (mainloop);
priv->pac = pa_context_new (mapi, "Openmoko Dialer");
if (!priv->pac)
{
g_warning ("Could create the PulseAudio context");
return;
}
pa_context_connect (priv->pac, NULL, 0, NULL);
pa_threaded_mainloop_start (mainloop);
}
开发者ID:shr-project,项目名称:shr,代码行数:29,代码来源:notify.c
示例8: pa_threaded_mainloop_get_api
JNIEXPORT jlong JNICALL
Java_org_jitsi_impl_neomedia_pulseaudio_PA_threaded_1mainloop_1get_1api
(JNIEnv *env, jclass clazz, jlong m)
{
return
(intptr_t)
pa_threaded_mainloop_get_api((pa_threaded_mainloop *) (intptr_t) m);
}
开发者ID:DroidInteractiveSoftware,项目名称:libjitsi,代码行数:8,代码来源:org_jitsi_impl_neomedia_pulseaudio_PA.c
示例9: xmms_pulse_backend_new
/*
* Public API.
*/
xmms_pulse *
xmms_pulse_backend_new (const char *server, const char *name,
int *rerror)
{
xmms_pulse *p;
int error = PA_ERR_INTERNAL;
if (server && !*server) {
if (rerror)
*rerror = PA_ERR_INVALID;
return NULL;
}
p = g_new0 (xmms_pulse, 1);
if (!p)
return NULL;
p->volume = 100;
p->mainloop = pa_threaded_mainloop_new ();
if (!p->mainloop)
goto fail;
p->context = pa_context_new (pa_threaded_mainloop_get_api (p->mainloop), name);
if (!p->context)
goto fail;
pa_context_set_state_callback (p->context, context_state_cb, p);
if (pa_context_connect (p->context, server, 0, NULL) < 0) {
error = pa_context_errno (p->context);
goto fail;
}
pa_threaded_mainloop_lock (p->mainloop);
if (pa_threaded_mainloop_start (p->mainloop) < 0)
goto unlock_and_fail;
/* Wait until the context is ready */
pa_threaded_mainloop_wait (p->mainloop);
if (pa_context_get_state (p->context) != PA_CONTEXT_READY) {
error = pa_context_errno (p->context);
goto unlock_and_fail;
}
pa_threaded_mainloop_unlock (p->mainloop);
return p;
unlock_and_fail:
pa_threaded_mainloop_unlock (p->mainloop);
fail:
if (rerror)
*rerror = error;
xmms_pulse_backend_free (p);
return NULL;
}
开发者ID:chrippa,项目名称:xmms2,代码行数:61,代码来源:backend.c
示例10: Java_com_harrcharr_pulse_PulseContext_JNICreate
JNIEXPORT jlong JNICALL
Java_com_harrcharr_pulse_PulseContext_JNICreate(
JNIEnv *jenv, jclass jcls, pa_threaded_mainloop *m) {
dlog(0, "%d", m);
pa_mainloop_api *api = pa_threaded_mainloop_get_api(m);
pa_context *c = pa_context_new(api, "primary");
return c;
}
开发者ID:Amaliya,项目名称:libpulse-android,代码行数:9,代码来源:context.c
示例11: init_pulse_context
static void init_pulse_context(){
if (context==NULL){
pa_loop=pa_threaded_mainloop_new();
context=pa_context_new(pa_threaded_mainloop_get_api(pa_loop),NULL);
pa_context_set_state_callback(context,state_notify,NULL);
pa_context_connect(context,NULL,0,NULL);
pa_threaded_mainloop_start(pa_loop);
atexit(uninit_pulse_context);
}
}
开发者ID:LaughingAngus,项目名称:linphone-vs2008,代码行数:10,代码来源:pulseaudio.c
示例12: pa_threaded_mainloop_get_api
void PulseAudioSinksManager::retrieveSinks()
{
pa_mainloop_api *pa_mlapi;
// Create a mainloop API and connection to the default server
pa_ml.reset(pa_threaded_mainloop_new());
pa_mlapi = pa_threaded_mainloop_get_api(pa_ml.get());
pa_ctx.reset(pa_context_new(pa_mlapi, "QAudioSwitcher"));
pa_context_set_state_callback(pa_ctx.get(), PulseAudioSinksManager::pulseAudioStateCallback, this);
pa_context_connect(pa_ctx.get(), NULL, PA_CONTEXT_NOFAIL , NULL);
pa_threaded_mainloop_start(pa_ml.get());
}
开发者ID:sgiurgiu,项目名称:QAudioSwitcher,代码行数:11,代码来源:pulseaudiosinksmanager.cpp
示例13: name_
WavegenClient::WavegenClient(std::string const& name)
: name_(name)
{
paMainLoop_ = pa_threaded_mainloop_new();
pa_threaded_mainloop_set_name(paMainLoop_, name_.c_str());
pa_threaded_mainloop_start(paMainLoop_);
paMainApi_ = pa_threaded_mainloop_get_api(paMainLoop_);
paContext_ = pa_context_new(paMainApi_, name_.c_str());
pa_context_set_state_callback(paContext_, &WavegenClient::contextStateCallback, this);
}
开发者ID:bog2k3,项目名称:soundspace,代码行数:11,代码来源:WavegenClient.cpp
示例14: FreeRDPRdpsndDeviceEntry
int FreeRDPRdpsndDeviceEntry(PFREERDP_RDPSND_DEVICE_ENTRY_POINTS pEntryPoints)
{
rdpsndPulsePlugin* pulse;
RDP_PLUGIN_DATA* data;
pulse = xnew(rdpsndPulsePlugin);
pulse->device.Open = rdpsnd_pulse_open;
pulse->device.FormatSupported = rdpsnd_pulse_format_supported;
pulse->device.SetFormat = rdpsnd_pulse_set_format;
pulse->device.SetVolume = rdpsnd_pulse_set_volume;
pulse->device.Play = rdpsnd_pulse_play;
pulse->device.Start = rdpsnd_pulse_start;
pulse->device.Close = rdpsnd_pulse_close;
pulse->device.Free = rdpsnd_pulse_free;
data = pEntryPoints->plugin_data;
if (data && strcmp((char*)data->data[0], "pulse") == 0)
{
if(data->data[1] && strlen((char*)data->data[1]) > 0)
pulse->device_name = xstrdup((char*)data->data[1]);
else
pulse->device_name = NULL;
}
pulse->dsp_context = freerdp_dsp_context_new();
pulse->mainloop = pa_threaded_mainloop_new();
if (!pulse->mainloop)
{
DEBUG_WARN("pa_threaded_mainloop_new failed");
rdpsnd_pulse_free((rdpsndDevicePlugin*)pulse);
return 1;
}
pulse->context = pa_context_new(pa_threaded_mainloop_get_api(pulse->mainloop), "freerdp");
if (!pulse->context)
{
DEBUG_WARN("pa_context_new failed");
rdpsnd_pulse_free((rdpsndDevicePlugin*)pulse);
return 1;
}
pa_context_set_state_callback(pulse->context, rdpsnd_pulse_context_state_callback, pulse);
if (!rdpsnd_pulse_connect((rdpsndDevicePlugin*)pulse))
{
DEBUG_WARN("rdpsnd_pulse_connect failed");
rdpsnd_pulse_free((rdpsndDevicePlugin*)pulse);
return 1;
}
pEntryPoints->pRegisterRdpsndDevice(pEntryPoints->rdpsnd, (rdpsndDevicePlugin*)pulse);
return 0;
}
开发者ID:littlejawa,项目名称:FreeRDP,代码行数:53,代码来源:rdpsnd_pulse.c
示例15: Initialize
bool CPulseAE::Initialize()
{
m_Volume = g_settings.m_fVolumeLevel;
if ((m_MainLoop = pa_threaded_mainloop_new()) == NULL)
{
CLog::Log(LOGERROR, "PulseAudio: Failed to allocate main loop");
return false;
}
if ((m_Context = pa_context_new(pa_threaded_mainloop_get_api(m_MainLoop), "XBMC")) == NULL)
{
CLog::Log(LOGERROR, "PulseAudio: Failed to allocate context");
return false;
}
pa_context_set_state_callback(m_Context, ContextStateCallback, m_MainLoop);
if (pa_context_connect(m_Context, NULL, (pa_context_flags_t)0, NULL) < 0)
{
CLog::Log(LOGERROR, "PulseAudio: Failed to connect context");
return false;
}
pa_threaded_mainloop_lock(m_MainLoop);
if (pa_threaded_mainloop_start(m_MainLoop) < 0)
{
CLog::Log(LOGERROR, "PulseAudio: Failed to start MainLoop");
pa_threaded_mainloop_unlock(m_MainLoop);
return false;
}
/* Wait until the context is ready */
do
{
pa_threaded_mainloop_wait(m_MainLoop);
CLog::Log(LOGDEBUG, "PulseAudio: Context %s", ContextStateToString(pa_context_get_state(m_Context)));
}
while (pa_context_get_state(m_Context) != PA_CONTEXT_READY && pa_context_get_state(m_Context) != PA_CONTEXT_FAILED);
if (pa_context_get_state(m_Context) == PA_CONTEXT_FAILED)
{
CLog::Log(LOGERROR, "PulseAudio: Waited for the Context but it failed");
pa_threaded_mainloop_unlock(m_MainLoop);
return false;
}
pa_threaded_mainloop_unlock(m_MainLoop);
return true;
}
开发者ID:2BReality,项目名称:xbmc,代码行数:50,代码来源:PulseAE.cpp
示例16: SetupContext
bool CAESinkPULSE::SetupContext(const char *host, pa_context **context, pa_threaded_mainloop **mainloop)
{
if ((*mainloop = pa_threaded_mainloop_new()) == NULL)
{
CLog::Log(LOGERROR, "PulseAudio: Failed to allocate main loop");
return false;
}
if (((*context) = pa_context_new(pa_threaded_mainloop_get_api(*mainloop), "Kodi")) == NULL)
{
CLog::Log(LOGERROR, "PulseAudio: Failed to allocate context");
return false;
}
pa_context_set_state_callback(*context, ContextStateCallback, *mainloop);
if (pa_context_connect(*context, host, (pa_context_flags_t)0, NULL) < 0)
{
CLog::Log(LOGERROR, "PulseAudio: Failed to connect context");
return false;
}
pa_threaded_mainloop_lock(*mainloop);
if (pa_threaded_mainloop_start(*mainloop) < 0)
{
CLog::Log(LOGERROR, "PulseAudio: Failed to start MainLoop");
pa_threaded_mainloop_unlock(*mainloop);
return false;
}
/* Wait until the context is ready */
do
{
pa_threaded_mainloop_wait(*mainloop);
CLog::Log(LOGDEBUG, "PulseAudio: Context %s", ContextStateToString(pa_context_get_state(*context)));
}
while (pa_context_get_state(*context) != PA_CONTEXT_READY && pa_context_get_state(*context) != PA_CONTEXT_FAILED);
if (pa_context_get_state(*context) == PA_CONTEXT_FAILED)
{
CLog::Log(LOGERROR, "PulseAudio: Waited for the Context but it failed");
pa_threaded_mainloop_unlock(*mainloop);
return false;
}
pa_threaded_mainloop_unlock(*mainloop);
return true;
}
开发者ID:krattai,项目名称:sht_tv,代码行数:48,代码来源:AESinkPULSE.cpp
示例17: pulse_init_context
/**
* Initialize the pulse audio context with properties and callback
*/
static void pulse_init_context()
{
pulse_lock();
pa_proplist *p = pulse_properties();
pulse_context = pa_context_new_with_proplist(
pa_threaded_mainloop_get_api(pulse_mainloop), "OBS", p);
pa_context_set_state_callback(pulse_context,
pulse_context_state_changed, NULL);
pa_context_connect(pulse_context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL);
pa_proplist_free(p);
pulse_unlock();
}
开发者ID:ArnoldSchiller,项目名称:obs-studio,代码行数:19,代码来源:pulse-wrapper.c
示例18: 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
示例19: FreeRDPAudinDeviceEntry
int FreeRDPAudinDeviceEntry(PFREERDP_AUDIN_DEVICE_ENTRY_POINTS pEntryPoints)
{
AudinPulseDevice* pulse;
RDP_PLUGIN_DATA * data;
pulse = xnew(AudinPulseDevice);
pulse->iface.Open = audin_pulse_open;
pulse->iface.FormatSupported = audin_pulse_format_supported;
pulse->iface.SetFormat = audin_pulse_set_format;
pulse->iface.Close = audin_pulse_close;
pulse->iface.Free = audin_pulse_free;
data = pEntryPoints->plugin_data;
if (data && data->data[0] && strcmp(data->data[0], "audin") == 0 &&
data->data[1] && strcmp(data->data[1], "pulse") == 0)
{
strncpy(pulse->device_name, (char*)data->data[2], sizeof(pulse->device_name));
}
pulse->mainloop = pa_threaded_mainloop_new();
if (!pulse->mainloop)
{
DEBUG_WARN("pa_threaded_mainloop_new failed");
audin_pulse_free((IAudinDevice*) pulse);
return 1;
}
pulse->context = pa_context_new(pa_threaded_mainloop_get_api(pulse->mainloop), "freerdp");
if (!pulse->context)
{
DEBUG_WARN("pa_context_new failed");
audin_pulse_free((IAudinDevice*) pulse);
return 1;
}
pa_context_set_state_callback(pulse->context, audin_pulse_context_state_callback, pulse);
if (!audin_pulse_connect((IAudinDevice*) pulse))
{
audin_pulse_free((IAudinDevice*) pulse);
return 1;
}
pEntryPoints->pRegisterAudinDevice(pEntryPoints->plugin, (IAudinDevice*) pulse);
return 0;
}
开发者ID:joshiggins,项目名称:NeutrinoRDP,代码行数:45,代码来源:audin_pulse.c
示例20: pa_proplist_new
/*
* Create a new pulseaudio context
*/
static pa_context *pulse_context_create(pa_threaded_mainloop *m)
{
pa_context *c;
pa_proplist *p;
p = pa_proplist_new();
pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, "OBS Studio");
pa_proplist_sets(p, PA_PROP_APPLICATION_ICON_NAME, "application-exit");
pa_proplist_sets(p, PA_PROP_MEDIA_ROLE, "production");
pa_threaded_mainloop_lock(m);
c = pa_context_new_with_proplist(pa_threaded_mainloop_get_api(m),
"OBS Studio", p);
pa_threaded_mainloop_unlock(m);
pa_proplist_free(p);
return c;
}
开发者ID:Jhonthe7th,项目名称:obs-studio,代码行数:22,代码来源:pulse-input.c
注:本文中的pa_threaded_mainloop_get_api函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论