diff options
-rw-r--r-- | docs/examples/config | 3 | ||||
-rw-r--r-- | modules/sndfile/sndfile.c | 15 |
2 files changed, 17 insertions, 1 deletions
diff --git a/docs/examples/config b/docs/examples/config index bd1e3b9..0bb37e5 100644 --- a/docs/examples/config +++ b/docs/examples/config @@ -169,3 +169,6 @@ ice_turn no ice_debug no ice_nomination regular # {regular,aggressive} ice_mode full # {full,lite} + +# sndfile # +snd_path /tmp/ 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; } |