#ifndef TYPEDEF_H #define TYPEDEF_H #include #define __str__(x) #x #define stringize(x) __str__(x) #define __RED__ "\033[0;31m" #define __GREEN__ "\033[0;32m" #define __RESET__ "\033[0m" #define info(...) fprintf(stdout, __GREEN__"[INFO]"__RESET__" "__FILE__":"stringize(__LINE__)": "__VA_ARGS__) #define err(...) fprintf(stderr, __RED__"[ERR]"__RESET__" "__FILE__":"stringize(__LINE__)": "__VA_ARGS__) // ----- 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