audio_options: do not duplicate def initialization

It should be either in audio/audio.h or main.cpp but not both because
it is unclear which will be used in the end.
This commit is contained in:
Martin Pulec
2024-08-05 15:22:11 +02:00
parent ecc8332359
commit b785c3d845
2 changed files with 10 additions and 18 deletions

View File

@@ -49,6 +49,9 @@
#ifndef _AUDIO_H_
#define _AUDIO_H_
#define DEFAULT_AUDIO_FEC "none"
#define DEFAULT_AUDIO_SCALE "mixauto"
#define AUDIO_PROTOCOLS "JACK, rtsp, sdp or ultragrid_rtp" // available audio protocols
#define PORT_AUDIO 5006
@@ -69,9 +72,9 @@ struct audio_options {
const char *send_cfg = "none";
const char *proto = "ultragrid_rtp";
const char *proto_cfg = "";
const char *fec_cfg = "none";
const char *fec_cfg = DEFAULT_AUDIO_FEC;
char *channel_map = nullptr;
const char *scale = "none";
const char *scale = DEFAULT_AUDIO_SCALE;
bool echo_cancellation = false;
const char *codec_cfg = "PCM";
const char *filter_cfg = "";

View File

@@ -121,7 +121,6 @@
#define MOD_NAME "[main] "
#define PORT_BASE 5004
#define DEFAULT_AUDIO_FEC "none"
static constexpr const char *DEFAULT_VIDEO_COMPRESSION = "none";
static constexpr const char *DEFAULT_AUDIO_CODEC = "PCM";
@@ -495,6 +494,10 @@ static void copy_sv_to_c_buf(char (&dest)[N], std::string_view sv){
struct ug_options {
ug_options() {
vidcap_params_set_device(vidcap_params_head, "none");
// will be adjusted later
audio.recv_port = -1;
audio.send_port = -1;
audio.codec_cfg = "PCM";
}
~ug_options() {
while (vidcap_params_head != nullptr) {
@@ -503,21 +506,7 @@ struct ug_options {
vidcap_params_head = next;
}
}
struct audio_options audio = {
.host = nullptr,
.recv_port = -1,
.send_port = -1,
.recv_cfg = "none",
.send_cfg = "none",
.proto = "ultragrid_rtp",
.proto_cfg = "",
.fec_cfg = DEFAULT_AUDIO_FEC,
.channel_map = nullptr,
.scale = "mixauto",
.echo_cancellation = false,
.codec_cfg = nullptr,
.filter_cfg = ""
};
struct audio_options audio;
std::string audio_filter_cfg;
// NULL terminated array of capture devices
struct vidcap_params *vidcap_params_head = vidcap_params_allocate();