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

C++ pa_context_get_state函数代码示例

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

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



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

示例1: __xine_pa_context_state_callback

/**
 * @brief Callback function called when the state of the context is changed
 * @param c Context which changed status
 * @param this_gen pulse_class_t pointer for the PulseAudio output class
 */
static void __xine_pa_context_state_callback(pa_context *c, void *this_gen)
{
  pulse_driver_t * this = (pulse_driver_t*) this_gen;

  switch (pa_context_get_state(c)) {

    case PA_CONTEXT_READY:
    case PA_CONTEXT_TERMINATED:
    case PA_CONTEXT_FAILED:
      pa_threaded_mainloop_signal(this->mainloop, 0);
      break;

    case PA_CONTEXT_CONNECTING:
    case PA_CONTEXT_UNCONNECTED:
    case PA_CONTEXT_AUTHORIZING:
    case PA_CONTEXT_SETTING_NAME:
      break;
  }
}
开发者ID:TELE-TWIN,项目名称:enigma2pc-1,代码行数:24,代码来源:audio_pulse_out.c


示例2: gst_pulsesrc_context_state_cb

static void
gst_pulsesrc_context_state_cb (pa_context * c, void *userdata)
{
  GstPulseSrc *pulsesrc = GST_PULSESRC_CAST (userdata);

  switch (pa_context_get_state (c)) {
    case PA_CONTEXT_READY:
    case PA_CONTEXT_TERMINATED:
    case PA_CONTEXT_FAILED:
      pa_threaded_mainloop_signal (pulsesrc->mainloop, 0);
      break;

    case PA_CONTEXT_UNCONNECTED:
    case PA_CONTEXT_CONNECTING:
    case PA_CONTEXT_AUTHORIZING:
    case PA_CONTEXT_SETTING_NAME:
      break;
  }
}
开发者ID:rosciio,项目名称:gst-plugins-good,代码行数:19,代码来源:pulsesrc.c


示例3: context_state_cb

static void context_state_cb(pa_context *c, void *userdata) {
    pa_simple *p = userdata;
    pa_assert(c);
    pa_assert(p);

    switch (pa_context_get_state(c)) {
        case PA_CONTEXT_READY:
        case PA_CONTEXT_TERMINATED:
        case PA_CONTEXT_FAILED:
            pa_threaded_mainloop_signal(p->mainloop, 0);
            break;

        case PA_CONTEXT_UNCONNECTED:
        case PA_CONTEXT_CONNECTING:
        case PA_CONTEXT_AUTHORIZING:
        case PA_CONTEXT_SETTING_NAME:
            break;
    }
}
开发者ID:KOLIA112,项目名称:pulseaudio,代码行数:19,代码来源:simple.c


示例4: context_state_callback

static void context_state_callback(pa_context *c, void *userdata)
{
	switch (pa_context_get_state(c)) {
	case PA_CONTEXT_CONNECTING:
	case PA_CONTEXT_AUTHORIZING:
	case PA_CONTEXT_SETTING_NAME:
	case PA_CONTEXT_READY:
		break;
	case PA_CONTEXT_TERMINATED:
		gtk_main_quit();
		break;
	case PA_CONTEXT_FAILED:
	default:
		fprintf(stderr, "Connection failure: %s",
			pa_strerror(pa_context_errno(c)));
		gtk_main_quit();
		break;
	}
}
开发者ID:osandov,项目名称:supavolumed,代码行数:19,代码来源:supavolumed.c


示例5: context_state_cb

void context_state_cb(pa_context *c, void *userdata) {

    switch (pa_context_get_state(c)) {
    case PA_CONTEXT_UNCONNECTED:
    case PA_CONTEXT_CONNECTING:
    case PA_CONTEXT_AUTHORIZING:
    case PA_CONTEXT_SETTING_NAME:
	break;

    case PA_CONTEXT_READY: {
    printf("func = %s , LINE = %d \n",__func__,__LINE__);
	pa_operation *o;

	// set up a callback to tell us about source devices
	if (!(o = pa_context_get_source_info_list(c,
					    sourcelist_cb,
					    NULL
						  ))) {
	    show_error(_("pa_context_subscribe() failed"));
	    return;
	}
	pa_operation_unref(o);

	// set up a callback to tell us about sink devices
	if (!(o = pa_context_get_sink_info_list(c,
					    sinklist_cb,
					    NULL
						  ))) {
	    show_error(_("pa_context_subscribe() failed"));
	    return;
	}
	pa_operation_unref(o);

	break;
    }

    case PA_CONTEXT_FAILED:
    case PA_CONTEXT_TERMINATED:
    default:
	return;
    }
}
开发者ID:Pradeeplge,项目名称:pulseaudio,代码行数:42,代码来源:palist_devices.c


示例6: pa_state_cb

static void pa_state_cb(pa_context* c, void* data)
      {
      int* pa_ready = (int*)data;
      switch (pa_context_get_state(c)) {
            // These are just here for reference
            case PA_CONTEXT_UNCONNECTED:
            case PA_CONTEXT_CONNECTING:
            case PA_CONTEXT_AUTHORIZING:
            case PA_CONTEXT_SETTING_NAME:
            default:
                  break;
            case PA_CONTEXT_FAILED:
            case PA_CONTEXT_TERMINATED:
                  *pa_ready = 2;
                  break;
            case PA_CONTEXT_READY:
                  *pa_ready = 1;
                  break;
            }
      }
开发者ID:CammyVee,项目名称:MuseScore,代码行数:20,代码来源:pulseaudio.cpp


示例7: InternalAudioSink

std::shared_ptr<AudioSink> AudioSinksManager::create_new_sink(std::string name,
                                                              std::string pretty_name) {
    auto internal_sink = std::shared_ptr<InternalAudioSink>(
            new InternalAudioSink(this, std::move(name), std::move(pretty_name)));
    auto sink = std::shared_ptr<AudioSink>(new AudioSink(internal_sink));
    pa_mainloop.get_strand().dispatch([this, internal_sink]() {
        if (stopping) {
            internal_sink->free();
        } else {
            logger->trace("(AudioSinkManager) Registering audio_sink '{}'",
                          internal_sink->get_name());
            audio_sinks.insert(internal_sink);
            sink_identifier_audio_sink.emplace(internal_sink->get_identifier(), internal_sink);
            if (pa_context_get_state(context) == PA_CONTEXT_READY) {
                internal_sink->start_sink();
            }
        }
    });
    return sink;
}
开发者ID:p2004a,项目名称:pulseaudio-chromecast-sink,代码行数:20,代码来源:audio_sinks_manager.cpp


示例8: switch

void AudioOutputPulseAudio::ContextStateCallback(pa_context *c, void *arg)
{
    QString fn_log_tag = "_ContextStateCallback, ";
    AudioOutputPulseAudio *audoutP = static_cast<AudioOutputPulseAudio*>(arg);
    switch (pa_context_get_state(c))
    {
    case PA_CONTEXT_READY:
        pa_threaded_mainloop_signal(audoutP->mainloop, 0);
        break;
    case PA_CONTEXT_TERMINATED:
    case PA_CONTEXT_FAILED:
        pa_threaded_mainloop_signal(audoutP->mainloop, 0);
        break;
    case PA_CONTEXT_CONNECTING:
    case PA_CONTEXT_UNCONNECTED:
    case PA_CONTEXT_AUTHORIZING:
    case PA_CONTEXT_SETTING_NAME:
        break;
    }
}
开发者ID:microe,项目名称:mythtv,代码行数:20,代码来源:audiooutputpulse.cpp


示例9: context_state_callback

void context_state_callback(pa_context *context, void *data){
    (void) data;

    pa_context_state_t state = pa_context_get_state(context);
    qDebug("Context state changed: %d", state);
    switch(state){
    case PA_CONTEXT_READY:
        qDebug("Ready, set, go...");
        connected = true;
        pa_threaded_mainloop_signal(threaded_main_loop, 0);
        break;
    case PA_CONTEXT_FAILED:
        qDebug("Connecting context failed.");
        failed = true;
        pa_threaded_mainloop_signal(threaded_main_loop, 0);
        break;
    default:
        break;
    }
}
开发者ID:ruedigergad,项目名称:vumeter,代码行数:20,代码来源:pa_context_helper.cpp


示例10: pa_context_get_state

void PulseAudioSinksManager::pulseAudioStateCallback(pa_context *ctx, void *userdata)
{
    PulseAudioSinksManager* sinksManager = (PulseAudioSinksManager*)userdata;
    pa_context_state_t state =  pa_context_get_state(ctx);
    switch  (state) {
    // There are just here for reference
    case PA_CONTEXT_UNCONNECTED:
    case PA_CONTEXT_CONNECTING:
    case PA_CONTEXT_AUTHORIZING:
    case PA_CONTEXT_SETTING_NAME:
    case PA_CONTEXT_TERMINATED:
    default:
        break;
    case PA_CONTEXT_FAILED:
        sinksManager->emitSignalError("Cannot connect to pulse audio");
        break;
    case PA_CONTEXT_READY:
        sinksManager->retrieveSinksInfo();
        break;
    }
}
开发者ID:sgiurgiu,项目名称:QAudioSwitcher,代码行数:21,代码来源:pulseaudiosinksmanager.cpp


示例11: drvHostPulseAudioCbCtxState

/**
 * Context status changed.
 */
static void drvHostPulseAudioCbCtxState(pa_context *pContext, void *pvUser)
{
    AssertPtrReturnVoid(pContext);
    NOREF(pvUser);

    switch (pa_context_get_state(pContext))
    {
        case PA_CONTEXT_READY:
        case PA_CONTEXT_TERMINATED:
            drvHostPulseAudioAbortMainLoop();
            break;

        case PA_CONTEXT_FAILED:
            LogRel(("PulseAudio: Audio input/output stopped!\n"));
            drvHostPulseAudioAbortMainLoop();
            break;

        default:
            break;
    }
}
开发者ID:bhanug,项目名称:virtualbox,代码行数:24,代码来源:DrvHostPulseAudio.cpp


示例12: gst_pulsemixer_ctrl_context_state_cb

static void
gst_pulsemixer_ctrl_context_state_cb (pa_context * context, void *userdata)
{
  GstPulseMixerCtrl *c = GST_PULSEMIXER_CTRL (userdata);

  /* Called from the background thread! */

  switch (pa_context_get_state (context)) {
    case PA_CONTEXT_READY:
    case PA_CONTEXT_TERMINATED:
    case PA_CONTEXT_FAILED:
      pa_threaded_mainloop_signal (c->mainloop, 0);
      break;

    case PA_CONTEXT_UNCONNECTED:
    case PA_CONTEXT_CONNECTING:
    case PA_CONTEXT_AUTHORIZING:
    case PA_CONTEXT_SETTING_NAME:
      break;
  }
}
开发者ID:JJCG,项目名称:gst-plugins-good,代码行数:21,代码来源:pulsemixerctrl.c


示例13: tsmf_pulse_context_state_callback

static void tsmf_pulse_context_state_callback(pa_context *context, void *userdata)
{
	TSMFPulseAudioDevice *pulse = (TSMFPulseAudioDevice *) userdata;
	pa_context_state_t state;
	state = pa_context_get_state(context);
	switch(state)
	{
		case PA_CONTEXT_READY:
			DEBUG_TSMF("PA_CONTEXT_READY");
			pa_threaded_mainloop_signal(pulse->mainloop, 0);
			break;
		case PA_CONTEXT_FAILED:
		case PA_CONTEXT_TERMINATED:
			DEBUG_TSMF("state %d", (int)state);
			pa_threaded_mainloop_signal(pulse->mainloop, 0);
			break;
		default:
			DEBUG_TSMF("state %d", (int)state);
			break;
	}
}
开发者ID:10084462,项目名称:FreeRDP,代码行数:21,代码来源:tsmf_pulse.c


示例14: context_state_callback

/* This is called whenever the context status changes */
static void context_state_callback(pa_context *c, void *userdata) {
    fail_unless(c != NULL);

    switch (pa_context_get_state(c)) {
        case PA_CONTEXT_CONNECTING:
        case PA_CONTEXT_AUTHORIZING:
        case PA_CONTEXT_SETTING_NAME:
            break;

        case PA_CONTEXT_READY: {

            int i;
            fprintf(stderr, "Connection established.\n");

            for (i = 0; i < NSTREAMS; i++) {
                char name[64];

                fprintf(stderr, "Creating stream %i\n", i);

                snprintf(name, sizeof(name), "stream #%i", i);

                streams[i] = pa_stream_new(c, name, &sample_spec, NULL);
                fail_unless(streams[i] != NULL);
                pa_stream_set_state_callback(streams[i], stream_state_callback, (void*) (long) i);
                pa_stream_connect_playback(streams[i], NULL, &buffer_attr, PA_STREAM_START_CORKED, NULL, i == 0 ? NULL : streams[0]);
            }

            break;
        }

        case PA_CONTEXT_TERMINATED:
            mainloop_api->quit(mainloop_api, 0);
            break;

        case PA_CONTEXT_FAILED:
        default:
            fprintf(stderr, "Context error: %s\n", pa_strerror(pa_context_errno(c)));
            fail();
    }
}
开发者ID:Distrotech,项目名称:pulseaudio,代码行数:41,代码来源:sync-playback.c


示例15: xvd_toggle_mute

void
xvd_toggle_mute (XvdInstance *i)
{
  pa_operation *op = NULL;

  if (!i || !i->pulse_context)
   {
      g_warning ("xvd_toggle_mute: pulseaudio context is null");
      return;
   }

  if (pa_context_get_state (i->pulse_context) != PA_CONTEXT_READY)
    {
      g_warning ("xvd_toggle_mute: pulseaudio context isn't ready");
      return;
    }

  if (i->sink_index == PA_INVALID_INDEX)
    {
      g_warning ("xvd_toggle_mute: undefined sink");
      return;
    }

  /* backup existing mute and update */
  i->mute = !(old_mute = i->mute);

  op =  pa_context_set_sink_mute_by_index (i->pulse_context,
                                           i->sink_index,
                                           i->mute,
                                           xvd_notify_volume_callback,
                                           i);

  if (!op)
    {
      g_warning ("xvd_toggle_mute: failed");
      return;
    }
  pa_operation_unref (op);
}
开发者ID:de-vri-es,项目名称:xfce4-volumed-pulse,代码行数:39,代码来源:xvd_pulse.c


示例16: state_cb

/**
 * Callback for context state.
 * Sets *user_data to one of conn_state_t.
 */
void state_cb(pa_context *ctx, void *user_data) {
    pa_context_state_t state;
    enum conn_state_t *pa_ready = user_data;

    state = pa_context_get_state(ctx);
    switch (state) {
        case PA_CONTEXT_UNCONNECTED:
        case PA_CONTEXT_CONNECTING:
        case PA_CONTEXT_AUTHORIZING:
        case PA_CONTEXT_SETTING_NAME:
        default:
            *pa_ready = CONN_WAIT;
            break;
        case PA_CONTEXT_FAILED:
        case PA_CONTEXT_TERMINATED:
            *pa_ready = CONN_FAILED;
            break;
        case PA_CONTEXT_READY:
            *pa_ready = CONN_READY;
            break;
    }
}
开发者ID:Zopieux,项目名称:i3blocks-contrib,代码行数:26,代码来源:pulse-volume.c


示例17: pa_names_state_cb

// This callback gets called when our context changes state.  We really only
// care about when it's ready or if it has failed.
static void pa_names_state_cb(pa_context *c, void *userdata) {
	pa_context_state_t ctx_state;
	int *main_state = userdata;

	ctx_state = pa_context_get_state(c);
	switch  (ctx_state) {
		// There are just here for reference
		case PA_CONTEXT_UNCONNECTED:
		case PA_CONTEXT_CONNECTING:
		case PA_CONTEXT_AUTHORIZING:
		case PA_CONTEXT_SETTING_NAME:
		default:
			break;
		case PA_CONTEXT_FAILED:
		case PA_CONTEXT_TERMINATED:
			*main_state = 9;
			break;
		case PA_CONTEXT_READY:
			*main_state = 1;
			break;
	}
}
开发者ID:gonesurfing,项目名称:quisk-main,代码行数:24,代码来源:sound_pulseaudio.c


示例18: Q_ASSERT

void PulseAudioSystem::contextCallback(pa_context *c) {
	Q_ASSERT(c == pacContext);
	switch (pa_context_get_state(c)) {
		case PA_CONTEXT_READY:
			bPulseIsGood = true;
			pa_operation_unref(pa_context_subscribe(pacContext, PA_SUBSCRIPTION_MASK_SOURCE, NULL, this));
			pa_operation_unref(pa_context_subscribe(pacContext, PA_SUBSCRIPTION_MASK_SINK, NULL, this));
			query();
			break;
		case PA_CONTEXT_TERMINATED:
			qWarning("PulseAudio: Forcibly disconnected from PulseAudio");
			break;
		case PA_CONTEXT_FAILED:
			qWarning("PulseAudio: Connection failure: %s", pa_strerror(pa_context_errno(c)));
			break;
		default:
			return;
	}
	qmWait.lock();
	qwcWait.wakeAll();
	qmWait.unlock();
}
开发者ID:AceXare,项目名称:mumble,代码行数:22,代码来源:PulseAudio.cpp


示例19: pulse_connect

/*
 * Create a new pulse audio main loop and connect to the server
 *
 * Returns a negative value on error
 */
static int pulse_connect(struct pulse_data *data)
{
	data->mainloop = pa_mainloop_new();
	if (!data->mainloop) {
		blog(LOG_ERROR, "pulse-input: Unable to create main loop");
		return -1;
	}

	data->context = pa_context_new_with_proplist(
		pa_mainloop_get_api(data->mainloop), "OBS Studio", data->props);
	if (!data->context) {
		blog(LOG_ERROR, "pulse-input: Unable to create context");
		return -1;
	}

	int status = pa_context_connect(
		data->context, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL);
	if (status < 0) {
		blog(LOG_ERROR, "pulse-input: Unable to connect! Status: %d",
		     status);
		return -1;
	}

	// wait until connected
	for (;;) {
		pulse_iterate(data);
		pa_context_state_t state = pa_context_get_state(data->context);
		if (state == PA_CONTEXT_READY) {
			blog(LOG_DEBUG, "pulse-input: Context ready");
			break;
		}
		if (!PA_CONTEXT_IS_GOOD(state)) {
			blog(LOG_ERROR, "pulse-input: Context connect failed");
			return -1;
		}
	}

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


示例20: __pulseaudio_context_state_cb

static void __pulseaudio_context_state_cb(pa_context *pulse_context, void *user_data)
{
	int state = 0;
	SOUND_INFO *info = NULL;

	mmf_return_if_fail(user_data);

	info = (SOUND_INFO *)user_data;

	state = pa_context_get_state(pulse_context);
	switch (state) {
	case PA_CONTEXT_READY:
		_mmcam_dbg_log("pulseaudio context READY");
		if (info->pulse_context == pulse_context) {
			/* Signal */
			_mmcam_dbg_log("pulseaudio send signal");
			pa_threaded_mainloop_signal(info->pulse_mainloop, 0);
		}
		break;
	case PA_CONTEXT_TERMINATED:
		if (info->pulse_context == pulse_context) {
			/* Signal */
			_mmcam_dbg_log("Context terminated : pulseaudio send signal");
			pa_threaded_mainloop_signal(info->pulse_mainloop, 0);
		}
		break;
	case PA_CONTEXT_UNCONNECTED:
	case PA_CONTEXT_CONNECTING:
	case PA_CONTEXT_AUTHORIZING:
	case PA_CONTEXT_SETTING_NAME:
	case PA_CONTEXT_FAILED:
	default:
		_mmcam_dbg_log("pulseaudio context %p, state %d",
		               pulse_context, state);
		break;
	}

	return;
}
开发者ID:tizenorg,项目名称:framework.multimedia.libmm-camcorder,代码行数:39,代码来源:mm_camcorder_sound.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C++ pa_context_new函数代码示例发布时间:2022-05-30
下一篇:
C++ outofmem函数代码示例发布时间: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