diff options
| author | kartofen <mladenovnasko0@gmail.com> | 2022-10-22 21:08:08 +0300 | 
|---|---|---|
| committer | kartofen <mladenovnasko0@gmail.com> | 2022-10-22 21:08:08 +0300 | 
| commit | f4c66a4c77e5818ca9703f59a80ea92e27ed45c6 (patch) | |
| tree | e334b3f1c8bdb5c96bd756be4e451836a7762ab4 /src/typedef.h | |
| parent | 9d88d471ac059c93523c00b96ae1cbbc52e07b69 (diff) | |
abstract messages for easier use
Diffstat (limited to 'src/typedef.h')
| -rw-r--r-- | src/typedef.h | 24 | 
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 | 
