当前位置: 首页>>代码示例>>C++>>正文


C++ pa_proplist_sets函数代码示例

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


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

示例1: apply_rule

static void apply_rule(struct rule *r, pa_proplist *p) {
    pa_assert(r);
    pa_assert(p);

    if (!r->good)
        return;

    if (r->proplist)
        pa_proplist_update(p, PA_UPDATE_MERGE, r->proplist);

    if (r->icon_name)
        if (!pa_proplist_contains(p, PA_PROP_APPLICATION_ICON_NAME))
            pa_proplist_sets(p, PA_PROP_APPLICATION_ICON_NAME, r->icon_name);

    if (r->application_name) {
        const char *t;

        t = pa_proplist_gets(p, PA_PROP_APPLICATION_NAME);

        if (!t || pa_streq(t, r->process_name))
            pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, r->application_name);
    }

    if (r->role)
        if (!pa_proplist_contains(p, PA_PROP_MEDIA_ROLE))
            pa_proplist_sets(p, PA_PROP_MEDIA_ROLE, r->role);
}
开发者ID:plbossart,项目名称:pulseaudio,代码行数:27,代码来源:module-augment-properties.c

示例2: UNUSED_PARAMETER

/*
 * Create the plugin object
 */
static void *pulse_create(obs_data_t settings, obs_source_t source)
{
	UNUSED_PARAMETER(settings);

	struct pulse_data *data = bmalloc(sizeof(struct pulse_data));
	memset(data, 0, sizeof(struct pulse_data));

	data->source = source;
	data->speakers = SPEAKERS_STEREO;

	blog(LOG_DEBUG, "pulse-input: obs wants '%s'",
		obs_data_getstring(settings, "device_id"));

	/* TODO: use obs-studio icon */
	data->props = pa_proplist_new();
	pa_proplist_sets(data->props, PA_PROP_APPLICATION_NAME,
		"OBS Studio");
	pa_proplist_sets(data->props, PA_PROP_APPLICATION_ICON_NAME,
		"application-exit");
	pa_proplist_sets(data->props, PA_PROP_MEDIA_ROLE,
		"production");

	if (os_event_init(&data->event, OS_EVENT_TYPE_MANUAL) != 0)
		goto fail;
	if (pthread_create(&data->thread, NULL, pulse_thread, data) != 0)
		goto fail;

	return data;

fail:
	pulse_destroy(data);
	return NULL;
}
开发者ID:Jhonthe7th,项目名称:obs-studio,代码行数:36,代码来源:pulse-input.c

示例3: cmtspeech_create_source_output

int cmtspeech_create_source_output(struct userdata *u)
{
    pa_source_output_new_data data;
    char t[256];

    pa_assert(u);
    pa_assert(!u->source);
    ENTER();

    if (u->source_output) {
        pa_log_info("Create called but output already exists");
        return 1;
    }

    if (!(u->source = pa_namereg_get(u->core, u->source_name, PA_NAMEREG_SOURCE))) {
        pa_log_error("Couldn't find source %s", u->source_name);
        return 2;
    }

    if (cmtspeech_check_source_api(u->source))
        return 3;

    pa_source_output_new_data_init(&data);
    data.driver = __FILE__;
    data.module = u->module;
    data.source = u->source;
    snprintf(t, sizeof(t), "Cellular call up link");
    pa_proplist_sets(data.proplist, PA_PROP_MEDIA_NAME, t);
    snprintf(t, sizeof(t), "phone");
    pa_proplist_sets(data.proplist, PA_PROP_MEDIA_ROLE, t);
    snprintf(t, sizeof(t), "cmtspeech module");
    pa_proplist_sets(data.proplist, PA_PROP_APPLICATION_NAME, t);
    pa_source_output_new_data_set_sample_spec(&data, &u->ss);
    pa_source_output_new_data_set_channel_map(&data, &u->map);
    data.flags = PA_SOURCE_OUTPUT_DONT_MOVE|PA_SOURCE_OUTPUT_START_CORKED;

    pa_source_output_new(&u->source_output, u->core, &data);
    pa_source_output_new_data_done(&data);

    if (!u->source_output) {
        pa_log("Creating cmtspeech source output failed");
        return -1;
    }

    u->source_output->push = cmtspeech_source_output_push_cb;
    u->source_output->kill = cmtspeech_source_output_kill_cb;
    u->source_output->attach = cmtspeech_source_output_attach_cb;
    u->source_output->detach = cmtspeech_source_output_detach_cb;
    u->source_output->moving = cmtspeech_source_output_moving_cb;
    u->source_output->state_change = cmtspeech_source_output_state_change_cb;
    u->source_output->may_move_to = cmtspeech_source_output_may_move_to_cb;
    u->source_output->userdata = u;

    pa_source_output_put(u->source_output);

    pa_log_info("cmtspeech source-output created");

    return 0;
}
开发者ID:tanuk2,项目名称:pulseaudio-modules-nemo,代码行数:59,代码来源:cmtspeech-source-output.c

示例4: pa_proplist_new

/**
 * get the default properties
 */
static pa_proplist *pulse_properties()
{
	pa_proplist *p = pa_proplist_new();

	pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, "OBS");
	pa_proplist_sets(p, PA_PROP_APPLICATION_ICON_NAME, "obs");
	pa_proplist_sets(p, PA_PROP_MEDIA_ROLE, "production");

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

示例5: switch_mode

static void switch_mode(struct userdata *u, const char *mode) {
    pa_proplist *proplist = pa_proplist_new();
    pa_log_debug("Switching to mode %s", mode);

    pa_proplist_sets(proplist, PA_NOKIA_PROP_AUDIO_MODE, mode);
    pa_proplist_sets(proplist, PA_NOKIA_PROP_AUDIO_ACCESSORY_HWID, "");
    pa_sink_update_proplist(u->mode_sink, PA_UPDATE_REPLACE, proplist);

    pa_proplist_free(proplist);
}
开发者ID:jusa,项目名称:pulseaudio-modules-nemo,代码行数:10,代码来源:module-meego-test-parameters.c

示例6: tunnel_new_proplist

static pa_proplist* tunnel_new_proplist(struct userdata *u) {
    pa_proplist *proplist = pa_proplist_new();
    pa_assert(proplist);
    pa_proplist_sets(proplist, PA_PROP_APPLICATION_NAME, "PulseAudio");
    pa_proplist_sets(proplist, PA_PROP_APPLICATION_ID, "org.PulseAudio.PulseAudio");
    pa_proplist_sets(proplist, PA_PROP_APPLICATION_VERSION, PACKAGE_VERSION);
    pa_init_proplist(proplist);

    return proplist;
}
开发者ID:indrwthaachen,项目名称:pulseaudio,代码行数:10,代码来源:module-tunnel-sink-new.c

示例7: Java_com_harrcharr_pulse_Stream_JNINewStream

JNIEXPORT jlong JNICALL
Java_com_harrcharr_pulse_Stream_JNINewStream(
		JNIEnv *jenv, jclass jcls, jlong c, jstring server) {
	pa_sample_spec ss;
	pa_stream *stream;

	ss.channels = 1;
	ss.format = PA_SAMPLE_FLOAT32;
	ss.rate = 25;

	pa_proplist *p = pa_proplist_new();
	pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, "Reverb PulseAudio Remote");

	const char *sname;
	sname = (*jenv)->GetStringUTFChars(jenv, server, NULL);
	if (sname == NULL) {
		return NULL; /* OutOfMemoryError already thrown */
	}

	if (!(stream = pa_stream_new_with_proplist((pa_context*)c, sname, &ss, NULL, p))) {
		LOGE("Failed to create new stream");
		stream = NULL;
	}

	(*jenv)->ReleaseStringUTFChars(jenv, server, sname);
	return stream;
}
开发者ID:Amaliya,项目名称:libpulse-android,代码行数:27,代码来源:stream.c

示例8: pa_scache_add_file_lazy

int pa_scache_add_file_lazy(pa_core *c, const char *name, const char *filename, uint32_t *idx) {
    pa_scache_entry *e;

#ifdef OS_IS_WIN32
    char buf[MAX_PATH];

    if (ExpandEnvironmentStrings(filename, buf, MAX_PATH))
        filename = buf;
#endif

    pa_assert(c);
    pa_assert(name);
    pa_assert(filename);

    if (!(e = scache_add_item(c, name)))
        return -1;

    e->lazy = TRUE;
    e->filename = pa_xstrdup(filename);

    pa_proplist_sets(e->proplist, PA_PROP_MEDIA_FILENAME, filename);

    if (!c->scache_auto_unload_event)
        c->scache_auto_unload_event = pa_core_rttime_new(c, pa_rtclock_now() + UNLOAD_POLL_TIME, timeout_callback, c);

    if (idx)
        *idx = e->index;

    return 0;
}
开发者ID:KimT,项目名称:pulseaudio_kt,代码行数:30,代码来源:core-scache.c

示例9: pa_scache_add_file

int pa_scache_add_file(pa_core *c, const char *name, const char *filename, uint32_t *idx) {
    pa_sample_spec ss;
    pa_channel_map map;
    pa_memchunk chunk;
    int r;
    pa_proplist *p;

#ifdef OS_IS_WIN32
    char buf[MAX_PATH];

    if (ExpandEnvironmentStrings(filename, buf, MAX_PATH))
        filename = buf;
#endif

    pa_assert(c);
    pa_assert(name);
    pa_assert(filename);

    p = pa_proplist_new();
    pa_proplist_sets(p, PA_PROP_MEDIA_FILENAME, filename);

    if (pa_sound_file_load(c->mempool, filename, &ss, &map, &chunk, p) < 0) {
        pa_proplist_free(p);
        return -1;
    }

    r = pa_scache_add_item(c, name, &ss, &map, &chunk, p, idx);
    pa_memblock_unref(chunk.memblock);
    pa_proplist_free(p);

    return r;
}
开发者ID:KimT,项目名称:pulseaudio_kt,代码行数:32,代码来源:core-scache.c

示例10: sink_input_moving_cb

/* Called from main thread */
static void sink_input_moving_cb(pa_sink_input *i, pa_sink *dest) {
    struct userdata *u;
    pa_proplist *p;
    const char *n;

    if (!dest)
        return;

    pa_sink_input_assert_ref(i);
    pa_assert_ctl_context();
    pa_assert_se(u = i->userdata);

    p = pa_proplist_new();
    pa_proplist_setf(p, PA_PROP_MEDIA_NAME, "Loopback to %s", pa_strnull(pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_DESCRIPTION)));

    if ((n = pa_proplist_gets(dest->proplist, PA_PROP_DEVICE_ICON_NAME)))
        pa_proplist_sets(p, PA_PROP_MEDIA_ICON_NAME, n);

    pa_source_output_update_proplist(u->source_output, PA_UPDATE_REPLACE, p);
    pa_proplist_free(p);

    if (pa_sink_get_state(dest) == PA_SINK_SUSPENDED)
        pa_source_output_cork(u->source_output, true);
    else
        pa_source_output_cork(u->source_output, false);

    update_adjust_timer(u);
}
开发者ID:xedp3x,项目名称:pulseaudio,代码行数:29,代码来源:module-loopback.c

示例11: pa_cli_new

pa_cli* pa_cli_new(pa_core *core, pa_iochannel *io, pa_module *m) {
    char cname[256];
    pa_cli *c;
    pa_client_new_data data;
    pa_client *client;

    pa_assert(io);

    pa_iochannel_socket_peer_to_string(io, cname, sizeof(cname));

    pa_client_new_data_init(&data);
    data.driver = __FILE__;
    data.module = m;
    pa_proplist_sets(data.proplist, PA_PROP_APPLICATION_NAME, cname);
    client = pa_client_new(core, &data);
    pa_client_new_data_done(&data);

    if (!client)
        return NULL;

    c = pa_xnew0(pa_cli, 1);
    c->core = core;
    c->client = client;
    pa_assert_se(c->line = pa_ioline_new(io));

    c->client->kill = client_kill;
    c->client->userdata = c;

    pa_ioline_set_callback(c->line, line_callback, c);

    return c;
}
开发者ID:Distrotech,项目名称:pulseaudio,代码行数:32,代码来源:cli.c

示例12: pa_assert

pa_context *pa_context_new_with_proplist(pa_mainloop_api *mainloop, const char *name, pa_proplist *p) {
    pa_context *c;

    pa_assert(mainloop);

    if (pa_detect_fork())
        return NULL;

    pa_init_i18n();

    c = pa_xnew0(pa_context, 1);
    PA_REFCNT_INIT(c);

    c->proplist = p ? pa_proplist_copy(p) : pa_proplist_new();

    if (name)
        pa_proplist_sets(c->proplist, PA_PROP_APPLICATION_NAME, name);

#ifdef HAVE_DBUS
    c->system_bus = c->session_bus = NULL;
#endif
    c->mainloop = mainloop;
    c->playback_streams = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
    c->record_streams = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
    c->client_index = PA_INVALID_INDEX;
    c->use_rtclock = pa_mainloop_is_our_api(mainloop);

    PA_LLIST_HEAD_INIT(pa_stream, c->streams);
    PA_LLIST_HEAD_INIT(pa_operation, c->operations);

    c->error = PA_OK;
    c->state = PA_CONTEXT_UNCONNECTED;

    reset_callbacks(c);

#ifndef MSG_NOSIGNAL
#ifdef SIGPIPE
    pa_check_signal_is_blocked(SIGPIPE);
#endif
#endif

    c->conf = pa_client_conf_new();
    pa_client_conf_load(c->conf, true, true);

    c->srb_template.readfd = -1;
    c->srb_template.writefd = -1;

    if (!(c->mempool = pa_mempool_new(!c->conf->disable_shm, c->conf->shm_size))) {

        if (!c->conf->disable_shm)
            c->mempool = pa_mempool_new(false, c->conf->shm_size);

        if (!c->mempool) {
            context_free(c);
            return NULL;
        }
    }

    return c;
}
开发者ID:colinleroy,项目名称:pulseaudio-wrongmerge,代码行数:60,代码来源:context.c

示例13: pa_context_set_name

pa_operation* pa_context_set_name(pa_context *c, const char *name, pa_context_success_cb_t cb, void *userdata) {
    pa_operation *o;

    pa_assert(c);
    pa_assert(PA_REFCNT_VALUE(c) >= 1);
    pa_assert(name);

    PA_CHECK_VALIDITY_RETURN_NULL(c, !pa_detect_fork(), PA_ERR_FORKED);
    PA_CHECK_VALIDITY_RETURN_NULL(c, c->state == PA_CONTEXT_READY, PA_ERR_BADSTATE);

    if (c->version >= 13) {
        pa_proplist *p = pa_proplist_new();

        pa_proplist_sets(p, PA_PROP_APPLICATION_NAME, name);
        o = pa_context_proplist_update(c, PA_UPDATE_REPLACE, p, cb, userdata);
        pa_proplist_free(p);
    } else {
        pa_tagstruct *t;
        uint32_t tag;

        o = pa_operation_new(c, NULL, (pa_operation_cb_t) cb, userdata);
        t = pa_tagstruct_command(c, PA_COMMAND_SET_CLIENT_NAME, &tag);
        pa_tagstruct_puts(t, name);
        pa_pstream_send_tagstruct(c->pstream, t);
        pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT,  pa_context_simple_ack_callback, pa_operation_ref(o), (pa_free_cb_t) pa_operation_unref);
    }

    return o;
}
开发者ID:felfert,项目名称:pulseaudio,代码行数:29,代码来源:context.c

示例14: pa_client_set_name

void pa_client_set_name(pa_client *c, const char *name) {
    pa_assert(c);
    pa_assert(name);

    pa_log_info("Client %u changed name from \"%s\" to \"%s\"", c->index, pa_strnull(pa_proplist_gets(c->proplist, PA_PROP_APPLICATION_NAME)), name);
    pa_proplist_sets(c->proplist, PA_PROP_APPLICATION_NAME, name);

    pa_client_update_proplist(c, 0, NULL);
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:9,代码来源:client.c

示例15: voice_init_voip_sink

int voice_init_voip_sink(struct userdata *u, const char *name) {
    pa_sink_new_data sink_data;
    pa_assert(u);
    pa_assert(u->core);
    pa_assert(u->master_sink);
    ENTER();

    pa_sink_new_data_init(&sink_data);
    sink_data.module = u->module;
    sink_data.driver = __FILE__;
    pa_sink_new_data_set_name(&sink_data, name);
    pa_sink_new_data_set_sample_spec(&sink_data, &u->aep_sample_spec);
    pa_sink_new_data_set_channel_map(&sink_data, &u->aep_channel_map);
    pa_proplist_setf(sink_data.proplist, PA_PROP_DEVICE_DESCRIPTION, "%s connected conceptually to %s", name, u->raw_sink->name);
    pa_proplist_sets(sink_data.proplist, PA_PROP_DEVICE_MASTER_DEVICE, u->raw_sink->name);
    pa_proplist_sets(sink_data.proplist, "module-suspend-on-idle.timeout", "1");

    pa_proplist_sets(sink_data.proplist, PA_PROP_SINK_API_EXTENSION_PROPERTY_NAME,
                     PA_PROP_SINK_API_EXTENSION_PROPERTY_VALUE);

    u->voip_sink = pa_sink_new(u->core, &sink_data,
                               (u->master_sink->flags & (PA_SINK_LATENCY | PA_SINK_DYNAMIC_LATENCY)) | PA_SINK_SHARE_VOLUME_WITH_MASTER);

    pa_sink_new_data_done(&sink_data);

    /* Create sink */
    if (!u->voip_sink) {
        pa_log_error("Failed to create sink.");
        return -1;
    }

    u->voip_sink->parent.process_msg = voip_sink_process_msg;
    u->voip_sink->set_state = voip_sink_set_state;
    u->voip_sink->update_requested_latency = voip_sink_update_requested_latency;
    u->voip_sink->request_rewind = voip_sink_request_rewind;
    u->voip_sink->userdata = u;
    pa_memblock_ref(u->aep_silence_memchunk.memblock);
    u->voip_sink->silence = u->aep_silence_memchunk;

    pa_sink_set_asyncmsgq(u->voip_sink, u->master_sink->asyncmsgq);
    pa_sink_set_rtpoll(u->voip_sink, u->master_sink->thread_info.rtpoll);

    return 0;
}
开发者ID:maemo-foss,项目名称:maemo-multimedia-pulseaudio-modules-meego,代码行数:44,代码来源:voice-voip-sink.c


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