• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ pa_threaded_mainloop_start函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中pa_threaded_mainloop_start函数的典型用法代码示例。如果您正苦于以下问题:C++ pa_threaded_mainloop_start函数的具体用法?C++ pa_threaded_mainloop_start怎么用?C++ pa_threaded_mainloop_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了pa_threaded_mainloop_start函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: vlc_mutex_lock

/**
 * Creates and references the VLC PulseAudio threaded main loop.
 * @return the mainloop or NULL on failure
 */
static pa_threaded_mainloop *vlc_pa_mainloop_init (void)
{
    pa_threaded_mainloop *mainloop;

    vlc_mutex_lock (&lock);
    if (refs == 0)
    {
        mainloop = pa_threaded_mainloop_new ();
        if (unlikely(mainloop == NULL))
            goto out;

        if (pa_threaded_mainloop_start (mainloop) < 0)
        {
            pa_threaded_mainloop_free (mainloop);
            goto out;
        }
        vlc_pa_mainloop = mainloop;
    }
    else
    {
        if (unlikely(refs < UINT_MAX))
        {
            mainloop = NULL;
            goto out;
        }
        mainloop = vlc_pa_mainloop;
    }

    assert (mainloop != NULL);
    refs++;
out:
    vlc_mutex_unlock (&lock);
    return mainloop;
}
开发者ID:OneDream,项目名称:faplayer,代码行数:38,代码来源:mainloop.c


示例2: pulse_enumerate_devices

/*
 * enumerate input/output devices
 */
static void pulse_enumerate_devices(obs_properties_t props, bool input)
{
	pa_context *c;
	pa_operation *op;
	pa_threaded_mainloop *m = pa_threaded_mainloop_new();
	struct pulse_enumerate e;

	e.mainloop = m;
	e.devices = obs_properties_add_list(props, "device_id", "Device",
		OBS_COMBO_TYPE_LIST, OBS_COMBO_FORMAT_STRING);
	e.input = input;

	pa_threaded_mainloop_start(m);
	c = pulse_context_create(m);

	if (pulse_context_connect(m, c) < 0)
		goto fail;

	pa_threaded_mainloop_lock(m);

	op = pa_context_get_source_info_list(c, pulse_source_info, (void *) &e);
	while (pa_operation_get_state(op) == PA_OPERATION_RUNNING)
		pa_threaded_mainloop_wait(m);
	pa_operation_unref(op);

	pa_threaded_mainloop_unlock(m);

	pa_context_disconnect(c);
fail:
	pa_context_unref(c);
	pa_threaded_mainloop_stop(m);
	pa_threaded_mainloop_free(m);
}
开发者ID:Jhonthe7th,项目名称:obs-studio,代码行数:36,代码来源:pulse-input.c


示例3: 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


示例4: 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


示例5: 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


示例6: pa_threaded_mainloop_new

context_t *backend_new(callback_t *callback) {
    context_t *context = (context_t*)malloc(sizeof(context_t));
    context->loop = pa_threaded_mainloop_new();
    context->state = PA_CONTEXT_UNCONNECTED;
    backend_init(context, callback);
    pa_threaded_mainloop_start(context->loop);
    return context;
}
开发者ID:KenjiTakahashi,项目名称:pacmixer,代码行数:8,代码来源:backend.c


示例7: 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


示例8: 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


示例9: 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


示例10: 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


示例11: pa_context_set_state_callback

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


示例12: rdpsnd_pulse_connect

static int
rdpsnd_pulse_connect(rdpsndDevicePlugin * devplugin)
{
	struct pulse_device_data * pulse_data;
	pa_context_state_t state;

	pulse_data = (struct pulse_device_data *) devplugin->device_data;
	if (!pulse_data->context)
		return 1;

	if (pa_context_connect(pulse_data->context, NULL, 0, NULL))
	{
		LLOGLN(0, ("rdpsnd_pulse_connect: pa_context_connect failed (%d)",
			pa_context_errno(pulse_data->context)));
		return 1;
	}
	pa_threaded_mainloop_lock(pulse_data->mainloop);
	if (pa_threaded_mainloop_start(pulse_data->mainloop) < 0)
	{
		pa_threaded_mainloop_unlock(pulse_data->mainloop);
		LLOGLN(0, ("rdpsnd_pulse_connect: pa_threaded_mainloop_start failed (%d)",
			pa_context_errno(pulse_data->context)));
		return 1;
	}
	for (;;)
	{
		state = pa_context_get_state(pulse_data->context);
		if (state == PA_CONTEXT_READY)
			break;
        if (!PA_CONTEXT_IS_GOOD(state))
		{
			LLOGLN(0, ("rdpsnd_pulse_connect: bad context state (%d)",
				pa_context_errno(pulse_data->context)));
			break;
		}
		pa_threaded_mainloop_wait(pulse_data->mainloop);
	}
	pa_threaded_mainloop_unlock(pulse_data->mainloop);
	if (state == PA_CONTEXT_READY)
	{
		LLOGLN(0, ("rdpsnd_pulse_connect: connected"));
		return 0;
	}
	else
	{
		pa_context_disconnect(pulse_data->context);
		return 1;
	}
}
开发者ID:nidelius,项目名称:FreeRDP,代码行数:49,代码来源:rdpsnd_pulse.c


示例13: pa_context_set_state_callback

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


示例14: 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


示例15: 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


示例16: pulse_init

int_fast32_t pulse_init()
{
	pthread_mutex_lock(&pulse_mutex);

	if (pulse_refs == 0) {
		pulse_mainloop = pa_threaded_mainloop_new();
		pa_threaded_mainloop_start(pulse_mainloop);

		pulse_init_context();
	}

	pulse_refs++;

	pthread_mutex_unlock(&pulse_mutex);

	return 0;
}
开发者ID:ArnoldSchiller,项目名称:obs-studio,代码行数:17,代码来源:pulse-wrapper.c


示例17: 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


示例18: 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


示例19: 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


示例20: 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



注:本文中的pa_threaded_mainloop_start函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ pa_threaded_mainloop_stop函数代码示例发布时间:2022-05-30
下一篇:
C++ pa_threaded_mainloop_new函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap