本文整理汇总了C++中pa_modargs_new函数的典型用法代码示例。如果您正苦于以下问题:C++ pa_modargs_new函数的具体用法?C++ pa_modargs_new怎么用?C++ pa_modargs_new使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pa_modargs_new函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: pa__init
int pa__init(pa_module*m) {
pa_modargs *ma = NULL;
int ret = -1;
int32_t fd = -1;
char x = 1;
pa_assert(m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs)) ||
pa_modargs_get_value_s32(ma, "fd", &fd) < 0 ||
fd < 0) {
pa_log("Failed to parse module arguments");
goto finish;
}
if (pa_loop_write(fd, &x, sizeof(x), NULL) != sizeof(x))
pa_log_warn("write(%u, 1, 1) failed: %s", fd, pa_cstrerror(errno));
pa_assert_se(pa_close(fd) == 0);
pa_module_unload_request(m, true);
ret = 0;
finish:
if (ma)
pa_modargs_free(ma);
return ret;
}
开发者ID:lebauce,项目名称:pulseaudio,代码行数:31,代码来源:module-esound-compat-spawnfd.c
示例2: pa__init
int pa__init(pa_module *m) {
pa_modargs *ma = NULL;
pa_assert(m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments.");
goto fail;
}
if (!(m->userdata = pa_droid_source_new(m, ma, __FILE__, (audio_devices_t) 0, NULL, NULL, NULL)))
goto fail;
pa_modargs_free(ma);
return 0;
fail:
if (ma)
pa_modargs_free(ma);
pa__done(m);
return -1;
}
开发者ID:mer-hybris,项目名称:pulseaudio-modules-droid,代码行数:25,代码来源:module-droid-source.c
示例3: pa__init
int pa__init(pa_module *m) {
pa_modargs *ma = NULL;
struct userdata *u;
pa_assert(m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
goto fail;
}
m->userdata = u = pa_xnew(struct userdata, 1);
u->core = m->core;
u->cork_state = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
u->sink_input_put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_PUT], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_put_cb, u);
u->sink_input_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_UNLINK], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_unlink_cb, u);
u->sink_input_move_start_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_START], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_move_start_cb, u);
u->sink_input_move_finish_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH], PA_HOOK_LATE, (pa_hook_cb_t) sink_input_move_finish_cb, u);
pa_modargs_free(ma);
return 0;
fail:
pa__done(m);
if (ma)
pa_modargs_free(ma);
return -1;
}
开发者ID:KimT,项目名称:pulseaudio_kt,代码行数:35,代码来源:module-cork-music-on-phone.c
示例4: pa__init
int pa__init(pa_module *m) {
pa_modargs *ma = NULL;
struct userdata *u;
pa_assert(m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
goto fail;
}
m->userdata = u = pa_xnew(struct userdata, 1);
u->core = m->core;
u->sink_input_put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_PUT], PA_HOOK_LATE-1, (pa_hook_cb_t) sink_input_put_cb, u);
u->sink_input_move_finish_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH], PA_HOOK_LATE-1, (pa_hook_cb_t) sink_input_move_finish_cb, u);
u->source_output_put_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_PUT], PA_HOOK_LATE-1, (pa_hook_cb_t) source_output_put_cb, u);
u->source_output_move_finish_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FINISH], PA_HOOK_LATE-1, (pa_hook_cb_t) source_output_move_finish_cb, u);
pa_modargs_free(ma);
return 0;
fail:
pa__done(m);
if (ma)
pa_modargs_free(ma);
return -1;
}
开发者ID:KOLIA112,项目名称:pulseaudio,代码行数:33,代码来源:module-filter-heuristics.c
示例5: pa__init
int pa__init(pa_module*m) {
pa_modargs *ma = NULL;
struct userdata *u;
pa_assert(m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
goto fail;
}
m->userdata = u = pa_xnew(struct userdata, 1);
u->sink_input_fixate_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_FIXATE], PA_HOOK_EARLY, (pa_hook_cb_t) sink_input_fixate_hook_callback, u);
pa_modargs_free(ma);
u->name = m->name;
return 0;
fail:
pa__done(m);
if (ma)
pa_modargs_free(ma);
return -1;
}
开发者ID:KOLIA112,项目名称:pulseaudio,代码行数:27,代码来源:module-position-event-sounds.c
示例6: pa__init
int pa__init(pa_module*m) {
pa_modargs *ma = NULL;
pa_assert(m);
pa_alsa_refcnt_inc();
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
goto fail;
}
if (!(m->userdata = pa_alsa_sink_new(m, ma, __FILE__, NULL, NULL)))
goto fail;
pa_modargs_free(ma);
return 0;
fail:
if (ma)
pa_modargs_free(ma);
pa__done(m);
return -1;
}
开发者ID:almosthappy4u,项目名称:PulseAudio-UCM,代码行数:28,代码来源:module-alsa-sink.c
示例7: pa__init
int pa__init(pa_module*m) {
pa_modargs *ma = NULL;
int ret = -1;
uint32_t pid = 0;
pa_assert(m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs)) ||
pa_modargs_get_value_u32(ma, "pid", &pid) < 0 ||
!pid) {
pa_log("Failed to parse module arguments");
goto finish;
}
if (kill((pid_t) pid, SIGUSR1) < 0)
pa_log_warn("kill(%u) failed: %s", pid, pa_cstrerror(errno));
pa_module_unload_request(m, true);
ret = 0;
finish:
if (ma)
pa_modargs_free(ma);
return ret;
}
开发者ID:DryakhlyyZlodey,项目名称:pulseaudio,代码行数:27,代码来源:module-esound-compat-spawnpid.c
示例8: pa__init
int pa__init(pa_module *m) {
pa_modargs *ma = NULL;
struct userdata *u;
pa_assert(m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
goto fail;
}
m->userdata = u = pa_xnew(struct userdata, 1);
u->cache = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
u->client_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_CLIENT_NEW], PA_HOOK_EARLY, (pa_hook_cb_t) client_new_cb, u);
u->client_proplist_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_CLIENT_PROPLIST_CHANGED], PA_HOOK_EARLY, (pa_hook_cb_t) client_proplist_changed_cb, u);
pa_modargs_free(ma);
return 0;
fail:
pa__done(m);
if (ma)
pa_modargs_free(ma);
return -1;
}
开发者ID:plbossart,项目名称:pulseaudio,代码行数:29,代码来源:module-augment-properties.c
示例9: pa__init
int pa__init(pa_module*m)
{
pa_modargs *ma = NULL;
pa_assert(m);
ma = pa_modargs_new(m->argument, valid_modargs);
if (NULL == ma) {
pa_log("Failed to parse module arguments");
goto fail;
}
m->userdata = pa_audioio_sink_new(m, ma, __FILE__);
if (NULL == m->userdata) {
goto fail;
}
pa_modargs_free(ma);
return 0;
fail:
if (ma) {
pa_modargs_free(ma);
}
pa__done(m);
return -1;
}
开发者ID:299299,项目名称:PulseAudio_Work,代码行数:25,代码来源:module-audioio-sink.c
示例10: pa__init
int pa__init(pa_module*m) {
pa_modargs *ma = NULL;
struct userdata *u;
uint32_t timeout = 5;
uint32_t idx;
pa_sink *sink;
pa_source *source;
pa_assert(m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments.");
goto fail;
}
if (pa_modargs_get_value_u32(ma, "timeout", &timeout) < 0) {
pa_log("Failed to parse timeout value.");
goto fail;
}
m->userdata = u = pa_xnew(struct userdata, 1);
u->core = m->core;
u->timeout = timeout;
u->device_infos = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
PA_IDXSET_FOREACH(sink, m->core->sinks, idx)
device_new_hook_cb(m->core, PA_OBJECT(sink), u);
PA_IDXSET_FOREACH(source, m->core->sources, idx)
device_new_hook_cb(m->core, PA_OBJECT(source), u);
u->sink_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_NORMAL, (pa_hook_cb_t) device_new_hook_cb, u);
u->source_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_PUT], PA_HOOK_NORMAL, (pa_hook_cb_t) device_new_hook_cb, u);
u->sink_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_UNLINK_POST], PA_HOOK_NORMAL, (pa_hook_cb_t) device_unlink_hook_cb, u);
u->source_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK_POST], PA_HOOK_NORMAL, (pa_hook_cb_t) device_unlink_hook_cb, u);
u->sink_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) device_state_changed_hook_cb, u);
u->source_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) device_state_changed_hook_cb, u);
u->sink_input_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_FIXATE], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_fixate_hook_cb, u);
u->source_output_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_FIXATE], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_fixate_hook_cb, u);
u->sink_input_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_UNLINK_POST], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_unlink_hook_cb, u);
u->source_output_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_UNLINK_POST], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_unlink_hook_cb, u);
u->sink_input_move_start_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_START], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_move_start_hook_cb, u);
u->source_output_move_start_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_START], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_move_start_hook_cb, u);
u->sink_input_move_finish_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_MOVE_FINISH], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_move_finish_hook_cb, u);
u->source_output_move_finish_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_MOVE_FINISH], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_move_finish_hook_cb, u);
u->sink_input_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) sink_input_state_changed_hook_cb, u);
u->source_output_state_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_STATE_CHANGED], PA_HOOK_NORMAL, (pa_hook_cb_t) source_output_state_changed_hook_cb, u);
pa_modargs_free(ma);
return 0;
fail:
if (ma)
pa_modargs_free(ma);
return -1;
}
开发者ID:MblIIIA,项目名称:pulseaudio,代码行数:59,代码来源:module-suspend-on-idle.c
示例11: pa_speex_ec_init
bool pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec *rec_ss, pa_channel_map *rec_map,
pa_sample_spec *play_ss, pa_channel_map *play_map,
pa_sample_spec *out_ss, pa_channel_map *out_map,
uint32_t *nframes, const char *args) {
int rate;
uint32_t frame_size_ms, filter_size_ms;
pa_modargs *ma;
if (!(ma = pa_modargs_new(args, valid_modargs))) {
pa_log("Failed to parse submodule arguments.");
goto fail;
}
filter_size_ms = DEFAULT_FILTER_SIZE_MS;
if (pa_modargs_get_value_u32(ma, "filter_size_ms", &filter_size_ms) < 0 || filter_size_ms < 1 || filter_size_ms > 2000) {
pa_log("Invalid filter_size_ms specification");
goto fail;
}
frame_size_ms = DEFAULT_FRAME_SIZE_MS;
if (pa_modargs_get_value_u32(ma, "frame_size_ms", &frame_size_ms) < 0 || frame_size_ms < 1 || frame_size_ms > 200) {
pa_log("Invalid frame_size_ms specification");
goto fail;
}
pa_speex_ec_fixate_spec(rec_ss, rec_map, play_ss, play_map, out_ss, out_map);
rate = out_ss->rate;
*nframes = pa_echo_canceller_blocksize_power2(rate, frame_size_ms);
pa_log_debug ("Using nframes %d, channels %d, rate %d", *nframes, out_ss->channels, out_ss->rate);
ec->params.priv.speex.state = speex_echo_state_init_mc(*nframes, (rate * filter_size_ms) / 1000, out_ss->channels, out_ss->channels);
if (!ec->params.priv.speex.state)
goto fail;
speex_echo_ctl(ec->params.priv.speex.state, SPEEX_ECHO_SET_SAMPLING_RATE, &rate);
if (!pa_speex_ec_preprocessor_init(ec, out_ss, *nframes, ma))
goto fail;
pa_modargs_free(ma);
return true;
fail:
if (ma)
pa_modargs_free(ma);
if (ec->params.priv.speex.pp_state) {
speex_preprocess_state_destroy(ec->params.priv.speex.pp_state);
ec->params.priv.speex.pp_state = NULL;
}
if (ec->params.priv.speex.state) {
speex_echo_state_destroy(ec->params.priv.speex.state);
ec->params.priv.speex.state = NULL;
}
return false;
}
开发者ID:DryakhlyyZlodey,项目名称:pulseaudio,代码行数:58,代码来源:speex.c
示例12: pa__init
int pa__init(pa_module*m) {
pa_modargs *ma = NULL;
struct userdata *u;
pa_bool_t restore_device = TRUE, restore_volume = TRUE;
pa_assert(m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
goto fail;
}
u = pa_xnew(struct userdata, 1);
u->core = m->core;
u->hashmap = pa_hashmap_new(pa_idxset_string_hash_func, pa_idxset_string_compare_func);
u->table_file = pa_xstrdup(pa_modargs_get_value(ma, "table", NULL));
u->modified = FALSE;
u->subscription = NULL;
u->sink_input_new_hook_slot = u->sink_input_fixate_hook_slot = u->source_output_new_hook_slot = NULL;
u->save_time_event = NULL;
m->userdata = u;
if (pa_modargs_get_value_boolean(ma, "restore_device", &restore_device) < 0 ||
pa_modargs_get_value_boolean(ma, "restore_volume", &restore_volume) < 0) {
pa_log("restore_volume= and restore_device= expect boolean arguments");
goto fail;
}
if (!(restore_device || restore_volume)) {
pa_log("Both restrong the volume and restoring the device are disabled. There's no point in using this module at all then, failing.");
goto fail;
}
if (load_rules(u) < 0)
goto fail;
u->subscription = pa_subscription_new(m->core, PA_SUBSCRIPTION_MASK_SINK_INPUT|PA_SUBSCRIPTION_MASK_SOURCE_OUTPUT, subscribe_callback, u);
if (restore_device) {
u->sink_input_new_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_NEW], (pa_hook_cb_t) sink_input_new_hook_callback, u);
u->source_output_new_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_OUTPUT_NEW], (pa_hook_cb_t) source_output_new_hook_callback, u);
}
if (restore_volume)
u->sink_input_fixate_hook_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_FIXATE], (pa_hook_cb_t) sink_input_fixate_hook_callback, u);
pa_modargs_free(ma);
return 0;
fail:
pa__done(m);
if (ma)
pa_modargs_free(ma);
return -1;
}
开发者ID:thewb,项目名称:mokoiax,代码行数:57,代码来源:module-volume-restore.c
示例13: pa__init
int pa__init(pa_module*m) {
pa_modargs *ma = NULL;
struct userdata *u;
pa_volume_t volume_limit = PA_CLAMP_VOLUME(PA_VOLUME_NORM*3/2);
pa_volume_t volume_step = PA_VOLUME_NORM/20;
pa_assert(m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
goto fail;
}
if (pa_modargs_get_value_u32(ma, "volume_limit", &volume_limit) < 0) {
pa_log("Failed to parse volume limit");
goto fail;
}
if (pa_modargs_get_value_u32(ma, "volume_step", &volume_step) < 0) {
pa_log("Failed to parse volume step");
goto fail;
}
m->userdata = u = pa_xnew(struct userdata, 1);
u->module = m;
u->io = NULL;
u->config = NULL;
u->sink_name = pa_xstrdup(pa_modargs_get_value(ma, "sink", NULL));
u->lirc_fd = -1;
u->mute_toggle_save = 0;
u->volume_limit = PA_CLAMP_VOLUME(volume_limit);
u->volume_step = PA_CLAMP_VOLUME(volume_step);
if ((u->lirc_fd = lirc_init((char*) pa_modargs_get_value(ma, "appname", "pulseaudio"), 1)) < 0) {
pa_log("lirc_init() failed.");
goto fail;
}
if (lirc_readconfig((char*) pa_modargs_get_value(ma, "config", NULL), &u->config, NULL) < 0) {
pa_log("lirc_readconfig() failed.");
goto fail;
}
u->io = m->core->mainloop->io_new(m->core->mainloop, u->lirc_fd, PA_IO_EVENT_INPUT|PA_IO_EVENT_HANGUP, io_callback, u);
pa_modargs_free(ma);
return 0;
fail:
if (ma)
pa_modargs_free(ma);
pa__done(m);
return -1;
}
开发者ID:BYSTROSTREL,项目名称:pulseaudio,代码行数:57,代码来源:module-lirc.c
示例14: pa_speex_ec_init
pa_bool_t pa_speex_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec *source_ss, pa_channel_map *source_map,
pa_sample_spec *sink_ss, pa_channel_map *sink_map,
uint32_t *blocksize, const char *args)
{
int framelen, y, rate;
uint32_t frame_size_ms, filter_size_ms;
pa_modargs *ma;
if (!(ma = pa_modargs_new(args, valid_modargs))) {
pa_log("Failed to parse submodule arguments.");
goto fail;
}
filter_size_ms = DEFAULT_FILTER_SIZE_MS;
if (pa_modargs_get_value_u32(ma, "filter_size_ms", &filter_size_ms) < 0 || filter_size_ms < 1 || filter_size_ms > 2000) {
pa_log("Invalid filter_size_ms specification");
goto fail;
}
frame_size_ms = DEFAULT_FRAME_SIZE_MS;
if (pa_modargs_get_value_u32(ma, "frame_size_ms", &frame_size_ms) < 0 || frame_size_ms < 1 || frame_size_ms > 200) {
pa_log("Invalid frame_size_ms specification");
goto fail;
}
pa_speex_ec_fixate_spec(source_ss, source_map, sink_ss, sink_map);
rate = source_ss->rate;
framelen = (rate * frame_size_ms) / 1000;
/* framelen should be a power of 2, round down to nearest power of two */
y = 1 << ((8 * sizeof (int)) - 2);
while (y > framelen)
y >>= 1;
framelen = y;
*blocksize = framelen * pa_frame_size (source_ss);
pa_log_debug ("Using framelen %d, blocksize %u, channels %d, rate %d", framelen, *blocksize, source_ss->channels, source_ss->rate);
ec->params.priv.speex.state = speex_echo_state_init_mc (framelen, (rate * filter_size_ms) / 1000, source_ss->channels, source_ss->channels);
if (!ec->params.priv.speex.state)
goto fail;
speex_echo_ctl(ec->params.priv.speex.state, SPEEX_ECHO_SET_SAMPLING_RATE, &rate);
pa_modargs_free(ma);
return TRUE;
fail:
if (ma)
pa_modargs_free(ma);
return FALSE;
}
开发者ID:KimT,项目名称:pulseaudio_kt,代码行数:55,代码来源:speex.c
示例15: pa__init
int pa__init(pa_module*m) {
struct userdata *u;
pa_modargs *ma = NULL;
char *hn, *un;
int error;
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments.");
goto fail;
}
m->userdata = u = pa_xnew(struct userdata, 1);
u->core = m->core;
u->module = m;
u->native = pa_native_protocol_get(u->core);
u->avahi_poll = pa_avahi_poll_new(m->core->mainloop);
u->services = pa_hashmap_new(pa_idxset_trivial_hash_func, pa_idxset_trivial_compare_func);
u->sink_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PUT], PA_HOOK_LATE, (pa_hook_cb_t) device_new_or_changed_cb, u);
u->sink_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_PROPLIST_CHANGED], PA_HOOK_LATE, (pa_hook_cb_t) device_new_or_changed_cb, u);
u->sink_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SINK_UNLINK], PA_HOOK_LATE, (pa_hook_cb_t) device_unlink_cb, u);
u->source_new_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_PUT], PA_HOOK_LATE, (pa_hook_cb_t) device_new_or_changed_cb, u);
u->source_changed_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_PROPLIST_CHANGED], PA_HOOK_LATE, (pa_hook_cb_t) device_new_or_changed_cb, u);
u->source_unlink_slot = pa_hook_connect(&m->core->hooks[PA_CORE_HOOK_SOURCE_UNLINK], PA_HOOK_LATE, (pa_hook_cb_t) device_unlink_cb, u);
u->main_entry_group = NULL;
un = pa_get_user_name_malloc();
hn = pa_get_host_name_malloc();
u->service_name = pa_truncate_utf8(pa_sprintf_malloc("%[email protected]%s", un, hn), AVAHI_LABEL_MAX-1);
pa_xfree(un);
pa_xfree(hn);
if (!(u->client = avahi_client_new(u->avahi_poll, AVAHI_CLIENT_NO_FAIL, client_callback, u, &error))) {
pa_log("avahi_client_new() failed: %s", avahi_strerror(error));
goto fail;
}
pa_modargs_free(ma);
return 0;
fail:
pa__done(m);
if (ma)
pa_modargs_free(ma);
return -1;
}
开发者ID:BYSTROSTREL,项目名称:pulseaudio,代码行数:53,代码来源:module-zeroconf-publish.c
示例16: sidetone_args_new
/* parse sidetone configuration file parameters */
sidetone_args* sidetone_args_new(const char *args) {
pa_modargs* ma = NULL;
sidetone_args* st_args = NULL;
int count = 0 ;
st_args = pa_xnew0(sidetone_args, 1);
st_args->steps=pa_xnew0(struct mv_volume_steps, 1);
ma = pa_modargs_new(args, valid_modargs);
if(!ma) {
pa_log_error("Failed to parse module arguments");
goto fail;
}
st_args->modargs = ma;
if(!(st_args->mixer = pa_modargs_get_value(ma, "mixer", NULL))) {
pa_log_error("Failed to read mixer name");
goto fail;
}
if(!(st_args->control_element = pa_modargs_get_value(ma, "control_element", NULL))) {
pa_log_error("Failed to parse control element");
goto fail;
}
if( !(st_args->master_sink = pa_modargs_get_value(ma, "master_sink", NULL))) {
pa_log_error("Failed to parse master sink name");
goto fail;
}
if(!(st_args->mainvolume = pa_modargs_get_value(ma, "mainvolume", NULL))) {
pa_log_error("failed to search volume string");
}
count = parse_volume_steps(st_args->steps, st_args->mainvolume);
if (count < 1) {
pa_log_error("failed to parse call steps; %s", st_args->mainvolume);
goto fail;
}
return st_args;
fail:
sidetone_args_free(st_args);
return NULL;
}
开发者ID:maemo-foss,项目名称:maemo-multimedia-pulseaudio-modules-meego,代码行数:53,代码来源:sidetone-args.c
示例17: pa__init
int pa__init(pa_module*m) {
bool just_one = false;
int n = 0;
pa_modargs *ma;
pa_assert(m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("Failed to parse module arguments");
goto fail;
}
if (pa_modargs_get_value_boolean(ma, "just-one", &just_one) < 0) {
pa_log("just_one= expects a boolean argument.");
goto fail;
}
#ifdef HAVE_ALSA
if ((n = detect_alsa(m->core, just_one)) <= 0)
#endif
#ifdef HAVE_OSS_OUTPUT
if ((n = detect_oss(m->core, just_one)) <= 0)
#endif
#ifdef HAVE_SOLARIS
if ((n = detect_solaris(m->core, just_one)) <= 0)
#endif
#ifdef OS_IS_WIN32
if ((n = detect_waveout(m->core, just_one)) <= 0)
#endif
{
pa_log_warn("failed to detect any sound hardware.");
goto fail;
}
pa_log_info("loaded %i modules.", n);
/* We were successful and can unload ourselves now. */
pa_module_unload_request(m, true);
pa_modargs_free(ma);
return 0;
fail:
if (ma)
pa_modargs_free(ma);
return -1;
}
开发者ID:UlrichEckhardt,项目名称:pulseaudio,代码行数:49,代码来源:module-detect.c
示例18: pa__init
int pa__init(pa_module *m) {
struct userdata *u;
pa_modargs *ma;
int xtest_event_base, xtest_error_base;
int major_version, minor_version;
pa_assert(m);
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("failed to parse module arguments");
goto fail;
}
m->userdata = u = pa_xnew0(struct userdata, 1);
u->module = m;
if (!(u->x11_wrapper = pa_x11_wrapper_get(m->core, pa_modargs_get_value(ma, "display", NULL))))
goto fail;
if (!XTestQueryExtension(
pa_x11_wrapper_get_display(u->x11_wrapper),
&xtest_event_base, &xtest_error_base,
&major_version, &minor_version)) {
pa_log("XTest extension not supported.");
goto fail;
}
pa_log_debug("XTest %i.%i supported.", major_version, minor_version);
u->x11_client = pa_x11_client_new(u->x11_wrapper, NULL, x11_kill_cb, u);
u->hook_slot = pa_hook_connect(
&m->core->hooks[PA_CORE_HOOK_SINK_INPUT_SEND_EVENT],
PA_HOOK_NORMAL,
(pa_hook_cb_t) sink_input_send_event_hook_cb, u);
pa_modargs_free(ma);
return 0;
fail:
if (ma)
pa_modargs_free(ma);
pa__done(m);
return -1;
}
开发者ID:Distrotech,项目名称:pulseaudio,代码行数:49,代码来源:module-x11-cork-request.c
示例19: pa_adrian_ec_init
pa_bool_t pa_adrian_ec_init(pa_core *c, pa_echo_canceller *ec,
pa_sample_spec *rec_ss, pa_channel_map *rec_map,
pa_sample_spec *play_ss, pa_channel_map *play_map,
pa_sample_spec *out_ss, pa_channel_map *out_map,
uint32_t *nframes, const char *args)
{
int rate, have_vector = 0;
uint32_t frame_size_ms;
pa_modargs *ma;
if (!(ma = pa_modargs_new(args, valid_modargs))) {
pa_log("Failed to parse submodule arguments.");
goto fail;
}
frame_size_ms = DEFAULT_FRAME_SIZE_MS;
if (pa_modargs_get_value_u32(ma, "frame_size_ms", &frame_size_ms) < 0 || frame_size_ms < 1 || frame_size_ms > 200) {
pa_log("Invalid frame_size_ms specification");
goto fail;
}
pa_adrian_ec_fixate_spec(rec_ss, rec_map, play_ss, play_map, out_ss, out_map);
rate = out_ss->rate;
*nframes = (rate * frame_size_ms) / 1000;
ec->params.priv.adrian.blocksize = (*nframes) * pa_frame_size(out_ss);
pa_log_debug ("Using nframes %d, blocksize %u, channels %d, rate %d", *nframes, ec->params.priv.adrian.blocksize, out_ss->channels, out_ss->rate);
/* For now we only support SSE */
if (c->cpu_info.cpu_type == PA_CPU_X86 && (c->cpu_info.flags.x86 & PA_CPU_X86_SSE))
have_vector = 1;
ec->params.priv.adrian.aec = AEC_init(rate, have_vector);
if (!ec->params.priv.adrian.aec)
goto fail;
pa_modargs_free(ma);
return TRUE;
fail:
if (ma)
pa_modargs_free(ma);
return FALSE;
}
开发者ID:Thread974,项目名称:pa,代码行数:45,代码来源:adrian.c
示例20: pa__init
int pa__init(pa_module*m) {
pa_iochannel *io;
pa_modargs *ma;
pa_bool_t exit_on_eof = FALSE;
pa_assert(m);
if (m->core->running_as_daemon) {
pa_log_info("Running as daemon, refusing to load this module.");
return 0;
}
if (!(ma = pa_modargs_new(m->argument, valid_modargs))) {
pa_log("failed to parse module arguments.");
goto fail;
}
if (pa_modargs_get_value_boolean(ma, "exit_on_eof", &exit_on_eof) < 0) {
pa_log("exit_on_eof= expects boolean argument.");
goto fail;
}
if (pa_stdio_acquire() < 0) {
pa_log("STDIN/STDUSE already in use.");
goto fail;
}
io = pa_iochannel_new(m->core->mainloop, STDIN_FILENO, STDOUT_FILENO);
pa_iochannel_set_noclose(io, 1);
m->userdata = pa_cli_new(m->core, io, m);
pa_cli_set_eof_callback(m->userdata, exit_on_eof ? eof_and_exit_cb : eof_and_unload_cb, m);
pa_modargs_free(ma);
return 0;
fail:
if (ma)
pa_modargs_free(ma);
return -1;
}
开发者ID:thewb,项目名称:mokoiax,代码行数:45,代码来源:module-cli.c
注:本文中的pa_modargs_new函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论