Skip to content

Display and control your Android device

Use meson to configure default values

Romain Vimont53ff1aa410f7
diff --git a/app/meson.build b/app/meson.build
index a9a7ae90..4536aab4 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -30,6 +30,22 @@ dependencies = [
dependency('SDL2_net'),
]
+conf = configuration_data()
+
+# the default client TCP port for the "adb reverse" tunnel
+# overridden by option --port
+conf.set('DEFAULT_LOCAL_PORT', '27183')
+
+# the default max video size for both dimensions, in pixels
+# overridden by option --max-size
+conf.set('DEFAULT_MAX_SIZE', '0') # 0: unlimited
+
+# the default video bitrate, in bits/second
+# overridden by option --bit-rate
+conf.set('DEFAULT_BIT_RATE', '4000000') # 4Mbps
+
+configure_file(configuration: conf, output: 'config.h')
+
executable('scrcpy', src, dependencies: dependencies)
diff --git a/app/src/main.c b/app/src/main.c
index 7ab41b75..4fe4e9a9 100644
--- a/app/src/main.c
+++ b/app/src/main.c
@@ -5,9 +5,7 @@
#include <libavformat/avformat.h>
#include <SDL2/SDL.h>
-#define DEFAULT_LOCAL_PORT 27183
-#define DEFAULT_MAX_SIZE 0 // unlimited
-#define DEFAULT_BIT_RATE 4000000 // 4Mbps
+#include "config.h"
struct args {
const char *serial;