From e0d34a9a097b15ea546ca48e1a495bf3f53824a8 Mon Sep 17 00:00:00 2001 From: Tobias Schlager Date: Fri, 24 Sep 2021 14:08:11 +0200 Subject: [PATCH] Allow forcing the audio recording format to WAV Currently the container format for audio recordings is determined by inspecting the target file extension. This patch allows to force WAV as container format for files with other extensions. --- include/mediastreamer2/msfilerec.h | 1 + src/audiofilters/msfilerec.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/include/mediastreamer2/msfilerec.h b/include/mediastreamer2/msfilerec.h index 70e0a64e64..7fe417cc10 100644 --- a/include/mediastreamer2/msfilerec.h +++ b/include/mediastreamer2/msfilerec.h @@ -27,6 +27,7 @@ extern MSFilterDesc ms_file_rec_desc; #define MS_FILE_REC_START MS_FILTER_METHOD_NO_ARG(MS_FILE_REC_ID,1) #define MS_FILE_REC_STOP MS_FILTER_METHOD_NO_ARG(MS_FILE_REC_ID,2) #define MS_FILE_REC_CLOSE MS_FILTER_METHOD_NO_ARG(MS_FILE_REC_ID,3) +#define MS_FILE_REC_FORCE_WAV MS_FILTER_METHOD_NO_ARG(MS_FILE_REC_ID,4) diff --git a/src/audiofilters/msfilerec.c b/src/audiofilters/msfilerec.c index 7a008e8bc4..a84cacb57e 100644 --- a/src/audiofilters/msfilerec.c +++ b/src/audiofilters/msfilerec.c @@ -290,6 +290,12 @@ static int rec_set_max_size(MSFilter *f, void *arg) { return 0; } +static int rec_force_wav(MSFilter *f, void *arg) { + RecState *d=(RecState*)f->data; + d->is_wav = TRUE; + return 0; +} + static MSFilterMethod rec_methods[]={ { MS_FILTER_SET_SAMPLE_RATE, rec_set_sr }, { MS_FILTER_SET_NCHANNELS , rec_set_nchannels }, @@ -307,6 +313,7 @@ static MSFilterMethod rec_methods[]={ { MS_FILTER_GET_OUTPUT_FMT, rec_get_fmtp }, { MS_FILTER_SET_OUTPUT_FMT, rec_set_fmtp }, { MS_RECORDER_SET_MAX_SIZE, rec_set_max_size }, + { MS_FILE_REC_FORCE_WAV , rec_force_wav }, { 0 , NULL } };