mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	split polyplib to multiple modules add some prelimenary documentation add doxygen support git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@123 fefdeb5f-60dc-0310-8127-8f9354f1896f
		
			
				
	
	
		
			443 lines
		
	
	
	
		
			16 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			443 lines
		
	
	
	
		
			16 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
/* $Id$ */
 | 
						|
 | 
						|
/***
 | 
						|
  This file is part of polypaudio.
 | 
						|
 
 | 
						|
  polypaudio is free software; you can redistribute it and/or modify
 | 
						|
  it under the terms of the GNU General Public License as published
 | 
						|
  by the Free Software Foundation; either version 2 of the License,
 | 
						|
  or (at your option) any later version.
 | 
						|
 
 | 
						|
  polypaudio is distributed in the hope that it will be useful, but
 | 
						|
  WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
						|
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 | 
						|
  General Public License for more details.
 | 
						|
 
 | 
						|
  You should have received a copy of the GNU General Public License
 | 
						|
  along with polypaudio; if not, write to the Free Software
 | 
						|
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
 | 
						|
  USA.
 | 
						|
***/
 | 
						|
 | 
						|
#ifdef HAVE_CONFIG_H
 | 
						|
#include <config.h>
 | 
						|
#endif
 | 
						|
 | 
						|
#include <assert.h>
 | 
						|
 | 
						|
#include "polyplib-introspect.h"
 | 
						|
#include "polyplib-context.h"
 | 
						|
#include "polyplib-internal.h"
 | 
						|
#include "pstream-util.h"
 | 
						|
 | 
						|
/*** Statistics ***/
 | 
						|
 | 
						|
static void context_stat_callback(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata) {
 | 
						|
    struct pa_operation *o = userdata;
 | 
						|
    struct pa_stat_info i, *p = &i;
 | 
						|
    assert(pd && o && o->context && o->ref >= 1);
 | 
						|
 | 
						|
    if (command != PA_COMMAND_REPLY) {
 | 
						|
        if (pa_context_handle_error(o->context, command, t) < 0)
 | 
						|
            goto finish;
 | 
						|
 | 
						|
        p = NULL;
 | 
						|
    } else if (pa_tagstruct_getu32(t, &i.memblock_count) < 0 ||
 | 
						|
               pa_tagstruct_getu32(t, &i.memblock_total) < 0 ||
 | 
						|
               !pa_tagstruct_eof(t)) {
 | 
						|
        pa_context_fail(o->context, PA_ERROR_PROTOCOL);
 | 
						|
        goto finish;
 | 
						|
    }
 | 
						|
 | 
						|
    if (o->callback) {
 | 
						|
        void (*cb)(struct pa_context *s, const struct pa_stat_info*i, void *userdata) = o->callback;
 | 
						|
        cb(o->context, p, o->userdata);
 | 
						|
    }
 | 
						|
 | 
						|
finish:
 | 
						|
    pa_operation_done(o);
 | 
						|
    pa_operation_unref(o);
 | 
						|
}
 | 
						|
 | 
						|
struct pa_operation* pa_context_stat(struct pa_context *c, void (*cb)(struct pa_context *c, const struct pa_stat_info*i, void *userdata), void *userdata) {
 | 
						|
    return pa_context_send_simple_command(c, PA_COMMAND_STAT, context_stat_callback, cb, userdata);
 | 
						|
}
 | 
						|
 | 
						|
/*** Server Info ***/
 | 
						|
 | 
						|
static void context_get_server_info_callback(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata) {
 | 
						|
    struct pa_operation *o = userdata;
 | 
						|
    struct pa_server_info i, *p = &i;
 | 
						|
    assert(pd && o && o->context && o->ref >= 1);
 | 
						|
 | 
						|
    if (command != PA_COMMAND_REPLY) {
 | 
						|
        if (pa_context_handle_error(o->context, command, t) < 0)
 | 
						|
            goto finish;
 | 
						|
 | 
						|
        p = NULL;
 | 
						|
    } else if (pa_tagstruct_gets(t, &i.server_name) < 0 ||
 | 
						|
               pa_tagstruct_gets(t, &i.server_version) < 0 ||
 | 
						|
               pa_tagstruct_gets(t, &i.user_name) < 0 ||
 | 
						|
               pa_tagstruct_gets(t, &i.host_name) < 0 ||
 | 
						|
               pa_tagstruct_get_sample_spec(t, &i.sample_spec) < 0 ||
 | 
						|
               !pa_tagstruct_eof(t)) {
 | 
						|
        pa_context_fail(o->context, PA_ERROR_PROTOCOL);
 | 
						|
        goto finish;
 | 
						|
    }
 | 
						|
    
 | 
						|
    if (o->callback) {
 | 
						|
        void (*cb)(struct pa_context *s, const struct pa_server_info*i, void *userdata) = o->callback;
 | 
						|
        cb(o->context, p, o->userdata);
 | 
						|
    }
 | 
						|
 | 
						|
finish:
 | 
						|
    pa_operation_done(o);
 | 
						|
    pa_operation_unref(o);
 | 
						|
}
 | 
						|
 | 
						|
struct pa_operation* pa_context_get_server_info(struct pa_context *c, void (*cb)(struct pa_context *c, const struct pa_server_info*i, void *userdata), void *userdata) {
 | 
						|
    return pa_context_send_simple_command(c, PA_COMMAND_GET_SERVER_INFO, context_get_server_info_callback, cb, userdata);
 | 
						|
}
 | 
						|
 | 
						|
/*** Sink Info ***/
 | 
						|
 | 
						|
static void context_get_sink_info_callback(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata) {
 | 
						|
    struct pa_operation *o = userdata;
 | 
						|
    int eof = 1;
 | 
						|
    assert(pd && o && o->context && o->ref >= 1);
 | 
						|
 | 
						|
    if (command != PA_COMMAND_REPLY) {
 | 
						|
        if (pa_context_handle_error(o->context, command, t) < 0)
 | 
						|
            goto finish;
 | 
						|
 | 
						|
        eof = -1;
 | 
						|
    } else {
 | 
						|
        
 | 
						|
        while (!pa_tagstruct_eof(t)) {
 | 
						|
            struct pa_sink_info i;
 | 
						|
            
 | 
						|
            if (pa_tagstruct_getu32(t, &i.index) < 0 ||
 | 
						|
                pa_tagstruct_gets(t, &i.name) < 0 ||
 | 
						|
                pa_tagstruct_gets(t, &i.description) < 0 ||
 | 
						|
                pa_tagstruct_get_sample_spec(t, &i.sample_spec) < 0 ||
 | 
						|
                pa_tagstruct_getu32(t, &i.owner_module) < 0 ||
 | 
						|
                pa_tagstruct_getu32(t, &i.volume) < 0 ||
 | 
						|
                pa_tagstruct_getu32(t, &i.monitor_source) < 0 ||
 | 
						|
                pa_tagstruct_gets(t, &i.monitor_source_name) < 0 ||
 | 
						|
                pa_tagstruct_getu32(t, &i.latency) < 0) {
 | 
						|
                pa_context_fail(o->context, PA_ERROR_PROTOCOL);
 | 
						|
                goto finish;
 | 
						|
            }
 | 
						|
 | 
						|
            if (o->callback) {
 | 
						|
                void (*cb)(struct pa_context *s, const struct pa_sink_info*i, int eof, void *userdata) = o->callback;
 | 
						|
                cb(o->context, &i, 0, o->userdata);
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
    
 | 
						|
    if (o->callback) {
 | 
						|
        void (*cb)(struct pa_context *s, const struct pa_sink_info*i, int eof, void *userdata) = o->callback;
 | 
						|
        cb(o->context, NULL, eof, o->userdata);
 | 
						|
    }
 | 
						|
 | 
						|
finish:
 | 
						|
    pa_operation_done(o);
 | 
						|
    pa_operation_unref(o);
 | 
						|
}
 | 
						|
 | 
						|
struct pa_operation* pa_context_get_sink_info_list(struct pa_context *c, void (*cb)(struct pa_context *c, const struct pa_sink_info *i, int is_last, void *userdata), void *userdata) {
 | 
						|
    return pa_context_send_simple_command(c, PA_COMMAND_GET_SINK_INFO_LIST, context_get_sink_info_callback, cb, userdata);
 | 
						|
}
 | 
						|
 | 
						|
struct pa_operation* pa_context_get_sink_info_by_index(struct pa_context *c, uint32_t index, void (*cb)(struct pa_context *c, const struct pa_sink_info *i, int is_last, void *userdata), void *userdata) {
 | 
						|
    struct pa_tagstruct *t;
 | 
						|
    struct pa_operation *o;
 | 
						|
    uint32_t tag;
 | 
						|
    assert(c && cb);
 | 
						|
 | 
						|
    o = pa_operation_new(c, NULL);
 | 
						|
    o->callback = cb;
 | 
						|
    o->userdata = userdata;
 | 
						|
 | 
						|
    t = pa_tagstruct_new(NULL, 0);
 | 
						|
    pa_tagstruct_putu32(t, PA_COMMAND_GET_SINK_INFO);
 | 
						|
    pa_tagstruct_putu32(t, tag = c->ctag++);
 | 
						|
    pa_tagstruct_putu32(t, index);
 | 
						|
    pa_tagstruct_puts(t, "");
 | 
						|
    pa_pstream_send_tagstruct(c->pstream, t);
 | 
						|
    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_sink_info_callback, o);
 | 
						|
 | 
						|
    return pa_operation_ref(o);
 | 
						|
}
 | 
						|
 | 
						|
/*** Source info ***/
 | 
						|
 | 
						|
static void context_get_source_info_callback(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata) {
 | 
						|
    struct pa_operation *o = userdata;
 | 
						|
    int eof = 1;
 | 
						|
    assert(pd && o && o->context && o->ref >= 1);
 | 
						|
 | 
						|
    if (command != PA_COMMAND_REPLY) {
 | 
						|
        if (pa_context_handle_error(o->context, command, t) < 0)
 | 
						|
            goto finish;
 | 
						|
 | 
						|
        eof = -1;
 | 
						|
    } else {
 | 
						|
        
 | 
						|
        while (!pa_tagstruct_eof(t)) {
 | 
						|
            struct pa_source_info i;
 | 
						|
            
 | 
						|
            if (pa_tagstruct_getu32(t, &i.index) < 0 ||
 | 
						|
                pa_tagstruct_gets(t, &i.name) < 0 ||
 | 
						|
                pa_tagstruct_gets(t, &i.description) < 0 ||
 | 
						|
                pa_tagstruct_get_sample_spec(t, &i.sample_spec) < 0 ||
 | 
						|
                pa_tagstruct_getu32(t, &i.owner_module) < 0 ||
 | 
						|
                pa_tagstruct_getu32(t, &i.monitor_of_sink) < 0 ||
 | 
						|
                pa_tagstruct_gets(t, &i.monitor_of_sink_name) < 0) {
 | 
						|
                pa_context_fail(o->context, PA_ERROR_PROTOCOL);
 | 
						|
                goto finish;
 | 
						|
            }
 | 
						|
 | 
						|
            if (o->callback) {
 | 
						|
                void (*cb)(struct pa_context *s, const struct pa_source_info*i, int eof, void *userdata) = o->callback;
 | 
						|
                cb(o->context, &i, 0, o->userdata);
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
    
 | 
						|
    if (o->callback) {
 | 
						|
        void (*cb)(struct pa_context *s, const struct pa_source_info*i, int eof, void *userdata) = o->callback;
 | 
						|
        cb(o->context, NULL, eof, o->userdata);
 | 
						|
    }
 | 
						|
 | 
						|
finish:
 | 
						|
    pa_operation_done(o);
 | 
						|
    pa_operation_unref(o);
 | 
						|
}
 | 
						|
 | 
						|
struct pa_operation* pa_context_get_source_info_list(struct pa_context *c, void (*cb)(struct pa_context *c, const struct pa_source_info *i, int is_last, void *userdata), void *userdata) {
 | 
						|
    return pa_context_send_simple_command(c, PA_COMMAND_GET_SOURCE_INFO_LIST, context_get_source_info_callback, cb, userdata);
 | 
						|
}
 | 
						|
 | 
						|
struct pa_operation* pa_context_get_source_info_by_index(struct pa_context *c, uint32_t index, void (*cb)(struct pa_context *c, const struct pa_source_info *i, int is_last, void *userdata), void *userdata) {
 | 
						|
    struct pa_tagstruct *t;
 | 
						|
    struct pa_operation *o;
 | 
						|
    uint32_t tag;
 | 
						|
    assert(c && cb);
 | 
						|
 | 
						|
    o = pa_operation_new(c, NULL);
 | 
						|
    o->callback = cb;
 | 
						|
    o->userdata = userdata;
 | 
						|
 | 
						|
    t = pa_tagstruct_new(NULL, 0);
 | 
						|
    pa_tagstruct_putu32(t, PA_COMMAND_GET_SOURCE_INFO);
 | 
						|
    pa_tagstruct_putu32(t, tag = c->ctag++);
 | 
						|
    pa_tagstruct_putu32(t, index);
 | 
						|
    pa_tagstruct_puts(t, "");
 | 
						|
    pa_pstream_send_tagstruct(c->pstream, t);
 | 
						|
    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_source_info_callback, o);
 | 
						|
 | 
						|
    return pa_operation_ref(o);
 | 
						|
}
 | 
						|
 | 
						|
/*** Client info ***/
 | 
						|
 | 
						|
static void context_get_client_info_callback(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata) {
 | 
						|
    struct pa_operation *o = userdata;
 | 
						|
    int eof = 1;
 | 
						|
    assert(pd && o && o->context && o->ref >= 1);
 | 
						|
 | 
						|
    if (command != PA_COMMAND_REPLY) {
 | 
						|
        if (pa_context_handle_error(o->context, command, t) < 0)
 | 
						|
            goto finish;
 | 
						|
 | 
						|
        eof = -1;
 | 
						|
    } else {
 | 
						|
        
 | 
						|
        while (!pa_tagstruct_eof(t)) {
 | 
						|
            struct pa_client_info i;
 | 
						|
            
 | 
						|
            if (pa_tagstruct_getu32(t, &i.index) < 0 ||
 | 
						|
                pa_tagstruct_gets(t, &i.name) < 0 ||
 | 
						|
                pa_tagstruct_gets(t, &i.protocol_name) < 0 ||
 | 
						|
                pa_tagstruct_getu32(t, &i.owner_module) < 0) {
 | 
						|
                pa_context_fail(o->context, PA_ERROR_PROTOCOL);
 | 
						|
                goto finish;
 | 
						|
            }
 | 
						|
 | 
						|
            if (o->callback) {
 | 
						|
                void (*cb)(struct pa_context *s, const struct pa_client_info*i, int eof, void *userdata) = o->callback;
 | 
						|
                cb(o->context, &i, 0, o->userdata);
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
    
 | 
						|
    if (o->callback) {
 | 
						|
        void (*cb)(struct pa_context *s, const struct pa_client_info*i, int eof, void *userdata) = o->callback;
 | 
						|
        cb(o->context, NULL, eof, o->userdata);
 | 
						|
    }
 | 
						|
 | 
						|
finish:
 | 
						|
    pa_operation_done(o);
 | 
						|
    pa_operation_unref(o);
 | 
						|
}
 | 
						|
 | 
						|
struct pa_operation* pa_context_get_client_info(struct pa_context *c, uint32_t index, void (*cb)(struct pa_context *c, const struct pa_client_info*i, int is_last, void *userdata), void *userdata) {
 | 
						|
    struct pa_tagstruct *t;
 | 
						|
    struct pa_operation *o;
 | 
						|
    uint32_t tag;
 | 
						|
    assert(c && cb);
 | 
						|
 | 
						|
    o = pa_operation_new(c, NULL);
 | 
						|
    o->callback = cb;
 | 
						|
    o->userdata = userdata;
 | 
						|
 | 
						|
    t = pa_tagstruct_new(NULL, 0);
 | 
						|
    pa_tagstruct_putu32(t, PA_COMMAND_GET_CLIENT_INFO);
 | 
						|
    pa_tagstruct_putu32(t, tag = c->ctag++);
 | 
						|
    pa_tagstruct_putu32(t, index);
 | 
						|
    pa_tagstruct_puts(t, "");
 | 
						|
    pa_pstream_send_tagstruct(c->pstream, t);
 | 
						|
    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_client_info_callback, o);
 | 
						|
 | 
						|
    return pa_operation_ref(o);
 | 
						|
}
 | 
						|
 | 
						|
struct pa_operation* pa_context_get_client_info_list(struct pa_context *c, void (*cb)(struct pa_context *c, const struct pa_client_info*i, int is_last, void *userdata), void *userdata) {
 | 
						|
    return pa_context_send_simple_command(c, PA_COMMAND_GET_CLIENT_INFO_LIST, context_get_client_info_callback, cb, userdata);
 | 
						|
}
 | 
						|
 | 
						|
/*** Module info ***/
 | 
						|
 | 
						|
static void context_get_module_info_callback(struct pa_pdispatch *pd, uint32_t command, uint32_t tag, struct pa_tagstruct *t, void *userdata) {
 | 
						|
    struct pa_operation *o = userdata;
 | 
						|
    int eof = 1;
 | 
						|
    assert(pd && o && o->context && o->ref >= 1);
 | 
						|
 | 
						|
    if (command != PA_COMMAND_REPLY) {
 | 
						|
        if (pa_context_handle_error(o->context, command, t) < 0)
 | 
						|
            goto finish;
 | 
						|
 | 
						|
        eof = -1;
 | 
						|
    } else {
 | 
						|
        
 | 
						|
        while (!pa_tagstruct_eof(t)) {
 | 
						|
            struct pa_module_info i;
 | 
						|
            
 | 
						|
            if (pa_tagstruct_getu32(t, &i.index) < 0 ||
 | 
						|
                pa_tagstruct_gets(t, &i.name) < 0 ||
 | 
						|
                pa_tagstruct_gets(t, &i.argument) < 0 ||
 | 
						|
                pa_tagstruct_getu32(t, &i.n_used) < 0 ||
 | 
						|
                pa_tagstruct_getu32(t, &i.auto_unload) < 0) {
 | 
						|
                pa_context_fail(o->context, PA_ERROR_PROTOCOL);
 | 
						|
                goto finish;
 | 
						|
            }
 | 
						|
 | 
						|
            if (o->callback) {
 | 
						|
                void (*cb)(struct pa_context *s, const struct pa_module_info*i, int eof, void *userdata) = o->callback;
 | 
						|
                cb(o->context, &i, 0, o->userdata);
 | 
						|
            }
 | 
						|
        }
 | 
						|
    }
 | 
						|
    
 | 
						|
    if (o->callback) {
 | 
						|
        void (*cb)(struct pa_context *s, const struct pa_module_info*i, int eof, void *userdata) = o->callback;
 | 
						|
        cb(o->context, NULL, eof, o->userdata);
 | 
						|
    }
 | 
						|
 | 
						|
finish:
 | 
						|
    pa_operation_done(o);
 | 
						|
    pa_operation_unref(o);
 | 
						|
}
 | 
						|
 | 
						|
struct pa_operation* pa_context_get_module_info(struct pa_context *c, uint32_t index, void (*cb)(struct pa_context *c, const struct pa_module_info*i, int is_last, void *userdata), void *userdata) {
 | 
						|
    struct pa_tagstruct *t;
 | 
						|
    struct pa_operation *o;
 | 
						|
    uint32_t tag;
 | 
						|
    assert(c && cb);
 | 
						|
 | 
						|
    o = pa_operation_new(c, NULL);
 | 
						|
    o->callback = cb;
 | 
						|
    o->userdata = userdata;
 | 
						|
 | 
						|
    t = pa_tagstruct_new(NULL, 0);
 | 
						|
    pa_tagstruct_putu32(t, PA_COMMAND_GET_MODULE_INFO);
 | 
						|
    pa_tagstruct_putu32(t, tag = c->ctag++);
 | 
						|
    pa_tagstruct_putu32(t, index);
 | 
						|
    pa_pstream_send_tagstruct(c->pstream, t);
 | 
						|
    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, context_get_module_info_callback, o);
 | 
						|
 | 
						|
    return pa_operation_ref(o);
 | 
						|
}
 | 
						|
 | 
						|
struct pa_operation* pa_context_get_module_info_list(struct pa_context *c, void (*cb)(struct pa_context *c, const struct pa_module_info*i, int is_last, void *userdata), void *userdata) {
 | 
						|
    return pa_context_send_simple_command(c, PA_COMMAND_GET_MODULE_INFO_LIST, context_get_module_info_callback, cb, userdata);
 | 
						|
}
 | 
						|
 | 
						|
/*** Volume manipulation ***/
 | 
						|
 | 
						|
struct pa_operation* pa_context_set_sink_volume_by_index(struct pa_context *c, uint32_t index, uint32_t volume, void (*cb)(struct pa_context *c, int success, void *userdata), void *userdata) {
 | 
						|
    struct pa_operation *o;
 | 
						|
    struct pa_tagstruct *t;
 | 
						|
    uint32_t tag;
 | 
						|
    assert(c && index != PA_INVALID_INDEX);
 | 
						|
 | 
						|
    o = pa_operation_new(c, NULL);
 | 
						|
    o->callback = cb;
 | 
						|
    o->userdata = userdata;
 | 
						|
 | 
						|
    t = pa_tagstruct_new(NULL, 0);
 | 
						|
    pa_tagstruct_putu32(t, PA_COMMAND_SET_SINK_VOLUME);
 | 
						|
    pa_tagstruct_putu32(t, tag = c->ctag++);
 | 
						|
    pa_tagstruct_putu32(t, index);
 | 
						|
    pa_tagstruct_puts(t, "");
 | 
						|
    pa_tagstruct_putu32(t, volume);
 | 
						|
    pa_pstream_send_tagstruct(c->pstream, t);
 | 
						|
    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, o);
 | 
						|
 | 
						|
    return pa_operation_ref(o);
 | 
						|
}
 | 
						|
 | 
						|
struct pa_operation* pa_context_set_sink_volume_by_name(struct pa_context *c, const char *name, uint32_t volume, void (*cb)(struct pa_context *c, int success, void *userdata), void *userdata) {
 | 
						|
    struct pa_operation *o;
 | 
						|
    struct pa_tagstruct *t;
 | 
						|
    uint32_t tag;
 | 
						|
    assert(c && name);
 | 
						|
 | 
						|
    o = pa_operation_new(c, NULL);
 | 
						|
    o->callback = cb;
 | 
						|
    o->userdata = userdata;
 | 
						|
 | 
						|
    t = pa_tagstruct_new(NULL, 0);
 | 
						|
    pa_tagstruct_putu32(t, PA_COMMAND_SET_SINK_VOLUME);
 | 
						|
    pa_tagstruct_putu32(t, tag = c->ctag++);
 | 
						|
    pa_tagstruct_putu32(t, PA_INVALID_INDEX);
 | 
						|
    pa_tagstruct_puts(t, name);
 | 
						|
    pa_tagstruct_putu32(t, volume);
 | 
						|
    pa_pstream_send_tagstruct(c->pstream, t);
 | 
						|
    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, o);
 | 
						|
 | 
						|
    return pa_operation_ref(o);
 | 
						|
}
 | 
						|
 | 
						|
struct pa_operation* pa_context_set_sink_input_volume(struct pa_context *c, uint32_t index, uint32_t volume, void (*cb)(struct pa_context *c, int success, void *userdata), void *userdata) {
 | 
						|
    struct pa_operation *o;
 | 
						|
    struct pa_tagstruct *t;
 | 
						|
    uint32_t tag;
 | 
						|
    assert(c && index != PA_INVALID_INDEX);
 | 
						|
 | 
						|
    o = pa_operation_new(c, NULL);
 | 
						|
    o->callback = cb;
 | 
						|
    o->userdata = userdata;
 | 
						|
 | 
						|
    t = pa_tagstruct_new(NULL, 0);
 | 
						|
    pa_tagstruct_putu32(t, PA_COMMAND_SET_SINK_INPUT_VOLUME);
 | 
						|
    pa_tagstruct_putu32(t, tag = c->ctag++);
 | 
						|
    pa_tagstruct_putu32(t, index);
 | 
						|
    pa_tagstruct_putu32(t, volume);
 | 
						|
    pa_pstream_send_tagstruct(c->pstream, t);
 | 
						|
    pa_pdispatch_register_reply(c->pdispatch, tag, DEFAULT_TIMEOUT, pa_context_simple_ack_callback, o);
 | 
						|
 | 
						|
    return pa_operation_ref(o);
 | 
						|
}
 |