DeckLink disp.: set_audio_props improved

print the connection directly from the display flag and then we can return
if audio is required to be embedded (no need to set AESEBU/analog switch).

\+ use more defensive msg about audio output (we actually may not set anything)
This commit is contained in:
Martin Pulec
2023-11-03 09:28:29 +01:00
parent 724ab38854
commit c610aaef5f
3 changed files with 28 additions and 13 deletions

View File

@@ -66,8 +66,9 @@
#include "lib_common.h"
#include "module.h"
#include "tv.h"
#include "utils/thread.h"
#include "utils/color_out.h"
#include "utils/macros.h"
#include "utils/thread.h"
#include "video.h"
#include "video_display.h"
#include "video_display/splashscreen.h"
@@ -611,6 +612,23 @@ struct video_frame *get_splashscreen()
return frame;
}
const char *
get_audio_conn_flag_name(int audio_init_flag)
{
switch (audio_init_flag) {
case 0:
return "(none)";
case DISPLAY_FLAG_AUDIO_EMBEDDED:
return "embedeed";
case DISPLAY_FLAG_AUDIO_AESEBU:
return "AES/EBU";
case DISPLAY_FLAG_AUDIO_ANALOG:
return "analog";
default:
UG_ASSERT(0 && "Wrong audio flag!");
}
}
void dev_add_option(struct device_info *dev, const char *name, const char *desc, const char *key, const char *opt_str, bool is_boolean){
int idx = 0;

View File

@@ -205,7 +205,8 @@ void display_put_audio_frame(struct display *d, const struct
bool display_reconfigure_audio(struct display *d, int quant_samples, int channels, int sample_rate);
/** @} */ // end of display_audio
struct video_frame *get_splashscreen(void);
struct video_frame *get_splashscreen(void);
const char *get_audio_conn_flag_name(int audio_init_flag);
#ifdef __cplusplus
}

View File

@@ -1265,11 +1265,15 @@ set_audio_props(state_decklink *s,
MSG(WARNING, "Cannot get maximum auudio channels!\n");
}
auto audioConnection = (BMDAudioOutputAnalogAESSwitch) 0;
MSG(INFO, "Using audio output: %s\n",
get_audio_conn_flag_name(audio_output));
/* Actually no action is required to set audio connection because BMD
* card plays audio through all its outputs (AES/SDI/analog) .... */
BMDAudioOutputAnalogAESSwitch audioConnection{};
switch (audio_output) {
case DISPLAY_FLAG_AUDIO_EMBEDDED:
audioConnection = (BMDAudioOutputAnalogAESSwitch) 0;
break;
return;
case DISPLAY_FLAG_AUDIO_AESEBU:
audioConnection = bmdAudioOutputSwitchAESEBU;
break;
@@ -1280,14 +1284,6 @@ set_audio_props(state_decklink *s,
MSG(ERROR, "Unsupporetd audio connection: %d.\n", audio_output);
abort();
}
LOG(LOG_LEVEL_INFO)
<< MOD_NAME "Audio output set to: "
<< bmd_get_audio_connection_name(audioConnection) << "\n";
/* Actually no action is required to set audio connection because BMD
* card plays audio through all its outputs (AES/SDI/analog) .... */
if (audioConnection == 0) {
return;
}
/* .... one exception is a card that has switchable cables between
* AES/EBU and analog. (But this applies only for channels 3 and above.)
*/