blob: b6b2b29a4cadf8d3cce45ab784a3fed6eb6c06f4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
#ifndef TYPEDEF_H
#define TYPEDEF_H
#include <stdio.h>
#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
|