From ee4646d7cc83fe86fc9c3c7e1bca1b2b1bc1684d Mon Sep 17 00:00:00 2001 From: Martin Pulec Date: Wed, 13 Nov 2019 16:19:55 +0100 Subject: [PATCH] Separate function for video protocol listing --- src/main.cpp | 5 +++-- src/video_rxtx.cpp | 10 ++++++---- src/video_rxtx.h | 1 + 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 260263fa5..5c74a1b23 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -813,10 +813,11 @@ int main(int argc, char *argv[]) } break; case OPT_PROTOCOL: - if (strcmp(optarg, "help") == 0) { + if (strcmp(optarg, "help") == 0 || + strcmp(optarg, "fullhelp") == 0) { cout << "Specify a " << style::bold << "common" << style::reset << " protocol for both audio and video.\n"; cout << "Audio protocol can be one of: " << style::bold << AUDIO_PROTOCOLS "\n" << style::reset; - video_rxtx::create("help", {}); + video_rxtx::list(strcmp(optarg, "fullhelp") == 0); return EXIT_SUCCESS; } audio_protocol = video_protocol = optarg; diff --git a/src/video_rxtx.cpp b/src/video_rxtx.cpp index b51715b1f..4a32f69a0 100644 --- a/src/video_rxtx.cpp +++ b/src/video_rxtx.cpp @@ -208,10 +208,6 @@ exit: video_rxtx *video_rxtx::create(string const & proto, std::map const ¶ms) { - if (proto == "help" || proto == "fullhelp") { - printf("Available TX protocols:\n"); - list_modules(LIBRARY_CLASS_VIDEO_RXTX, VIDEO_RXTX_ABI_VERSION, proto == "fullhelp"); - } auto vri = static_cast(load_library(proto.c_str(), LIBRARY_CLASS_VIDEO_RXTX, VIDEO_RXTX_ABI_VERSION)); if (vri) { auto ret = vri->create(params); @@ -222,3 +218,9 @@ video_rxtx *video_rxtx::create(string const & proto, std::map const &); + static void list(bool full); std::string m_port_id; protected: video_rxtx(std::map const &);