https://github.com/ammen99/wf-recorder/pull/277
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
 <leohdz172@proton.me>
Date: Tue, 10 Sep 2024 23:05:06 -0600
Subject: [PATCH] fix compilation when building w/o audio support
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Leonardo Hernández Hernández <leohdz172@proton.me>
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -611,14 +611,18 @@ static void write_loop(FrameWriterParams params)
         uint64_t sync_timestamp = 0;
         if (first_frame_ts.has_value()) {
             sync_timestamp = buffer.base_usec - first_frame_ts.value();
-        } else if (pr) {
+        }
+#ifdef HAVE_AUDIO
+        else if (pr) {
             if (!pr->get_time_base() || pr->get_time_base() > buffer.base_usec) {
                 drop = true;
             } else {
                 first_frame_ts = pr->get_time_base();
                 sync_timestamp = buffer.base_usec - first_frame_ts.value();
             }
-        } else {
+        }
+#endif
+        else {
             sync_timestamp = 0;
             first_frame_ts = buffer.base_usec;
         }
@@ -1136,7 +1140,11 @@ int main(int argc, char *argv[])
                 break;
 
             case '*':
+#ifdef HAVE_AUDIO
                 audioParams.audio_backend = optarg;
+#else
+                std::cerr << "Ignoring --audio-backend. Built without audio support." << std::endl;
+#endif
                 break;
 
             default:
-- 
2.46.2

