summaryrefslogtreecommitdiff
path: root/modules/aubridge/aubridge.c
blob: f1fcfa36d212c58142ca3d2efbb63181a0239e2a (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/**
 * @file aubridge.c Audio bridge
 *
 * Copyright (C) 2010 - 2015 Creytiv.com
 */
#include <re.h>
#include <baresip.h>
#include "aubridge.h"


/**
 * @defgroup aubridge aubridge
 *
 * Audio bridge module
 *
 * This module can be used to connect two audio devices together,
 * so that all output to AUPLAY device is bridged as the input to
 * a AUSRC device.
 *
 * Sample config:
 *
 \verbatim
  audio_player            aubridge,pseudo0
  audio_source            aubridge,pseudo0
 \endverbatim
 */


static struct ausrc *ausrc;
static struct auplay *auplay;

struct hash *ht_device;


static int module_init(void)
{
	int err;

	err = hash_alloc(&ht_device, 32);
	if (err)
		return err;

	err  = ausrc_register(&ausrc, "aubridge", src_alloc);
	err |= auplay_register(&auplay, "aubridge", play_alloc);

	return err;
}


static int module_close(void)
{
	ausrc  = mem_deref(ausrc);
	auplay = mem_deref(auplay);

	ht_device = mem_deref(ht_device);

	return 0;
}


EXPORT_SYM const struct mod_export DECL_EXPORTS(aubridge) = {
	"aubridge",
	"audio",
	module_init,
	module_close,
};