set acap to vidcap even when set after

Previous commit modified the behavior that audio connection (embedded et
al.) specification is applied to following capture. To be more
user-friendly when there is only one vidcap device, set the audio also
to previous device (similarly it has been done for -F), so:

   uv -s embedded -t testcard
   uv -t testcard -s embedded  # <- this now works again
   uv -t switcher -t testcard -s embedded # this doesn't (ambigous)
This commit is contained in:
Martin Pulec
2023-06-09 14:46:01 +02:00
parent a25b285e25
commit 67385e37ae

View File

@@ -62,6 +62,7 @@
#include "lib_common.h"
#include "module.h"
#include "video_capture.h"
#include "video_capture_params.h"
#include <string>
#include <iomanip>
@@ -120,6 +121,20 @@ int initialize_video_capture(struct module *parent,
}
vidcap_params_set_capture_filter(tprev, vidcap_params_get_capture_filter(tlast));
}
// similarly for audio connection
if (vidcap_params_get_driver(tlast) == nullptr
&& vidcap_params_get_flags(tlast) != 0) {
if (tprev != param) { // more than one -t
log_msg(LOG_LEVEL_ERROR, "Audio connection (-s) needs to be "
"specified before capture (-t)\n");
return -1;
}
if (vidcap_params_get_flags(tprev) != 0) { // one -t but -s specified both before and after it
log_msg(LOG_LEVEL_ERROR, "Multiple audio connection specification.\n");
return -1;
}
vidcap_params_set_flags(tprev, vidcap_params_get_flags(tlast));
}
const struct video_capture_info *vci = (const struct video_capture_info *)
load_library(vidcap_params_get_driver(param), LIBRARY_CLASS_VIDEO_CAPTURE, VIDEO_CAPTURE_ABI_VERSION);