From 46a9d20ac8286e68e7b3cf11a3a09742bc417345 Mon Sep 17 00:00:00 2001 From: pigeatgarlic <64737125+pigeatgarlic@users.noreply.github.com> Date: Tue, 13 May 2025 16:27:30 +0700 Subject: [PATCH] select codec --- src/main.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5318e724..2b29460a 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -136,6 +136,16 @@ main(int argc, char *argv[]) { std::string target; ss0 >> target; if (target == "audio") queuetype = QueueType::Audio; + + int codec = 0; + char* shmid; + if (argc == 4) { + std::stringstream ss1; ss1 << argv[2]; + std::string codecs; ss1 >> codecs; + shmid = argv[3]; + if (codecs == "h265") + codec = 1; + } else shmid = argv[2]; @@ -165,7 +175,7 @@ main(int argc, char *argv[]) { } auto platf_deinit_guard = platf::init(); - auto queue = init_shared_memory(argv[2]); + auto queue = init_shared_memory(shmid); if (!platf_deinit_guard) { BOOST_LOG(error) << "Platform failed to initialize"sv; return StatusCode::NO_ENCODER_AVAILABLE; @@ -343,7 +353,7 @@ main(int argc, char *argv[]) { BOOST_LOG(info) << "Starting capture on channel " << queuetype; if (queuetype == QueueType::Video) { - auto capture = std::thread{video_capture,mail,target,0}; + auto capture = std::thread{video_capture,mail,target,codec}; auto forward = std::thread{push,mail,queue,(QueueType)queuetype}; auto touch_thread = std::thread{touch_fun,queue}; auto receive = std::thread{pull};