commit 1b54770e4739dc5fd18e2356f38a689fbdfa7236
parent 2814472d83c918975b9738e3849d8555906f719f
Author: Dominik Schmidt <dominik@schm1dt.ch>
Date: Sat, 31 Aug 2019 15:31:53 +0200
Implement recording
If we specify RECORD without a parameter, then recording is stopped.
Diffstat:
1 file changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/siproc.cpp b/src/siproc.cpp
@@ -98,7 +98,7 @@ class MyCall: public Call{
char *line;
size_t line_length;
std::vector<MyAudioMediaPlayer*> players;
- AudioMediaRecorder recorder;
+ AudioMediaRecorder* recorder=NULL;
public:
MyCall(Account &acc, int call_id = PJSUA_INVALID_ID) : Call(acc, call_id){
c_stdin = NULL;
@@ -120,6 +120,10 @@ class MyCall: public Call{
for(unsigned int i=0; i<players.size(); i++){
delete players[i];
}
+ if(recorder != NULL){
+ delete recorder;
+ recorder = NULL;
+ }
}
AudioMedia& call_audio(){
@@ -242,7 +246,18 @@ class MyCall: public Call{
}
void cmd_record(char *path){
- AudioMedia& play_dev_med = playdev();
+ AudioMedia& cap_dev_med = call_audio();
+ if(recorder != NULL){
+ cap_dev_med.stopTransmit(*recorder);
+ delete recorder;
+ recorder = NULL;
+ }
+
+ if(path != NULL){
+ recorder = new AudioMediaRecorder();
+ recorder->createRecorder(path);
+ cap_dev_med.startTransmit(*recorder);
+ }
}
void cmd_stop(char *path){