diff options
author | Jan Klemkow <web2p10@wemelug.de> | 2010-07-08 22:29:00 +0200 |
---|---|---|
committer | Jan Klemkow <web2p10@wemelug.de> | 2010-07-08 22:29:00 +0200 |
commit | 1d09ceecefe1a9a18addf2f9a42294075bc190c2 (patch) | |
tree | 6e7c6da7baf10a30562371dcc4faa34cf9c62895 /sink_input.c | |
parent | 4ed3f983f9609ee6b1b3ce20053b31e62ddb2a1f (diff) | |
download | pa-sink-ctl-1d09ceecefe1a9a18addf2f9a42294075bc190c2.tar.gz pa-sink-ctl-1d09ceecefe1a9a18addf2f9a42294075bc190c2.tar.bz2 pa-sink-ctl-1d09ceecefe1a9a18addf2f9a42294075bc190c2.zip |
splitting project into seperat files
Diffstat (limited to 'sink_input.c')
-rw-r--r-- | sink_input.c | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/sink_input.c b/sink_input.c new file mode 100644 index 0000000..1a6eda2 --- /dev/null +++ b/sink_input.c @@ -0,0 +1,54 @@ +#include <stdio.h> +#include <pulse/pulseaudio.h> +#include <ncurses.h> +#include <string.h> +#include <stdlib.h> + +#include "sink_input.h" + +sink_input_info* sink_input_init() { + + sink_input_info* sink_input = (sink_input_info*) calloc(1, sizeof(sink_input_info)); + sink_input->name = NULL; + sink_input->pid = NULL; + + return sink_input; +} + +void sink_input_clear(sink_input_info* sink_input) { + + if (sink_input->name != NULL) + free(sink_input->name); + + if (sink_input->pid != NULL) + free(sink_input->pid); + + free(sink_input); +} + +void sink_input_list_init(sink_input_info** sink_input_list, int max) { + sink_input_list = (sink_input_info**) calloc(max, sizeof(sink_input_info*)); +} + +void sink_input_list_clear(sink_input_info** sink_input_list, int *max) { + + for (int i = 0; i < (*max); ++i) + sink_input_clear(sink_input_list[i]); + + (*max) = 0; + + free(sink_input_list); +} + +int cmp_sink_input_list(const void *a, const void *b) { + sink_input_info* sinka = *((sink_input_info**) a); + sink_input_info* sinkb = *((sink_input_info**) b); + + if (sinka->sink < sinkb->sink) + return -1; + else if (sinka->sink > sinkb->sink) + return 1; + else + return 0; +} + |