Esempio n. 1
0
void pa_dbus_append_proplist(DBusMessageIter *iter, pa_proplist *proplist) {
    DBusMessageIter dict_iter;
    DBusMessageIter dict_entry_iter;
    DBusMessageIter array_iter;
    void *state = NULL;
    const char *key;

    pa_assert(iter);
    pa_assert(proplist);

    pa_assert_se(dbus_message_iter_open_container(iter, DBUS_TYPE_ARRAY, "{say}", &dict_iter));

    while ((key = pa_proplist_iterate(proplist, &state))) {
        const void *value = NULL;
        size_t nbytes;

        pa_assert_se(pa_proplist_get(proplist, key, &value, &nbytes) >= 0);

        pa_assert_se(dbus_message_iter_open_container(&dict_iter, DBUS_TYPE_DICT_ENTRY, NULL, &dict_entry_iter));

        pa_assert_se(dbus_message_iter_append_basic(&dict_entry_iter, DBUS_TYPE_STRING, &key));

        pa_assert_se(dbus_message_iter_open_container(&dict_entry_iter, DBUS_TYPE_ARRAY, "y", &array_iter));
        pa_assert_se(dbus_message_iter_append_fixed_array(&array_iter, DBUS_TYPE_BYTE, &value, nbytes));
        pa_assert_se(dbus_message_iter_close_container(&dict_entry_iter, &array_iter));

        pa_assert_se(dbus_message_iter_close_container(&dict_iter, &dict_entry_iter));
    }

    pa_assert_se(dbus_message_iter_close_container(iter, &dict_iter));
}
Esempio n. 2
0
void pa_source_output_cb(pa_context *c, const pa_source_output_info *i, int eol, void *userdata)
{
    if (eol > 0) {
        return;
    }
    char buf[1024];
    const char *prop_key = NULL;
    void *prop_state = NULL;
    printf("index: %d\n", i->index);
    printf("name: %s\n", i->name);
    printf("module: %d\n", i->owner_module);
    printf("client: %d\n", i->client);
    printf("source: %d\n", i->source);
    printf("volume: channels:%d, min:%d, max:%d\n",
           i->volume.channels,
           pa_cvolume_min(&i->volume),
           pa_cvolume_max(&i->volume));
    printf("resample_method: %s", i->resample_method);
    printf("driver: %s\n", i->driver);
    printf("mute: %d\n", i->mute);
    printf("corked: %d\n", i->corked);
    printf("has_volume: %d\n", i->has_volume);
    printf("volume_writable: %d\n", i->volume_writable);
    while ((prop_key=pa_proplist_iterate(i->proplist, &prop_state))) {
        printf("  %s: %s\n", prop_key, pa_proplist_gets(i->proplist, prop_key));
    }
    printf("format_info: %s\n", pa_format_info_snprint(buf, 1000, i->format));
    printf("------------------------------\n");
}
Esempio n. 3
0
static void m_pa_sink_info_cb(pa_context *c, 
                              const pa_sink_info *i, 
                              int eol, 
                              void *userdata)
{
    if (!c || !i || eol > 0) {
        return;
    }

    pa_sink_port_info **ports  = NULL;
    pa_sink_port_info *port = NULL;
    pa_sink_port_info *active_port = NULL;
    const char *prop_key = NULL;
    void *prop_state = NULL;
    int j;

    while ((prop_key = pa_proplist_iterate(i->proplist, &prop_state))) {
        printf("DEBUG %s %s\n", prop_key, pa_proplist_gets(i->proplist, prop_key));
    }

    m_channel_num = i->channel_map.channels;
    printf("DEBUG channel_map_can_balance %s, channel_map_count %d\n", 
           pa_channel_map_can_balance(&i->channel_map) ? "TRUE" : "FALSE", 
           i->channel_map.channels);
    for (j = 0; j < i->channel_map.channels; j++) {
        printf("DEBUG channel_map %d\n", i->channel_map.map[j]);
    }

    ports = i->ports;
    for (j = 0; j < i->n_ports; j++) {
        port = ports[j];
        printf("DEBUG port %s %s %s\n", 
               port->name, 
               port->description, 
               port->available ? "TRUE" : "FALSE");
    }

    active_port = i->active_port;
    if (active_port) {
        printf("DEBUG active_port %s %s %s\n", 
               active_port->name, 
               active_port->description, 
               active_port->available ? "TRUE" : "FALSE");
    }

    for (j = 0; j < i->volume.channels; j++) {
        printf("DEBUG volume_channel_value %d\n", i->volume.values[j]);
    }
    gtk_adjustment_set_value(m_adjust, i->volume.values[0]);

    printf("DEBUG sink %s %s base_volume %d muted %s\n", 
           i->name, 
           i->description, 
           i->base_volume, 
           i->mute ? "TRUE" : "FALSE");
}
Esempio n. 4
0
void print_properties(pa_proplist *props) {
    void *state = NULL;

    printf("  Properties are: \n");
    while (1) {
	char *key;
	if ((key = pa_proplist_iterate(props, &state)) == NULL) {
	    return;
	}
	char *value = pa_proplist_gets(props, key);
	printf("   key: %s, value: %s\n", key, value);
    }
}
Esempio n. 5
0
int pa_format_info_is_compatible(pa_format_info *first, pa_format_info *second) {
    const char *key;
    void *state = NULL;

    pa_assert(first);
    pa_assert(second);

    if (first->encoding != second->encoding)
        return false;

    while ((key = pa_proplist_iterate(first->plist, &state))) {
        const char *value_one, *value_two;

        value_one = pa_proplist_gets(first->plist, key);
        value_two = pa_proplist_gets(second->plist, key);

        if (!value_two || !pa_format_info_prop_compatible(value_one, value_two))
            return false;
    }

    return true;
}