summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorAlfred E. Heggestad <alfred.heggestad@gmail.com>2017-01-21 22:47:13 +0100
committerGitHub <noreply@github.com>2017-01-21 22:47:13 +0100
commit903ce9869c933e4f13995cd9f10c1498665cfd58 (patch)
treeb49557d93ed5cf8f4928c264b60f5617372c1781 /modules
parent546456bdf813449585fa014a11384bcd7475bd41 (diff)
Elektm93 feat/configure snd file path (#207)
* [WIP] implemented configuration of path of sndfile * [WIP] opening sndfile on defined path * [WIP] modification in path-buildup * Revert "[WIP] modification in path-buildup" This reverts commit adad516c90356402e3b5ebeddcccf3fa91bf3d91. * [FIX] path fix * [FIX] proper strcpy for struct pl * [FIX] fixes on suggestion from project owner - removed unnecessary comment - changed struct pl to an string - changed way how filename is assembled * [FIX] removed unnecessary/wrong/depr. comment * sndfile: fix warnings
Diffstat (limited to 'modules')
-rw-r--r--modules/sndfile/sndfile.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/sndfile/sndfile.c b/modules/sndfile/sndfile.c
index 667c0b1..8141284 100644
--- a/modules/sndfile/sndfile.c
+++ b/modules/sndfile/sndfile.c
@@ -13,6 +13,11 @@
* @defgroup sndfile sndfile
*
* Audio filter that writes audio samples to WAV-file
+ *
+ * Example Configuration:
+ \verbatim
+ snd_path /tmp/
+ \endverbatim
*/
@@ -26,6 +31,8 @@ struct sndfile_dec {
SNDFILE *dec;
};
+static char file_path[256] = ".";
+
static int timestamp_print(struct re_printf *pf, const struct tm *tm)
{
@@ -69,7 +76,8 @@ static SNDFILE *openfile(const struct aufilt_prm *prm, bool enc)
SNDFILE *sf;
(void)re_snprintf(filename, sizeof(filename),
- "dump-%H-%s.wav",
+ "%s/dump-%H-%s.wav",
+ file_path,
timestamp_print, tm, enc ? "enc" : "dec");
sfinfo.samplerate = prm->srate;
@@ -168,6 +176,11 @@ static struct aufilt sndfile = {
static int module_init(void)
{
aufilt_register(&sndfile);
+
+ conf_get_str(conf_cur(), "snd_path", file_path, sizeof(file_path));
+
+ info("sndfile: saving files in %s\n", file_path);
+
return 0;
}