aboutsummaryrefslogtreecommitdiff
path: root/src/typedef.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/typedef.h')
-rw-r--r--src/typedef.h24
1 files changed, 22 insertions, 2 deletions
diff --git a/src/typedef.h b/src/typedef.h
index c585f7a..b6b2b29 100644
--- a/src/typedef.h
+++ b/src/typedef.h
@@ -12,7 +12,27 @@
#define info(...) fprintf(stdout, __GREEN__"[INFO]"__RESET__" "__FILE__":"stringize(__LINE__)": "__VA_ARGS__)
#define err(...) fprintf(stderr, __RED__"[ERR]"__RESET__" "__FILE__":"stringize(__LINE__)": "__VA_ARGS__)
-#define BUF_CAP 65536 // max datagram size
-#define REC_CAP 5880 // 30th of a second of audio
+// ----- MESSAGE ----- //
+
+#define BUF_CAP 65500 // max datagram size with some bytes left for the headers and things
+
+#define FRAMES 32
+#define BITRATE 16
+#define SAMPLING_RATE 44100
+#define CHANNELS 2
+
+#define TEMP_BUF_SZ (FRAMES * CHANNELS * 2) // 2 bytes per sample
+#define REC_CAP ((BITRATE * SAMPLING_RATE * CHANNELS)/240) // 30th of a second of audio
+
+#define VID_CAP (BUF_CAP - ((2*(sizeof(int))) + REC_CAP))
+
+typedef struct message {
+ char audio[REC_CAP];
+ unsigned int WIDTH;
+ unsigned int HEIGHT;
+ char video[VID_CAP];
+} message;
+
+#define MESSAGE_SZ sizeof(message)
#endif