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

C++ pa_streq函数代码示例

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

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



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

示例1: parse_categories

static int parse_categories(
    const char *filename,
    unsigned line,
    const char *section,
    const char *lvalue,
    const char *rvalue,
    void *data,
    void *userdata) {

    struct rule *r = userdata;
    const char *state = NULL;
    char *c;

    while ((c = pa_split(rvalue, ";", &state))) {

        if (pa_streq(c, "Game")) {
            pa_xfree(r->role);
            r->role = pa_xstrdup("game");
        } else if (pa_streq(c, "Telephony")) {
            pa_xfree(r->role);
            r->role = pa_xstrdup("phone");
        }

        pa_xfree(c);
    }

    return 0;
}
开发者ID:plbossart,项目名称:pulseaudio,代码行数:28,代码来源:module-augment-properties.c


示例2: source_put_hook_callback

/* When a source is created, loopback it to default sink */
static pa_hook_result_t source_put_hook_callback(pa_core *c, pa_source *source, void* userdata) {
    const char *s;
    const char *role;
    char *args;

    pa_assert(c);
    pa_assert(source);

    /* Only consider bluetooth sinks and sources */
    s = pa_proplist_gets(source->proplist, PA_PROP_DEVICE_BUS);
    if (!s)
        return PA_HOOK_OK;

    if (!pa_streq(s, "bluetooth"))
        return PA_HOOK_OK;

    /* Restrict to A2DP profile (sink role) */
    s = pa_proplist_gets(source->proplist, "bluetooth.protocol");
    if (!s)
        return PA_HOOK_OK;

    if (pa_streq(s, "a2dp_source"))
        role = "music";
    else {
        pa_log_debug("Profile %s cannot be selected for loopback", s);
        return PA_HOOK_OK;
    }

    /* Load module-loopback */
    args = pa_sprintf_malloc("source=\"%s\" source_dont_move=\"true\" sink_input_properties=\"media.role=%s\"", source->name, role);
    (void) pa_module_load(c, "module-loopback", args);
    pa_xfree(args);

    return PA_HOOK_OK;
}
开发者ID:dzrongg,项目名称:pulseaudio-1,代码行数:36,代码来源:module-bluetooth-policy.c


示例3: stream_event_callback

static void stream_event_callback(pa_stream *s, const char *name, pa_proplist *pl, void *userdata) {
    char *t;

    pa_assert(s);
    pa_assert(name);
    pa_assert(pl);

    t = pa_proplist_to_string_sep(pl, ", ");
    pa_log("Got event '%s', properties '%s'", name, t);

    if (pa_streq(name, PA_STREAM_EVENT_REQUEST_CORK)) {
        if (cork_requests == 0) {
            pa_log(_("Cork request stack is empty: corking stream"));
            pa_operation_unref(pa_stream_cork(s, 1, NULL, NULL));
        }
        cork_requests++;
    } else if (pa_streq(name, PA_STREAM_EVENT_REQUEST_UNCORK)) {
        if (cork_requests == 1) {
            pa_log(_("Cork request stack is empty: uncorking stream"));
            pa_operation_unref(pa_stream_cork(s, 0, NULL, NULL));
        }
        if (cork_requests == 0)
            pa_log(_("Warning: Received more uncork requests than cork requests!"));
        else
            cork_requests--;
    }

    pa_xfree(t);
}
开发者ID:DryakhlyyZlodey,项目名称:pulseaudio,代码行数:29,代码来源:pacat.c


示例4: process_device

static void process_device(struct userdata *u, struct udev_device *dev) {
    const char *action, *ff;

    pa_assert(u);
    pa_assert(dev);

    if (udev_device_get_property_value(dev, "PULSE_IGNORE")) {
        pa_log_debug("Ignoring %s, because marked so.", udev_device_get_devpath(dev));
        return;
    }

    if ((ff = udev_device_get_property_value(dev, "SOUND_CLASS")) &&
        pa_streq(ff, "modem")) {
        pa_log_debug("Ignoring %s, because it is a modem.", udev_device_get_devpath(dev));
        return;
    }

    action = udev_device_get_action(dev);

    if (action && pa_streq(action, "remove"))
        remove_card(u, dev);
    else if ((!action || pa_streq(action, "change")) && udev_device_get_property_value(dev, "SOUND_INITIALIZED"))
        card_changed(u, dev);

    /* For an explanation why we don't look for 'add' events here
     * have a look into /lib/udev/rules.d/78-sound-card.rules! */
}
开发者ID:DryakhlyyZlodey,项目名称:pulseaudio,代码行数:27,代码来源:module-udev-detect.c


示例5: sink_input_send_event_hook_cb

static pa_hook_result_t sink_input_send_event_hook_cb(
        pa_core *c,
        pa_sink_input_send_event_hook_data *data,
        struct userdata *u) {

    KeySym sym;
    KeyCode code;
    Display *display;

    pa_assert(c);
    pa_assert(data);
    pa_assert(u);

    if (pa_streq(data->event, PA_STREAM_EVENT_REQUEST_CORK))
        sym = XF86XK_AudioPause;
    else if (pa_streq(data->event, PA_STREAM_EVENT_REQUEST_UNCORK))
        sym = XF86XK_AudioPlay;
    else
        return PA_HOOK_OK;

    pa_log_debug("Triggering X11 keysym: %s", XKeysymToString(sym));

    display = pa_x11_wrapper_get_display(u->x11_wrapper);
    code = XKeysymToKeycode(display, sym);

    XTestFakeKeyEvent(display, code, True, CurrentTime);
    XSync(display, False);

    XTestFakeKeyEvent(display, code, False, CurrentTime);
    XSync(display, False);

    return PA_HOOK_OK;
}
开发者ID:Distrotech,项目名称:pulseaudio,代码行数:33,代码来源:module-x11-cork-request.c


示例6: compare_group

static int compare_group(const struct group *a, const struct group *b) {
    char **amem, **bmem;

    if (!pa_streq(a->gr_name, b->gr_name)) {
        fprintf(stderr, "Group name mismatch: [%s] [%s]\n", a->gr_name, b->gr_name);
        return 1;
    }

    if (!pa_streq(a->gr_passwd, b->gr_passwd)) {
        fprintf(stderr, "Group password mismatch: [%s] [%s]\n", a->gr_passwd, b->gr_passwd);
        return 1;
    }

    if (a->gr_gid != b->gr_gid) {
        fprintf(stderr, "Gid mismatch: [%lu] [%lu]\n", (unsigned long) a->gr_gid, (unsigned long) b->gr_gid);
        return 1;
    }

    /* XXX: Assuming the group ordering is identical. */
    for (amem = a->gr_mem, bmem = b->gr_mem; *amem && *bmem; ++amem, ++bmem) {
        if (!pa_streq(*amem, *bmem)) {
            fprintf(stderr, "Group member mismatch: [%s] [%s]\n", *amem, *bmem);
            return 1;
        }
    }

    if (*amem || *bmem) {
        fprintf(stderr, "Mismatched group count\n");
        return 1;
    }

    return 0;
}
开发者ID:Distrotech,项目名称:pulseaudio,代码行数:33,代码来源:usergroup-test.c


示例7: handle_set

static DBusHandlerResult handle_set(DBusConnection *conn, DBusMessage *msg, pa_dbusobj_server_lookup *sl) {
    DBusHandlerResult r = DBUS_HANDLER_RESULT_HANDLED;
    const char* interface;
    const char* property;
    DBusMessage *reply = NULL;

    pa_assert(conn);
    pa_assert(msg);
    pa_assert(sl);

    if (!dbus_message_get_args(msg, NULL, DBUS_TYPE_STRING, &interface, DBUS_TYPE_STRING, &property, DBUS_TYPE_INVALID)) {
        if (!(reply = dbus_message_new_error(msg, DBUS_ERROR_INVALID_ARGS, "Invalid arguments"))) {
            r = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
            goto finish;
        }
        if (!dbus_connection_send(conn, reply, NULL)) {
            r = DBUS_HANDLER_RESULT_NEED_MEMORY;
            goto finish;
        }
        r = DBUS_HANDLER_RESULT_HANDLED;
        goto finish;
    }

    if (*interface && !pa_streq(interface, INTERFACE)) {
        r = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
        goto finish;
    }

    if (!pa_streq(property, "Address")) {
        if (!(reply = dbus_message_new_error_printf(msg, PA_DBUS_ERROR_NO_SUCH_PROPERTY, "%s: No such property", property))) {
            r = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
            goto finish;
        }
        if (!dbus_connection_send(conn, reply, NULL)) {
            r = DBUS_HANDLER_RESULT_NEED_MEMORY;
            goto finish;
        }
        r = DBUS_HANDLER_RESULT_HANDLED;
        goto finish;
    }

    if (!(reply = dbus_message_new_error_printf(msg, DBUS_ERROR_ACCESS_DENIED, "%s: Property not settable", property))) {
        r = DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
        goto finish;
    }
    if (!dbus_connection_send(conn, reply, NULL)) {
        r = DBUS_HANDLER_RESULT_NEED_MEMORY;
        goto finish;
    }
    r = DBUS_HANDLER_RESULT_HANDLED;

finish:
    if (reply)
        dbus_message_unref(reply);

    return r;
}
开发者ID:Distrotech,项目名称:pulseaudio,代码行数:57,代码来源:server-lookup.c


示例8: detect_oss

static int detect_oss(pa_core *c, int just_one) {
    FILE *f;
    int n = 0, b = 0;

    if (!(f = pa_fopen_cloexec("/dev/sndstat", "r")) &&
        !(f = pa_fopen_cloexec("/proc/sndstat", "r")) &&
        !(f = pa_fopen_cloexec("/proc/asound/oss/sndstat", "r"))) {

        if (errno != ENOENT)
            pa_log_error("failed to open OSS sndstat device: %s", pa_cstrerror(errno));

        return -1;
    }

    while (!feof(f)) {
        char line[256], args[64];
        unsigned device;

        if (!fgets(line, sizeof(line), f))
            break;

        line[strcspn(line, "\r\n")] = 0;

        if (!b) {
            b = pa_streq(line, "Audio devices:") || pa_streq(line, "Installed devices:");
            continue;
        }

        if (line[0] == 0)
            break;

        if (sscanf(line, "%u: ", &device) == 1) {
            if (device == 0)
                pa_snprintf(args, sizeof(args), "device=/dev/dsp");
            else
                pa_snprintf(args, sizeof(args), "device=/dev/dsp%u", device);

            if (!pa_module_load(c, "module-oss", args))
                continue;

        } else if (sscanf(line, "pcm%u: ", &device) == 1) {
            /* FreeBSD support, the devices are named /dev/dsp0.0, dsp0.1 and so on */
            pa_snprintf(args, sizeof(args), "device=/dev/dsp%u.0", device);

            if (!pa_module_load(c, "module-oss", args))
                continue;
        }

        n++;

        if (just_one)
            break;
    }

    fclose(f);
    return n;
}
开发者ID:UlrichEckhardt,项目名称:pulseaudio,代码行数:57,代码来源:module-detect.c


示例9: START_TEST

END_TEST

START_TEST(array_test) {
    pa_json_object *o;
    const pa_json_object *v, *v2;

    o = pa_json_parse(" [  ] ");

    fail_unless(o != NULL);
    fail_unless(pa_json_object_get_type(o) == PA_JSON_TYPE_ARRAY);
    fail_unless(pa_json_object_get_array_length(o) == 0);

    pa_json_object_free(o);

    o = pa_json_parse("[\"a member\"]");

    fail_unless(o != NULL);
    fail_unless(pa_json_object_get_type(o) == PA_JSON_TYPE_ARRAY);
    fail_unless(pa_json_object_get_array_length(o) == 1);

    v = pa_json_object_get_array_member(o, 0);
    fail_unless(v != NULL);
    fail_unless(pa_json_object_get_type(v) == PA_JSON_TYPE_STRING);
    fail_unless(pa_streq(pa_json_object_get_string(v), "a member"));

    pa_json_object_free(o);

    o = pa_json_parse("[\"a member\", 1234.5, { \"another\": true } ]");

    fail_unless(o != NULL);
    fail_unless(pa_json_object_get_type(o) == PA_JSON_TYPE_ARRAY);
    fail_unless(pa_json_object_get_array_length(o) == 3);

    v = pa_json_object_get_array_member(o, 0);
    fail_unless(v != NULL);
    fail_unless(pa_json_object_get_type(v) == PA_JSON_TYPE_STRING);
    fail_unless(pa_streq(pa_json_object_get_string(v), "a member"));
    v = pa_json_object_get_array_member(o, 1);
    fail_unless(v != NULL);
    fail_unless(pa_json_object_get_type(v) == PA_JSON_TYPE_DOUBLE);
    fail_unless(PA_DOUBLE_IS_EQUAL(pa_json_object_get_double(v), 1234.5));
    v = pa_json_object_get_array_member(o, 2);
    fail_unless(v != NULL);
    fail_unless(pa_json_object_get_type(v) == PA_JSON_TYPE_OBJECT);
    v2 =pa_json_object_get_object_member(v, "another");
    fail_unless(v2 != NULL);
    fail_unless(pa_json_object_get_type(v2) == PA_JSON_TYPE_BOOL);
    fail_unless(pa_json_object_get_bool(v2) == true);

    pa_json_object_free(o);
}
开发者ID:UlrichEckhardt,项目名称:pulseaudio,代码行数:51,代码来源:json-test.c


示例10: pa_daemon_conf_set_local_server_type

int pa_daemon_conf_set_local_server_type(pa_daemon_conf *c, const char *string) {
    pa_assert(c);
    pa_assert(string);

    if (pa_streq(string, "user"))
        c->local_server_type = PA_SERVER_TYPE_USER;
    else if (pa_streq(string, "system")) {
        c->local_server_type = PA_SERVER_TYPE_SYSTEM;
    } else if (pa_streq(string, "none")) {
        c->local_server_type = PA_SERVER_TYPE_NONE;
    } else
        return -1;

    return 0;
}
开发者ID:plbossart,项目名称:pulseaudio,代码行数:15,代码来源:daemon-conf.c


示例11: register_profile

static void register_profile(pa_bluetooth_backend *b, const char *profile, const char *uuid) {
    DBusMessage *m;
    DBusMessageIter i, d;
    dbus_bool_t autoconnect;
    dbus_uint16_t version, chan;

    pa_log_debug("Registering Profile %s %s", profile, uuid);

    pa_assert_se(m = dbus_message_new_method_call(BLUEZ_SERVICE, "/org/bluez", BLUEZ_PROFILE_MANAGER_INTERFACE, "RegisterProfile"));

    dbus_message_iter_init_append(m, &i);
    pa_assert_se(dbus_message_iter_append_basic(&i, DBUS_TYPE_OBJECT_PATH, &profile));
    pa_assert_se(dbus_message_iter_append_basic(&i, DBUS_TYPE_STRING, &uuid));
    dbus_message_iter_open_container(&i, DBUS_TYPE_ARRAY, DBUS_DICT_ENTRY_BEGIN_CHAR_AS_STRING DBUS_TYPE_STRING_AS_STRING
            DBUS_TYPE_VARIANT_AS_STRING DBUS_DICT_ENTRY_END_CHAR_AS_STRING, &d);
    if (pa_streq (uuid, PA_BLUETOOTH_UUID_HSP_HS)) {
        /* In the headset role, the connection will only be initiated from the remote side */
        autoconnect = 0;
        pa_dbus_append_basic_variant_dict_entry(&d, "AutoConnect", DBUS_TYPE_BOOLEAN, &autoconnect);
        chan = HSP_HS_DEFAULT_CHANNEL;
        pa_dbus_append_basic_variant_dict_entry(&d, "Channel", DBUS_TYPE_UINT16, &chan);
        /* HSP version 1.2 */
        version = 0x0102;
        pa_dbus_append_basic_variant_dict_entry(&d, "Version", DBUS_TYPE_UINT16, &version);
    }
    dbus_message_iter_close_container(&i, &d);

    send_and_add_to_pending(b, m, register_profile_reply, pa_xstrdup(profile));
}
开发者ID:plbossart,项目名称:pulseaudio,代码行数:29,代码来源:backend-native.c


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


示例13: pa_conversion_parse_formats

bool pa_conversion_parse_formats(const char *fn, const unsigned ln,
                                 const char *str, bool legacy,
                                 audio_format_t *formats) {
    int count;
    char *unknown = NULL;

    pa_assert(fn);
    pa_assert(str);
    pa_assert(formats);

#if AUDIO_API_VERSION_MAJ >= 3
    /* Needs to be probed later */
    if (pa_streq(str, "dynamic")) {
        *formats = 0;
        return true;
    }
#endif

    count = pa_conversion_parse_list(CONV_STRING_FORMAT, value_separator(legacy), str, formats, &unknown);

    if (legacy)
        return check_and_log(fn, ln, "formats", count, str, unknown, false);

    /* As the new XML configuration lists formats as one per profile, unknown
     * formats will cause the parser to quit. As a workaround for non-legacy
     * conversions with no recognized formats log only info level and return false. */
    check_and_log(fn, ln, "format", count == 0 ? 1 : count, str, unknown, false);
    return count > 0;
}
开发者ID:jusa,项目名称:pulseaudio-modules-droid,代码行数:29,代码来源:conversion.c


示例14: pa_encoding_from_string

pa_encoding_t pa_encoding_from_string(const char *encoding) {
    pa_encoding_t e;

    for (e = PA_ENCODING_ANY; e < PA_ENCODING_MAX; e++)
        if (pa_streq(_encoding_str_table[e], encoding))
            return e;

    return PA_ENCODING_INVALID;
}
开发者ID:DryakhlyyZlodey,项目名称:pulseaudio,代码行数:9,代码来源:format.c


示例15: line_callback

static void line_callback(pa_ioline *line, const char *s, void *userdata) {
    pa_strbuf *buf;
    pa_cli *c = userdata;
    char *p;

    pa_assert(line);
    pa_assert(c);

    if (!s) {
        pa_log_debug("CLI got EOF from user.");

        if (c->eof_callback)
            c->eof_callback(c, c->userdata);

        return;
    }

    /* Magic command, like they had in AT Hayes Modems! Those were the good days! */
    if (pa_streq(s, "/"))
        s = c->last_line;
    else if (s[0]) {
        pa_xfree(c->last_line);
        c->last_line = pa_xstrdup(s);
    }

    pa_assert_se(buf = pa_strbuf_new());
    c->defer_kill++;
    if (pa_streq(s, "hello")) {
        pa_strbuf_printf(buf, "Welcome to PulseAudio %s! "
            "Use \"help\" for usage information.\n", PACKAGE_VERSION);
        c->interactive = true;
    }
    else
        pa_cli_command_execute_line(c->core, s, buf, &c->fail);
    c->defer_kill--;
    pa_ioline_puts(line, p = pa_strbuf_to_string_free(buf));
    pa_xfree(p);

    if (c->kill_requested) {
        if (c->eof_callback)
            c->eof_callback(c, c->userdata);
    } else if (c->interactive)
        pa_ioline_puts(line, PROMPT);
}
开发者ID:Distrotech,项目名称:pulseaudio,代码行数:44,代码来源:cli.c


示例16: check_type

static int check_type(
    const char *filename,
    unsigned line,
    const char *section,
    const char *lvalue,
    const char *rvalue,
    void *data,
    void *userdata) {

    return pa_streq(rvalue, "Application") ? 0 : -1;
}
开发者ID:plbossart,项目名称:pulseaudio,代码行数:11,代码来源:module-augment-properties.c


示例17: pa_channel_position_from_string

pa_channel_position_t pa_channel_position_from_string(const char *p) {
    pa_channel_position_t i;
    pa_assert(p);

    /* Some special aliases */
    if (pa_streq(p, "left"))
        return PA_CHANNEL_POSITION_LEFT;
    else if (pa_streq(p, "right"))
        return PA_CHANNEL_POSITION_RIGHT;
    else if (pa_streq(p, "center"))
        return PA_CHANNEL_POSITION_CENTER;
    else if (pa_streq(p, "subwoofer"))
        return PA_CHANNEL_POSITION_SUBWOOFER;

    for (i = 0; i < PA_CHANNEL_POSITION_MAX; i++)
        if (pa_streq(p, table[i]))
            return i;

    return PA_CHANNEL_POSITION_INVALID;
}
开发者ID:KimT,项目名称:pulseaudio_kt,代码行数:20,代码来源:channelmap.c


示例18: verify

static void verify(struct algorithm *params, const char *mode, const char *params_str, meego_parameter_status_t expected_status) {

    pa_log_debug("Expected: status=%s, mode=%s, params=%s", status_to_string(expected_status),
                                                            pa_strnull(mode),
                                                            pa_strnull(params_str));

    pa_log_debug("Got: status=%s, mode=%s, params=%s", status_to_string(params->status),
                                                       pa_strnull(params->mode),
                                                       pa_strnull(params->parameters));

    if (mode) {
        pa_assert(params->mode);
        pa_assert(pa_streq(params->mode, mode));
    }
    if (params_str) {
        pa_assert(params->parameters);
        pa_assert(pa_streq(params->parameters, params_str));
    }
    pa_assert(params->status == expected_status);
}
开发者ID:jusa,项目名称:pulseaudio-modules-nemo,代码行数:20,代码来源:module-meego-test-parameters.c


示例19: find_desktop_file_in_dir

static char * find_desktop_file_in_dir(struct rule *r, const char *desktop_file_dir, struct stat *st) {
    char *fn = NULL;

    pa_assert(st);

    fn = pa_sprintf_malloc("%s" PA_PATH_SEP "%s.desktop", desktop_file_dir, r->process_name);
    if (stat(fn, st) == 0)
        return fn;

    pa_xfree(fn);

#ifdef DT_DIR
    {
        DIR *desktopfiles_dir;
        struct dirent *dir;

        /* Let's try a more aggressive search, but only one level */
        if ((desktopfiles_dir = opendir(desktop_file_dir))) {
            while ((dir = readdir(desktopfiles_dir))) {
                if (dir->d_type != DT_DIR
                    || pa_streq(dir->d_name, ".")
                    || pa_streq(dir->d_name, ".."))
                    continue;

                fn = pa_sprintf_malloc("%s" PA_PATH_SEP "%s" PA_PATH_SEP "%s.desktop", desktop_file_dir, dir->d_name, r->process_name);

                if (stat(fn, st) == 0) {
                    closedir(desktopfiles_dir);
                    return fn;
                }

                pa_xfree(fn);
            }
            closedir(desktopfiles_dir);
        }
    }
#endif

    return NULL;
}
开发者ID:jprvita,项目名称:pulseaudio,代码行数:40,代码来源:module-augment-properties.c


示例20: pa_assert

pa_proplist *pa_dbus_get_proplist_arg(DBusConnection *c, DBusMessage *msg, DBusMessageIter *iter) {
    DBusMessageIter dict_iter;
    DBusMessageIter dict_entry_iter;
    char *signature;
    pa_proplist *proplist = NULL;
    const char *key = NULL;
    const uint8_t *value = NULL;
    int value_length = 0;

    pa_assert(c);
    pa_assert(msg);
    pa_assert(iter);

    pa_assert(signature = dbus_message_iter_get_signature(iter));
    pa_assert_se(pa_streq(signature, "a{say}"));

    dbus_free(signature);

    proplist = pa_proplist_new();

    dbus_message_iter_recurse(iter, &dict_iter);

    while (dbus_message_iter_get_arg_type(&dict_iter) != DBUS_TYPE_INVALID) {
        dbus_message_iter_recurse(&dict_iter, &dict_entry_iter);

        dbus_message_iter_get_basic(&dict_entry_iter, &key);
        dbus_message_iter_next(&dict_entry_iter);

        if (strlen(key) <= 0 || !pa_ascii_valid(key)) {
            pa_dbus_send_error(c, msg, DBUS_ERROR_INVALID_ARGS, "Invalid property list key: '%s'.", key);
            goto fail;
        }

        dbus_message_iter_get_fixed_array(&dict_entry_iter, &value, &value_length);

        pa_assert(value_length >= 0);

        pa_assert_se(pa_proplist_set(proplist, key, value, value_length) >= 0);

        dbus_message_iter_next(&dict_iter);
    }

    dbus_message_iter_next(iter);

    return proplist;

fail:
    if (proplist)
        pa_proplist_free(proplist);

    return NULL;
}
开发者ID:jprvita,项目名称:pulseaudio,代码行数:52,代码来源:dbus-util.c



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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