summaryrefslogtreecommitdiff
path: root/src/sink_input.c
blob: 3d0c1cd71149e3f8c11d9ca1acdedaab40cd7990 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <glib.h>
#include <pulse/pulseaudio.h>
#include <ncurses.h>
#include <string.h>
#include <stdlib.h>

#include "sink_input.h"

GArray *sink_input_list_alloc(void)
{
	return g_array_sized_new(false, false, sizeof(sink_input_info), 8);
}

static 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);
}

void sink_input_list_free(GArray *sink_input_list)
{
	for (int i = 0; i < sink_input_list->len; ++i)
		sink_input_clear(&g_array_index(sink_input_list, sink_input_info, i));
	g_array_free(sink_input_list, true);
}