diff options
author | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2023-03-18 03:38:04 +0100 |
---|---|---|
committer | Daniel Calviño Sánchez <danxuliu@gmail.com> | 2023-03-22 14:08:01 +0100 |
commit | 67fab58dd20c51ef2f69c1d21ef47c352038e7b2 (patch) | |
tree | ce756b275955734db19092ee9f60ef473f03c2c6 /recording | |
parent | c4bb8002b2124d7af8ec26ee44396df8d8df3015 (diff) |
Add setter methods to override the recorder arguments
Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'recording')
-rw-r--r-- | recording/src/nextcloud/talk/recording/RecorderArgumentsBuilder.py | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/recording/src/nextcloud/talk/recording/RecorderArgumentsBuilder.py b/recording/src/nextcloud/talk/recording/RecorderArgumentsBuilder.py index c0f89ca15..ae41b9af5 100644 --- a/recording/src/nextcloud/talk/recording/RecorderArgumentsBuilder.py +++ b/recording/src/nextcloud/talk/recording/RecorderArgumentsBuilder.py @@ -25,8 +25,10 @@ class RecorderArgumentsBuilder: Helper class to get the arguments to start the recorder process. Some of the recorder arguments, like the arguments for the output video - codec, can be customized. Those values are got from the configuration, - either a specific value set in the configuration file or a default value. + codec, can be customized. By default they are got from the configuration, + either a specific value set in the configuration file or a default value, + but the configuration value can be overriden by explicitly setting it in + RecorderArgumentsBuilder. """ def __init__(self): @@ -51,12 +53,10 @@ class RecorderArgumentsBuilder: ffmpegCommon = ['ffmpeg', '-loglevel', 'level+warning', '-n'] ffmpegInputAudio = ['-f', 'pulse', '-i', audioSinkIndex] ffmpegInputVideo = ['-f', 'x11grab', '-draw_mouse', '0', '-video_size', f'{width}x{height}', '-i', displayId] - ffmpegOutputAudio = config.getFfmpegOutputAudio() - ffmpegOutputVideo = config.getFfmpegOutputVideo() + ffmpegOutputAudio = self.getFfmpegOutputAudio() + ffmpegOutputVideo = self.getFfmpegOutputVideo() - extension = config.getFfmpegExtensionAudio() - if status == RECORDING_STATUS_AUDIO_AND_VIDEO: - extension = config.getFfmpegExtensionVideo() + extension = self.getExtension(status) outputFileName = extensionlessOutputFileName + extension @@ -72,3 +72,33 @@ class RecorderArgumentsBuilder: ffmpegArguments += ffmpegOutputVideo return ffmpegArguments + [outputFileName] + + def getFfmpegOutputAudio(self): + if self._ffmpegOutputAudio != None: + return self._ffmpegOutputAudio + + return config.getFfmpegOutputAudio() + + def getFfmpegOutputVideo(self): + if self._ffmpegOutputVideo != None: + return self._ffmpegOutputVideo + + return config.getFfmpegOutputVideo() + + def getExtension(self, status): + if self._extension: + return self._extension + + if status == RECORDING_STATUS_AUDIO_AND_VIDEO: + return config.getFfmpegExtensionVideo() + + return config.getFfmpegExtensionAudio() + + def setFfmpegOutputAudio(self, ffmpegOutputAudio): + self._ffmpegOutputAudio = ffmpegOutputAudio + + def setFfmpegOutputVideo(self, ffmpegOutputVideo): + self._ffmpegOutputVideo = ffmpegOutputVideo + + def setExtension(self, extension): + self._extension = extension |